/* NARA "hungry" — phone first (390×844), then 768, then 1024+ */

/* Metric-matched fallbacks so the web fonts arrive without moving a line. */
@font-face {
  font-family: "Caslon Fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 85.3%;   /* measured: Libre Caslon Display runs 85% of Georgia's width */
  ascent-override: 92%;
  descent-override: 26%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Franklin Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 104.4%;  /* measured: Libre Franklin runs 104% of Arial's width */
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}

:root {
  --ink: #1A1A1A;
  --ink-2: #4A4A4A;
  --ink-3: #6F6F6F;
  --gold: #C9A84C;
  --gold-2: #86691F;
  --gold-tint: #F7F1E1;
  --gold-line: #E8DDBB;
  --line: #E6E6E6;
  --bg: #FFFFFF;
  --surface: #FAFAFA;
  --serif: "Libre Caslon Display", "Caslon Fallback", Georgia, serif;
  --sans: "Libre Franklin", "Franklin Fallback", Arial, sans-serif;
  --radius: 12px;
  --gutter: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 160ms;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font: 400 16px/1.45 var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
img { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-2); }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Slim scrollbars everywhere: thin rounded thumb, transparent track. */
* { scrollbar-width: thin; scrollbar-color: rgba(26, 26, 26, .28) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(26, 26, 26, .28); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(26, 26, 26, .45); }

/* ---- header ------------------------------------------------------------- */
.top {
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 var(--gutter);
  max-width: 1120px; margin: 0 auto;
}
.mark { display: block; flex: none; width: 52px; height: 40px; border-radius: 6px; overflow: hidden; background: #000; }
.mark img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; transform: scale(1.18); }
.org { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: .01em; color: var(--ink-2); }

/* ---- ask (headline, search, chips, toggles, status) ---------------------- */
.app { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); min-height: 100svh; } /* footer starts below the fold, so results arriving never move it on screen */
.ask { padding-top: 8px; }

.headline {
  font: 400 clamp(34px, 10.6vw, 42px)/1.06 var(--serif);
  letter-spacing: -.01em;
  margin: 0 0 16px;
  min-height: calc(2 * 1.06em);           /* two lines reserved on the phone */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  text-wrap: balance;
}
#headline-text { display: inline; transition: opacity var(--t) var(--ease); } /* inline so the two-line clamp applies to live copy */
#headline-text.swap { opacity: 0; }

.search { position: relative; margin: 0 0 14px; }
.search-ic { position: absolute; left: 16px; top: 50%; width: 22px; height: 22px; margin-top: -11px; pointer-events: none; color: var(--ink-3); }
#q {
  width: 100%; height: 56px; padding: 0 52px 0 48px;
  border: 1.5px solid var(--ink); border-radius: 14px; background: var(--bg);
  font-size: 17px; font-weight: 500;
  -webkit-appearance: none; appearance: none;
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
#q::placeholder { color: var(--ink-3); font-weight: 400; }
#q::-webkit-search-cancel-button, #q::-webkit-search-decoration { -webkit-appearance: none; display: none; }
#q:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--gold-line); }
.q-clear { position: absolute; right: 8px; top: 8px; }

