/* ════════════════════════════════════════════════════════════════
   Ryan & Harini — house style
   Ivory paper, ink navy, antique gold. Cinzel for engraved capitals,
   Cormorant for the grand italics, EB Garamond for reading.
   ════════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Cinzel'; src: url('fonts/cinzel-latin-wght-normal.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url('fonts/eb-garamond-latin-wght-normal.woff2') format('woff2'); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url('fonts/eb-garamond-latin-wght-italic.woff2') format('woff2'); font-weight: 400 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-garamond-latin-wght-normal.woff2') format('woff2'); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('fonts/cormorant-garamond-latin-wght-italic.woff2') format('woff2'); font-weight: 300 700; font-style: italic; font-display: swap; }

:root {
  --paper: #F5F0E4;
  --paper-raised: #FCFAF4;
  --paper-sunk: #ECE5D4;
  --ink: #18203D;
  --ink-soft: #4A5170;
  --ink-faint: #85879A;
  --gold: #977433;
  --gold-bright: #B8954F;
  --gold-wash: rgba(151, 116, 51, .10);
  --gold-line: rgba(151, 116, 51, .42);
  --hair: rgba(24, 32, 61, .12);
  --hair-strong: rgba(24, 32, 61, .22);
  --claret: #7C2335;
  --claret-wash: rgba(124, 35, 53, .08);
  --blue: #2B4F93;
  --blue-wash: rgba(43, 79, 147, .09);
  --blue-line: rgba(43, 79, 147, .38);
  --green: #2E5A45;
  --green-wash: rgba(46, 90, 69, .09);
  --band: #131A31;            /* the royal header band, same in both themes */
  --band-ink: #F1E9D6;
  --band-gold: #CDAE68;
  --chip-on-bg: #18203D;
  --chip-on-ink: #F5F0E4;
  --shadow: 0 10px 30px -18px rgba(19, 26, 49, .45);
  --sheet-shadow: 0 -18px 50px -20px rgba(19, 26, 49, .45);
  --scrim: rgba(13, 18, 34, .42);
  --f-caps: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --f-display: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --f-text: 'EB Garamond', Garamond, Georgia, serif;
  --radius: 10px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1324; --paper-raised: #141B30; --paper-sunk: #0A0F1D;
    --ink: #EEE6D3; --ink-soft: #B6AE99; --ink-faint: #7E7A6C;
    --gold: #CBAA62; --gold-bright: #E2C682; --gold-wash: rgba(203, 170, 98, .10); --gold-line: rgba(203, 170, 98, .40);
    --hair: rgba(238, 230, 211, .11); --hair-strong: rgba(238, 230, 211, .22);
    --claret: #E0909C; --claret-wash: rgba(224, 144, 156, .10);
    --blue: #93B4F0; --blue-wash: rgba(147, 180, 240, .12); --blue-line: rgba(147, 180, 240, .42);
    --green: #93C6A6; --green-wash: rgba(147, 198, 166, .10);
    --band: #080C19; --chip-on-bg: #CBAA62; --chip-on-ink: #0D1324;
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8); --sheet-shadow: 0 -18px 50px -20px rgba(0, 0, 0, .9);
    --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D1324; --paper-raised: #141B30; --paper-sunk: #0A0F1D;
  --ink: #EEE6D3; --ink-soft: #B6AE99; --ink-faint: #7E7A6C;
  --gold: #CBAA62; --gold-bright: #E2C682; --gold-wash: rgba(203, 170, 98, .10); --gold-line: rgba(203, 170, 98, .40);
  --hair: rgba(238, 230, 211, .11); --hair-strong: rgba(238, 230, 211, .22);
  --claret: #E0909C; --claret-wash: rgba(224, 144, 156, .10);
  --blue: #93B4F0; --blue-wash: rgba(147, 180, 240, .12); --blue-line: rgba(147, 180, 240, .42);
  --green: #93C6A6; --green-wash: rgba(147, 198, 166, .10);
  --band: #080C19; --chip-on-bg: #CBAA62; --chip-on-ink: #0D1324;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8); --sheet-shadow: 0 -18px 50px -20px rgba(0, 0, 0, .9);
  --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-text); font-size: 17px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--gold); }
