/* Tokens follow the "dessn" design system (light marketing variant). */
:root {
  /* brand */
  --brand-navy: #253b55;
  --brand-red: #e34927;
  --brand-amber: #faa715;
  --brand-deep-teal: #125c5c;
  --brand-teal: #43b3a8;
  --brand-gold: #eecb6b;
  --brand-periwinkle: #8288c8;
  --brand-sky: #81c4e9;
  --brand-pale-sky: #b7dfe8;
  --brand-russet: #823330;
  --brand-green: #118d47;
  --brand-neutral-950: #1c1a1d;
  --brand-neutral-800: #383836;
  --brand-neutral-300: #e2d5cd;
  --brand-neutral-200: #eee1c0;
  --brand-neutral-100: #f5f3e6;

  --gray-0: #fff;
  --gray-50: #f5f5f6;
  --gray-200: #d3d4d6;
  --gray-300: #b1b2b6;
  --gray-500: #6b6c70;
  --gray-600: #515256;

  /* surfaces */
  --paper: var(--brand-neutral-100);
  --paper-light: color-mix(in srgb, var(--gray-0) 55%, var(--brand-neutral-100));
  --paper-deep: var(--brand-neutral-200);
  --ink: var(--brand-neutral-950);
  --ink-soft: var(--brand-neutral-800);

  --background: var(--paper);
  --foreground: var(--ink);
  --card: var(--paper-light);
  --card-muted: var(--paper-deep);
  --muted-foreground: var(--gray-600);
  --subtle-foreground: var(--gray-500);
  --accent: color-mix(in srgb, var(--ink) 6%, transparent);
  --border: color-mix(in srgb, var(--ink) 14%, transparent);
  --border-strong: color-mix(in srgb, var(--ink) 28%, transparent);
  --input: color-mix(in srgb, var(--ink) 22%, transparent);

  --primary: #c64125;
  --primary-hover: #cf4426;
  --primary-active: #b53a20;
  --primary-foreground: #fff;
  --primary-muted: color-mix(in srgb, var(--brand-red) 14%, var(--card));
  --success: #128745;
  --success-muted: color-mix(in srgb, var(--success) 12%, var(--card));
  --warning: var(--brand-amber);
  --destructive: var(--brand-russet);
  --destructive-ink: #b03a2e;
  --info: var(--brand-sky);

  --ring: var(--brand-red);
  --focus-ring: 0 0 0 1px var(--background), 0 0 0 3px color-mix(in srgb, var(--ring) 70%, transparent);

  /* type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cal Sans", "Inter", system-ui, sans-serif;
  --text-xs: .75rem;
  --text-sm: .875rem;
  --text-md: .9375rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --leading-body: 1.5;
  --leading-title: 1.1;

  /* shape */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius: 8px;
  --radius-xl: 10px;
  --radius-2xl: 12px;
  --radius-frame: 14px;
  --radius-scale: 1;
  --corner-shape: round;

  /* depth */
  --shadow-rgb: 3 3 6;
  --highlight-top: inset 0 1px 0 #ffffff0f;
  --shadow-xs: 0 1px 1px rgb(var(--shadow-rgb) / 6%);
  --shadow-sm: 0 1px 1px rgb(var(--shadow-rgb) / 5%), 0 2px 4px rgb(var(--shadow-rgb) / 4%);
  --shadow-md: 0 1px 1px rgb(var(--shadow-rgb) / 5%), 0 2px 4px rgb(var(--shadow-rgb) / 4%), 0 6px 12px rgb(var(--shadow-rgb) / 4%);
  --shadow-lg: 0 1px 2px rgb(var(--shadow-rgb) / 6%), 0 4px 8px rgb(var(--shadow-rgb) / 5%), 0 12px 24px rgb(var(--shadow-rgb) / 5%), 0 24px 48px rgb(var(--shadow-rgb) / 4%);
  --shadow-control: inset 0 1px 0 #ffffff29, var(--shadow-xs);
  --shadow-control-hover: inset 0 1px 0 #ffffff29, var(--shadow-sm);
  --shadow-card: var(--shadow-md);

  /* motion */
  --ease-enter: cubic-bezier(.16, 1, .3, 1);
  --duration-fast: .1s;
  --duration-base: .15s;
  --duration-slow: .3s;
}
@supports (corner-shape: superellipse(1.6)) {
  :root { --radius-scale: 1.3; --corner-shape: superellipse(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0s; --duration-base: 0s; --duration-slow: 0s; }
}

*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: var(--text-base)/var(--leading-body) var(--font-sans);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: #d5ad5a66; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400; /* Cal Sans is a single-weight display face */
  line-height: var(--leading-title);
  letter-spacing: -.005em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 5.5vw, 3.75rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
h3 { font-size: var(--text-xl); }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--foreground) 30%, transparent); text-underline-offset: 4px; }
.muted { color: var(--muted-foreground); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-md); }

