/* ==========================================================================
   Revive, the app

   The site in the hand. One rule carries the look: serif type only ever
   shows a mind's own words (the pages, and the words an answer repeats from
   them). Everything the machine writes is set in Inter. Gold is the author,
   violet is the machine, each mind keeps its own colour from the film.
   ========================================================================== */

@font-face { font-family: "Inter"; src: url("../assets/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../assets/fonts/cormorant.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../assets/fonts/cormorant-italic.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }

:root {
  --void: #050508; --bg2: #0f0f17; --bg3: #171722; --line: #262636; --line-2: #3a3550;
  --text: #ecebf4; --text-2: #a4a3b6; --muted: #6d6c80;
  --violet: #7433e0; --lav: #ab84f9; --gold: #f5c542; --gold-hi: #ffe29a; --page: #efe3c4;
  --mint: #45e0b4; --red: #ff5c75;

  --c-gabriella: #ee4a32; --c-franklin: #f5c542; --c-leonardo: #ff6b6b; --c-sagan: #74c0fc;
  --c-emily: #f7a8c4; --c-attenborough: #69db7c; --c-decode: #e6cf00; --c-russell: #ffa94d;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --col: 480px;
  --gut: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabs-h: calc(62px + var(--safe-b));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--void); }
body {
  margin: 0; min-height: 100dvh; color: var(--text); font: 400 16px/1.5 var(--sans);
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(116, 51, 224, 0.28), transparent 60%),
    radial-gradient(80% 50% at 100% 100%, rgba(116, 51, 224, 0.12), transparent 70%),
    var(--void);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---- the column ------------------------------------------------------- */
.app { position: relative; max-width: var(--col); min-height: 100dvh; margin: 0 auto; }
@media (min-width: 720px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); background: rgba(5, 5, 8, 0.55); }
}
.view { padding: calc(var(--safe-t) + 14px) var(--gut) calc(var(--tabs-h) + 28px); }
.view--full { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; max-width: var(--col); margin: 0 auto; padding: 0; background: var(--void); }
@media (min-width: 720px) { .view--full { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* ---- type ------------------------------------------------------------- */
.masthead { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.wordmark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.wordmark svg { width: 24px; height: 24px; stroke: none; }
.intro { padding: 30px 0 22px; }
.intro--tight { padding-top: 22px; }
.display { margin: 0; font-weight: 800; font-size: clamp(44px, 13vw, 58px); line-height: 0.98; letter-spacing: -0.035em; }
.display--md { font-size: clamp(34px, 10vw, 42px); }
.lede { margin: 14px 0 0; max-width: 36ch; color: var(--text-2); font-size: 16.5px; line-height: 1.5; }
.section-h { margin: 34px 0 12px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.hint { display: block; margin: 0 0 10px; color: var(--text-2); font-size: 14.5px; }
.banner { margin: 0 0 16px; padding: 12px 14px; border: 1px solid rgba(255, 92, 117, 0.4); border-radius: 12px; background: rgba(255, 92, 117, 0.08); font-size: 14.5px; }

/* ---- faces ------------------------------------------------------------ */
/* A face is two portraits: the mind's own words, and the face over them. */
.face { --c: var(--lav); position: relative; flex: none; display: block; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--bg3); box-shadow: 0 0 0 1.5px var(--c); }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.face .words { opacity: 0; transition: opacity 0.5s var(--ease); }
.face--sm { width: 36px; height: 36px; }
.face--lg { width: 96px; height: 96px; box-shadow: 0 0 0 2px var(--c), 0 0 40px -6px var(--c); }
.face.reading .words { animation: reading 2.4s ease-in-out infinite; }
@keyframes reading { 0%, 100% { opacity: 0; } 45%, 60% { opacity: 1; } }

/* ---- roster (character select) --------------------------------------- */
.roster { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { --c: var(--lav); position: relative; display: block; overflow: hidden; border-radius: 12px; aspect-ratio: 4 / 5; background: var(--bg3); text-decoration: none; isolation: isolate; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.card .words { opacity: 0; transition: opacity 0.6s var(--ease); }
.card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(5, 5, 8, 0.96) 6%, rgba(5, 5, 8, 0.55) 34%, transparent 58%); }
.card::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c); box-shadow: 0 0 18px var(--c); }
.card-name { position: absolute; left: 12px; right: 10px; bottom: 30px; font-weight: 800; font-size: 18px; line-height: 1.1; letter-spacing: -0.01em; }
.card-role { position: absolute; left: 12px; right: 10px; bottom: 11px; color: var(--text-2); font-size: 12.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:hover .words, .card:focus-visible .words { opacity: 1; }
.card.is-off img { filter: grayscale(1) brightness(0.55); }
.card.is-off::before { background: var(--muted); box-shadow: none; }
.card-flag { position: absolute; top: 10px; left: 10px; padding: 3px 8px; border-radius: 99px; background: rgba(5, 5, 8, 0.8); color: var(--text-2); font-size: 12px; }
/* The one opening moment: every portrait resolves from its words into a face. */
.js .roster.resolve .card .words { animation: resolve 1.8s var(--ease) both; animation-delay: calc(var(--i) * 90ms); }
@keyframes resolve { 0%, 35% { opacity: 1; } 100% { opacity: 0; } }

/* ---- bars, threads, messages ----------------------------------------- */
.bar { flex: none; display: flex; align-items: center; gap: 6px; padding: calc(var(--safe-t) + 8px) 8px 8px; border-bottom: 1px solid var(--line); background: rgba(5, 5, 8, 0.9); }
.bar-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.bar-text { min-width: 0; display: flex; flex-direction: column; }
.bar-text strong { font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-text span { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text); text-decoration: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); }
.faces { display: flex; flex: none; }
.faces .face { width: 32px; height: 32px; box-shadow: 0 0 0 2px var(--void), 0 0 0 3.5px var(--c); }
.faces .face + .face { margin-left: -9px; }

.thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px var(--gut) 24px; scroll-behavior: smooth; }
.msg { margin: 0 0 22px; }
.msg--you { display: flex; justify-content: flex-end; }
.msg--you p { margin: 0; max-width: 86%; padding: 10px 14px; border: 1px solid rgba(171, 132, 249, 0.35); border-radius: 18px 18px 4px 18px; background: rgba(116, 51, 224, 0.2); white-space: pre-line; }
.msg-who { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.msg-who .face { width: 28px; height: 28px; }
.msg-text { margin: 0; font-size: 17px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.msg--mind { --c: var(--lav); }
.msg--speaking .msg-text { color: #fff; }
.msg--speaking .msg-who .face { box-shadow: 0 0 0 1.5px var(--c), 0 0 16px var(--c); }
.msg--error .msg-text { color: var(--text-2); font-size: 15px; }
.msg--note { color: var(--text-2); font-size: 14px; text-align: center; }

/* Words an answer repeats from its pages, word for word. */
mark.q { background: none; color: var(--page); font-family: var(--serif); font-style: italic; font-size: 1.12em; line-height: 1.3; box-shadow: inset 0 -1px 0 rgba(245, 197, 66, 0.75); cursor: pointer; }
.about-q { cursor: default; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pages-chip, .listen { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 99px; background: rgba(255, 255, 255, 0.03); font-size: 14px; font-weight: 600; }
.pages-chip { border-color: rgba(245, 197, 66, 0.45); color: var(--gold-hi); }
.pages-chip svg, .listen svg { width: 17px; height: 17px; }
.pages-chip small { color: var(--text-2); font-weight: 500; font-size: 13px; }
.pages-chip--inline { min-height: 0; padding: 1px 9px; font-size: 13px; vertical-align: 1px; }
/* The Revive Score of an answer. Lavender is the machine's colour: the score is the system's check, not the mind's words. */
.score-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 1px solid rgba(171, 132, 249, 0.45); border-radius: 99px; background: rgba(116, 51, 224, 0.1); color: var(--lav); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.score-chip svg { width: 17px; height: 17px; }
.score-chip.is-fail { border-color: rgba(255, 92, 117, 0.45); color: #ff8fa1; background: rgba(255, 92, 117, 0.08); }
.score-chip.is-near { border-style: dashed; background: transparent; }
/* On a phone, the source and score chips fit on one row, in a chat and in a salon. */
@media (max-width: 440px) {
  .msg-actions { gap: 5px; }
  .msg-actions .pages-chip, .msg-actions .score-chip, .msg-actions .listen { gap: 4px; padding: 0 8px; font-size: 12.5px; }
  .msg-actions svg { width: 14px; height: 14px; }
}
@media (max-width: 370px) {
  .msg-actions .pages-chip, .msg-actions .score-chip, .msg-actions .listen { font-size: 12px; letter-spacing: -0.01em; }
}
.listen[aria-pressed="true"] { border-color: var(--c); color: #fff; box-shadow: 0 0 14px -4px var(--c); }

.thinking { display: flex; align-items: center; gap: 12px; margin: 4px 0 22px; color: var(--text-2); font-size: 14.5px; }
.thinking .face { width: 34px; height: 34px; }
.thinking span::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* Empty conversation: who this is, and how to start. */
.hello { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 6px 6px; }
.hello h2 { margin: 16px 0 2px; font-size: 24px; letter-spacing: -0.02em; }
.hello .role { margin: 0; color: var(--text-2); font-size: 15px; }
.hello .built { margin: 14px 0 0; max-width: 34ch; font-size: 15px; color: var(--text-2); }
.hello .built strong { color: var(--text); font-weight: 600; }
.starters { display: grid; gap: 8px; width: 100%; margin-top: 22px; }
.starter { width: 100%; padding: 13px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: rgba(255, 255, 255, 0.03); text-align: left; font-size: 15.5px; line-height: 1.35; }
.starter:hover { border-color: var(--c, var(--lav)); background: rgba(255, 255, 255, 0.05); }
.ask-list { margin-top: 26px; }
.ask-list .starters { margin-top: 10px; }
.ask-h { margin: 0; color: var(--text-2); font-size: 14px; font-weight: 600; }
.asked-all { margin: 26px 0 0; color: var(--text-2); font-size: 14.5px; text-align: center; }
.msg.is-new { animation: arrive 0.6s var(--ease) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }
.banner--quiet { border-color: var(--line-2); background: rgba(255, 255, 255, 0.03); color: var(--text-2); }

/* ---- buttons, chips, fields ------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border: 1px solid var(--line-2); border-radius: 99px; background: transparent; font-weight: 700; font-size: 15.5px; text-decoration: none; }
.btn--gold { border-color: var(--gold); background: var(--gold); color: #1a1405; }
.btn--gold:disabled { border-color: var(--line-2); background: var(--bg3); color: var(--muted); cursor: default; }
.btn--quiet { color: var(--text-2); }
/* ---- salon ------------------------------------------------------------ */
.matchups { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.matchup { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(100deg, rgba(116, 51, 224, 0.12), rgba(255, 255, 255, 0.02)); text-align: left; }
.matchup:hover { border-color: var(--line-2); }
.matchup .faces .face { width: 46px; height: 46px; }
.matchup .faces .face + .face { margin-left: -12px; }
.matchup-q { display: block; font-weight: 700; font-size: 16.5px; line-height: 1.25; }
.matchup-who { display: block; margin-top: 3px; color: var(--text-2); font-size: 13.5px; }
.matchup.is-off { opacity: 0.45; }

.thread--salon .msg--mind { padding-left: 14px; border-left: 2px solid transparent; transition: border-color 0.3s; }
.thread--salon .msg--speaking { border-left-color: var(--c); }
.stage-controls { flex: none; display: flex; justify-content: center; gap: 10px; padding: 8px var(--gut) 0; }
.stage-controls { flex-wrap: wrap; padding-bottom: calc(10px + var(--safe-b)); }
.stage-controls .btn { min-height: 40px; padding: 0 18px; font-size: 14.5px; }
#stage-voice .off { display: none; }
#stage-voice[aria-pressed="false"] .on { display: none; }
#stage-voice[aria-pressed="false"] .off { display: inline; }

/* ---- how it works ------------------------------------------------------ */
.steps { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 0 0 22px 46px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font-weight: 700; font-size: 14px; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 6px; width: 1px; background: var(--line-2); }
.steps h2 { margin: 3px 0 4px; font-size: 17px; }
.steps p { margin: 0; color: var(--text-2); font-size: 15.5px; }
.note-card { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, 0.02); }
.note-card h2 { margin: 0 0 6px; font-size: 16.5px; }
.note-card p { margin: 0; color: var(--text-2); font-size: 15px; }
.note-card .btn { margin-top: 14px; }
.note-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); font-size: 15px; }
.note-card li + li { margin-top: 4px; }
.note-card .score-chip { min-height: 0; padding: 1px 9px; font-size: 13px; vertical-align: 1px; }
.links { list-style: none; margin: 26px 0 0; padding: 0; border-top: 1px solid var(--line); }
.links a { display: flex; align-items: center; justify-content: space-between; min-height: 54px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.links a::after { content: ""; width: 8px; height: 8px; border-top: 1.8px solid var(--text-2); border-right: 1.8px solid var(--text-2); transform: rotate(45deg); }

/* ---- tabs -------------------------------------------------------------- */
.tabs { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; max-width: var(--col); margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--tabs-h); padding-bottom: var(--safe-b); border-top: 1px solid var(--line); background: rgba(5, 5, 8, 0.88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--gold); }
.tabs.is-hidden { display: none; }

/* ---- the pages sheet --------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.25s ease both; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: var(--col); max-height: 86dvh; margin: 0 auto; display: flex; flex-direction: column; border-top: 1px solid var(--line-2); border-radius: 20px 20px 0 0; background: var(--bg2); animation: rise 0.35s var(--ease) both; outline: none; }
.sheet-grip { width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--line-2); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 0 var(--gut); }
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-sub { margin: 2px var(--gut) 10px; color: var(--text-2); font-size: 14px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px var(--gut) calc(26px + var(--safe-b)); }
.page { padding: 16px 0 18px; border-top: 1px solid var(--line); }
.page-label { margin: 0 0 8px; color: var(--gold); font-weight: 600; font-size: 13.5px; }
.page-note { margin: -2px 0 10px; color: var(--lav); font-size: 13.5px; }
.page-text { margin: 0; color: var(--page); font-family: var(--serif); font-size: 20px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.page-text.is-clamped { display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden; }
.page-text mark { background: rgba(245, 197, 66, 0.2); color: var(--gold-hi); border-radius: 3px; box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.2); }
.page.is-other .page-text { color: var(--text-2); font-family: var(--sans); font-size: 15.5px; line-height: 1.55; }
.page-more { margin-top: 8px; padding: 6px 0; border: 0; background: none; color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.page.is-target { animation: flash 1.6s ease both; }
/* The score sheet */
.score-head { display: flex; align-items: baseline; gap: 8px; padding: 6px 0 14px; }
.score-num { color: var(--lav); font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score-of { color: var(--text-2); font-size: 15px; }
.score-verdict { margin-left: auto; padding: 4px 12px; border: 1px solid rgba(171, 132, 249, 0.5); border-radius: 99px; color: var(--lav); font-size: 14px; font-weight: 700; }
.score-verdict.is-fail { border-color: rgba(255, 92, 117, 0.5); color: #ff8fa1; }
.score-verdict.is-near { border-style: dashed; }
.score-h { margin: 16px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; }
.checks, .dims, .claims { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.checks svg { flex: none; width: 20px; height: 20px; padding: 2px; border-radius: 50%; stroke-width: 2.6; }
.checks .is-pass svg { background: rgba(171, 132, 249, 0.18); color: var(--lav); }
.checks .is-fail svg { background: rgba(255, 92, 117, 0.18); color: #ff8fa1; }
.dims li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14.5px; }
.dim-pts { color: var(--text-2); font-variant-numeric: tabular-nums; }
.dim-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--bg3); overflow: hidden; }
.dim-bar i { display: block; height: 100%; border-radius: 4px; background: var(--lav); }
.claims li { padding: 10px 12px; border-left: 2px solid var(--line-2); background: rgba(255, 255, 255, 0.02); border-radius: 0 10px 10px 0; }
.claims .is-supported { border-left-color: var(--lav); }
.claims .is-partial { border-left-color: var(--gold); }
.claims .is-unsupported, .claims .is-contradicted { border-left-color: #ff5c75; }
.claim-text { display: block; font-size: 15px; }
.claim-verdict { display: block; margin-top: 3px; color: var(--text-2); font-size: 13px; }
.score-foot { margin: 22px 0 0; font-size: 14.5px; }
.score-foot a { color: var(--lav); text-underline-offset: 3px; }

@keyframes flash { 0%, 40% { background: rgba(245, 197, 66, 0.07); } 100% { background: transparent; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

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