/* ─────────────────────────────────────────────────────────
   TimeToTalk — Conversation Cards
   Colours are tokens. Each card type sets its own surface
   tokens (--bg, --fg, --btn-bg, ...) on .card--<type>.
   Every text/background pair passes WCAG 4.5:1.
   ───────────────────────────────────────────────────────── */

:root {
  /* Brand */
  --navy: #1E2979;
  --navy-deep: #0B0F3A;
  --pink: #F0176E;
  --pink-deep: #D0105C;   /* white text 5.4:1 */
  --blue: #4485F2;
  --blue-deep: #2F5FD0;   /* white text 5.7:1 */
  --blue-tint: #EAF0FE;   /* navy text 11.2:1 */
  --orange: #F26522;
  --orange-deep: #C2410C; /* white text 5.2:1 */
  --orange-ink: #9A3412;  /* on orange tint 6.6:1 */
  --orange-tint: #FFF1E8; /* navy text 11.5:1 */
  --ink: #121212;
  --ink-text: #EDEDED;    /* on ink 16:1 */
  --ink-muted: #A8A8A8;   /* on ink 7.9:1 */
  --white: #FFFFFF;
  --grey-text: #5A5F7A;   /* on white 6.3:1 */
  --placeholder-bg: #F4F4F4;
  --placeholder-line: #C9C9C9;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-btn: 10px;
  --gutter: 24px;
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: #E7E4DD;
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── Card shell ─────────────────────────────────────────── */

.card {
  /* Defaults; each type overrides. */
  --bg: var(--white);
  --fg: var(--navy);
  --muted: var(--grey-text);
  --head-bg: transparent;
  --head-fg: var(--fg);
  --body-bg: transparent;
  --foot-bg: var(--bg);
  --rule: var(--white);
  --btn-bg: var(--pink-deep);
  --btn-fg: var(--white);
  --back-bg: var(--white);
  --back-fg: var(--navy);
  --back-border: transparent;
  --pill-bg: var(--navy-deep);
  --pill-fg: var(--white);

  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

.card__head {
  flex: none;
  background: var(--head-bg);
  color: var(--head-fg);
  padding: 28px var(--gutter) 20px;
  text-align: center;
}
.card__head--counted {
  display: flex;
  align-items: baseline;
  gap: 14px;
  text-align: left;
}
.card__count {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: .9;
}
.card__title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}

.card__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px var(--gutter) 24px;
  background: var(--body-bg);
}

.card__foot {
  flex: none;
  background: var(--foot-bg);
  border-top: 5px solid var(--rule);
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
}

/* ── Buttons ────────────────────────────────────────────── */

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-stack { display: grid; gap: 12px; }

.btn {
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  border: 2px solid transparent;
  font: 700 16px/1 var(--font);
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.btn[disabled] { opacity: .4; cursor: default; }
.btn--block { width: 100%; }
.btn--primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn--back {
  background: var(--back-bg);
  color: var(--back-fg);
  border-color: var(--back-border);
  font-weight: 600;
}

/* ── Media (image slot) ─────────────────────────────────── */

.media {
  flex: none;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: var(--media-bg, transparent);
}
.media img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Illustrations are transparent; dark cards give them a light panel so
   dark shapes (phones, hair) don't vanish into the background. */
.card--issue, .card--sorting { --media-bg: #F6F3EE; }
.media--collage {
  display: flex; align-items: flex-end; justify-content: center; gap: 4%;
  padding: 4px 0;
}
.media--collage img {
  flex: 0 1 auto; min-width: 0;
  width: auto; object-fit: contain; object-position: bottom;
}
.card--issue .media--collage, .card--sorting .media--collage { padding: 12px; }
.card--issue .media--collage img { padding: 0; }
.card--issue .media:not(.media--empty) img,
.card--sorting .media:not(.media--empty) img { padding: 12px; }
.media--empty {
  background: var(--placeholder-bg);
  border: 1.5px dashed var(--placeholder-line);
}
.media__x { width: 100%; height: 100%; display: block; }
.media__x line { stroke: var(--placeholder-line); stroke-width: .6; vector-effect: non-scaling-stroke; }
.media--wide  { aspect-ratio: 2 / 1; }
/* On short screens the image gives up height before the text has to scroll. */
.card__body > .media--wide,
.card__body > .media--cover { flex: 0 1 auto; min-height: 96px; }
.media--cover { aspect-ratio: 4 / 3; }
.media--tall  { aspect-ratio: 3 / 4; max-height: 100%; }

/* ── Shared text blocks ─────────────────────────────────── */

.prompt__text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-wrap: pretty;
}
.prompt__sub {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  color: var(--muted);
}

.prompt__text--long { font-size: 18px; }

.prompt__steps {
  list-style: none;
  counter-reset: step;
  display: flex; flex-direction: column; gap: 14px;
}
.prompt__steps li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  font-size: 17px; font-weight: 700; line-height: 1.45;
}
.prompt__steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--head-bg, var(--navy)); color: var(--head-fg, var(--white));
  font-size: 15px; font-weight: 700;
}

