/* Vanara web app. Every colour, size and face comes from design/tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: var(--type-body-size); line-height: var(--type-body-line);
       -webkit-tap-highlight-color: transparent; }
:lang(kn), [lang="kn"] { font-family: var(--font-ui-kannada); }
.ic { width: var(--size-icon); height: var(--size-icon); flex: none; color: currentColor; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

#map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-bottom-right { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

/* top: search */
.top { position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0; padding: var(--space-3) max(var(--space-3), env(safe-area-inset-right, 0px)) 0 max(var(--space-3), env(safe-area-inset-left, 0px)); z-index: 5; }
.search { display: flex; align-items: center; gap: var(--space-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
          min-height: var(--size-touch); padding: 0 var(--space-1) 0 var(--space-3); box-shadow: 0 1px 2px #0002; }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1.0625rem; min-height: var(--size-touch); outline: none; }
.iconbtn { border: 0; background: none; min-width: var(--size-touch); min-height: var(--size-touch); border-radius: var(--radius-md); display: grid; place-items: center; cursor: pointer; }
.iconbtn span { font-family: var(--font-place); font-size: 1.25rem; }
.results { list-style: none; margin: var(--space-1) 0 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
           max-height: 55vh; overflow: auto; }
.results li button { display: grid; gap: 2px; width: 100%; text-align: left; border: 0; background: none; padding: var(--space-3) var(--space-4); min-height: var(--size-touch); cursor: pointer; border-bottom: 1px solid var(--line); }
.results .r-name { font-family: var(--font-place); font-size: 1.125rem; }
.results .r-sub { font-size: var(--type-small-size); color: var(--ink-soft); }
.results .r-none { padding: var(--space-3) var(--space-4); color: var(--ink-soft); font-size: var(--type-small-size); }
.results .r-old { color: var(--heritage-ink); }

/* floating buttons */
.fabs { position: absolute; right: max(var(--space-3), env(safe-area-inset-right, 0px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); display: grid; gap: var(--space-2); z-index: 4; }
.fab { width: var(--size-touch-lg); height: var(--size-touch-lg); border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; box-shadow: 0 1px 3px #0003; cursor: pointer; }
.fab.on { color: var(--accent-ink); border-color: var(--accent); }

/* bottom tabs */
.tabs { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 6; }
.tabs button { border: 0; background: none; min-height: 60px; display: grid; justify-items: center; align-content: center; gap: 2px; font-size: var(--type-caption-size); font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.tabs button[aria-current="page"] { color: var(--accent-ink); }
body.nav .tabs, body.nav .top, body.nav .fabs #locateBtn { display: none; }

/* bottom sheet */
.sheet { position: absolute; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); max-height: 72vh; overflow: auto; background: var(--surface);
         border-top: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-4) max(var(--space-4), env(safe-area-inset-right, 0px)) var(--space-4) max(var(--space-4), env(safe-area-inset-left, 0px));
         z-index: 7; box-shadow: 0 -2px 8px #0002; }
body.nav .sheet { bottom: 0; padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); }
.sheet h2 { margin: 0; font-family: var(--font-place); font-weight: 400; font-size: var(--type-place-size); line-height: var(--type-place-line); text-wrap: balance; }
.sheet .native { font-family: var(--font-place); color: var(--ink-soft); font-size: 1.125rem; }
.sheet .sub { color: var(--ink-soft); font-size: var(--type-small-size); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.btn { min-height: var(--size-touch); padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface);
       display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: var(--type-label-size); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.big { min-height: var(--size-touch-lg); flex: 1; justify-content: center; }
.btn .ic { width: 22px; height: 22px; }
.chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; }
.chip { flex: none; min-height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface);
        display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .ic { width: 20px; height: 20px; }
.stack { display: grid; gap: var(--space-3); }

/* directions */
.wp { display: grid; grid-template-columns: 20px 1fr; gap: var(--space-2) var(--space-3); align-items: center; }
.wp .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink-soft); justify-self: center; }
.wp .dot.to { background: var(--accent); border-color: var(--accent); border-radius: 2px; }
.wp .field { min-height: var(--size-touch); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); display: flex; align-items: center; background: var(--surface-sunken); }
.routes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.routes button { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3) var(--space-4);
                 display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); cursor: pointer; min-height: 64px; }