img, svg { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lining { font-variant-numeric: lining-nums tabular-nums; }

/* ───────── Type ───────── */
.eyebrow { font-family: var(--f-caps); font-size: 10.5px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.caps { font-family: var(--f-caps); letter-spacing: .14em; text-transform: uppercase; }
.display { font-family: var(--f-display); font-style: italic; font-weight: 500; }
.page-title { font-family: var(--f-display); font-weight: 600; font-size: 34px; line-height: 1.05; margin: 2px 0 2px; letter-spacing: -.005em; }
.page-sub { color: var(--ink-soft); font-style: italic; margin: 0; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.section-title { display: flex; align-items: center; gap: 12px; margin: 26px 0 10px; font-family: var(--f-caps); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-line), transparent); }
.section-title .count { color: var(--ink-faint); letter-spacing: .1em; }
.section-title a, .section-title button { font-family: var(--f-text); text-transform: none; letter-spacing: 0; font-size: 15px; font-style: italic; color: var(--gold); order: 3; }

.flourish { display: flex; align-items: center; gap: 12px; color: var(--gold); margin: 14px auto; max-width: 220px; }
.flourish span { flex: 1; height: 1px; background: var(--gold-line); }
.flourish i { font-style: normal; font-size: 15px; line-height: 1; }

/* ───────── Surfaces ───────── */
.card { background: var(--paper-raised); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.framed { position: relative; background: var(--paper-raised); border: 1px solid var(--gold-line); border-radius: 4px; padding: 26px 20px 22px; box-shadow: var(--shadow); }
.framed::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--gold-line); border-radius: 2px; pointer-events: none; opacity: .55; }
.framed .corner { position: absolute; width: 14px; height: 14px; border-color: var(--gold); border-style: solid; opacity: .9; }
.framed .corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.framed .corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.framed .corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.framed .corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ───────── Controls ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px;
  font-family: var(--f-caps); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; transition: transform .12s ease, opacity .12s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--chip-on-bg); color: var(--chip-on-ink); box-shadow: inset 0 0 0 1px var(--gold-line); }
.btn-gold { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: #fffaf0; }
.btn-ghost { border: 1px solid var(--hair-strong); color: var(--ink); }
.btn-danger { color: var(--claret); border: 1px solid var(--claret-wash); background: var(--claret-wash); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 10.5px; }
.link-btn { color: var(--gold); font-style: italic; font-size: 16px; }

.field { display: block; margin: 0 0 14px; }
.field > span, .label { display: block; font-family: var(--f-caps); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; font-size: 17px; /* ≥16px stops iOS zooming */
  background: var(--paper); color: var(--ink); border: 1px solid var(--hair-strong); border-radius: 8px; outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-wash); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type="date"].input { min-height: 48px; line-height: 24px; }
input[type="date"].input::-webkit-date-and-time-value { text-align: left; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--hair-strong);
  font-family: var(--f-caps); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.chip b { font-family: var(--f-text); font-weight: 500; letter-spacing: 0; font-size: 13px; opacity: .75; }
.chip[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-ink); border-color: transparent; }

.seg { display: flex; padding: 3px; border-radius: 999px; background: var(--paper-sunk); border: 1px solid var(--hair); }
.seg button { flex: 1; height: 36px; border-radius: 999px; font-family: var(--f-caps); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.seg button[aria-pressed="true"] { background: var(--paper-raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12), inset 0 0 0 1px var(--gold-line); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--paper-sunk); border: 1px solid var(--hair-strong); transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper-raised); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--gold); border-color: var(--gold); }
.switch input:checked + i::after { transform: translateX(20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row small { display: block; color: var(--ink-soft); font-size: 14px; line-height: 1.3; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-family: var(--f-caps); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.pill.yes { color: var(--green); background: var(--green-wash); }
.pill.no { color: var(--claret); background: var(--claret-wash); }
.pill.wait { color: var(--ink-soft); background: var(--paper-sunk); }
.pill.gold { color: var(--gold); background: var(--gold-wash); }

.progress { height: 3px; border-radius: 3px; background: var(--hair); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); border-radius: 3px; transition: width .4s ease; }

/* ───────── Toast ───────── */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); display: flex; justify-content: center; pointer-events: none; z-index: 90; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 16px; max-width: 520px; padding: 12px 16px 12px 18px; border-radius: 12px;
  background: var(--band); color: var(--band-ink); box-shadow: 0 12px 30px -10px rgba(0,0,0,.5), inset 0 0 0 1px rgba(205,174,104,.35); font-size: 16px;
  animation: toast-in .25s ease; }
.toast button { color: var(--band-gold); font-family: var(--f-caps); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

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