/* Ardent / Caelix Labs: shared world. Night reading room: plum-black ground,
   wine light, rose for the one action, candlelight gold for time and coins. */

@font-face { font-family: 'Playfair'; src: url(/fonts/PlayfairDisplay-SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Playfair'; src: url(/fonts/PlayfairDisplay-Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Playfair'; src: url(/fonts/PlayfairDisplay-SemiBoldItalic.ttf) format('truetype'); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Literata'; src: url(/fonts/Literata-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Literata'; src: url(/fonts/Literata-Italic.ttf) format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/Inter-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/Inter-Medium.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/Inter-SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }

:root {
  --bg: #0f0a0e;
  --bg-2: #150e13;
  --surface: #1a1218;
  --surface-2: #241a21;
  --wine: #4c1129;
  --wine-2: #7a1e44;
  --line: rgba(246, 238, 241, 0.1);
  --text: #f6eef1;
  --dim: #c4b5bd;
  --faint: #8f7f88;
  --rose: #e5577b;
  --rose-hi: #f07a97;
  --rose-deep: #9e2a4a;
  --gold: #e8c07d;
  --gold-hi: #f6dca6;
  --display: 'Playfair', Georgia, serif;
  --read: 'Literata', Georgia, serif;
  --ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--wine-2) var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--rose); color: #fff; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--wine-2); border-radius: 10px; border: 2px solid var(--bg); }
img { max-width: 100%; display: block; }
a { color: var(--rose-hi); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--gold-hi); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--bg) 0%, rgba(15, 10, 14, 0.86) 100%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease-out), background 0.4s var(--ease-out);
}
.top.scrolled { border-bottom-color: var(--line); background: rgba(15, 10, 14, 0.94); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 16px; }
.brand { font: italic 600 26px/1 var(--display); color: var(--text); text-decoration: none; letter-spacing: 0.01em; }
.brand:hover { color: var(--text); }
.nav, .top nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
.nav a, .top nav a { color: var(--dim); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav a:hover, .top nav a:hover { color: var(--text); }
.nav .mini-clock { font: 600 15px/1 var(--display); color: var(--gold); font-variant-numeric: lining-nums tabular-nums; opacity: 0; transform: translateY(-4px); transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out); }
.top.scrolled .mini-clock { opacity: 1; transform: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 17px 26px; border-radius: 18px;
  font: 600 16px/1 var(--ui); letter-spacing: 0.01em; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, #c93d62, #b0345a 55%, #8e2445);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}
.btn:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 22px 40px -14px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.28); filter: brightness(1.06); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.link-quiet { color: var(--dim); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.link-quiet:hover { color: var(--text); border-bottom-color: var(--gold); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; letter-spacing: -0.012em; }
h2 { font-size: clamp(34px, 5vw, 60px); line-height: 1.04; }
.lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--dim); max-width: 34em; line-height: 1.6; text-wrap: pretty; }
.fine { color: var(--faint); font-size: 14px; }

/* ---------- Covers (typographic, same system as the app) ---------- */
.cover {
  --a: #1b1030; --b: #b8860b;
  position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--a) 65%, var(--b)), var(--a) 55%, color-mix(in srgb, var(--a) 60%, #000));
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
  color: #fff; text-decoration: none; isolation: isolate; container-type: inline-size;
}
.cover::before { content: ''; position: absolute; inset: -30% -40% auto auto; width: 110%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(color-mix(in srgb, var(--b) 60%, transparent), transparent 65%); z-index: -1; }
.cover::after { content: ''; position: absolute; inset: 6%; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 9px; pointer-events: none; }
.cover .g { position: absolute; top: 10%; left: 11%; font: 600 6.2cqw/1 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); }
.cover .t { position: absolute; left: 11%; right: 11%; bottom: 23%; font: 700 14cqw/1.06 var(--display); }
.cover .r { position: absolute; left: 11%; bottom: 18.5%; width: 16%; height: 1.5px; background: var(--b); }
.cover .au { position: absolute; left: 11%; bottom: 11%; font: 400 7cqw/1 var(--ui); color: rgba(255, 255, 255, 0.75); }

/* ---------- Phones (real screenshots) ---------- */
.phone {
  position: relative; width: 100%; aspect-ratio: 720 / 1616; border-radius: 13% / 6%;
  padding: 2.4%; background: linear-gradient(160deg, #2c2128, #120c10);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 11% / 5%; }

/* ---------- Coin ---------- */
.coin { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 44px 0 56px; color: var(--faint); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: baseline; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
footer a { color: var(--dim); text-decoration: none; }
footer a:hover { color: var(--text); }
footer .brand { font-size: 20px; }

/* ---------- Legal pages ---------- */
main.legal { padding: 64px 0 96px; }
main.legal .wrap { max-width: 760px; }
main.legal h1 { font-size: clamp(36px, 5vw, 52px); margin-bottom: 10px; }
main.legal h2 { font-size: 24px; margin: 48px 0 10px; }
main.legal h3 { font: 600 17px/1.4 var(--ui); margin: 26px 0 6px; color: var(--text); }
main.legal p, main.legal li { color: var(--dim); max-width: 68ch; }
main.legal li { margin-bottom: 8px; }
main.legal strong { color: var(--text); font-weight: 600; }
.meta { color: var(--faint); font-size: 14px; }

/* ---------- The night deepens as you scroll (--night: 0 at 11:47, 1 at 12:31) ---------- */
.night-sky { position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(70% 55% at 78% 0%, rgba(122, 30, 68, calc(0.42 - 0.3 * var(--night, 0))), transparent 70%),
    radial-gradient(60% 50% at 12% 100%, rgba(58, 12, 36, calc(0.08 + 0.34 * var(--night, 0))), transparent 70%),
    linear-gradient(180deg, #0f0a0e, color-mix(in srgb, #0f0a0e calc(100% - 55% * var(--night, 0)), #080407));
}

/* ---------- Motion ---------- */
/* Covers are dealt onto the shelf, one after another. */
.js [data-deal] > * { opacity: 0; transform: translateY(-34px) rotate(-7deg); transition: opacity 0.7s var(--ease-out), transform 0.9s var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms); }
.js [data-deal].dealt > * { opacity: 1; transform: none; }
/* Coins fill the nights in order. */
.js [data-fill] .night-cell .disc { transform: scale(0.7); opacity: 0; transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s var(--ease-out); transition-delay: calc(var(--i, 0) * 110ms); }
.js [data-fill].filled .night-cell .disc { transform: none; opacity: 1; }
.reveal { opacity: 1; transform: none; }
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js [data-deal] > *, .js [data-fill] .night-cell .disc { opacity: 1; transform: none; }
}
