/* ---------- Tokens ---------- */
:root {
  --paper: #f1f6f7;
  --field: #ffffff;
  --field-focus: #ffffff;
  --field-border: #d3e0e3;
  --ink: #0e1a1f;
  --muted: #56656b;
  --rule: #d3dfe2;
  /* Bright cyan for fills (button, progress, highlight, focus glow).
     It's too light for text on a light background, so text, borders
     and outlines use --accent-text, a darker cyan. */
  --accent: #1be7ff;
  --accent-text: #00717f;
  --accent-ink: #0e1a1f;
  --accent-soft: rgba(27, 231, 255, 0.3);
  --highlight: rgba(27, 231, 255, 0.4);
  --error: #a3261b;

  --serif: "Noto Serif Georgian", Georgia, serif;
  --sans: "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141618;
    --field: #1d2023;
    --field-focus: #22262a;
    --field-border: transparent;
    --highlight: rgba(27, 231, 255, 0.24);
    --ink: #e7e8e4;
    --muted: #9aa1a6;
    --rule: #30353a;
    --accent: #1be7ff;
    --accent-text: #1be7ff;
    --accent-ink: #06262b;
    --accent-soft: rgba(27, 231, 255, 0.22);
    --error: #ff9a8f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141618;
  --field: #1d2023;
  --field-focus: #22262a;
  --field-border: transparent;
  --highlight: rgba(27, 231, 255, 0.24);
  --ink: #e7e8e4;
  --muted: #9aa1a6;
  --rule: #30353a;
  --accent: #1be7ff;
  --accent-text: #1be7ff;
  --accent-ink: #06262b;
  --accent-soft: rgba(27, 231, 255, 0.22);
  --error: #ff9a8f;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

::selection { background: var(--accent-soft); }

/* ---------- Languages ----------
   Every text exists twice: <span lang="ka"> and <span lang="en">.
   The <html lang> attribute decides which one is shown. */
html[lang="ka"] [lang="en"]:not([data-set-lang]):not(.show-all-langs *),
html[lang="en"] [lang="ka"]:not([data-set-lang]):not(.show-all-langs *) {
  display: none;
}

/* English: Montserrat Alternates for titles, Montserrat for everything else
   (Montserrat has no Georgian letters, so Georgian keeps the Noto fonts) */
html[lang="en"],
[lang="en"]:not(html):not([data-set-lang]) {
  --serif: "Montserrat Alternates", "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* thanks.html shows both languages at once */
p[lang="en"], a > [lang="en"] { font-family: var(--sans); }

/* ---------- Progress ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 10;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--field);
}
.switch button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  font: 600 0.8rem/1 var(--sans);
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
@media (hover: hover) {
  .switch button:hover { color: var(--ink); }
}
.switch button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.switch svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Page ---------- */
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(120px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  /* Content column with a left gutter for the question numbers */
  --gutter: 120px;
}
.intro,
.form,
.success {
  padding-left: var(--gutter);
  max-width: calc(640px + var(--gutter));
}

/* ---------- Intro ---------- */
.intro { padding-top: 72px; padding-bottom: 56px; }

.intro h1 {
  font-family: var(--serif);
  font-weight: 650;
  font-stretch: 80%;
  font-variation-settings: "wdth" 80;
  font-size: clamp(3rem, 11vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  /* Pull the headline into the gutter so it anchors the whole column */
  margin-left: calc(var(--gutter) * -1);
}
.lede {
  font-size: 1.2rem;
  line-height: 1.55;
  margin: 0 0 14px;
  max-width: 36em;
}
/* The two facts that make starting easy: how long it takes, and no commitment */
.lede mark {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(transparent 38%, var(--highlight) 38%, var(--highlight) 94%, transparent 94%);
  padding: 0 0.1em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.note { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Questions ---------- */
.questions {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: q;
}
.question,
.field {
  scroll-margin-top: 16px;
}
.question {
  counter-increment: q;
  position: relative;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
}
.question::before {
  content: counter(q, decimal-leading-zero);
  position: absolute;
  left: calc(var(--gutter) * -1);
  top: 40px;
  font: 500 1.6rem/1.3 var(--serif);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: color 0.2s;
}
.question:focus-within::before,
.question.is-answered::before { color: var(--accent-text); }

.question > label,
.question legend {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-variation-settings: "wdth" 90;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin-bottom: 8px;
  text-wrap: balance;
}

.hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.req {
  color: var(--accent-text);
  margin-left: 0.2em;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
legend { padding: 0; }

/* ---------- Choice chips (radio = pick one, checkbox = pick any) ---------- */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.question legend + .choices { margin-top: 16px; }
.choice {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
/* The real input stays in place (and focusable) but invisible; the chip shows its state */
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1.5px solid var(--field-border);
  border-radius: 999px;
  background: var(--field);
  font-size: 1rem;
  line-height: 1.3;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
/* Checkboxes get a small box, so "pick any" reads differently from "pick one" */
.choice input[type="checkbox"] + .chip::before {
  content: "";
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.55;
}
.choice input[type="checkbox"]:checked + .chip::before {
  content: "✓";
  opacity: 1;
}
@media (hover: hover) {
  .choice:hover .chip { border-color: var(--muted); }
}
.choice input:checked + .chip {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.choice input:focus-visible + .chip {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.reveal { margin-top: 20px; }
.contact-method { margin-top: 28px; }
.contact-method legend {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

/* ---------- Inputs ---------- */
input,
textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 1.05rem; /* ≥16px, so iOS doesn't zoom */
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  padding: 14px 16px;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
textarea {
  resize: none;
  min-height: 110px;
  line-height: 1.55;
  overflow: hidden;
}
input::placeholder,
textarea::placeholder { color: var(--muted); opacity: 0.6; }

@media (hover: hover) {
  input:hover,
  textarea:hover { border-color: var(--muted); }
}

input:focus,
textarea:focus {
  outline: none;
  background: var(--field-focus);
  border-color: var(--accent-text);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

[aria-invalid="true"],
[aria-invalid="true"]:hover { border-color: var(--error); }

.error {
  margin: 8px 0 0;
  color: var(--error);
  font-size: 0.9rem;
}
.error:empty { display: none; }

/* Honeypot: hidden from people, visible to bots */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Contact ---------- */
.contact {
  padding: 48px 0 8px;
  border-top: 1px solid var(--rule);
}
.contact h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-variation-settings: "wdth" 90;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  line-height: 1.25;
  margin: 0 0 24px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.opt {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Actions ---------- */
.actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 40px;
}
.submit {
  font: 600 1.05rem/1 var(--sans);
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 20px 36px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
@media (hover: hover) {
  .submit:hover { box-shadow: 0 8px 24px -8px var(--accent); transform: translateY(-1px); }
}
.submit:active { transform: scale(0.98); box-shadow: none; }
.submit:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }

.form-status { margin: 0; color: var(--muted); font-size: 0.95rem; }
.form-status.is-error { color: var(--error); }

/* ---------- Focus (keyboard) ---------- */
.switch button:focus-visible,
.submit:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

/* ---------- Success ---------- */
.success { padding-top: 72px; }
.success:focus { outline: none; }
.success h2 {
  font-family: var(--serif);
  font-weight: 650;
  font-variation-settings: "wdth" 80;
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}
.success p { margin: 0 0 12px; font-size: 1.15rem; max-width: 34em; }
.success a { color: var(--accent-text); }
.success hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .page { --gutter: 0px; }
  .topbar { padding-top: 14px; }
  .intro { padding-top: 40px; padding-bottom: 36px; }
  .intro h1 { margin-bottom: 20px; }
  .lede { font-size: 1.08rem; }
  .question { padding: 28px 0 32px; }
  .question::before {
    position: static;
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
  }
  .question > label { font-size: 1.3rem; }
  .hint { margin-bottom: 12px; }
  textarea { min-height: 96px; }
  .contact { padding-top: 36px; }
  .grid { grid-template-columns: 1fr; gap: 18px; }
  .actions { margin-top: 32px; gap: 12px; }
  .submit { width: 100%; padding: 18px 24px; }
  .form-status { width: 100%; text-align: center; }
  .success { padding-top: 48px; }
}

/* Bigger tap targets on touch screens */
@media (pointer: coarse) {
  .switch button { height: 40px; min-width: 44px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