/* shared radius helper so superellipse corners apply everywhere */
.card, .btn, .visa-body, .field input, .field textarea, .steps li, .window-card, .bubble, .mic-note, .error, .tip {
  corner-shape: var(--corner-shape);
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .14em; font-size: var(--text-xs); font-weight: 600;
  color: var(--primary); margin-bottom: 1em;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Header / footer */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.25rem; text-decoration: none; }
.logo-stamp {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: calc(var(--radius) * var(--radius-scale)); corner-shape: var(--corner-shape);
  background: var(--primary); color: var(--primary-foreground); font-size: .8rem; letter-spacing: .02em;
  box-shadow: var(--shadow-control);
}
.logo-tld { color: var(--subtle-foreground); }
.badge-free {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em;
  color: var(--success); background: var(--success-muted);
  border: 1px solid color-mix(in srgb, var(--success) 20%, transparent);
  padding: 4px 10px; border-radius: 999px;
}
.site-footer { border-top: 1px solid var(--border); margin-top: 96px; padding: 32px 0 48px; font-size: var(--text-sm); color: var(--muted-foreground); }
.site-footer p { margin: 0 0 .4em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 38px; padding: 0 16px;
  border-radius: calc(var(--radius) * var(--radius-scale));
  border: 1px solid var(--border-strong);
  background: var(--card); color: var(--foreground);
  font: 500 var(--text-md)/1 var(--font-sans);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-control);
  transition: background-color var(--duration-base) var(--ease-enter), box-shadow var(--duration-base) var(--ease-enter), transform var(--duration-fast) var(--ease-enter);
}
.btn:hover { background: color-mix(in srgb, var(--ink) 4%, var(--card)); box-shadow: var(--shadow-control-hover); }
.btn:active { transform: translateY(.5px) scale(.99); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary-active); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--brand-neutral-100); }
.btn-ink:hover { background: var(--ink-soft); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--accent); box-shadow: none; color: var(--destructive-ink); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: var(--text-base); border-radius: calc(var(--radius-xl) * var(--radius-scale)); }
.btn-block { width: 100%; }

.spinner { width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 35%); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: var(--border); border-top-color: var(--ink); width: 22px; height: 22px; flex: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-frame) * var(--radius-scale));
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

/* Hero */
.hero { padding: 88px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center; }
.lede { font-size: var(--text-lg); color: var(--muted-foreground); max-width: 34em; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 32px; font-size: var(--text-sm); }

