/* AITH Speaking Club
   Thesis: every meeting becomes a colourful conversation you can keep.
   - Warm paper surfaces (light) / warm cocoa (dark) instead of neutral white/black.
   - AITH orange = actions only. Voice colours = people and word types (always with a text label).
   - Signature: speech-bubble shapes (one sharp corner) for tiles, avatars and cards.
   Contrast (WCAG, computed): ink-2 on bg 6.3:1 light / 8.8:1 dark; ink on any voice colour >= 7.2:1;
   ink-2 on any tint >= 5.4:1 light / 6.1:1 dark; white on button 4.4:1 (bold 17px). */

:root {
  --bg: #fff8f1;
  --card: #ffffff;
  --line: #f0e3d6;
  --ink: #21160f;
  --ink-2: #6a5a4e;
  --action: #d9440b;         /* filled buttons (white text) */
  --action-hover: #bf3a08;
  --action-text: #c2410c;    /* links and text-buttons */
  --brand: #fa5416;          /* logo, focus ring */

  /* Voice palette: strong = avatars, bars, dots; tint = card backgrounds */
  --yellow: #ffc23d;  --yellow-t: #fff1cc;
  --blue:   #5aa9ff;  --blue-t:   #ddeeff;
  --mint:   #32c98e;  --mint-t:   #d6f5e8;
  --lilac:  #b096ff;  --lilac-t:  #ece5ff;
  --pink:   #ff7db8;  --pink-t:   #ffe0ee;
  --orange: #ff8a3d;  --orange-t: #ffe6d6;

  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bubble: 22px 22px 22px 6px;   /* speech bubble, tail bottom-left */
  --bubble-r: 22px 22px 6px 22px; /* tail bottom-right */
  --r: 18px;
  --page: 780px;
  --shadow: 0 1px 0 rgba(33, 22, 15, .04), 0 8px 24px -12px rgba(33, 22, 15, .18);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1310;
    --card: #251c17;
    --line: #3a2d25;
    --ink: #fbf1e8;
    --ink-2: #c2b1a4;
    --action-text: #ff8a5c;
    --yellow-t: #3a2f14; --blue-t: #16304a; --mint-t: #123a2c;
    --lilac-t: #2c2547; --pink-t: #43202f; --orange-t: #43291a;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 28px -14px rgba(0,0,0,.6);
  }
}
@media (prefers-contrast: more) {
  :root { --line: var(--ink-2); --ink-2: var(--ink); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-body); -webkit-font-smoothing: antialiased;
}
svg { display: block; flex: none; }
.icon .duo { fill: currentColor; fill-opacity: .2; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--action-text); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 8px; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.125rem, 1.4rem + 3vw, 3.25rem); line-height: 1.04; font-weight: 800; }
h2 { font-size: 1.5rem; line-height: 1.15; font-weight: 750; }
h3 { font-size: 1.1875rem; line-height: 1.25; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9375rem; }
.kicker { font: 650 0.9375rem/1.3 var(--font-body); color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 20px; }
.stack > * + * { margin-top: var(--gap, 16px); }
section.block { padding: 36px 0; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.section-head .aside { margin-left: auto; font-size: .9375rem; color: var(--ink-2); }

/* Riso stickers: flat colour slightly off-register under a wobbly ink line */
.sticker { color: var(--ink); flex: none; overflow: visible; }
.section-head .sticker { margin: -6px 0 -6px -4px; }
.fact .sticker { margin: -4px 0; }

/* Speech-bubble tile holding an icon */
.tile {
  width: 44px; height: 44px; border-radius: 14px 14px 14px 4px;
  display: grid; place-items: center; color: var(--ink); flex: none;
}
.tone-yellow { background: var(--yellow); } .tone-blue { background: var(--blue); }
.tone-mint { background: var(--mint); }     .tone-lilac { background: var(--lilac); }
.tone-pink { background: var(--pink); }     .tone-orange { background: var(--orange); }
.tile .icon { color: #21160f; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
@media (prefers-reduced-transparency: reduce) { .topbar { background: var(--bg); backdrop-filter: none; } }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font: 800 1.125rem/1 var(--font-display); letter-spacing: -0.02em; }
.brand-sub { display: block; font-size: .8125rem; color: var(--ink-2); margin-top: 3px; }
.brand:hover .typing { animation: typing 1s ease-in-out infinite; }
.brand:hover .typing:nth-of-type(2) { animation-delay: .15s; }
.brand:hover .typing:nth-of-type(3) { animation-delay: .3s; }
@keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  min-height: 46px; padding: 0 20px; border-radius: 999px;
  font: 650 1.0625rem/1 var(--font-body);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .15s, transform .12s, box-shadow .15s;
}
.btn .icon { width: 20px; height: 20px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--action); color: #fff; box-shadow: 0 6px 16px -8px rgba(217, 68, 11, .7); }
.btn-primary:hover { background: var(--action-hover); color: #fff; }
.btn-secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-secondary:hover { box-shadow: inset 0 0 0 1.5px var(--ink-2); color: var(--ink); }
.btn-plain { background: none; color: var(--action-text); padding: 0 6px; }
.btn-plain:hover { text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Hero (home) ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: center; padding: 44px 0 28px; }
.hero .lede { font-size: 1.1875rem; color: var(--ink-2); margin-top: 18px; }
.hero .btn-row { margin-top: 26px; }
.bubbles { position: relative; height: 260px; }
.bubble {
  position: absolute; padding: 12px 18px; border-radius: var(--bubble);
  font: 750 1.25rem/1.1 var(--font-display); color: #21160f; box-shadow: var(--shadow);
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.bubble.r { border-radius: var(--bubble-r); }
.bubble small { display: block; font: 500 .8125rem/1.3 var(--font-body); opacity: .75; margin-top: 4px; }
@keyframes pop { from { transform: translateY(8px) scale(.9); } } /* no opacity: content stays visible even if animations never run */

/* ---------- Avatars and talk share ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 14px 14px 14px 4px; display: inline-grid; place-items: center;
  font: 800 .9375rem/1 var(--font-display); color: #21160f; flex: none;
}
.people { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 24px; }
.person-chip { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.person-chip .pct { font-weight: 500; color: var(--ink-2); font-size: .9375rem; }
.talkbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 3px; margin-top: 18px; }
.talkbar span { min-width: 6px; }
.talkbar span:first-child { border-radius: 999px 0 0 999px; }
.talkbar span:last-child { border-radius: 0 999px 999px 0; }

/* ---------- Meeting list ---------- */
.meeting-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.meeting-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  padding: 18px 20px; text-decoration: none; background: var(--card);
  border-radius: var(--bubble); box-shadow: var(--shadow); transition: transform .15s;
}
.meeting-row:hover { transform: translateY(-2px); color: inherit; }
.meeting-row:hover .meeting-title { color: var(--action-text); }
.date-badge { width: 56px; text-align: center; border-radius: 14px; padding: 8px 0; background: var(--orange-t); }
.date-badge b { display: block; font: 800 1.375rem/1 var(--font-display); }
.date-badge span { font-size: .75rem; font-weight: 650; text-transform: uppercase; color: var(--ink-2); }
.meeting-title { font: 700 1.1875rem/1.25 var(--font-display); letter-spacing: -0.01em; }
.stack-av { display: flex; }
.stack-av .avatar { width: 30px; height: 30px; font-size: .75rem; border: 2px solid var(--card); margin-left: -8px; border-radius: 10px 10px 10px 3px; }
.go { color: var(--ink-2); }

.empty { text-align: center; padding: 44px 20px; border-radius: var(--bubble); background: var(--card); box-shadow: var(--shadow); }
.empty .sticker { margin: 0 auto 4px; }

/* ---------- Report ---------- */
.report-head { padding: 44px 0 12px; }
.report-head h1 { margin-top: 14px; }
.lede { font-size: 1.1875rem; line-height: 1.55; margin-top: 18px; }

.card { background: var(--card); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.summary-bubble { background: var(--card); border-radius: var(--bubble); padding: 22px 24px; box-shadow: var(--shadow); margin-top: 22px; font-size: 1.125rem; }

ul.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
ul.points li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
ul.points .avatar { width: 28px; height: 28px; font-size: .75rem; border-radius: 10px 10px 10px 3px; margin-top: 1px; }
.bullet { width: 10px; height: 10px; margin: .5em 9px 0; border-radius: 4px 4px 4px 1px; background: var(--orange); }

/* Signature: flashcards */
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.word {
  border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 8px;
  transform: rotate(var(--tilt, 0deg)); transition: transform .2s;
}
.word:hover { transform: rotate(0) translateY(-3px); }
.word-term { font: 750 1.25rem/1.2 var(--font-display); letter-spacing: -0.01em; }
.word-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 650; padding: 4px 9px; border-radius: 999px; background: var(--card); }
.tag i { width: 8px; height: 8px; border-radius: 3px; }
.word-example { font-style: italic; color: var(--ink-2); font-size: .9375rem; margin-top: auto; padding-top: 6px; }

.phrases { display: grid; gap: 10px; }
.phrase { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 14px 18px; border-radius: var(--bubble); background: var(--card); box-shadow: var(--shadow); }
.phrase:nth-child(even) { border-radius: var(--bubble-r); }
.phrase b { font-weight: 650; }

.material { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 16px 0; border-top: 1.5px dashed var(--line); }
.material:first-child { border-top: 0; padding-top: 0; }
.material { grid-template-columns: 92px 1fr; }
.kind { justify-self: start; font-size: .8125rem; font-weight: 650; text-transform: capitalize; padding: 3px 10px; border-radius: 999px; background: var(--lilac-t); }

.topics { display: grid; gap: 14px; }
.topic { border-radius: var(--bubble); padding: 22px; }
.topic:nth-child(3n+1) { background: var(--yellow-t); }
.topic:nth-child(3n+2) { background: var(--lilac-t); }
.topic:nth-child(3n+3) { background: var(--mint-t); }
.topic p { margin-top: 6px; }
.topic ol { margin: 14px 0 0; padding-left: 22px; }
.topic ol li + li { margin-top: 4px; }
.topic ol li::marker { font-weight: 700; }

.fact { display: flex; gap: 16px; align-items: center; background: var(--pink-t); border-radius: var(--bubble); padding: 20px 22px; }

/* Language notes (host only) */
.private-note { display: flex; gap: 10px; align-items: center; font-size: .9375rem; color: var(--ink-2); margin-bottom: 16px; }
.private-note .icon { width: 20px; height: 20px; }
details.person { padding: 0; overflow: hidden; }
details.person + details.person { margin-top: 12px; }
details.person > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 20px; min-height: 56px; }
details.person > summary::-webkit-details-marker { display: none; }
details.person > summary::after { content: "+"; margin-left: auto; font: 500 1.5rem/1 var(--font-body); color: var(--ink-2); }
details.person[open] > summary::after { content: "−"; }
.person-body { padding: 0 20px 20px; }
.fix { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--bg); }
.fix + .fix { margin-top: 8px; }
.fix-said { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--pink); text-decoration-thickness: 2px; }
.fix-better { font-weight: 650; }
.fix-better::before { content: "→ "; color: var(--mint); font-weight: 800; }
.fix-why { font-size: .9375rem; color: var(--ink-2); }
.label { font-weight: 700; font-size: .9375rem; margin: 16px 0 8px; }

