/*
 * Application form — dressed in the landing page's design system.
 * Colours, typography, the bevelled CTA and the easing curve are all lifted from
 * source/landing-export.html so the form reads as the same product, not a bolt-on.
 */

:root {
  --ink: #050505;
  --panel: #0b0b0c;
  --accent: #ee964b;
  --accent-hi: #f2a863;
  --paper: #f5f3ed;
  --muted: #a19d94;
  --dim: #6f6c66;
  --line: #272727;
  --line-hi: #393939;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 400ms;

  --shell: min(760px, calc(100% - 40px));
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 1ms; }
}

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

/* The UA stylesheet gives [hidden] display:none, but any author `display` beats it.
   Several elements here are flex or grid and toggled via the hidden attribute. */
[hidden] { display: none !important; }

html {
  background: var(--ink);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--paper);
  background: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

::selection { background: var(--accent); color: var(--ink); }

.hp {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The landing's diagonal hatch, at the same weight. */
.hatch {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background: repeating-linear-gradient(135deg, rgb(255 255 255 / 2%) 0 1px, transparent 1px 28px);
}

/* ---------- chrome ---------- */

.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--shell);
  margin: 0 auto;
  min-height: 64px;
  background: linear-gradient(180deg, var(--ink) 40%, rgb(5 5 5 / 0%));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}

.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.linkish {
  border: 0;
  background: none;
  padding: 8px 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.25s ease;
}

.linkish:hover { color: var(--paper); }
#reset:hover { color: var(--accent); }

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 21;
  height: 2px;
  background: var(--line);
}

.progress-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--ease);
}

/* "Βήμα X από N" — its own band in the gap between the fixed header (64px) and where the
   question content begins (88px), so it never competes with the brand or the back/reset
   buttons for horizontal space. Opaque so scrolling content passes cleanly behind it;
   pointer-events:none so it is never in the way of a tap. Empty on welcome and done. */
.progress-step {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 19;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  margin: 0;
  pointer-events: none;
  background: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.ghost {
  border: 0;
  background: none;
  padding: 0;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.ghost:hover { color: var(--paper); }

/* ---------- stage & screens ---------- */

.stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100svh;
}

.screen {
  grid-area: 1 / 1;
  display: flex;
  width: 100%;
  padding: 88px 0 48px;
  overflow-y: auto;
}

.screen-inner {
  width: var(--shell);
  /* auto block margins centre the panel and simply collapse when the content is
     taller than the viewport, so nothing is ever clipped out of reach */
  margin: auto;
}

.screen[data-anim='enter-fwd'] { animation: enterFwd var(--dur) var(--ease) both; }
.screen[data-anim='enter-bwd'] { animation: enterBwd var(--dur) var(--ease) both; }
.screen[data-anim='exit-fwd']  { animation: exitFwd  var(--dur) var(--ease) both; }
.screen[data-anim='exit-bwd']  { animation: exitBwd  var(--dur) var(--ease) both; }

@keyframes enterFwd { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes enterBwd { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: none; } }
@keyframes exitFwd  { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-30px); } }
@keyframes exitBwd  { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(30px); } }

/* ---------- shared type ---------- */

.eyebrow {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--dim);
  text-transform: uppercase;
}

.q-num { color: var(--accent); }

.rule {
  width: 64px;
  margin: 18px 0 26px;
  transform: skewX(-24deg);
}

.rule-fill {
  display: block;
  height: 2px;
  background: var(--accent);
  transform-origin: left center;
  animation: grow 0.7s var(--ease) both;
}

@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.statement-head {
  margin: 0;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 5.4vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.statement-copy {
  max-width: 560px;
  margin: 28px 0 0;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.7;
  color: var(--muted);
}

.q-label {
  margin: 16px 0 0;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 900;
  font-size: clamp(26px, 3.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.q-optional {
  font-weight: 500;
  font-size: 0.5em;
  letter-spacing: 0;
  color: var(--muted);
  white-space: nowrap;
}

.q-help {
  margin: 14px 0 0;
  max-width: 540px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.q-control { margin-top: clamp(26px, 4vw, 40px); }

.q-error {
  margin: 16px 0 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent-hi);
}

/* ---------- CTA (bevelled corner, no radius — the landing's signature) ---------- */

.actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: clamp(28px, 4vw, 40px);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 18px 30px;
  background: var(--accent);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 100%, 0 100%);
  transition: background 0.3s ease, gap 0.3s var(--ease);
}

.cta:hover { background: var(--accent-hi); gap: 16px; }
.cta-lg { padding: 21px 40px; font-size: 14px; }
.cta-sm { padding: 13px 20px; font-size: 11px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 100%, 0 100%); }

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--dim);
}

.hint kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
}

