/* MYND Food AR library. MYNDSET palette (see app/src/app/globals.css); light mode only, like the app. */
:root {
  color-scheme: light;
  --bg: #f7f5ee;
  --surface: #ffffff;
  --stage: #f1efe5;
  --stage-glow: #fffbe0;
  --ink: #111111;
  --ink-2: #3a3d47;
  --muted: #666666;
  --line: #e4dfcf;
  --yellow: #f1cb2a;
  --yellow-soft: #fff194;
  --brown: #7f6545;
  --focus: #a47600;
  --radius: 16px;
  --gutter: 16px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (min-width: 720px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
[hidden] { display: none !important; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: rgb(247 245 238 / 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand img { width: 112px; height: auto; }
.brand span { font-size: 14px; font-weight: 500; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); white-space: nowrap; }
.nav-link { font-size: 14px; font-weight: 500; text-decoration: none; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.nav-link:hover { background: var(--stage); }
.back { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 420px) { .brand span { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 15px/1.2 var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #cfc7ae; }
.btn-primary { background: var(--yellow); border-color: var(--yellow); font-weight: 600; }
.btn-primary:hover { background: #e8bf12; border-color: #e8bf12; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Library hero */
.hero { padding: 40px 0 24px; max-width: 760px; }
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brown); }
h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
.lede { margin: 14px 0 0; font-size: 18px; color: var(--ink-2); text-wrap: pretty; }
.platforms { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.platforms li { font-size: 13px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.platforms b { font-weight: 600; color: var(--ink); }

/* Filters */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 20px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .chips { margin: 0; padding: 2px; flex-wrap: wrap; } }
.chip { flex: none; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 500 14px/1 var(--font); color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.search { flex: 1 1 220px; max-width: 320px; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: 400 15px var(--font); color: var(--ink); }
@media (max-width: 719px) { .search { max-width: none; } }

/* Grid of foods */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0 0 48px; list-style: none; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card a { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.card a:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -18px rgb(60 45 20 / 0.45); }
.card-media { aspect-ratio: 1; background: radial-gradient(circle at 50% 45%, var(--stage-glow), var(--stage) 70%); }
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: 12px 14px 14px; }
.card h2 { margin: 0; font-size: 16px; line-height: 1.25; font-weight: 600; }
.card p { margin: 4px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { padding: 40px 0 80px; color: var(--muted); text-align: center; }

/* Viewer page */
.viewer { display: grid; gap: 20px; padding-top: 16px; padding-bottom: 32px; }
@media (min-width: 900px) { .viewer { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 32px; padding-top: 28px; align-items: start; } }
.stage { position: relative; border-radius: 20px; overflow: hidden; background: radial-gradient(circle at 50% 42%, var(--stage-glow), var(--stage) 72%); border: 1px solid var(--line); }
/* model-viewer's host styles set a fixed 300x150; height:auto lets aspect-ratio size it. */
model-viewer { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1.15; --poster-color: transparent; --progress-bar-color: var(--yellow); }
@media (min-width: 900px) { model-viewer { aspect-ratio: 4 / 3.4; } .stage { position: sticky; top: 84px; } }
.ar-btn { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 12px 22px; border-radius: 999px; border: 0; background: var(--yellow); color: var(--ink);
  font: 600 16px/1 var(--font); box-shadow: 0 8px 24px -10px rgb(0 0 0 / 0.45); cursor: pointer; white-space: nowrap; }
.ar-btn svg { width: 22px; height: 22px; }
.from-qr .ar-btn { animation: nudge 1.6s ease-in-out 3; }
@keyframes nudge { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .from-qr .ar-btn { animation: none; } .card a { transition: none; } }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: var(--yellow); transition: width .2s ease, opacity .4s ease; }

.panel h1 { font-size: clamp(28px, 4vw, 40px); }
.panel .lede { font-size: 17px; }
.note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

.box { margin-top: 20px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.box h2 { margin: 0; font-size: 17px; font-weight: 600; }
.box p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.qr-box { display: grid; grid-template-columns: 132px 1fr; gap: 18px; align-items: center; }
.qr-box .qr { width: 132px; height: 132px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr svg { display: block; width: 100%; height: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { min-height: 38px; padding: 8px 14px; font-size: 14px; }
.steps { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.steps li + li { margin-top: 4px; }
/* Phones/tablets that can open AR get the AR steps; everything else gets the QR code. */
.when-ar { display: none; }
.ar-capable .when-ar { display: block; }
.ar-capable .when-no-ar { display: none; }
.no-ar-touch { display: none; }
.touch:not(.ar-capable) .no-ar-touch { display: block; }

.pager { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.pager a { display: flex; flex-direction: column; gap: 2px; max-width: 48%; padding: 12px 16px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.pager a:last-child { text-align: right; margin-left: auto; }
.pager small { font-size: 12px; color: var(--muted); }
.pager b { font-weight: 600; }
.more { padding-top: 24px; padding-bottom: 56px; }
.more h2 { margin: 0 0 14px; font-size: 20px; }
.more .grid { padding-bottom: 0; }

/* QR sheet */
.sheet-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; padding: 36px 0 24px; }
.sheet-head > div { max-width: 640px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 0; padding: 0 0 56px; list-style: none; }
.qr-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 16px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); break-inside: avoid; }
.qr-card .qr { width: 100%; max-width: 180px; aspect-ratio: 1; }
.qr-card h2 { margin: 10px 0 0; font-size: 17px; font-weight: 600; }
.qr-card p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.qr-card .url { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.qr-card .actions { justify-content: center; margin-top: 10px; }

.footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 13px; color: var(--muted); }
.footer p { margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.toast.show { opacity: 1; }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .topbar, .sheet-head .actions, .qr-card .actions, .footer, .no-print { display: none !important; }
  .sheet-head { padding: 0 0 8mm; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .qr-card { border: 1px dashed #bbb; border-radius: 0; padding: 6mm 4mm; }
}