.icon-btn {
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--gold-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t) var(--ease);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--gold-tint); }
.icon-btn:active { background: var(--gold-line); }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* suggestions: out of flow, so the page never moves */
.sugg {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(26, 26, 26, .12);
  padding: 6px; max-height: 50svh; overflow: auto;
}
.sugg[hidden] { display: none; }
.opt {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.opt[aria-selected="true"], .opt:hover { background: var(--gold-tint); }
.opt .l { flex: 1; font-weight: 500; }
.opt .k { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.opt svg { width: 18px; height: 18px; color: var(--gold-2); flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 88px; margin-bottom: 12px; align-content: flex-start; }
.chip, .toggle {
  height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.chip:hover, .toggle:hover { border-color: var(--gold); }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.toggle svg { width: 18px; height: 18px; color: var(--gold-2); }
.toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.toggle[aria-pressed="true"] svg { color: var(--gold); }
.toggle.busy { border-style: dashed; }
.toggles { display: flex; gap: 8px; margin-bottom: 10px; }

.status {
  min-height: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  font-size: 14px; color: var(--ink-2); margin-bottom: 10px;
}
.status .note { color: var(--gold-2); }
.tok {
  display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 4px 0 10px; border-radius: 999px;
  background: var(--gold-tint); border: 1px solid var(--gold-line); color: var(--ink); font-weight: 500;
}
.tok button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--gold-2); display: inline-flex; align-items: center; justify-content: center; }
.tok button svg { width: 14px; height: 14px; }
.tok button:hover { background: var(--gold-line); }

/* ---- results ------------------------------------------------------------ */
.results { min-height: 60svh; }
.list { list-style: none; margin: 0; padding: 0; }
.card {
  border-top: 1px solid var(--line);
  padding: 14px 0 12px;
  contain: layout;
}
.card:first-child { border-top: 0; }
.card.pick { background: linear-gradient(90deg, var(--gold) 0 3px, transparent 3px); padding-left: 12px; margin-left: -12px; border-radius: 2px; }
.card-main {
  display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 14px;
  width: 100%; text-align: left; padding: 0; border: 0; background: transparent; border-radius: 10px;
}
.card-main:focus-visible { outline-offset: 4px; }
.ph { width: 100px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--gold-tint); position: relative; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .init { position: absolute; inset: 0; display: grid; place-items: center; font: 400 30px/1 var(--serif); color: var(--gold-2); }
.ph img[data-ok="0"] { visibility: hidden; }
.card-text { min-width: 0; }
.name { margin: 0; font: 400 20px/1.2 var(--serif); letter-spacing: -.005em; overflow-wrap: anywhere; }
.name .nm { display: inline-block; }
.meta { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.open { margin: 2px 0 0; font-size: 14px; font-weight: 600; min-height: 20px; }
.open.is-open { color: var(--gold-2); }
.open.is-closing { color: var(--gold-2); }
.open.is-closed { color: var(--ink-3); font-weight: 500; }
.why { margin: 3px 0 0; font-size: 14px; color: var(--ink); }
.award { margin: 3px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--gold-2); display: flex; align-items: flex-start; gap: 5px; }
.award svg { width: 12px; height: 12px; margin-top: 2px; fill: var(--gold); stroke: none; flex: none; }
.award:empty, .why:empty, .open:empty { display: none; }

.actions { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.go {
  height: 42px; padding: 0 18px; border: 0; border-radius: 11px;
  background: var(--gold); color: var(--ink); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
  min-width: 132px; justify-content: center;
}
.go svg { width: 18px; height: 18px; }
.go:hover { background: #D4B55C; }
.go:active { transform: scale(.98); }
.go.done { background: var(--ink); color: #fff; }
.go.done svg { color: var(--gold); }
.go .t { display: inline-block; }
.spacer { flex: 1; }
.actions .icon-btn[hidden] { display: none; }

.empty { padding: 24px 0; }
.empty h2 { margin: 0 0 12px; font: 400 22px/1.2 var(--serif); }
.empty .chips { min-height: 0; }
.more-row { padding: 14px 0 8px; }
.more {
  width: 100%; height: 46px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); font-weight: 500;
}
.more:hover { border-color: var(--gold); }

/* skeleton rows trace the real card (100×75 photo, four text lines) */
.ghost { pointer-events: none; }
.ghost .ph { background: var(--surface); }
.ghost .bar { height: 12px; border-radius: 6px; background: var(--surface); margin: 6px 0; }
.ghost .bar.n { height: 18px; width: 60%; margin-top: 2px; }
.ghost .bar.m { width: 45%; }
.ghost .bar.w { width: 70%; }

/* ---- footer ------------------------------------------------------------- */
.foot {
  max-width: 1120px; margin: 24px auto 0; padding: 20px var(--gutter) 28px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
}
.foot p { margin: 0; }
.foot nav { display: flex; gap: 18px; }
.foot a { color: var(--gold-2); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---- details (sheet on phone/tablet, panel from 1024) -------------------- */
.sheet {
  border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%;
  max-height: 92svh; background: var(--bg); color: var(--ink);
  border-radius: 18px 18px 0 0;
  position: fixed; inset: auto 0 0 0;
  box-shadow: 0 -8px 40px rgba(26, 26, 26, .18);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(26, 26, 26, .35); }
body.sheet-open { overflow: hidden; }
.sheet[open] { animation: rise var(--t) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sheet .det { max-height: 92svh; overflow: auto; padding: 0 var(--gutter) calc(20px + env(safe-area-inset-bottom)); }

.det-head { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; justify-content: flex-end; padding: 8px 0 0; height: 48px; }
.det-head .grab { position: absolute; left: 50%; top: 8px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.det-photo { width: 100%; aspect-ratio: 38 / 26; border-radius: 12px; overflow: hidden; background: var(--gold-tint); position: relative; }
.det-photo img { width: 100%; height: 100%; object-fit: cover; }
.det-photo img[data-ok="0"] { visibility: hidden; }
.det-photo .init { position: absolute; inset: 0; display: grid; place-items: center; font: 400 56px/1 var(--serif); color: var(--gold-2); }
.det h2 { margin: 14px 0 2px; font: 400 26px/1.15 var(--serif); letter-spacing: -.01em; }
.det .meta { font-size: 15px; }
.det .open { font-size: 15px; margin-top: 4px; }
.det .actions { margin-top: 14px; }
.det .desc { margin: 16px 0 0; font-size: 15px; color: var(--ink-2); line-height: 1.5; }
.det h3 { margin: 18px 0 6px; font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.det ul { margin: 0; padding-left: 18px; font-size: 15px; }
.det li { margin: 2px 0; }
.hours { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.hours td { padding: 3px 0; vertical-align: top; }
.hours td:first-child { color: var(--ink-2); padding-right: 14px; white-space: nowrap; }
.hours tr.today td { font-weight: 600; }
.addr { margin: 4px 0 0; font-size: 14.5px; color: var(--ink-2); }
.loc { border-top: 1px solid var(--line); padding: 10px 0; }
.loc:first-of-type { border-top: 0; }
.loc .lname { font-weight: 600; font-size: 15px; }
.loc .actions { margin-top: 8px; }
.go.sm { height: 38px; min-width: 0; padding: 0 14px; font-size: 14px; }
.nara-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; font-size: 14.5px; font-weight: 500; }
.nara-link svg { width: 16px; height: 16px; }

.panel { display: none; }

/* ---- 768: breathe ------------------------------------------------------- */
@media (min-width: 768px) {
  :root { --gutter: 32px; }
  .top { height: 76px; }
  .ask { padding-top: 16px; }
  .headline { font-size: clamp(40px, 5vw, 48px); line-height: 1.08; min-height: calc(2 * 1.08em); margin-bottom: 20px; } /* two lines reserved: the live headline may wrap */
  .chips { min-height: 40px; }
  .card { padding: 16px 0 14px; }
  .card-main { grid-template-columns: 132px minmax(0, 1fr); gap: 18px; }
  .ph { width: 132px; }
  .name { font-size: 22px; }
  .sheet { max-width: 640px; margin: 0 auto; }
}

/* ---- 1024+: details panel beside the list ------------------------------- */
@media (min-width: 1024px) {
  .app {
    display: grid; grid-template-columns: minmax(0, 1fr) 400px; column-gap: 48px;
    grid-template-rows: auto 1fr;
  }
  .ask { grid-column: 1; }
  .results { grid-column: 1; }
  .panel {
    display: block; grid-column: 2; grid-row: 1 / span 2;
    position: sticky; top: 16px; align-self: start;
    max-height: calc(100svh - 32px); overflow: auto;
    border: 1px solid var(--line); border-radius: 16px; padding: 0 20px 20px;
    min-height: 420px;
  }
    .panel .det-head { height: 12px; padding: 0; }
  .panel .det-head .grab, .panel .det-head .icon-btn { display: none; }
  .panel .det h2 { font-size: 28px; }
  .results { min-height: 0; }
  .card { cursor: default; }
  .card.pick { background: none; padding-left: 0; margin-left: 0; }   /* the panel already shows the top pick */
  .card.sel { background: linear-gradient(90deg, var(--gold) 0 3px, transparent 3px); padding-left: 14px; margin-left: -14px; }
  .sheet { display: none; }
}

@media (min-width: 1280px) {
  .app { column-gap: 72px; grid-template-columns: minmax(0, 1fr) 440px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