.window-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(18px * var(--radius-scale));
  padding: 20px;
  box-shadow: var(--shadow-lg);
  rotate: 1.2deg;
  animation: rise var(--duration-slow) var(--ease-enter) both;
}
.window-top { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: var(--text-xs); color: var(--subtle-foreground); }
.window-top span { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.window-top em { margin-left: auto; font-style: normal; font-weight: 500; }
.stamp {
  position: absolute; right: -14px; bottom: -18px; rotate: -12deg;
  border: 2.5px solid var(--primary); color: var(--primary);
  border-radius: var(--radius); padding: 3px 12px 4px;
  font: 1.05rem var(--font-display); letter-spacing: .16em;
  background: color-mix(in srgb, var(--card) 88%, transparent);
}
@keyframes rise { from { opacity: 0; translate: 0 8px; } }

/* Chat bubbles (hero + transcript) */
.bubble {
  max-width: 85%; padding: 10px 14px; margin-bottom: 10px;
  border-radius: calc(var(--radius-2xl) * var(--radius-scale));
  font-size: var(--text-md); line-height: 1.45;
  animation: rise var(--duration-slow) var(--ease-enter) both;
}
.bubble.officer { background: var(--card-muted); color: var(--ink); border-bottom-left-radius: var(--radius-sm); }
.bubble.candidate { background: var(--ink); color: var(--brand-neutral-100); margin-left: auto; border-bottom-right-radius: var(--radius-sm); }

/* How it works */
.how { padding: 56px 0; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li {
  counter-increment: step;
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius-frame) * var(--radius-scale));
  padding: 24px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.steps li::before {
  content: counter(step);
  display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 10px;
  border-radius: 50%; background: var(--primary-muted); color: var(--primary);
  font: 1rem var(--font-display);
}
.steps strong { font-family: var(--font-display); font-weight: 400; font-size: var(--text-lg); }
.steps span { color: var(--muted-foreground); font-size: var(--text-md); }

/* Start form */
.start { padding: 56px 0; scroll-margin-top: 60px; }
.form fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.form legend, .field > span { font-weight: 600; font-size: var(--text-sm); margin-bottom: 8px; display: block; }
.field em, legend em { font-style: normal; font-weight: 400; color: var(--subtle-foreground); }
.visa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.visa-option { cursor: pointer; position: relative; }
.visa-option input { position: absolute; opacity: 0; pointer-events: none; }
.visa-body {
  display: flex; flex-direction: column; gap: 1px; height: 100%;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius-2xl) * var(--radius-scale));
  padding: 14px 16px; background: var(--paper-light);
  transition: border-color var(--duration-base), background-color var(--duration-base), box-shadow var(--duration-base);
}
.visa-option:hover .visa-body { background: color-mix(in srgb, var(--ink) 3%, var(--paper-light)); }
.visa-option input:checked + .visa-body {
  border-color: var(--primary); background: var(--primary-muted);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.visa-option input:focus-visible + .visa-body { box-shadow: var(--focus-ring); }
.visa-country { font-size: var(--text-xs); color: var(--subtle-foreground); text-transform: uppercase; letter-spacing: .1em; font-weight: 500; }
.visa-label { font: var(--text-lg) var(--font-display); }
.visa-blurb { font-size: var(--text-sm); color: var(--muted-foreground); }
.field { display: block; margin-bottom: 18px; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) * var(--radius-scale));
  padding: 11px 13px;
  font: inherit; font-size: var(--text-md); color: inherit;
  background: var(--paper-light); resize: vertical;
  transition: border-color var(--duration-base), box-shadow var(--duration-base);
}
.field input::placeholder, .field textarea::placeholder { color: var(--subtle-foreground); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ring); box-shadow: var(--focus-ring); }
.field small { display: block; text-align: right; font-size: var(--text-xs); margin-top: 4px; }
.mic-note {
  font-size: var(--text-sm); color: var(--ink-soft);
  background: color-mix(in srgb, var(--brand-amber) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--brand-amber) 35%, transparent);
  border-radius: calc(var(--radius) * var(--radius-scale)); padding: 10px 14px;
}
.error {
  color: var(--destructive-ink);
  background: color-mix(in srgb, var(--brand-red) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--brand-red) 25%, transparent);
  border-radius: calc(var(--radius) * var(--radius-scale)); padding: 10px 14px; font-size: var(--text-sm);
}

/* FAQ */
.faq { padding: 40px 0; }
.faq details { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--subtle-foreground); font-size: 1.2rem; line-height: 1; transition: rotate var(--duration-base) var(--ease-enter); }
.faq details[open] summary::after { rotate: 45deg; }
.faq details p { margin: 10px 0 0; color: var(--muted-foreground); }

