/*
Theme Name: AskTod
Theme URI: https://asktod.com
Description: The AskTod theme. Ask Tod, a lavender coat button who knows a guy, to find local places to fix it, find it, make it or get rid of it. Needs the AskTod Core plugin.
Version: 0.4.0
Author: AskTod
Requires PHP: 7.4
Text Domain: asktod
*/

:root {
  --bg: #ffffff; --surface: #f4f2fa; --card: #ffffff; --line: #e9e6f0; --fg: #1a1726; --muted: #6a6577;
  --tod: #a48bff; --tod-soft: #ece6ff; --on-tod: #1a1726; --ink: #1a1726; --on-ink: #ffffff; --ok: #1f7a4d; --warn: #b4542a;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #15121d; --surface: #211d2c; --card: #1b1825; --line: #2e2a3a; --fg: #f4f2fa; --muted: #ada7bd; --tod-soft: #2c2540; --ink: #f4f2fa; --on-ink: #15121d; --on-tod: #15121d; --ok: #5fd39a; --warn: #ff9a6b; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #15121d; --surface: #211d2c; --card: #1b1825; --line: #2e2a3a; --fg: #f4f2fa; --muted: #ada7bd; --tod-soft: #2c2540; --ink: #f4f2fa; --on-ink: #15121d; --on-tod: #15121d; --ok: #5fd39a; --warn: #ff9a6b; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
img { max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr, .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 3px solid var(--tod); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main.wrap { padding-block: 20px 40px; }

/* Header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 7; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.wordmark { display: inline-flex; align-items: center; font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1; text-decoration: none; flex: none; }
.wordmark svg { margin: 0 1px; position: relative; top: 1px; }
.dnav { display: none; gap: 4px; }
.dnav a { min-height: 40px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; font-size: 15px; font-weight: 600; text-decoration: none; color: var(--muted); }
.dnav a.on, .dnav a:hover { color: var(--fg); background: var(--surface); }
.top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.area-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 600; text-decoration: none; min-width: 0; }
.area-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

/* Bottom tab bar on phones */
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; background: var(--bg); border-top: 1px solid var(--line); display: flex; padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.bnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.bnav .ni { width: 52px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.bnav a.on { color: var(--fg); }
.bnav a.on .ni { background: var(--tod-soft); }
.site-foot { padding-block: 28px; border-top: 1px solid var(--line); margin-top: 40px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.site-foot a { color: var(--muted); }

/* Buttons and chips */
.btn { min-height: 44px; padding: 0 18px; border-radius: 999px; border: none; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn.tod { background: var(--tod); color: var(--on-tod); }
.btn.ink { background: var(--ink); color: var(--on-ink); }
.btn.line { background: transparent; color: var(--fg); border: 1.5px solid var(--line); font-weight: 600; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip.sm { min-height: 34px; font-size: 13px; padding: 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface); color: var(--muted); }
.pill.ok { background: var(--tod-soft); color: var(--fg); }

/* Pages */
.page { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }
.page.wide { max-width: none; }
.back { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--muted); align-self: flex-start; min-height: 32px; display: inline-flex; align-items: center; }
.pg-title { font-size: clamp(28px, 6vw, 40px); }
.sec { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-h h2 { font-size: 21px; }
.links { display: flex; flex-direction: column; }
.links a { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); text-decoration: none; font-weight: 500; font-size: 15px; }
.links a::after { content: "\2192"; color: var(--muted); flex: none; }

/* Search box */
.search { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 640px; min-height: 60px; padding: 6px 6px 6px 20px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); }
.search input { flex: 1; min-width: 0; border: none; background: transparent; font: inherit; font-size: 17px; color: var(--fg); outline: none; }
.search input::placeholder { color: var(--muted); }
.search .btn { min-height: 48px; }

/* Home */
.hero { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.hero h1 { font-size: clamp(34px, 9vw, 56px); letter-spacing: -0.01em; }
.hero .lede { font-size: 18px; color: var(--muted); max-width: 46ch; }
.cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 20px; background: var(--surface); text-decoration: none; min-height: 104px; }
.cat-tile strong { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.cat-tile span { font-size: 13px; color: var(--muted); }
.cats .cat-tile:first-child { grid-column: 1 / -1; }

/* Tod's answer */
.take { display: flex; gap: 12px; align-items: flex-start; }
.take-b { flex: 1; min-width: 0; background: var(--surface); border-radius: 6px 22px 22px 22px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.take-b p { font-size: 16px; }
.take-b .ask-q { font-weight: 700; font-size: 14px; }
.take-b .chip { min-height: 36px; font-size: 13px; }
.understood { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.locform { display: flex; gap: 8px; }
.locform input, .field input, .field textarea, .comment-form input[type=text], .comment-form textarea { flex: 1; min-width: 0; min-height: 42px; border-radius: 14px; border: 1.5px solid var(--line); padding: 8px 14px; font: inherit; font-size: 16px; background: var(--card); color: var(--fg); width: 100%; }

/* Business cards */
.results { display: flex; flex-direction: column; gap: 10px; }
.pcard { border: 1.5px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.pc-top { display: flex; align-items: center; gap: 12px; }
.av { width: 44px; height: 44px; border-radius: 14px; background: var(--surface); flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--muted); }
.pc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pc-name { font-weight: 700; font-size: 16px; text-decoration: none; }
.pc-name:hover { text-decoration: underline; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dist { font-weight: 700; font-size: 14px; }

/* Business page */
.biz-head { display: flex; gap: 14px; align-items: center; }
.biz-head .av { width: 64px; height: 64px; border-radius: 20px; font-size: 28px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); }
.facts > div { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts .k { width: 92px; flex: none; color: var(--muted); font-size: 14px; }
.facts .v { min-width: 0; overflow-wrap: anywhere; }
.claim-box { background: var(--surface); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }

/* Whispers */
.feed { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line); text-decoration: none; }
.feed strong { font-size: 16px; }
.kg { background: var(--surface); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.kg textarea { min-height: 64px; resize: vertical; }
.answers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.answers .comment-body { border: 1.5px solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.answers .comment-author { font-weight: 700; font-size: 14px; } .answers .comment-author img { display: none; }
.answers .comment-meta, .answers .reply { font-size: 12px; color: var(--muted); }
.answers .children { list-style: none; padding-left: 16px; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px; }
.comment-form .submit { min-height: 44px; padding: 0 18px; border-radius: 999px; border: none; font: inherit; font-weight: 700; background: var(--ink); color: var(--on-ink); cursor: pointer; }
.comment-notes, .logged-in-as { font-size: 13px; color: var(--muted); }
.notice { background: var(--tod-soft); border-radius: 16px; padding: 12px 14px; font-size: 14px; }

/* Meet Tod */
.todhero { display: flex; gap: 16px; align-items: center; }
.story { display: flex; flex-direction: column; gap: 6px; } .story h2 { font-size: 20px; } .story p { max-width: 62ch; }
.why { display: grid; margin: 0; } .why dt { font-weight: 700; margin-top: 12px; } .why dd { margin: 2px 0 0; color: var(--muted); max-width: 62ch; }
.moodrow { display: flex; flex-wrap: wrap; gap: 10px 14px; } .mood { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 48px; }

/* Pagination */
.pager { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pager .page-numbers { min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 600; }
.pager .current { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* Motion: Tod pops in, shakes when angry, hops when excited */
@media (prefers-reduced-motion: no-preference) {
  .take .face { animation: tpop 420ms cubic-bezier(.3,1.6,.5,1) both; }
  .take .face.m-angry { animation: tpop 420ms both, tshake 360ms 420ms 2; }
  .take .face.m-excited { animation: tpop 420ms both, thop 500ms 420ms 2; }
  @keyframes tpop { from { transform: scale(.6) rotate(-8deg); } to { transform: none; } }
  @keyframes tshake { 25% { transform: translateX(-2px) rotate(-3deg); } 75% { transform: translateX(2px) rotate(3deg); } }
  @keyframes thop { 50% { transform: translateY(-5px); } }
}

/* Desktop */
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .bnav { display: none; }
  .dnav { display: flex; }
  .cats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cats .cat-tile:first-child { grid-column: auto; }
  .grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: start; }
  .facts .k { width: 110px; }
}

/* v0.2: reasons, save, maps, profile, owner */
.why-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.savef { margin: 0; flex: none; }
.av-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.av { overflow: hidden; }
.map { width: 100%; border-radius: 20px; overflow: hidden; border: 1.5px solid var(--line); background: var(--surface); z-index: 0; position: relative; }
.map-credit { margin-top: -6px; }
.leaflet-popup-content { font-family: var(--font-body); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--tod); border-radius: inherit; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .flabel { font-size: 14px; font-weight: 600; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field select { min-height: 42px; border-radius: 14px; border: 1.5px solid var(--line); padding: 0 12px; font: inherit; background: var(--card); color: var(--fg); }
.err { background: #fde8e8; color: #8a1f1f; border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.checks li { display: flex; gap: 8px; align-items: baseline; font-size: 15px; }
.checks .ok { color: var(--ok); } .checks .todo { color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.codebox { display: flex; gap: 8px; align-items: center; background: var(--surface); border-radius: 14px; padding: 10px 14px; font-family: ui-monospace, monospace; font-size: 17px; }
.tipcard { border: 1.5px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.tipcard strong { font-size: 16px; }
.alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alerts li { font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.alerts .pill { flex: none; }
article.guide { max-width: 680px; }
article.guide h2 { font-size: 22px; margin-top: 18px; }
article.guide p, article.guide li { font-size: 17px; line-height: 1.6; }
article.guide ul { gap: 8px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
