:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #596273;
  --paper: #fffaf2;
  --card: #ffffff;
  --line: #d7d3ca;
  --input-line: #9ca3af;
  --accent: #183f77;
  --accent-hover: #102f5b;
  --focus: #ffbf47;
  --success: #1f6b45;
  --error: #9f2525;
  --page: 36rem;
  --header-offset: 4.25rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  background: var(--paper);
  box-shadow: 0 1px 0 var(--line);
}

.site-header .brand,
.page-shell,
.site-footer {
  width: 100%;
  max-width: var(--page);
  margin-left: auto;
  margin-right: auto;
  padding-inline: 20px;
}

.site-header .brand {
  display: inline-block;
  padding-top: 16px;
  padding-bottom: 14px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.page-shell {
  flex: 1;
  display: flex;
  align-items: flex-start;
  padding-top: clamp(16px, 4vh, 40px);
  padding-bottom: 40px;
}

.conversion {
  width: 100%;
}

#alku {
  scroll-margin-top: var(--header-offset);
}

h1 {
  margin: 0 0 20px;
  max-width: 16ch;
  font-size: clamp(2rem, 8vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.form-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 22px 28px;
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.08);
}

.wizard-meta {
  margin-bottom: 22px;
}

.phase {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.progress span {
  height: 8px;
  border-radius: 999px;
  background: #d7d3ca;
}

.progress span.is-done,
.progress span.is-current {
  background: var(--accent);
}

.wizard-step {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  font-size: 1rem;
  font-weight: 700;
}

.optional {
  color: var(--muted);
  font-weight: 600;
}

input:not([type="checkbox"]) {
  width: 100%;
  min-height: 58px;
  border: 2px solid var(--input-line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
}

input:not([type="checkbox"])[aria-invalid="true"] {
  border-color: var(--error);
}

input::placeholder {
  color: #7b8190;
  opacity: 1;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
.success-panel:focus-visible,
.legal-note:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.actions {
  display: grid;
  gap: 10px;
}

button {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 10px;
  padding: 14px 20px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-secondary {
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
}

.button-secondary:hover {
  background: #eef3fb;
}

.button-ghost {
  min-height: 52px;
  background: transparent;
  color: var(--muted);
}

.button-ghost:hover {
  background: #f3eee6;
  color: var(--ink);
}

.field-error {
  margin: 0;
  color: var(--error);
  font-size: 0.95rem;
  font-weight: 700;
}

.consent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.consent input[type="checkbox"] {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.consent label {
  display: block;
  line-height: 1.4;
  font-size: 1.02rem;
  overflow-wrap: break-word;
}

.consent-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 12px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.consent-links a,
.consent-links span {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.consent-links a {
  color: var(--accent);
  font-weight: 700;
}

.consent .field-error {
  margin-top: 8px;
}

.form-status {
  min-height: 0;
  margin-top: 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.form-status:empty {
  display: none;
}

.form-status.error {
  color: var(--error);
}

.success-panel {
  display: grid;
  gap: 8px;
  padding: 10px 0 4px;
}

.success-panel h2 {
  margin: 0;
  color: var(--success);
  font-size: 1.7rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.success-panel p {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
}

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

.site-footer {
  padding-top: 8px;
  padding-bottom: 36px;
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0 6px;
  border-top: 1px solid var(--line);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
}

.footer-links a {
  color: var(--accent);
  font-weight: 700;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.legal-note {
  margin-top: 16px;
  padding: 20px 18px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  overflow-wrap: break-word;
  scroll-margin-top: calc(var(--header-offset) + 12px);
}

.legal-note:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 63, 119, 0.16);
}

.legal-note h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.legal-note p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
}

.legal-note p + p {
  margin-top: 12px;
}

.legal-note a {
  color: var(--accent);
  font-weight: 700;
}

code {
  font-size: 0.95em;
}

@media (min-width: 720px) {
  :root {
    font-size: 19px;
    --header-offset: 4.5rem;
  }

  .site-header .brand,
  .page-shell,
  .site-footer {
    padding-inline: 24px;
  }

  .page-shell {
    padding-top: 32px;
    padding-bottom: 56px;
  }

  .form-card {
    padding: 30px 28px 32px;
  }

  .legal-note {
    padding: 24px 24px 26px;
  }
}

@media (max-width: 430px) {
  .form-card {
    border-radius: 18px;
    padding: 22px 16px 24px;
  }

  .consent {
    padding: 14px;
    gap: 12px;
  }

  .legal-note {
    padding: 18px 16px 20px;
  }
}

@media (max-width: 380px) {
  .site-header .brand,
  .page-shell,
  .site-footer {
    padding-inline: 16px;
  }

  .footer-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .consent-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .consent-links span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