/* Interview room */
.room-page { padding: 48px 0; }
.room-head { margin-bottom: 24px; }
.prestart ul { margin-bottom: 24px; }
.ticks, .arrows { list-style: none; padding: 0; margin: 0; }
.ticks li, .arrows li { position: relative; padding-left: 26px; margin-bottom: 10px; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.arrows li::before { content: "→"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }

.booth { padding: 28px; }
.officer { display: flex; align-items: center; gap: 16px; }
.officer-avatar {
  position: relative; flex: none; width: 60px; height: 60px; border-radius: 50%;
  background: var(--brand-navy); color: var(--brand-pale-sky); display: grid; place-items: center;
}
.officer-avatar svg { width: 36px; height: 36px; }
.officer-avatar::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2.5px solid transparent; transition: border-color var(--duration-base); }
.officer.speaking .officer-avatar::after { border-color: var(--primary); animation: pulse 1.2s ease-in-out infinite; }
.officer.listening .officer-avatar::after { border-color: var(--success); }
.officer.thinking .officer-avatar::after,
.officer.waiting .officer-avatar::after,
.officer.connecting .officer-avatar::after { border-color: var(--border); border-top-color: var(--ink); animation: spin 1s linear infinite; }
@keyframes pulse { 50% { scale: 1.06; opacity: .55; } }
.officer-name { font: var(--text-lg) var(--font-display); }
.officer-status { color: var(--muted-foreground); font-size: var(--text-sm); }
.caption { margin: 24px 0 4px; font: clamp(1.25rem, 2.6vw, 1.6rem)/1.3 var(--font-display); text-wrap: pretty; }
.mic-row { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.meter { flex: 1; height: 8px; border-radius: 999px; background: var(--card-muted); overflow: hidden; }
.meter-fill { height: 100%; background: var(--success); border-radius: 999px; transition: width 60ms linear; }
.mic-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--subtle-foreground); min-width: 64px; }
.booth-foot { display: flex; justify-content: space-between; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 12px; }
.error-card { border-color: color-mix(in srgb, var(--brand-red) 30%, transparent); }

.transcript { margin: 32px 0; }
.transcript h3 { font: 600 var(--text-xs) var(--font-sans); color: var(--subtle-foreground); text-transform: uppercase; letter-spacing: .12em; }

/* Scorecard */
.feedback-pending { display: flex; align-items: center; gap: 16px; }
.feedback-pending p { margin: 0; }
.score-head { display: flex; gap: 28px; align-items: center; }
.score-head h2 { margin-bottom: .2em; }
.score-head p:last-child { margin: 0; color: var(--muted-foreground); }
.score-ring {
  --c: var(--warning);
  flex: none; width: 112px; height: 112px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 80%, transparent 81%), conic-gradient(var(--c) calc(var(--score) * 1%), var(--card-muted) 0);
}
.score-ring span { font: 2.1rem/1 var(--font-display); }
.score-ring small { color: var(--subtle-foreground); font-size: var(--text-xs); }
.verdict-likely_approved .score-ring { --c: var(--success); }
.verdict-likely_approved h2 { color: var(--success); }
.verdict-borderline h2 { color: #b7790f; }
.verdict-likely_refused .score-ring { --c: var(--primary); }
.verdict-likely_refused h2 { color: var(--primary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.qa { border-top: 1px solid var(--border); padding: 14px 0; }
.qa summary { cursor: pointer; font-weight: 500; }
.qa p { margin: 10px 0 0; color: var(--muted-foreground); }
.qnum { display: inline-block; min-width: 2.2em; color: var(--primary); font-family: var(--font-display); }
.label { display: inline-block; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; color: var(--subtle-foreground); margin-right: 6px; }
.tip { background: var(--success-muted); border-radius: calc(var(--radius) * var(--radius-scale)); padding: 8px 12px; color: var(--ink-soft) !important; }
.tip .label { color: var(--success); }
.again { text-align: center; margin: 32px 0; }

@media (max-width: 860px) {
  .hero { padding: 48px 0 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .window-card { rotate: 0deg; margin: 0 8px; }
  .steps, .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .visa-grid { grid-template-columns: 1fr; }
  .score-head { flex-direction: column; text-align: center; }
  .card { padding: 20px; }
}
