/* ==========================================================================
   F*ck the Small Talk: the host application theme.
   A table (dark, sky or periwinkle), white conversation cards dealt one at a
   time, and the yellow hand-drawn circle from the FTST site. Re-skins public/engine/flow.css.
   ========================================================================== */

/* ---------- Fonts (self-hosted, OFL) ---------- */
@font-face { font-family: 'Fraunces'; src: url(/fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(/fonts/fraunces-italic.woff2) format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url(/fonts/newsreader.woff2) format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url(/fonts/newsreader-italic.woff2) format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url(/fonts/courier-prime.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url(/fonts/courier-prime-bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url(/fonts/caveat.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --paper: #ffffff;
  --paper-2: #eef0f2;
  --paper-3: #dde1e5;
  --paper-4: #ccd2d8;
  --ink: #141414;
  --ink-2: #4b4d52;
  --yellow: #ffcf3f;
  --sky: #dff0f5;
  --periwinkle: #8ea5f5;
  --pink: #ffc4dc;

  --card-bg: var(--paper);
  --card-ink: var(--ink);
  --card-muted: var(--ink-2);
  --field-bg: var(--paper);
  --field-ink: var(--ink);
  --field-placeholder: rgba(20, 20, 20, .36);
  --option-on-bg: var(--yellow);
  --option-on-ink: var(--ink);
  --accent: var(--yellow);
  --accent-ink: var(--ink);
  --focus: var(--periwinkle);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --font-mono: 'Courier Prime', 'Courier New', ui-monospace, monospace;
  --font-hand: 'Caveat', 'Bradley Hand', cursive;
  --radius: 14px;
  --radius-big: 22px;
}

/* ---------- The table: pick one with the body class (see TABLE in src/index.tsx) ---------- */
/* --chalk is "text on the table", --hand-ink the handwriting, --pop-ink small emphasis. */
body.table-dark {
  --table: #141414;
  --table-glow: #262626;
  --chalk: #f6f3ea;
  --chalk-2: rgba(246, 243, 234, .66);
  --hand-ink: var(--yellow);
  --pop-ink: var(--yellow);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 24px 50px -22px rgba(0, 0, 0, .9);
  --field-line: transparent;
  --option-bg: rgba(246, 243, 234, .06);
  --danger: #ff6b57;
}
body.table-sky {
  --table: #d7eaf2;
  --table-glow: #eef7fa;
  --chalk: #141414;
  --chalk-2: rgba(20, 20, 20, .64);
  --hand-ink: #2d46c8;
  --pop-ink: #2d46c8;
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 22px 44px -26px rgba(22, 52, 92, .5);
  --field-line: rgba(20, 20, 20, .1);
  --option-bg: rgba(255, 255, 255, .6);
  --danger: #d23a26;
}
body.table-blue {
  --table: #8ea5f5;
  --table-glow: #a9bbf8;
  --chalk: #141414;
  --chalk-2: rgba(20, 20, 20, .7);
  --hand-ink: #141414;
  --pop-ink: #141414;
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 24px 46px -24px rgba(20, 30, 90, .55);
  --field-line: rgba(20, 20, 20, .08);
  --option-bg: rgba(255, 255, 255, .42);
  --danger: #b4231a;
}
body[class*='table-'] {
  --flow-bg: var(--table);
  --flow-ink: var(--chalk);
  --flow-muted: var(--chalk-2);
  --flow-line: color-mix(in srgb, var(--chalk) 16%, transparent);
  --option-ink: var(--chalk);
  --option-line: color-mix(in srgb, var(--chalk) 24%, transparent);
}

body.apply {
  background:
    radial-gradient(110% 70% at 50% -10%, var(--table-glow) 0%, transparent 60%),
    var(--table);
  background-attachment: fixed;
}
.q, .q--huge, .btn, .mode-title, .options--stack .option-face, .field--big input, .answer-card textarea, .scale-opt span {
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
}
.q { font-weight: 800; letter-spacing: -.02em; }
::selection { background: var(--yellow); color: var(--ink); }

/* ---------- Top bar ---------- */
.ftst-mark {
  display: inline-flex; flex-direction: column; text-decoration: none; color: var(--chalk);
  font: 900 .82rem/.92 var(--font-display); text-transform: uppercase; letter-spacing: .02em;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  padding: .35rem .6rem .3rem; border: 2px solid var(--chalk); border-radius: 8px; transform: rotate(-3deg);
  transition: transform .25s var(--ease-pop);
}
.ftst-mark:hover { transform: rotate(0) scale(1.04); }
.flow-progress-part.is-current { background: color-mix(in srgb, var(--chalk) 26%, transparent); }
.flow-status-time { color: var(--chalk); }

/* ---------- The card deck ---------- */
.step:not(.step--intro):not(.step--sending):not(.step--done) .q-card,
.q-card--cover, .q-card--done, .plain-page .q-card {
  background: var(--paper); color: var(--ink);
  border-radius: var(--radius-big);
  padding: 1.3rem 1.3rem 2.6rem;
  min-height: 190px;
  rotate: var(--tilt, -1deg);
  /* The cards still to come peek out underneath. */
  box-shadow: var(--deck, none), var(--card-shadow);
}
.step:nth-of-type(even) { --tilt: .9deg; }
.step:nth-of-type(odd) { --tilt: -1.1deg; }
.flow[data-cards-left='1'] { --deck: 5px 7px 0 -1px var(--paper-2); }
.flow[data-cards-left='2'] { --deck: 5px 7px 0 -1px var(--paper-2), 10px 14px 0 -2px var(--paper-3); }
.flow[data-cards-left='3'] { --deck: 5px 7px 0 -1px var(--paper-2), 10px 14px 0 -2px var(--paper-3), 15px 21px 0 -3px var(--paper-4); }
.q-card .q-kicker { color: var(--ink-2); }
.q-card .q-help { color: var(--ink-2); font-size: 1.1rem; }
.q-card .q { margin-bottom: .45em; }
.q-card .q:last-child, .q-card .q:has(+ .q-card-num) { margin-bottom: 0; }
.q-card-num { right: 1.3rem; bottom: 1rem; color: var(--ink-2); }
/* The little brand line every real FTST card has. */
.step:not(.step--intro):not(.step--sending):not(.step--done) .q-card::after {
  content: 'F*ck the Small Talk™'; position: absolute; left: 1.3rem; bottom: 1rem;
  font: 700 .66rem var(--font-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); opacity: .7;
}

/* The yellow circle, drawn around the words that matter. */
.hl {
  font-style: normal;
  padding: .05em .28em .1em; margin: 0 -.12em;
  background: url(/img/circle.svg) center / 100% 100% no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------- Dealing the cards ---------- */
.step.is-entering { animation: none; }
.step.is-entering .q-card { animation: deal .55s var(--ease-out) both; }
.step.is-entering .q-answers, .step.is-entering .intro-facts, .step.is-entering .intro-parts { animation: rise .45s .12s var(--ease-out) both; }
.step.is-entering .intro-photo { animation: deal .6s .08s var(--ease-out) both; }
.step.is-entering.from-back .q-card { animation-name: undeal; }
.step.is-leaving { animation: none; }
.step.is-leaving .q-card { animation: toss .42s cubic-bezier(.5, 0, .75, 0) both; }
.step.is-leaving.to-back .q-card { animation-name: back-to-deck; }
.step.is-leaving .q-answers, .step.is-leaving .intro-facts, .step.is-leaving .intro-parts, .step.is-leaving .intro-photo { animation: fade-out .2s ease both; }
@keyframes deal {
  from { opacity: 0; transform: translate(14px, 26px) rotate(5deg) scale(.95); }
  to { opacity: 1; transform: none; }
}
@keyframes undeal {
  from { opacity: 0; transform: translate(-70%, -6px) rotate(-14deg); }
  to { opacity: 1; transform: none; }
}
@keyframes toss { to { opacity: 0; transform: translate(-115%, -14px) rotate(-16deg); } }
@keyframes back-to-deck { to { opacity: 0; transform: translate(14px, 26px) rotate(5deg) scale(.95); } }
@keyframes fade-out { to { opacity: 0; } }

/* ---------- Answers on the table ---------- */
.field-label { color: var(--chalk-2); }
.field input, .field textarea { border-width: 2px; box-shadow: 0 10px 24px -16px rgba(0, 0, 0, .9); }
.field input:focus, .field textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 207, 63, .28); }
.field--big input { font-size: 1.8rem; font-weight: 800; }
.input-prefix { color: rgba(20, 20, 20, .45); }
.option-face { font-family: var(--font-body); }
.option input:checked + .option-face { transform: rotate(-1.2deg) scale(1.02); box-shadow: 0 10px 22px -12px rgba(255, 207, 63, .7); }
.options--stack .option:nth-child(2) input:checked + .option-face { --option-on-bg: var(--pink); background: var(--pink); border-color: var(--pink); }
.options--stack .option:nth-child(3) input:checked + .option-face { background: var(--sky); border-color: var(--sky); }
.options--stack .option:nth-child(4) input:checked + .option-face { background: var(--periwinkle); border-color: var(--periwinkle); }
/* "What resonates": little white cards to pick from */
.options--cards .option-face { background: var(--paper); color: var(--ink); border-color: var(--paper); box-shadow: 0 12px 24px -18px rgba(0, 0, 0, .6); }
.options--cards .option:nth-child(odd) .option-face { rotate: -.6deg; }
.options--cards .option:nth-child(even) .option-face { rotate: .7deg; }
.options--cards .option-tick { border-color: rgba(20, 20, 20, .25); }
.options--cards .option input:checked + .option-face { background: var(--yellow); border-color: var(--yellow); transform: translateY(-4px) rotate(-2deg) scale(1.03); }
.options.is-full .option input:not(:checked) + .option-face { opacity: .35; }
.picks { color: var(--chalk-2); }
.picks.is-full { color: var(--pop-ink); }

.scale-face { font-size: 3.6rem; }
.scale-opt span { font-weight: 800; }

/* The two questions they love asking: blank FTST cards */
.answer-card { position: relative; padding-bottom: 2.4rem; }
.answer-card:nth-child(1) { rotate: -1.4deg; }
.answer-card:nth-child(2) { rotate: 1.2deg; }
.answer-card::after {
  content: 'F*ck the Small Talk™'; position: absolute; left: 1.1rem; bottom: .9rem;
  font: 700 .62rem var(--font-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); opacity: .6;
}
.answer-card:focus-within { box-shadow: var(--card-shadow), 0 0 0 4px var(--yellow); rotate: 0deg; }
.answer-card textarea { font-size: 1.45rem; font-weight: 800; }

/* Record it / write it */
.mode.is-active { box-shadow: 0 10px 22px -12px rgba(255, 207, 63, .7); }
.modes-or { color: var(--chalk-2); font-size: 1.6rem; }
.recorder .rec-btn--record { background: #ff4d3d; border-color: #ff4d3d; box-shadow: 0 4px 0 #141414; }

/* Nav */
.flow-back { color: var(--chalk); border-color: color-mix(in srgb, var(--chalk) 30%, transparent); }
.flow-next { box-shadow: 0 10px 26px -12px rgba(255, 207, 63, .65); }
.is-final .flow-next { background: var(--yellow); padding-left: 1.7rem; padding-right: 1.7rem; animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 10px 34px -6px rgba(255, 207, 63, .85); } }
.step-error { color: var(--chalk); }

/* ---------- FTST extras (driven by /js/ftst.js) ---------- */
.hello-aside {
  margin: -.3rem 0 0 .2rem;
  font: 600 1.6rem/1.15 var(--font-hand); color: var(--hand-ink); rotate: -1.5deg; transform-origin: left;
  animation: rise .35s var(--ease-out) both;
}
.hello-aside small { font-size: 1.25rem; color: var(--chalk-2); white-space: nowrap; }

.city-check { display: grid; gap: .7rem; }
.city-result {
  display: grid; gap: .45rem; justify-items: start;
  padding: 1rem 1.1rem; border-radius: var(--radius); border: 1.5px dashed color-mix(in srgb, var(--chalk) 28%, transparent);
  animation: rise .35s var(--ease-out) both;
}
.city-result p { margin: 0; color: var(--chalk); font-size: 1.05rem; }
.city-result--hint p { color: var(--chalk-2); }
.city-stamp {
  display: inline-block; padding: .35rem .7rem; border-radius: 6px; rotate: -3deg;
  font: 700 .78rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .1em;
  background: var(--yellow); color: var(--ink);
  animation: slam .45s var(--ease-pop) both;
}
.city-result--active .city-stamp { background: var(--sky); }
.city-result--looking .city-stamp { background: var(--periwinkle); }
@keyframes slam { 0% { opacity: 0; transform: scale(2) rotate(-14deg); } 70% { opacity: 1; transform: scale(.95); } 100% { transform: none; } }
.city-list summary { cursor: pointer; font: 700 .78rem var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--chalk-2); width: fit-content; }
.city-list summary:hover { color: var(--chalk); }
.city-list dl { margin: .8rem 0 0; display: grid; gap: .6rem; font-size: .98rem; }
.city-list dt { font: 700 .72rem var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--chalk-2); }
.city-list dd { margin: 0; color: var(--chalk); }

/* ---------- Intro ---------- */
.intro { display: grid; gap: 1.6rem; }
.q-card--cover { padding: 1.5rem 1.4rem 1.4rem; rotate: -1.4deg; --deck: 6px 8px 0 -1px var(--paper-2), 12px 16px 0 -2px var(--paper-3), 18px 24px 0 -3px var(--paper-4); }
.q-card--cover .q-kicker { color: var(--ink-2); }
.q-card--cover .q { margin-bottom: .55em; }
.intro-text { font-size: 1.15rem; color: var(--ink-2); margin-bottom: .9rem; }
/* A real FTST moment, as a photo print on the table. */
.intro-photo {
  margin: -.4rem 0 0; justify-self: center; width: min(100%, 520px);
  padding: .55rem .55rem 0; background: var(--paper); border-radius: 12px;
  box-shadow: var(--card-shadow); rotate: 2deg;
}
.intro-photo img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; }
.intro-photo figcaption { padding: .5rem .3rem .6rem; text-align: center; font: 600 1.35rem/1 var(--font-hand); color: var(--ink); }
.intro-sign { margin: 0; font: 600 1.5rem/1 var(--font-hand); color: var(--ink); }
.intro-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.intro-facts li {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 99px;
  border: 1.5px solid color-mix(in srgb, var(--chalk) 26%, transparent); font: 700 .78rem var(--font-mono); text-transform: uppercase; letter-spacing: .06em;
}
.intro-facts li:first-child { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
/* The five parts, fanned out like a hand of cards. */
.intro-parts { list-style: none; margin: .4rem 0 0; padding: 0 0 .6rem; display: flex; justify-content: center; }
.intro-parts li {
  --off: calc(var(--i) - 2);
  flex: none; width: 76px; height: 104px; margin: 0 -9px; padding: .5rem .45rem;
  display: grid; grid-template-rows: auto 1fr auto; justify-items: center; text-align: center;
  background: var(--paper); color: var(--ink); border-radius: 10px;
  box-shadow: 0 14px 22px -14px rgba(0, 0, 0, .95);
  transform: rotate(calc(var(--off) * 7deg)) translateY(calc(abs(var(--off)) * 7px));
  transition: transform .3s var(--ease-pop);
}
.intro-parts li:hover { transform: rotate(0) translateY(-10px); z-index: 2; }
.intro-part-num { font: 700 .66rem var(--font-mono); color: var(--ink-2); }
.intro-part-emoji { font-size: 1.5rem; align-self: center; }
.intro-part-title { max-width: 3.3rem; font: 800 .72rem/1.1 var(--font-display); font-variation-settings: 'SOFT' 100; text-wrap: balance; }
@supports not (width: abs(1px)) {
  .intro-parts li { transform: rotate(calc(var(--off) * 7deg)); }
}

/* ---------- Done ---------- */
.step--done { padding-top: .5rem; }
.done { position: relative; display: grid; gap: 1.2rem; }
.q-card--done { padding-top: 2.2rem; --deck: none; rotate: -1deg; }
.q-card--done p { font-size: 1.12rem; color: var(--ink-2); margin: 0; }
.stamp {
  position: absolute; top: -.9rem; right: 1.1rem;
  padding: .45rem .9rem; border: 3px solid var(--ink); border-radius: 8px; background: var(--yellow);
  font: 700 .9rem var(--font-mono); text-transform: uppercase; letter-spacing: .14em; rotate: 6deg;
  animation: slam .6s .25s var(--ease-pop) both;
}
.done-burst { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.done-burst span {
  position: absolute; left: 50%; top: 18%; width: 34px; height: 46px; border-radius: 6px; background: var(--paper);
  animation: burst 1.1s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms);
}
.done-burst span:nth-child(3n) { background: var(--yellow); }
.done-burst span:nth-child(3n + 1) { background: var(--periwinkle); }
@keyframes burst {
  0% { opacity: 1; transform: translate(-50%, 0) rotate(0) scale(.4); }
  100% { opacity: 0; transform: translate(calc(-50% + (var(--i) - 3.5) * 46px), calc(-140px + (var(--i) * 13px))) rotate(calc((var(--i) - 3.5) * 40deg)) scale(1); }
}
.done > :not(.done-burst) { position: relative; z-index: 1; }
.next-title { margin: .6rem 0 0; font: 700 .78rem var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--chalk-2); }
.next-steps { list-style: none; counter-reset: next; margin: 0; padding: 0; display: grid; gap: .9rem; }
.next-steps li { counter-increment: next; position: relative; padding-left: 3rem; font-size: 1.08rem; color: var(--chalk-2); }
.next-steps li strong { color: var(--chalk); }
.next-steps li::before {
  content: counter(next); position: absolute; left: 0; top: -.1rem; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--yellow); color: var(--ink); font: 800 1rem var(--font-display);
}
.done .done-ctas { justify-content: flex-start; margin: .4rem 0 1rem; }

