@layer reset, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, p, ol, fieldset { margin: 0; }
  button, input, textarea { font: inherit; }
}

@layer base {
  :root {
    --night: #171d45;
    --night-deep: #10152f;
    --sky: #63d5ff;
    --paper: #f5f3ed;
    --white: #ffffff;
    --ink: #171a2f;
    --muted: #626779;
    --line: #d7d5cf;
    --coral: #ff785f;
    --success: #14745a;
    --error: #b4382a;
    --radius: 2px;
  }

  body {
    min-width: 320px;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  [hidden] { display: none !important; }

  :focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
  ::selection { background: var(--sky); color: var(--night); }
}

@layer components {
  .skip-link {
    position: fixed; z-index: 100; top: 12px; left: 12px; transform: translateY(-150%);
    padding: 10px 14px; background: var(--white); color: var(--night); font-weight: 800;
  }
  .skip-link:focus { transform: translateY(0); }

  .masthead { background: var(--night); color: var(--white); border-bottom: 1px solid rgba(255,255,255,.16); }
  .masthead__inner { width: min(1180px, calc(100% - 48px)); min-height: 72px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
  .brand-mark { font-weight: 900; letter-spacing: .08em; }
  .brand-mark::after { content: ""; display: inline-block; width: 38px; height: 5px; margin-left: 10px; background: var(--sky); vertical-align: .16em; }
  .masthead__meta { color: #d6daf4; font-size: .83rem; letter-spacing: .035em; }

  .intro { position: relative; overflow: hidden; min-height: 520px; background: var(--night); color: var(--white); display: grid; align-items: center; }
  .intro__content { position: relative; z-index: 2; width: min(1180px, calc(100% - 48px)); margin: auto; padding: 78px 0 92px; }
  .eyebrow { color: var(--sky); font-size: .75rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
  .intro h1 { max-width: 850px; margin-top: 22px; font-size: clamp(3rem, 7vw, 6.9rem); line-height: .94; letter-spacing: -.065em; text-wrap: balance; }
  .intro__lead { max-width: 660px; margin-top: 32px; color: #dce0f5; font-size: clamp(1.05rem, 2vw, 1.35rem); }
  .intro__facts { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: 44px; color: #cbd0e9; font-size: .86rem; }
  .intro__facts span { display: inline-flex; align-items: baseline; gap: 8px; }
  .intro__facts strong { color: var(--sky); font-size: 1.55rem; line-height: 1; }
  .intro__map { position: absolute; inset: 0; opacity: .55; pointer-events: none; }
  .map-line { position: absolute; right: -6vw; width: 62vw; height: 1px; background: linear-gradient(90deg, transparent, var(--sky)); transform-origin: right; animation: map-arrival .9s .18s both ease-out; }
  .map-line--one { top: 30%; --map-angle: -12deg; transform: rotate(var(--map-angle)); }
  .map-line--two { top: 60%; --map-angle: 18deg; transform: rotate(var(--map-angle)); background: linear-gradient(90deg, transparent, var(--coral)); animation-delay: .35s; }
  .map-dot { position: absolute; width: 17px; height: 17px; border: 3px solid var(--sky); border-radius: 50%; }
  .map-dot--start { right: 18%; top: 25%; }
  .map-dot--end { right: 7%; bottom: 23%; border-color: var(--coral); }

  .survey-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(48px, 8vw, 116px); padding: 96px 0 112px; }
  .journey__sticky { position: sticky; top: 32px; }
  .journey__label { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
  .journey ol { list-style: none; padding: 26px 0 22px 18px; border-left: 1px solid #c7c5c0; }
  .journey li { position: relative; display: grid; grid-template-columns: 34px 1fr; align-items: baseline; gap: 4px; padding: 12px 0; color: #8b8e99; transition: color .3s ease, transform .3s ease; }
  .journey li::before { content: ""; position: absolute; left: -23px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1px solid #aaa9a4; transition: background .3s ease, border-color .3s ease, transform .3s ease; }
  .journey li.is-active { color: var(--night); transform: translateX(4px); }
  .journey li.is-active::before { background: var(--sky); border-color: var(--night); transform: scale(1.3); }
  .journey li span { font-size: .68rem; font-weight: 800; }
  .journey li em { font-style: normal; font-weight: 700; }
  .journey__meter { height: 5px; overflow: hidden; background: #d7d5cf; }
  .journey__meter span { display: block; width: 0; height: 100%; background: var(--night); transition: width .35s ease; }
  .journey__count { margin-top: 10px; color: var(--muted); font-size: .74rem; }

  .survey { min-width: 0; }
  .chapter { padding-bottom: 96px; animation: enter .55s both ease-out; }
  .chapter:nth-of-type(2) { animation-delay: .08s; }
  .chapter:nth-of-type(3) { animation-delay: .16s; }
  .chapter:nth-of-type(4) { animation-delay: .24s; }
  .chapter__header { display: grid; grid-template-columns: 52px 1fr; gap: 18px; align-items: start; margin-bottom: 40px; padding-bottom: 18px; border-bottom: 4px solid var(--night); }
  .chapter__header > span { display: grid; place-items: center; width: 52px; height: 52px; background: var(--night); color: var(--sky); font-weight: 900; }
  .chapter__header p { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
  .chapter__header h2 { margin-top: 2px; color: var(--night); font-size: clamp(1.85rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.04em; }

  .question { min-width: 0; padding: 32px 0 38px; border: 0; border-bottom: 1px solid var(--line); }
  .question legend, .text-question > label { width: 100%; color: var(--ink); font-size: clamp(1.1rem, 2vw, 1.35rem); font-weight: 750; line-height: 1.35; }
  .question legend b { color: var(--coral); }
  .question__number { display: inline-block; min-width: 34px; color: var(--muted); font-size: .72rem; font-weight: 850; vertical-align: .16em; }
  .question small { color: var(--muted); font-size: .73rem; font-weight: 600; }

  .scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 22px; }
  .scale label { min-width: 0; cursor: pointer; }
  .scale input { position: absolute; opacity: 0; pointer-events: none; }
  .scale span { min-height: 78px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #bab9b4; background: transparent; transition: background .18s ease, color .18s ease, transform .18s ease, border-color .18s ease; }
  .scale strong { font-size: 1.3rem; }
  .scale small { display: block; margin-top: 2px; font-size: .64rem; text-align: center; }
  .scale label:hover span { border-color: var(--night); transform: translateY(-2px); }
  .scale input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 3px; }
  .scale input:checked + span { background: var(--night); border-color: var(--night); color: var(--white); }
  .scale input:checked + span::after { content: "✓"; position: absolute; margin: -52px 0 0 48px; color: var(--sky); font-weight: 900; }
  .scale input:checked + span small { color: #d9ddf4; }

  .choice-ledger { display: grid; margin-top: 22px; border-top: 1px solid #bdbcb7; }
  .choice-ledger label { cursor: pointer; }
  .choice-ledger input { position: absolute; opacity: 0; pointer-events: none; }
  .choice-ledger span { display: grid; grid-template-columns: 46px 1fr; align-items: center; min-height: 58px; border-bottom: 1px solid #bdbcb7; transition: background .18s ease, padding .18s ease; }
  .choice-ledger i { color: var(--muted); font-size: .72rem; font-style: normal; font-weight: 850; }
  .choice-ledger label:hover span { padding-left: 8px; background: #eceae4; }
  .choice-ledger input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: -3px; }
  .choice-ledger input:checked + span { padding-left: 12px; background: var(--night); color: var(--white); }
  .choice-ledger input:checked + span i { color: var(--sky); }
  .choice-ledger input:checked + span::after { content: "✓"; padding-right: 16px; color: var(--sky); font-weight: 900; }

  .other-field { display: none; margin-top: 18px; }
  .other-field.is-visible { display: grid; gap: 7px; }
  .other-field span { color: var(--muted); font-size: .75rem; font-weight: 700; }
  .other-field input, textarea { width: 100%; border: 1px solid #aaa9a4; border-radius: 0; background: #fbfaf7; color: var(--ink); }
  .other-field input { min-height: 48px; padding: 10px 12px; }
  textarea { margin-top: 14px; padding: 16px; resize: vertical; }
  textarea:focus, .other-field input:focus { border-color: var(--night); outline: 3px solid var(--sky); outline-offset: 0; }
  .char-count { display: block; margin-top: 4px; color: var(--muted); font-size: .68rem; text-align: right; }
  .field-error { min-height: 20px; margin-top: 8px; color: var(--error); font-size: .78rem; font-weight: 700; }
  .question.has-error { border-left: 4px solid var(--error); padding-left: 16px; }

  .submit-zone { display: grid; grid-template-columns: 1fr auto; gap: 24px 32px; align-items: end; padding: 44px; background: var(--night); color: var(--white); }
  .submit-zone h2 { margin-top: 8px; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1; letter-spacing: -.04em; }
  .submit-zone p:not(.eyebrow):not(.form-status) { max-width: 620px; margin-top: 18px; color: #d5d9ee; font-size: .9rem; }
  .submit-button { min-height: 58px; padding: 0 20px 0 24px; display: inline-flex; align-items: center; gap: 24px; border: 0; background: var(--sky); color: var(--night); font-weight: 850; cursor: pointer; transition: background .18s ease, transform .18s ease; }
  .submit-button:hover { background: var(--white); transform: translateY(-2px); }
  .submit-button:active { transform: translateY(1px); }
  .submit-button:disabled { cursor: wait; opacity: .7; transform: none; }
  .submit-button svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
  .form-status { grid-column: 1 / -1; min-height: 24px; color: #ffd5ce; font-size: .85rem; font-weight: 700; }

  .success-panel { width: min(760px, calc(100% - 48px)); margin: 84px auto 120px; padding: 72px; background: var(--night); color: var(--white); text-align: center; }
  .success-panel__mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 24px; border: 1px solid var(--sky); border-radius: 50%; color: var(--sky); font-size: 1.8rem; }
  .success-panel h2 { margin-top: 10px; font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1; letter-spacing: -.05em; }
  .success-panel > p:last-child { margin-top: 20px; color: #d5d9ee; }

  footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 36px; display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
  .honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
}

@layer utilities {
  @keyframes enter { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes map-arrival { from { opacity: 0; transform: rotate(var(--map-angle)) scaleX(.35); } to { opacity: 1; transform: rotate(var(--map-angle)) scaleX(1); } }

  @media (max-width: 780px) {
    .masthead__inner, .intro__content, .survey-shell, footer { width: min(100% - 32px, 700px); }
    .masthead__inner { min-height: 62px; }
    .masthead__meta { max-width: 150px; text-align: right; font-size: .65rem; }
    .brand-mark::after { width: 24px; }
    .intro { min-height: 500px; }
    .intro__content { padding: 64px 0 72px; }
    .intro h1 { font-size: clamp(3.1rem, 14vw, 5rem); }
    .intro__lead { margin-top: 26px; }
    .intro__facts { gap: 14px 20px; margin-top: 34px; }
    .map-line { right: -24vw; width: 100vw; }
    .survey-shell { display: block; padding: 40px 0 80px; }
    .journey { position: sticky; z-index: 10; top: 0; margin: 0 -16px 44px; padding: 12px 16px 10px; background: rgba(245,243,237,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
    .journey__sticky { position: static; }
    .journey__label, .journey li em, .journey__count { display: none; }
    .journey ol { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 0 10px; border: 0; }
    .journey li { display: block; padding: 0; text-align: center; }
    .journey li::before { position: static; display: inline-block; margin-right: 6px; vertical-align: -.06em; }
    .journey li.is-active { transform: none; }
    .chapter { padding-bottom: 72px; }
    .chapter__header { grid-template-columns: 44px 1fr; gap: 13px; margin-bottom: 20px; }
    .chapter__header > span { width: 44px; height: 44px; }
    .question { padding: 28px 0 32px; }
    .scale { gap: 5px; }
    .scale span { min-height: 74px; padding: 9px 2px; }
    .scale input:checked + span::after { margin: -50px 0 0 27px; }
    .scale small { font-size: .57rem; }
    .choice-ledger span { grid-template-columns: 34px 1fr; padding: 8px 4px; line-height: 1.3; }
    .choice-ledger input:checked + span { grid-template-columns: 34px 1fr 20px; padding-left: 8px; }
    .choice-ledger input:checked + span::after { padding-right: 4px; }
    .submit-zone { grid-template-columns: 1fr; padding: 30px 24px; }
    .submit-button { width: 100%; justify-content: space-between; }
    .success-panel { padding: 48px 24px; }
    footer { flex-direction: column; gap: 6px; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .chapter { animation: none; }
  }
}