/* Transcript */
.turn { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 10px 0; }
.turn .avatar { width: 30px; height: 30px; font-size: .75rem; border-radius: 10px 10px 10px 3px; }
.turn-who { font-weight: 650; font-size: .9375rem; }

/* Share bar */
.sharebar {
  position: sticky; bottom: 0; z-index: 5; padding: 12px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
@media (prefers-reduced-transparency: reduce) { .sharebar { background: var(--bg); backdrop-filter: none; } }
.sharebar .wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.check { display: flex; gap: 8px; align-items: center; min-height: 44px; font-size: .9375rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--action); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; font-size: .9375rem; }
.field .hint { font-size: .875rem; color: var(--ink-2); }
input[type=text], input[type=date], input[type=password], textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink); font: 400 1.0625rem/1.4 var(--font-body);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-card { background: var(--card); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); }

.segmented { display: inline-grid; grid-auto-flow: column; background: var(--bg); border-radius: 999px; padding: 4px; box-shadow: inset 0 0 0 1.5px var(--line); }
.segmented button {
  appearance: none; border: 0; background: none; color: var(--ink-2); cursor: pointer;
  min-height: 38px; padding: 0 16px; border-radius: 999px; font: 650 .9375rem/1 var(--font-body);
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button .icon { width: 18px; height: 18px; }
.segmented button[aria-selected=true] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.drop {
  position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 32px 20px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--bubble); background: var(--bg); transition: border-color .15s, background-color .15s;
}
.drop .sticker { margin-bottom: 4px; transition: transform .2s; }
.drop:hover .sticker { transform: rotate(-6deg); }
.drop.over, .drop:hover { border-color: var(--brand); background: var(--orange-t); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 28px; }
.steps li { flex: 1; font-size: .875rem; font-weight: 650; color: var(--ink-2); }
.steps li::before { content: ""; display: block; height: 6px; border-radius: 999px; background: var(--line); margin-bottom: 8px; }
.steps li[aria-current=step] { color: var(--ink); }
.steps li[aria-current=step]::before { background: var(--brand); }
.steps li.done::before { background: var(--mint); }