.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: -6px; }
.chips li {
  background: var(--white);
  color: var(--navy);
  border: 1px solid rgba(30, 41, 121, .18);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px; font-weight: 500;
}

.optional {
  border: 1.5px dashed var(--muted);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px; line-height: 1.45;
}
.optional__label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}

.timer {
  margin-top: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
}
.timer__icon { font-size: 30px; line-height: 1; }
.timer__pill {
  background: var(--pill-bg);
  color: var(--pill-fg);
  font-size: 17px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}

/* ── Brand blocks (cover, closing) ──────────────────────── */

.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 16px; }
.brand__row { display: flex; align-items: center; justify-content: center; gap: 24px; }
.logo { height: 26px; }
.logo[src*="kok-bisa"] { height: 32px; } /* square badge reads small next to wordmarks */
.logo--text { font-size: 15px; font-weight: 700; color: var(--ink); height: auto; }
.brand-logo { height: 28px; }
.brand-logo--text { font-size: 17px; font-weight: 800; color: var(--pink); height: auto; }

/* ── 01 Cover ───────────────────────────────────────────── */

.card--cover { --foot-bg: var(--navy); --rule: var(--pink); }
.card--cover .card__body { justify-content: space-between; }
.cover__text { text-align: center; padding-bottom: 8px; }

/* Scene: portrait stage (3:4) that fits the free space; items are
   placed in % of it (x, w: of width; y: of height). */
.scene {
  flex: 1 1 auto;
  min-height: 220px;
  position: relative;
  container-type: size;
}
.scene__stage {
  position: absolute;
  left: 50%; top: 50%;
  width: min(100cqw, 75cqh);
  aspect-ratio: 3 / 4;
  transform: translate(-50%, -50%);
}
.scene__item {
  position: absolute;
  height: auto;
  transform: translateX(-50%) rotate(var(--rotate, 0deg));
  transform-origin: 50% 100%;
}
.scene__shape, .scene__dot { position: absolute; border-radius: 50%; }
.scene__shape--main   { left: 4%;  top: 10%; width: 92%; aspect-ratio: 1; background: var(--blue-tint); }
.scene__shape--pink   { right: -4%; top: 1%;  width: 32%; aspect-ratio: 1; background: #FFE3EE; }
.scene__shape--orange { left: -4%; bottom: 24%; width: 20%; aspect-ratio: 1; background: var(--orange-tint); }
.scene__dot { width: 3.2%; aspect-ratio: 1; }
.scene__dot--1 { left: 48%; top: 4%;  background: var(--pink); }
.scene__dot--2 { left: 3%;  top: 38%; background: var(--blue); }
.scene__dot--3 { right: 8%; top: 52%; background: var(--orange); width: 2.4%; }
@media (prefers-reduced-motion: no-preference) {
  .card--cover .scene__item { animation: float-in .6s cubic-bezier(.2,.8,.2,1) both; }
  .card--cover .scene__item:nth-of-type(2) { animation-delay: .06s; }
  .card--cover .scene__item:nth-of-type(3) { animation-delay: .12s; }
  .card--cover .scene__item:nth-of-type(4) { animation-delay: .18s; }
  .card--cover .scene__item:nth-of-type(5) { animation-delay: .24s; }
  .card--cover .scene__item:nth-of-type(6) { animation-delay: .30s; }
}
@keyframes float-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12%) rotate(var(--rotate, 0deg)); }
}
.cover__title { font-size: 30px; font-weight: 800; color: var(--pink); line-height: 1.15; text-wrap: balance; }
.cover__subtitle { margin-top: 8px; font-size: 14px; color: var(--grey-text); }
.card--cover .btn--primary { font-size: 18px; }