.routes button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.routes .t { font-weight: 800; font-size: 1.25rem; }
.routes .d { color: var(--ink-soft); }
.routes .via { grid-column: 1 / -1; font-size: var(--type-small-size); color: var(--ink-soft); }

/* navigation */
.banner { position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 8; background: var(--ink); color: var(--bg);
          display: grid; grid-template-columns: 64px 1fr; gap: var(--space-3); align-items: center;
          padding: var(--space-4) max(var(--space-4), env(safe-area-inset-right, 0px)) var(--space-4) max(var(--space-4), env(safe-area-inset-left, 0px)); }
.banner .turn { width: 64px; height: 64px; color: var(--accent); }
.bn-dist { font-weight: 800; font-size: 2rem; line-height: 1; }
.bn-instr { font-weight: 600; font-size: var(--type-label-size); line-height: 1.25; margin-top: var(--space-1); }
.bn-then { font-size: var(--type-small-size); opacity: .8; margin-top: var(--space-1); }
.navbar { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3); align-items: center; }
.navbar .eta { font-weight: 800; font-size: 1.5rem; }
.navbar .rem { color: var(--ink-soft); }
.history { position: absolute; left: max(var(--space-3), env(safe-area-inset-left, 0px)); right: calc(var(--size-touch-lg) + 2 * var(--space-3));
           bottom: calc(140px + env(safe-area-inset-bottom, 0px)); z-index: 7; background: var(--surface); border: 1px solid var(--line);
           border-left: 4px solid var(--accent); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); box-shadow: 0 1px 4px #0003; }
.history b { font-family: var(--font-place); font-weight: 400; font-size: 1.125rem; display: block; }
.history .old { color: var(--ink-old); font-family: var(--font-place); }
.history p { margin: var(--space-1) 0 0; font-size: var(--type-small-size); color: var(--ink-soft); }

/* story bits used by the place sheet */
.names { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.names .n b { font-family: var(--font-place); font-weight: 400; font-size: 1.125rem; display: block; }
.names .n span { font-size: var(--type-caption-size); color: var(--ink-soft); }
.claim { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.claim .src { position: relative; width: 28px; height: 28px; color: var(--ink); }
.claim .src svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.claim .src.proposed { color: var(--ink-soft); }
.claim p { margin: 0; }
.claim .cite { font-size: var(--type-small-size); color: var(--ink-soft); }
.yr { font-family: var(--font-place); color: var(--accent-ink); }
h3 { margin: var(--space-3) 0 var(--space-1); font-size: var(--type-caption-size); letter-spacing: var(--type-caption-tracking); text-transform: uppercase; color: var(--ink-soft); }

.toast { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); z-index: 9; background: var(--ink); color: var(--bg);
         padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); max-width: calc(100% - 32px); font-weight: 600; }
.select { display: grid; gap: var(--space-2); }
.select button { text-align: left; }
.copyrow { display: flex; gap: var(--space-2); align-items: center; }
.copyrow input { flex: 1; min-width: 0; min-height: var(--size-touch); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 var(--space-3); background: var(--surface-sunken); color: var(--ink); font: inherit; }
.trailbar { border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); margin-bottom: var(--space-3); }
blockquote p { font-size: 1.0625rem; }

/* Phase 6: welcome, home, story, stone, time, discover, passport */
.welcome { position: absolute; inset: 0; z-index: 20; background: var(--bg); display: grid; align-content: center; justify-items: center; text-align: center;
           padding: 24px max(24px, env(safe-area-inset-right, 0px)) 24px max(24px, env(safe-area-inset-left, 0px)); }
