/* ============================================
   DESIGN TOKENS
   Change colors, fonts, and spacing here
   ============================================ */
:root {
  --color-bg: #f7f6f2;
  --color-text: #1c1b18;
  --color-text-secondary: #77746c;
  --color-border: #e4e2db;
  --color-surface: #ffffff;
  /* Accent — swappable via the dots in the top bar. Each accent carries a
     light, dark, and high-contrast value; the theme picks which applies. */
  --accent-light: #16a05c;
  --accent-dark: #2fbf74;
  --accent-access: #006636;
  --color-accent: var(--accent-light);
  --color-dot-grid: #d9d6cd;

  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --max-width: 880px;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(28, 27, 24, 0.08);
}

/* THEME MODES — data-theme on <html>: "light" | "dark" | "access";
   absent (or "system") follows the OS preference. */
:root[data-theme="dark"] {
  --color-bg: #141412;
  --color-text: #ece9e2;
  --color-text-secondary: #94918a;
  --color-border: #2b2a26;
  --color-surface: #1d1c19;
  --color-accent: var(--accent-dark);
  --color-dot-grid: #26251f;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="access"]) {
    --color-bg: #141412;
    --color-text: #ece9e2;
    --color-text-secondary: #94918a;
    --color-border: #2b2a26;
    --color-surface: #1d1c19;
    --color-accent: var(--accent-dark);
    --color-dot-grid: #26251f;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  }
}

/* ACCESSIBLE — WCAG-strength contrast, larger type, zero motion */
:root[data-theme="access"] {
  --color-bg: #ffffff;
  --color-text: #000000;
  --color-text-secondary: #333333;
  --color-border: #595959;
  --color-surface: #ffffff;
  --color-accent: var(--accent-access);
  --color-dot-grid: transparent;
  --shadow: none;
  font-size: 112.5%;
}

:root[data-theme="access"] *,
:root[data-theme="access"] *::before,
:root[data-theme="access"] *::after {
  animation: none !important;
  transition: none !important;
}

:root[data-theme="access"] body {
  background-image: none;
}

:root[data-theme="access"] :focus-visible {
  outline: 3px solid #000000;
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

:root[data-accent="amber"] {
  --accent-light: #9a6a0f;
  --accent-dark: #e0a54a;
  --accent-access: #6b4700;
}

:root[data-accent="cyan"] {
  --accent-light: #0e7c8a;
  --accent-dark: #45c4d4;
  --accent-access: #005460;
}

:root[data-accent="violet"] {
  --accent-light: #6d4bc4;
  --accent-dark: #a98cf0;
  --accent-access: #4a2f96;
}

/* ============================================
   BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Firefox — thumb, then track. Both follow the active theme/accent. */
  scrollbar-color: var(--color-accent) var(--color-bg);
  scrollbar-width: thin;
}

/* WebKit/Blink. The track matches the page background and the thumb the
   accent; the border is drawn in the track colour so the thumb reads as a
   slim pill rather than filling the gutter edge to edge. */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border: 3px solid var(--color-bg);
  border-radius: 999px;
  /* the accent at full strength is loud for furniture */
  opacity: 0.9;
}

::-webkit-scrollbar-thumb:hover {
  border-width: 2px;
}

::-webkit-scrollbar-corner {
  background: var(--color-bg);
}

/* Panes that sit on the raised surface get a matching track */
.log::-webkit-scrollbar-track,
.log::-webkit-scrollbar-corner {
  background: var(--color-surface);
}

.log::-webkit-scrollbar-thumb {
  border-color: var(--color-surface);
}

