/* Tell Me a Story — app styles.
   Brand pulled from tellmeastoryphotography.net:
   sage #718a88 · charcoal #1d1d1d/#373737 · cream/white neutrals
   Averia Serif Libre (display) · EB Garamond (body) */

:root {
  color-scheme: light; /* light-only design — keep iOS/Android from auto-darkening controls */
  --sage: #718a88;
  --sage-dark: #5c7370;
  --sage-soft: #e8edec;
  --ink: #1d1d1d;
  --char: #373737;
  --cream: #faf8f4;
  --paper: #ffffff;
  --line: #e3e0d8;
  --muted: #857f74;
  --warn: #a4552e;
  --ok: #4e7a52;
  --display: "Averia Serif Libre", Georgia, serif;
  --body: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 17.5px;
  line-height: 1.55;
  color: var(--char);
  background: var(--cream);
  min-height: 100dvh;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; color: var(--ink); line-height: 1.2; }
h1 { font-size: 1.9rem; font-style: italic; margin-bottom: .35rem; }
h2 { font-size: 1.25rem; }
a { color: var(--sage-dark); text-decoration: none; }
p { margin-bottom: .6rem; }

.kicker, .label {
  font-family: var(--body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- wordmark ---------- */
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark-script { font-family: var(--display); font-style: italic; font-size: 1.25rem; color: var(--ink); }
.wordmark-sub { font-size: .58rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin-top: .15rem; }
.wordmark-light .wordmark-script { color: #fff; }
.wordmark-light .wordmark-sub { color: rgba(255,255,255,.75); }

/* ---------- customer chrome ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem 1.1rem;
  padding-top: calc(.8rem + env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topnav { display: none; gap: 1.4rem; align-items: center; }
.topnav a {
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--char);
  padding-bottom: .2rem; border-bottom: 1px solid transparent;
}
.topnav a.active { border-bottom-color: var(--sage); color: var(--ink); }
.topnav-admin { color: var(--sage-dark) !important; }
.cart-chip { position: relative; color: var(--char); display: inline-flex; padding: .3rem; }
.cart-count {
  position: absolute; top: -4px; right: -6px;
  background: var(--sage); color: #fff; font-size: .66rem; font-weight: 600;
  border-radius: 999px; min-width: 17px; height: 17px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: .4rem 0 .45rem; color: var(--muted);
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
}
.tab-ic { display: inline-flex; padding: .2rem .85rem; border-radius: 999px; transition: background .15s; }
.tabbar a.active { color: var(--sage-dark); }
.tabbar a.active .tab-ic { background: var(--sage-soft); }
.tabbar a.active svg { stroke-width: 2.2; }
.tabbar a.active > span:last-child { font-weight: 700; }

.page { max-width: 640px; margin: 0 auto; padding: 1.3rem 1.1rem 5.5rem; }
.page-wide { max-width: 1100px; }

/* ---------- tab navigation placeholder (see TAB_SCRIPT in src/ui.tsx) ---------- */
.nav-skeleton { display: none; }
.is-navigating main.page, .is-navigating .flash { display: none; }
.is-navigating .nav-skeleton { display: flex; flex-direction: column; gap: .8rem; animation: sk-in .18s ease-out; }
.sk {
  display: block; border-radius: 4px;
  background: linear-gradient(90deg, var(--sage-soft) 0%, #f3f5f4 45%, var(--sage-soft) 90%);
  background-size: 250% 100%;
  animation: sk-shimmer 1.3s ease-in-out infinite;
}
.sk-kicker { width: 28%; height: .7rem; margin-top: .3rem; }
.sk-title { width: 62%; height: 2rem; margin-bottom: .6rem; }
.sk-card { height: 5.5rem; border-radius: 2px; }
.sk-card-tall { height: 8.5rem; }
/* thin progress line under the top bar */
.is-navigating .topbar::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  background: var(--sage); transform-origin: left; animation: nav-progress 2.4s cubic-bezier(.1,.7,.3,1) forwards;
}
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes sk-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes nav-progress { from { transform: scaleX(0); } to { transform: scaleX(.85); } }
@media (prefers-reduced-motion: reduce) {
  .sk, .is-navigating .nav-skeleton { animation: none; }
  .is-navigating .topbar::after { animation: none; transform: scaleX(.5); }
}

@media (min-width: 880px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .page { padding-bottom: 3rem; }
}

/* ---------- public / auth ---------- */
.public-body { background: linear-gradient(180deg, var(--sage-soft), var(--cream) 320px); }
.public-wrap { max-width: 480px; margin: 0 auto; padding: 2.2rem 1.2rem 3rem; padding-top: calc(2.2rem + env(safe-area-inset-top)); }
.public-brand { display: flex; justify-content: center; margin-bottom: 1.6rem; text-align: center; }
.public-brand .wordmark-script { font-size: 1.7rem; }

/* ---------- cards & sections ---------- */
.card {
  background: var(--paper); border: 1px solid var(--line);
  padding: 1.15rem 1.2rem; margin-bottom: 1rem;
}
.card-sage { background: var(--sage); border-color: var(--sage); color: #fff; }
.card-sage h2, .card-sage .kicker { color: #fff; }
.card-sage .kicker { color: rgba(255,255,255,.8); }
.card h2 { margin-bottom: .3rem; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 1.5rem 0 .7rem; }
.section-title h2 { font-style: italic; font-size: 1.35rem; }
.section-title a { font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; }

.empty {
  border: 1px dashed var(--line); background: transparent; color: var(--muted);
  padding: 1.6rem 1.2rem; text-align: center; margin-bottom: 1rem;
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  font-family: var(--body); font-size: .8rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  background: var(--ink); color: #fff; padding: .85rem 1.5rem;
  transition: background .15s;
}
.btn:hover { background: var(--char); }
.btn-sage { background: var(--sage); }
.btn-sage:hover { background: var(--sage-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--char); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-sm { padding: .5rem .9rem; font-size: .7rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-danger { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.btn-danger:hover { background: var(--warn); color: #fff; }

form.stack { display: flex; flex-direction: column; gap: .85rem; }
.field label { display: block; margin-bottom: .25rem; }
.field input, .field select, .field textarea {
  width: 100%; font-family: var(--body); font-size: 1rem; color: var(--ink);
  padding: .65rem .75rem; border: 1px solid var(--line); background: var(--paper);
  border-radius: 0; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23373737' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--sage); outline-offset: -1px; }
/* iOS collapses empty date/time inputs to their intrinsic (tiny) size once
   appearance is stripped — force them to match the other fields. */
.field input[type="date"], .field input[type="time"] {
  min-height: 2.7rem;
  width: 100%;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.field-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .85rem; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.check { display: flex; gap: .5rem; align-items: baseline; }
.check input { width: auto; }

.flash {
  max-width: 640px; margin: .8rem auto 0; padding: .7rem 1.1rem;
  background: var(--sage-soft); border: 1px solid var(--sage);
  color: var(--sage-dark); font-size: .95rem;
}
.flash-err { background: #f7ece6; border-color: var(--warn); color: var(--warn); }

/* ---------- lists & tables ---------- */
.row-list { border: 1px solid var(--line); background: var(--paper); margin-bottom: 1rem; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); color: inherit; }
.row-item:last-child { border-bottom: 0; }
a.row-item:hover { background: var(--cream); }
.row-main { min-width: 0; }
.row-title { font-size: 1.05rem; color: var(--ink); }
.row-sub { font-size: .85rem; color: var(--muted); }
.row-side { text-align: right; flex-shrink: 0; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper); margin-bottom: 1rem; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th {
  text-align: left; font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: .6rem .9rem; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: .55rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block; font-size: .68rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  padding: .22rem .6rem; border-radius: 999px;
}
.pill-sage { background: var(--sage-soft); color: var(--sage-dark); }
.pill-ink { background: var(--ink); color: #fff; }
.pill-warn { background: #f7ece6; color: var(--warn); }
.pill-ok { background: #e7efe7; color: var(--ok); }

.price { font-variant-numeric: tabular-nums; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stat { background: var(--paper); border: 1px solid var(--line); padding: .9rem 1rem; }
.stat b { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 400; color: var(--ink); }
.stat span { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.progress { height: 6px; background: var(--sage-soft); margin-top: .5rem; }
.progress i { display: block; height: 100%; background: var(--sage); }

/* ---------- shop ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.prod-card { background: var(--paper); border: 1px solid var(--line); color: inherit; display: flex; flex-direction: column; }
.prod-card:hover { border-color: var(--sage); }
.prod-thumb {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--sage-soft); font-size: 2.6rem;
}
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-body { padding: .7rem .8rem .8rem; }
.prod-name { font-family: var(--display); color: var(--ink); }
.prod-price { font-size: .9rem; color: var(--muted); }

.qty-input { width: 90px !important; }

/* ---------- cart / checkout ---------- */
.line-item { display: flex; gap: .9rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-thumb { width: 60px; height: 60px; flex-shrink: 0; background: var(--sage-soft); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.line-thumb img { width: 100%; height: 100%; object-fit: cover; }
.totals { margin-top: .4rem; }
.totals div { display: flex; justify-content: space-between; padding: .28rem 0; }
.totals .grand { border-top: 1px solid var(--char); margin-top: .4rem; padding-top: .6rem; font-size: 1.15rem; color: var(--ink); }

.choice { display: block; border: 1px solid var(--line); background: var(--paper); padding: .9rem 1rem; margin-bottom: .6rem; cursor: pointer; }
.choice input { margin-right: .6rem; }
.choice.on { border-color: var(--sage); background: var(--sage-soft); }

.recips { max-height: 330px; overflow-y: auto; border: 1px solid var(--line); background: var(--paper); }
.recips label { display: flex; gap: .6rem; padding: .5rem .9rem; border-bottom: 1px solid var(--line); align-items: baseline; }
.recips label:last-child { border-bottom: 0; }
.recips .addr { font-size: .82rem; color: var(--muted); }

/* ---------- order timeline ---------- */
.timeline { list-style: none; margin: .6rem 0 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before {
  content: ''; position: absolute; left: .35rem; top: .45rem; bottom: -.1rem; width: 1px; background: var(--line);
}
.timeline li:last-child::before { display: none; }
.timeline li::after {
  content: ''; position: absolute; left: 0; top: .3rem; width: 11px; height: 11px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--line);
}
.timeline li.done::after { background: var(--sage); border-color: var(--sage); }
.timeline li.now::after { background: var(--paper); border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
.timeline .when { font-size: .8rem; color: var(--muted); }

/* ---------- admin ---------- */
.admin-body { background: #f4f3ef; }
.adminbar { background: var(--ink); color: #fff; padding: .7rem 1.2rem; padding-top: calc(.7rem + env(safe-area-inset-top)); display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.6rem; position: sticky; top: 0; z-index: 40; }
.adminbar-brand { display: flex; align-items: baseline; gap: .6rem; color: #fff; }
.adminbar-brand .wordmark-script { color: #fff; font-size: 1.15rem; }
.adminbar-tag { font-size: .62rem; letter-spacing: .26em; text-transform: uppercase; color: var(--sage); }
.adminnav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.adminnav a { color: rgba(255,255,255,.75); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; padding: .25rem 0; }
.adminnav a.active { color: #fff; border-bottom: 1px solid var(--sage); }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: 250px; gap: .8rem; overflow-x: auto; padding-bottom: 1rem; }
.board-col { background: var(--paper); border: 1px solid var(--line); }
.board-col h3 { font-family: var(--body); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: .6rem .8rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.board-card { display: block; padding: .6rem .8rem; border-bottom: 1px solid var(--line); color: inherit; }
.board-card:hover { background: var(--cream); }
.board-card b { display: block; color: var(--ink); font-weight: 500; }
.board-card small { color: var(--muted); }

/* ---------- guest form ---------- */
.guest-hero { text-align: center; margin-bottom: 1.4rem; }
.guest-hero h1 { font-size: 1.7rem; }
.guest-hero .kicker { margin-bottom: .5rem; }

.share-link {
  display: block; word-break: break-all; background: var(--cream); border: 1px dashed var(--sage);
  padding: .8rem 1rem; font-size: .95rem; margin: .6rem 0;
}
.qr-box { display: flex; justify-content: center; padding: 1rem; }
.qr-box svg { width: 200px; height: 200px; }
.share-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.honeypot { position: absolute; left: -6000px; }

/* ---------- passport ---------- */
.passport-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stamp { border: 1px solid var(--line); background: var(--paper); text-align: center; padding: 1rem .6rem; position: relative; }
.stamp .big { font-size: 2rem; filter: grayscale(1); opacity: .45; }
.stamp.got .big { filter: none; opacity: 1; }
.stamp .name { font-family: var(--display); font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.stamp.got .name { color: var(--ink); }
.stamp.got::after {
  content: '✓'; position: absolute; top: .4rem; right: .5rem;
  color: var(--ok); font-weight: 700;
}

/* ---------- notifications ---------- */
.notif { border-left: 3px solid transparent; }
.notif.unread { border-left-color: var(--sage); background: var(--sage-soft); }

.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- special events: queue, check-in, Story Pass ---------- */
.board.queue { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-columns: auto; overflow-x: visible; align-items: start; }
@media (max-width: 760px) { .board.queue { grid-template-columns: 1fr; } }
.queue-card { display: flex; flex-direction: column; gap: .5rem; }
.queue-card b { font-size: 1.05rem; }
.queue-card small { display: block; }
.queue-actions { display: flex; gap: .4rem; }
.queue-actions .btn-sage { flex: 1; }
.checkin-search { display: flex; gap: .5rem; }
.checkin-search input { flex: 1; font-size: 1.15rem; min-height: 3rem; }
.pass-scanner { margin: .6rem 0; }
.pass-scanner .hint:empty { display: none; }
.scan-video { width: 100%; max-width: 420px; border: 1px solid var(--line); background: #000; }
.pass-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 760px) { .pass-layout { grid-template-columns: 1fr; } }
.pass-card { background: var(--paper); border: 1px solid var(--line); border-top: 6px solid var(--sage); padding: 1.4rem 1.2rem 1rem; text-align: center; }
.pass-card .kicker { margin: 0 0 .4rem; }
.pass-event { font-family: var(--display, var(--body)); font-size: 1.35rem; color: var(--ink); }
.pass-party { margin-top: .2rem; color: var(--muted); }
.pass-number { font-size: 2.4rem; font-weight: 600; color: var(--ink); letter-spacing: .02em; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.pass-card .qr-box svg { width: 220px; height: 220px; }

/* ---------- print (mailing labels) ---------- */
.labels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.label-cell { border: 1px dashed var(--line); padding: .9rem 1rem; font-size: 1.05rem; line-height: 1.4; }
@media print {
  .adminbar, .btn, .flash, .no-print { display: none !important; }
  body { background: #fff; }
  .label-cell { border: none; page-break-inside: avoid; }
  .pass-layout { grid-template-columns: 1fr; }
  .pass-card { border: 2px solid #000; max-width: 360px; margin: 0 auto; }
}

.footer-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 2rem; }