.welcome .wm { font-family: var(--font-place); font-size: 4rem; line-height: 1; }
.welcome p { max-width: 32ch; color: var(--ink-soft); }
.welcome .kn { font-family: var(--font-place); font-size: 1.25rem; color: var(--ink); }
.sheet.peek { max-height: 38vh; }
.handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: -6px auto 10px; cursor: pointer; }
.kindline { display: inline-flex; align-items: center; gap: 6px; font-size: var(--type-caption-size); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--heritage-ink); }
.kindline .ic { width: 20px; height: 20px; }
.hook { font-size: 1.0625rem; margin: 8px 0 0; }
.actions { margin-top: 14px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); }
.btn.lamp.lit { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); }
.timeline-names { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-strong); display: grid; gap: 10px; }
.timeline-names li { position: relative; display: grid; }
.timeline-names li::before { content: ""; position: absolute; left: -20px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-old); }
.timeline-names li.today::before { background: var(--accent); border-color: var(--accent); }
.timeline-names b { font-family: var(--font-place); font-weight: 400; font-size: 1.1875rem; }
.timeline-names span { font-size: var(--type-small-size); color: var(--ink-soft); }
.linkbtn { border: 0; background: none; padding: 6px 0 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; min-height: 32px; }
pre.stone { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-place); font-size: 0.9375rem; line-height: 1.6; background: var(--surface-sunken);
            border-left: 3px solid var(--heritage); padding: 12px 14px; margin: 4px 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; min-width: 0; overflow-wrap: anywhere; }
.plabel { display: block; font-size: var(--type-caption-size); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 2px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.card { flex: none; width: 200px; scroll-snap-align: start; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface);
        padding: 10px 12px; display: grid; gap: 4px; align-content: start; cursor: pointer; min-height: 96px; }
.card b { font-family: var(--font-place); font-weight: 400; font-size: 1.125rem; line-height: 1.2; }
.card .old { font-family: var(--font-place); color: var(--ink-old); }
.card .hk { font-size: var(--type-small-size); color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.homechips { margin-bottom: 4px; }
.timebar .chip.era { display: inline-grid; justify-items: start; line-height: 1.1; padding-block: 6px; }
.eraname { font-family: var(--font-place); font-weight: 400; font-size: 1rem; }
.erayr { font-size: var(--type-caption-size); opacity: .8; }
.erah { font-family: var(--font-place); }
.banner-fest { width: 100%; text-align: left; display: grid; gap: 2px; border: 0; border-radius: var(--radius-md); background: var(--festival); color: var(--on-accent);
               padding: 14px 16px; margin: 8px 0 4px; cursor: pointer; }
.banner-fest b { font-family: var(--font-place); font-weight: 400; font-size: 1.375rem; }
.lamps { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.lampcell { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--line-strong); border: 1px dashed var(--line-strong); }
.lampcell.lit { color: var(--accent-ink); border: 1px solid var(--accent); background: var(--accent-wash); }
.rowbtn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--size-touch); border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.rowbtn .cite { margin-left: auto; }
.quest { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line); }
progress { width: 90px; accent-color: var(--accent); }
.claim details.rice { margin-top: var(--space-2); }
.claim details.rice summary { cursor: pointer; font-size: var(--type-small-size); color: var(--ink-soft); min-height: var(--size-touch); display: flex; align-items: center; }
.claim details.rice p { color: var(--ink-soft); }
.claim dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--space-3); font-size: var(--type-small-size); margin: var(--space-2) 0 0; }
.claim dl.terms dt { font-style: italic; }
.claim dl.terms dd { margin: 0; color: var(--ink-soft); }
.claim ul.terms { margin: var(--space-2) 0; padding-left: 1.1em; font-size: var(--type-small-size); color: var(--ink-soft); display: grid; gap: var(--space-2); }
.claim ul.terms q { display: block; margin-top: 2px; font-style: italic; color: var(--ink-soft); }
.claim details.rice a { font-size: var(--type-small-size); color: var(--accent-ink); display: inline-flex; align-items: center; min-height: var(--size-touch); }
.review { margin-top: var(--space-3); padding: var(--space-3); border: 1px dashed var(--line); border-radius: var(--radius-md); display: grid; gap: var(--space-2); }
.review textarea { width: 100%; font: inherit; padding: var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.review .saved { color: var(--accent-ink); font-weight: 600; }