/* ---------- options ---------- */

.opts { display: grid; gap: 10px; max-width: 640px; }

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease);
}

.opt:hover { border-color: var(--line-hi); transform: translateX(3px); }

/* The native control stays in the DOM for semantics and keyboard behaviour. */
.opt-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.opt-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.opt-label {
  flex: 1;
  font-size: 17px;
  line-height: 1.35;
}

.opt-mark {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-hi);
  border-radius: 2px;
  position: relative;
  transition: all 0.2s ease;
}

.opt-mark::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--ink);
  opacity: 0;
  clip-path: polygon(14% 46%, 0 60%, 40% 100%, 100% 22%, 86% 8%, 38% 70%);
  transition: opacity 0.15s ease;
}

/* A square mark reads as "pick several". Single-choice gets a radio dot instead,
   so the control tells the truth about how many answers it accepts. */
.opt:has(.opt-input[type='radio']) .opt-mark { border-radius: 50%; }

.opt:has(.opt-input[type='radio']) .opt-mark::after {
  inset: 5px;
  border-radius: 50%;
  clip-path: none;
}

.opt:has(.opt-input:checked) {
  border-color: var(--accent);
  background: rgb(238 150 75 / 8%);
}

.opt:has(.opt-input:checked) .opt-key {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.opt:has(.opt-input:checked) .opt-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.opt:has(.opt-input:checked) .opt-mark::after { opacity: 1; }

.opt:has(.opt-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.opt-other { margin-top: 12px; max-width: 640px; }

/* ---------- text fields ---------- */

.field-wrap {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 640px;
}

.field {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-hi);
  border-radius: 0;
  padding: 12px 2px;
  /* 16px minimum on mobile: anything smaller makes iOS zoom the viewport on focus. */
  font-size: 16px;
  color: var(--paper);
  outline: none;
  transition: border-color 0.25s ease;
}

.field::placeholder { color: var(--dim); }
.field:focus { border-bottom-color: var(--accent); }

.field-lg { font-size: clamp(18px, 2.4vw, 26px); padding: 14px 2px; }
.field-area { resize: none; line-height: 1.55; font-size: clamp(16px, 1.6vw, 19px); min-height: 92px; }

.field-number {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 900;
  font-size: clamp(40px, 7vw, 72px);
  letter-spacing: -0.03em;
  padding: 6px 2px;
  max-width: 220px;
}

.field-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.number-wrap { align-items: baseline; }

.has-prefix .field-prefix {
  font-size: clamp(18px, 2.4vw, 26px);
  color: var(--dim);
}

.field-counter {
  position: absolute;
  right: 2px;
  bottom: -22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--dim);
}

/* ---------- scale ---------- */

.scale { max-width: 640px; }

.scale-track {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}

.scale-step { position: relative; display: block; }

.scale-face {
  display: grid;
  place-items: center;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  font-family: 'Inter Tight', sans-serif;
  font-weight: 900;
  font-size: 17px;
  color: var(--muted);
  transition: all 0.18s var(--ease);
}

.scale-step:hover .scale-face { border-color: var(--line-hi); color: var(--paper); }

.scale-step:has(.opt-input:checked) .scale-face {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
  transform: translateY(-4px);
}

.scale-step:has(.opt-input:focus-visible) .scale-face {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- consent ---------- */

.consent { max-width: 640px; }
.opt-consent { align-items: flex-start; padding: 20px; }
.opt-consent .opt-label { font-size: 16px; line-height: 1.6; }
.opt-consent .opt-mark { margin-top: 2px; }

.consent-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
  text-underline-offset: 4px;
}

.consent-link:hover { color: var(--accent); }

/* ---------- mobile ---------- */

@media (max-width: 720px) {
  :root { --shell: calc(100% - 36px); }

  .screen { padding: 84px 0 36px; }
  .statement-head { font-size: clamp(28px, 8.4vw, 40px); }
  .q-label { font-size: clamp(23px, 6.6vw, 32px); }
  .opt { min-height: 64px; }
  .opt-label { font-size: 16px; }
  .actions { gap: 14px; }
  .cta { width: 100%; justify-content: center; padding: 19px 24px; }
  .cta-sm { width: auto; }
  .hint { width: 100%; text-align: center; }

  /* Ten targets never fit one row on a phone. */
  .scale-track { grid-template-columns: repeat(5, 1fr); }
  .scale-face { height: 54px; }

  /* Side by side the two end labels collide on a 375px screen. */
  .scale-ends {
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
  }
}

/* ---------- completion ---------- */

.done-code {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  width: fit-content;
}

.done-code-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.done-code strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.cta:disabled { opacity: 0.6; cursor: progress; }
a.cta { text-decoration: none; }