/* ── 02 Instruction ─────────────────────────────────────── */

.card--instruction { --bg: var(--navy); --fg: var(--white); }
.card--instruction .card__body { justify-content: center; }
.instruction__heading { font-size: 22px; font-weight: 700; }
.instruction__list { list-style: none; display: flex; flex-direction: column; gap: 22px; }
.instruction__list li {
  position: relative;
  padding-left: 22px;
  font-size: 17px;
  line-height: 1.45;
}
.instruction__list li::before {
  content: '';
  position: absolute; left: 2px; top: .5em;
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}

/* ── 04 Issue ───────────────────────────────────────────── */

.card--issue { --bg: var(--ink); --fg: var(--ink-text); --muted: var(--ink-muted); --btn-bg: var(--blue-deep); --pill-bg: #33343F; }
.stat {
  display: flex; flex-direction: column; align-items: center;
  background: var(--pink-deep);
  color: var(--white);
  border-radius: 6px;
  padding: 14px 16px 16px;
  text-align: center;
}
.stat__value { font-size: 44px; font-weight: 800; line-height: 1; }
.stat__label { margin-top: 6px; font-size: 14px; font-weight: 600; }
.issue__lead { font-size: 15px; line-height: 1.5; text-align: center; color: var(--muted); }
.issue__body { font-size: 18px; font-weight: 700; line-height: 1.4; text-align: center; }
.issue__source { font-size: 12px; text-align: center; color: var(--muted); margin-top: -8px; }

/* ── 06 Card Sorting ────────────────────────────────────── */

.card--sorting { --bg: var(--pink); --fg: var(--white); --btn-bg: var(--navy); --rule: rgba(255,255,255,.6); }
.sorting__panel {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--navy-deep);
  border-radius: 0 0 28px 28px;
}
.card--sorting .card__body { align-items: center; }
.card--sorting .media--tall { width: auto; height: 100%; max-width: 100%; min-height: 0; flex: 1; }
.sorting__name { font-size: 20px; font-weight: 700; }

/* ── 07 Closing ─────────────────────────────────────────── */

.card--closing { --foot-bg: var(--navy); --rule: var(--pink); }
.card--closing .card__body { align-items: stretch; text-align: center; gap: 16px; }
.closing__title { font-size: 26px; font-weight: 800; color: var(--pink-deep); }
.closing__body { font-size: 17px; line-height: 1.45; color: var(--navy); }

/* ── 03 Prompt / 05 Action ──────────────────────────────
   Brand colour on the header and accents; the body is a light
   tint with navy text so long prompts stay easy to read. */

.card--prompt {
  --bg: var(--blue-tint); --fg: var(--navy); --muted: var(--blue-deep);
  --head-bg: var(--blue-deep); --head-fg: var(--white);
  --rule: var(--blue-deep);
  --btn-bg: var(--navy); --back-bg: var(--white); --back-border: var(--navy);
  --pill-bg: var(--navy);
}
.card--action {
  --bg: var(--orange-tint); --fg: var(--navy); --muted: var(--orange-ink);
  --head-bg: var(--orange-deep); --head-fg: var(--white);
  --rule: var(--orange-deep);
  --btn-bg: var(--navy); --back-bg: var(--white); --back-border: var(--navy);
  --pill-bg: var(--navy);
}

/* ── App frame (index.html) ─────────────────────────────── */

.stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  touch-action: pan-y;
}
@media (min-width: 600px) {
  body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }
  .stage {
    width: 400px;
    height: min(860px, calc(100dvh - 48px));
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(20, 20, 50, .18);
  }
}

.stage > .card { position: absolute; inset: 0; }
.card.is-entering-next { animation: in-next .28s cubic-bezier(.2,.8,.2,1) both; }
.card.is-entering-prev { animation: in-prev .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes in-next { from { transform: translateX(24%); opacity: 0; } }
@keyframes in-prev { from { transform: translateX(-24%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .card.is-entering-next, .card.is-entering-prev { animation: none; }
}

.load-error { padding: 32px; text-align: center; color: var(--navy); }
