/* The house look ("The Deck") and the frame, for every page but the landing page.
   Night by default: a warm near-black ground, off-white paper text, one gold accent. Light when chosen, or when
   "device" is chosen and the device asks for light (theme.js): warm paper ground, ink text, a deep amber accent.
   Type: Bricolage Grotesque for headings, names and buttons (--display), DM Sans for reading (--body), Instrument
   Serif italic for the occasional accent word (--serif). All three are served from /shared/fonts/. */
@font-face { font-family: "Bricolage"; src: url("/shared/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/shared/fonts/dm-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/shared/fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  --bg: #0e0d0b;
  --bg-soft: #171512;
  --panel: #171512;
  --panel-2: #211e1a;
  --line: #2e2a24;
  --text: #f5f0e6;
  --text-dim: #b3ac9f;
  --accent: #ffc53d;          /* links, marks, focus: the one gold */
  --accent-2: #f2a93b;        /* a second gold, a little warmer, for borders and small marks */
  --accent-fill: #ffc53d;     /* the main button's face */
  --accent-deep: #7a5a14;     /* the main button's ledge */
  --gold: #ffc53d;
  --danger: #ff7a5c;
  --on-accent: #0e0d0b;
  --on-danger: #0e0d0b;
  --bar: rgba(14, 13, 11, .88);
  --radius: 22px;
  --shadow: 0 24px 50px -22px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .03);
  --focus: #ffc53d;
  --display: "Bricolage", "Arial Black", system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f1e7;
  --bg-soft: #eee7d9;
  --panel: #fffcf5;
  --panel-2: #efe8da;
  --line: #dcd1bd;
  --text: #1c1915;
  --text-dim: #5e564a;
  --accent: #855400;
  --accent-2: #9a4a00;
  --accent-fill: #f5b62f;
  --accent-deep: #a8740c;
  --gold: #855400;
  --danger: #b3261e;
  --on-accent: #1c1915;
  --on-danger: #fff;
  --bar: rgba(246, 241, 231, .9);
  --shadow: 0 18px 40px -22px rgba(70, 48, 10, .35), 0 0 0 1px rgba(70, 48, 10, .04);
  --focus: #855400;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="device"] {
    --bg: #f6f1e7;
    --bg-soft: #eee7d9;
    --panel: #fffcf5;
    --panel-2: #efe8da;
    --line: #dcd1bd;
    --text: #1c1915;
    --text-dim: #5e564a;
    --accent: #855400;
    --accent-2: #9a4a00;
    --accent-fill: #f5b62f;
    --accent-deep: #a8740c;
    --gold: #855400;
    --danger: #b3261e;
    --on-accent: #1c1915;
    --on-danger: #fff;
    --bar: rgba(246, 241, 231, .9);
    --shadow: 0 18px 40px -22px rgba(70, 48, 10, .35), 0 0 0 1px rgba(70, 48, 10, .04);
    --focus: #855400;
    color-scheme: light;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; }
h1, h2, h3 { font-family: var(--display); }
h1 { font-size: clamp(1.8rem, 5.4vw, 2.6rem); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; margin-bottom: 14px; }
h2 { font-size: 1.3rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 10px; }
h3 { font-weight: 700; letter-spacing: -.01em; }
em.accent, .accent-word { font: italic 400 1.12em/1 var(--serif); letter-spacing: 0; color: var(--accent); }
p + p { margin-top: .8em; }
a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
.dim { color: var(--text-dim); }
.small { font-size: .88rem; }
.error { color: var(--danger); margin-top: 10px; }
.error::before { content: "! "; font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

/* ---- Buttons and forms ---- */
/* A pill with a line round it (the outline and deck buttons); the main one is gold, standing on a ledge. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 24px;
  border-radius: 999px; border: 2px solid var(--line);
  background: var(--panel); color: var(--text);
  font: 700 1rem/1.2 var(--display); letter-spacing: -.005em; text-decoration: none; cursor: pointer;
  transition: transform .35s var(--spring), box-shadow .35s var(--spring), border-color .2s, background .2s, opacity .15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--text-dim); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn-primary {
  background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); font-weight: 800;
  box-shadow: 0 4px 0 var(--accent-deep), 0 14px 30px -14px color-mix(in srgb, var(--accent-fill) 60%, transparent);
}
.btn-primary:hover:not(:disabled) { border-color: var(--accent-fill); }
.btn-primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-deep), 0 6px 16px -12px var(--accent-fill); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
/* Busy (shared/api.js busy): taken, not unavailable, with a small ring that turns (still for reduced motion). */
[aria-busy="true"]:disabled { opacity: .8; cursor: progress; }
button[aria-busy="true"]::after {
  content: ""; display: inline-block; flex: none; width: .9em; height: .9em; margin-left: .5em; vertical-align: -.1em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busy-turn .8s linear infinite;
}
@keyframes busy-turn { to { transform: rotate(360deg); } }
.link {
  background: none; border: none; color: var(--accent); font: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; min-height: 44px; padding: 0 4px;
}
.link:disabled { color: var(--text-dim); text-decoration: none; cursor: default; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input:not([type="checkbox"]), select {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit;
  transition: border-color .2s;
}
input:not([type="checkbox"]):focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent-fill); flex: none; }
.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; min-height: 44px; }
.check label { margin: 0; }
form .btn { margin-top: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: var(--shadow);
}
.soon { font: 700 .78rem/1.3 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }

/* ---- Sign-in ---- */
.signin { max-width: 460px; margin: 0 auto; }
.signin .why { font-weight: 600; }
.signin-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; }

/* ---- Top bar (navigation) ---- */
.top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; position: sticky; top: 0; z-index: 50;
  background: var(--bar); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font: 800 1.2rem/1 var(--display); letter-spacing: -.02em; color: var(--text); text-decoration: none;
  min-height: 44px; display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
/* The mark: the site's heart (img/heart.svg, the same file as the site icon), shown here in place of the glyph
   frame.js writes (hidden from screen readers there already). */
.brand-mark { flex: none; width: 28px; height: 28px; font-size: 0; color: transparent; background: url(img/heart.svg) center / contain no-repeat; }
.tabs { display: flex; gap: 6px; margin-left: auto; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  color: var(--text-dim); text-decoration: none; font: 600 .95rem/1 var(--display); letter-spacing: -.005em;
  transition: color .2s, background .2s;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.tab[aria-current="page"] .tab-icon { color: var(--accent); }
.tab-icon { display: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-fill); display: inline-block; box-shadow: 0 0 0 2px var(--bg); }
.theme-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); background: transparent; color: var(--text);
  font-size: 1.1rem; cursor: pointer; transition: border-color .2s;
}
.theme-btn:hover { border-color: var(--text-dim); }
/* The account button (account.js draws it with its own small style; here it takes the house look). */
.top .account { width: 42px; height: 42px; font: 800 1.05rem/1 var(--display); color: var(--on-accent); background: var(--accent-fill); box-shadow: 0 3px 0 var(--accent-deep); }
.top .account:hover, .top .account:focus-visible { box-shadow: 0 3px 0 var(--accent-deep), 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.top .account.out { background: transparent; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.top .account.out:hover { border-color: var(--text-dim); box-shadow: none; }
.top .account[aria-current="page"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* On a phone the three links sit in a bar at the bottom of the screen, icons with labels under them. */
@media (max-width: 640px) {
  /* A blurred bar would hold the fixed tab bar inside it, so the phone top bar is plain. */
  .top { backdrop-filter: none; background: var(--bg); }
  .brand { font-size: 1.05rem; gap: 8px; }
  .top .theme-btn { margin-left: auto; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0;
    justify-content: space-around; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--bar); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  }
  .tab { flex-direction: column; gap: 2px; font-size: .75rem; padding: 4px 10px; border-radius: 14px; min-width: 72px; }
  .tab[aria-current="page"] { box-shadow: none; }
  .tab-icon { display: block; }
  .tab .dot { position: absolute; top: 4px; right: 18px; }
  body { padding-bottom: 72px; }
}

/* ---- Foot ---- */
.foot {
  border-top: 1px solid var(--line); background: var(--bg-soft);
  padding: 26px 16px; text-align: center; color: var(--text-dim); font-size: .9rem;
}
.foot .honest { color: var(--text); max-width: 640px; margin: 0 auto 10px; }
.foot .honest a { font-weight: 600; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.foot-links a { color: var(--text-dim); min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; }
.foot-links span { min-height: 44px; display: inline-flex; align-items: center; }

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

/* A partner's own notice, read and answered before the first hello. */
.notice-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 9, 8, .78); }
.notice { max-width: 520px; width: 100%; padding: 26px 26px 22px; border-radius: var(--radius); background: var(--card, var(--panel)); border: 1px solid var(--line); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); }
.notice h2 { margin: 0 0 12px; font-size: 1.4rem; }
.notice p { margin: 0 0 12px; line-height: 1.55; }
.notice-buttons { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
/* "Please read": the yes button is held for a few seconds and fills from the left as it becomes ready. */
.notice-wait { position: relative; overflow: hidden; cursor: progress; opacity: .45; animation: notice-ready var(--wait, 5s) linear forwards; }
.notice-wait::before { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .28); transform-origin: left; transform: scaleX(0); animation: notice-fill var(--wait, 5s) linear forwards; }
@keyframes notice-ready { from { opacity: .45; } to { opacity: 1; } }
@keyframes notice-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .notice-wait, .notice-wait::before { animation: none; } }