.log {
  scrollbar-color: var(--color-accent) var(--color-surface);
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  /* faint dot grid, strongest at the edges, clear in the middle */
  background-image: radial-gradient(var(--color-dot-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

body::before {
  /* wash the dot grid out toward the center so content stays clean */
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 70% 90% at 50% 40%, var(--color-bg) 40%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

main, footer {
  position: relative;
  z-index: 1;
}

/* ============================================
   STATUS LINE — footer. Nothing sits above the
   hero, so the page opens on the name.
   ============================================ */
.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.75rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ============================================
   APPEARANCE CONTROLS — footer
   ============================================ */
.footer-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.theme-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

.theme-switch button {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0 0 1px;
  cursor: pointer;
}

.theme-switch button[aria-pressed="true"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* Accent picker — four dots, no labels. The active one wears a ring. */
.accent-switch {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.accent-switch button {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.55;
  box-shadow: 0 0 0 0 transparent;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.accent-switch button:hover {
  opacity: 1;
}

.accent-switch button[aria-pressed="true"] {
  opacity: 1;
  box-shadow: 0 0 0 3px var(--color-bg), 0 0 0 4px currentColor;
}

/* Each dot shows its own colour, not the active accent */
.accent-switch [data-set-accent="green"]  { background: #2fbf74; color: #2fbf74; }
.accent-switch [data-set-accent="amber"]  { background: #e0a54a; color: #e0a54a; }
.accent-switch [data-set-accent="cyan"]   { background: #45c4d4; color: #45c4d4; }
.accent-switch [data-set-accent="violet"] { background: #a98cf0; color: #a98cf0; }

:root[data-theme="light"] .accent-switch [data-set-accent="green"]  { background: #16a05c; color: #16a05c; }
:root[data-theme="light"] .accent-switch [data-set-accent="amber"]  { background: #9a6a0f; color: #9a6a0f; }
:root[data-theme="light"] .accent-switch [data-set-accent="cyan"]   { background: #0e7c8a; color: #0e7c8a; }
:root[data-theme="light"] .accent-switch [data-set-accent="violet"] { background: #6d4bc4; color: #6d4bc4; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .accent-switch [data-set-accent="green"]  { background: #16a05c; color: #16a05c; }
  :root:not([data-theme="dark"]) .accent-switch [data-set-accent="amber"]  { background: #9a6a0f; color: #9a6a0f; }
  :root:not([data-theme="dark"]) .accent-switch [data-set-accent="cyan"]   { background: #0e7c8a; color: #0e7c8a; }
  :root:not([data-theme="dark"]) .accent-switch [data-set-accent="violet"] { background: #6d4bc4; color: #6d4bc4; }
}

.ok {
  color: var(--color-accent);
  font-weight: 500;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-right: 0.5em;
  vertical-align: 1px;
}

.cursor {
  color: var(--color-accent);
  animation: blink 1.1s steps(1) infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ============================================
   LAYOUT
   ============================================ */
main {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  flex: 1;
}

/* ============================================
   HERO
   ============================================ */
.hero {
  text-align: center;
  /* nothing above it now, so the hero carries its own top breathing room */
  padding: 6rem 0 2.5rem;
  transition: padding 0.55s ease;
}

/* Chat mode: hero steps back so the conversation takes focus */
body.chat-active .hero {
  padding: 2rem 0 1.5rem;
}

body.chat-active h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
}

body.chat-active .sub {
  font-size: 1rem;
  margin-top: 0.4rem;
  opacity: 0.8;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(3rem, 9vw, 5.25rem);
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0;
  transition: font-size 0.55s ease;
}

.caret {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  background: var(--color-accent);
  margin-left: 0.12em;
  vertical-align: -0.08em;
  animation: blink 1.1s steps(1) infinite;
}

.sub {
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  color: var(--color-text-secondary);
  margin-top: 1.25rem;
  transition: font-size 0.55s ease, margin-top 0.55s ease, opacity 0.55s ease;
}

/* ============================================
   CHAT
   ============================================ */
.chat {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 1.5rem;
}

/* Personalized recruiter mode: banner above the chat window */
.personal-banner[hidden] {
  display: none; /* the flex display below would otherwise override [hidden] */
}

.personal-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--color-text-secondary);
  margin: 0 0 1rem;
  text-align: center;
}

.personal-banner::before {
  content: '';
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* "Reach me" CTA — the conversion path in personalized mode */
.reach-cta[hidden] {
  display: none;
}

.reach-cta {
  display: block;
  width: max-content;
  margin: 0 auto 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  text-decoration: none;
  border: 1px solid var(--color-accent);
  border-radius: 100px;
  padding: 0.55rem 1.3rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.reach-cta:hover {
  background: var(--color-accent);
  color: #fff;
}

/* One card holds the log and the input — the log slides
   open inside it when the first question is asked */
.chat-window {
  position: relative;
  z-index: 1;              /* sits over the drawer tucked beneath it */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.chat-window:focus-within {
  border-color: var(--color-accent);
}

.log {
  font-size: 0.95rem;
  max-height: 0;
  opacity: 0;
  padding: 0 1.5rem;
  overflow-y: auto;
  transition: max-height 0.55s ease, opacity 0.4s ease, padding 0.55s ease;
}

body.chat-active .log {
  max-height: min(45vh, 380px);
  opacity: 1;
  padding: 1.4rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.log-q {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-accent);
  margin-top: 1.25rem;
}

.log-q:first-child {
  margin-top: 0;
}

.log-a {
  margin-top: 0.6rem;
  line-height: 1.75;
}

.log-a.typing::after {
  content: '\2588';
  color: var(--color-accent);
  animation: blink 1.1s steps(1) infinite;
  margin-left: 1px;
}

.askbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
}

/* ---- Skills-match chart (personalized mode) ---- */
.skills-chart {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin: 1rem 0 0.5rem;
}

.skill-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.skill-pct {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-accent);
  flex-shrink: 0;
}

.skill-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--color-border);
  overflow: hidden;
  margin-top: 0.45rem;
}

.skill-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--color-accent);
  width: 0;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-evidence {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: 0.35rem;
  line-height: 1.55;
}

.prompt {
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-weight: 500;
}

#q {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.02rem;
  color: var(--color-text);
  min-width: 0;
}

#q::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.75;
}

/* ---- Drawer ----
   Slides out from under the chat window: inset on both sides, tucked
   up behind the card's rounded bottom so only the lower lip shows.
   The card sits above it and casts its shadow across the top. */
.drawer {
  position: relative;
  z-index: 0;
  margin: calc(var(--radius) * -1) 1.4rem 0;
  padding: calc(var(--radius) + 0.85rem) 1.5rem 0.95rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  min-height: calc(var(--radius) + 3.1rem);
}

/* ---- The rotating question ----
   No border, no fill, no button chrome — text on the drawer's own
   background, fading from one question to the next. It's a real
   button underneath, so it clicks and takes keyboard focus, but
   nothing about it looks like one. */
.suggestion {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  text-align: left;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.75s ease, color 0.18s ease;
}

.suggestion.visible {
  opacity: 0.72;
}

/* Hover: snaps to the accent immediately (no fade on colour) and the
   rotation holds, so a question can't slip away mid-read. */
.suggestion:hover,
.suggestion:focus-visible {
  color: var(--color-accent);
  opacity: 1;
  transition: color 0s;
}

@media (prefers-reduced-motion: reduce) {
  .suggestion {
    transition: none;
  }
}

.hint {
  display: flex;
  justify-content: center;
  margin: 1.15rem 0 0;
  text-align: center;
}

/* "Have a code?" affordance — quiet, but discoverable */
.code-hint {
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.code-hint:hover {
  color: var(--color-accent);
}

/* Once unlocked, the invitation is no longer needed */
body.personalized .code-hint {
  display: none;
}

/* ============================================
   TOP QUESTIONS — personalized mode cards
   ============================================ */
.top-questions[hidden] {
  display: none;
}

.top-questions {
  padding: 2rem 0 0.5rem;
}

.tq-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.tq-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  font-family: var(--font-body);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tq-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 6px 20px rgba(22, 160, 92, 0.15);
}

.tq-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  color: var(--color-accent);
}

.tq-q {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--color-text);
  line-height: 1.4;
}

.tq-desc {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 639px) {
  .tq-cards {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   VISUAL ANSWERS — timeline + facts card (in the log)
   ============================================ */
.mini-timeline {
  margin: 1rem 0 0.5rem;
}

.tl-row {
  position: relative;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding: 0.65rem 0 0.65rem 1.1rem;
  border-left: 2px solid var(--color-border);
}

.tl-row::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 1.15rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}

.tl-relevant::before {
  background: var(--color-accent);
}

.tl-row:not(.tl-relevant) {
  opacity: 0.55;
}

.tl-when {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  padding-top: 0.15rem;
}

.tl-head {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.4;
}

.tl-note {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 639px) {
  .tl-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.facts-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.75rem;
  margin: 1rem 0 0.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.fact-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--color-accent);
  margin-bottom: 0.15rem;
}

.fact-value {
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 639px) {
  .facts-card {
    grid-template-columns: 1fr;
  }
}

/* Disclosure tag under AI-generated answers */
.ai-tag {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--color-text-secondary);
}

/* Soft CTA line after visual answers */
.log-cta {
  margin-top: 1rem;
}

.log-cta a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--color-accent);
}

/* Hero text swap on unlock */
#hero-title, #hero-sub {
  transition: opacity 0.3s ease;
}

body.hero-swapping #hero-title,
body.hero-swapping #hero-sub {
  opacity: 0;
}

/* ============================================
   SECTION DIVIDER — recruiter "top questions"
   ============================================ */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--color-text-secondary);
  margin-bottom: 1.75rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

footer p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin: 0;
}

footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: color 0.2s ease, border-color 0.2s ease;
}

footer a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .cursor, .caret, .log-a.typing::after {
    animation: none;
  }
  .hero, h1, .sub, .log, .skill-fill, #hero-title, #hero-sub {
    transition: none;
  }
}

/* ============================================
   RESPONSIVE — small screens
   ============================================ */
@media (max-width: 639px) {
  .hero {
    padding-top: 3.5rem;
  }

  .askbar {
    padding: 0.9rem 1rem;
  }

  .drawer {
    margin-inline: 0.9rem;
    padding-inline: 1.15rem;
  }

  /* Narrow enough that a question would be cut off mid-sentence, so let
     it take a second line instead. */
  .suggestion {
    white-space: normal;
    font-size: 0.94rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .status {
    font-size: 0.62rem;
    gap: 0.3rem 1rem;
  }
}