/* ---------- The overview: your hand of cards ---------- */
.step--review.is-entering .review-head { animation: rise .4s var(--ease-out) both; }
.step--review.is-entering .review-card { animation: deal .5s var(--ease-out) both; animation-delay: calc(var(--n, 0) * 30ms); }
.step--review.is-leaving { animation: fade-out .2s ease both; }
.review-head .q { font-size: clamp(2rem, 6vw, 3rem); }
.review-card:nth-child(3n + 1) { rotate: -.6deg; }
.review-card:nth-child(3n + 2) { rotate: .5deg; }
.review-card:nth-child(3n) { rotate: -.2deg; }
.review-card:hover { rotate: 0deg; }
.review-num::after { content: ' · F*ck the Small Talk™'; opacity: .6; }

/* ---------- Desktop ---------- */
@media (min-width: 960px) {
  .step:not(.step--intro):not(.step--sending):not(.step--done) .q-card { min-height: 300px; padding: 2rem 2.1rem 3rem; }
  .step--question .q { font-size: clamp(2rem, 2.9vw, 2.7rem); }
  .intro { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); grid-template-areas: 'card photo' 'facts parts'; column-gap: 4rem; row-gap: 2.2rem; align-items: center; }
  .intro-photo { grid-area: photo; width: 100%; margin: 0; rotate: 3deg; }
  .q-card--cover { grid-area: card; padding: 2.6rem 2.6rem 2.2rem; }
  .q-card--cover .q { font-size: clamp(2.6rem, 4.2vw, 3.6rem); }
  .intro-facts { grid-area: facts; align-items: center; align-self: start; }
  .intro-facts li { font-size: .86rem; padding: .55rem 1rem; }
  .intro-parts { grid-area: parts; justify-content: center; align-self: start; }
  .done { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'card title' 'card steps' 'card ctas'; column-gap: 4.5rem; row-gap: 1rem; align-items: start; }
  .q-card--done { grid-area: card; padding: 2.8rem 2.4rem 2.4rem; }
  .next-title { grid-area: title; margin-top: 1.4rem; }
  .next-steps { grid-area: steps; }
  .done .done-ctas { grid-area: ctas; }
}

/* ---------- 404 & errors ---------- */
.plain-page { max-width: 560px; margin: 0 auto; padding: 4rem var(--gutter); }
.plain-page .q-card { padding-bottom: 1.4rem; }
.plain-page .btn { margin-top: .6rem; }

@media (min-width: 640px) {
  .step:not(.step--intro):not(.step--sending):not(.step--done) .q-card { padding: 1.7rem 1.8rem 2.8rem; min-height: 220px; }
  .q-card--cover { padding: 2rem 2rem 1.8rem; }
  .intro-parts li { width: 92px; height: 120px; margin: 0 -6px; }
  .intro-part-title { font-size: .8rem; max-width: 3.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .is-final .flow-next { animation: none; }
}