.speaker-card { display: grid; grid-template-columns: auto 1fr 220px; gap: 16px; align-items: start; }
.speaker-card .sample { font-size: .9375rem; color: var(--ink-2); }
.speaker-card .sample p + p { margin-top: 6px; }
.speaker-card .who { font-weight: 700; color: var(--ink); margin-bottom: 6px; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--blue-t); font-size: .9375rem; }
.notice .icon { width: 20px; height: 20px; margin-top: 1px; }
.notice.error { background: var(--pink-t); }

/* Progress */
.progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.progress li { display: flex; gap: 12px; align-items: center; color: var(--ink-2); font-weight: 600; }
.progress li.active, .progress li.done { color: var(--ink); }
.dots { display: inline-flex; gap: 4px; width: 26px; justify-content: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: typing .9s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
.progress li.done .dots i { animation: none; background: var(--mint); }

/* Skeleton */
.skeleton { background: var(--line); border-radius: 10px; opacity: .6; }
.skeleton.h1 { height: 52px; width: 80%; }
.skeleton.line { height: 16px; margin-top: 12px; }

dialog { border: 0; border-radius: 24px; padding: 28px; width: min(420px, calc(100% - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(33, 22, 15, .45); }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 30;
  display: flex; gap: 8px; align-items: center;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--bubble);
  font-weight: 650; font-size: .9375rem; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}

.site-foot { padding: 32px 0 56px; color: var(--ink-2); font-size: .875rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .word { transform: none; }
}

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  #new-btn { display: none; } /* the hero already has New report */
  .brand-name, .brand-sub { white-space: nowrap; }
  .bubbles { height: 190px; order: -1; }
  .bubble { font-size: 1.0625rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .speaker-card { grid-template-columns: auto 1fr; }
  .speaker-card .field { grid-column: 1 / -1; }
  .meeting-row { grid-template-columns: auto 1fr; }
  .meeting-row .stack-av, .meeting-row .go { display: none; }
  .phrase { flex-direction: column; gap: 2px; }
  .material { grid-template-columns: 1fr; gap: 6px; }
  .sharebar .check { width: 100%; }
}

/* Mobile: keep the share bar to one row and the header button on one line */
@media (max-width: 640px) {
  .topbar .btn { white-space: nowrap; padding: 0 14px; }
  .brand-sub { display: none; }
  .sharebar { padding: 10px 0; }
  .sharebar .btn-row { width: 100%; flex-wrap: nowrap; margin-left: 0 !important; }
  .sharebar .btn { flex: 1; padding: 0 12px; font-size: 1rem; }
}
