/* Exypnord: Nord blue, black and bronze on background gray. Raleway for display, PT Sans for text.
   Layout follows the "product performs" direction: the working calculator is the hero. */

:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --ink: #141414;
  --muted: #4d4d4d;
  --accent: #2e2eff;
  --accent-ink: #ffffff;
  --accent-soft: #e8e8ff;

  /* "Kuidas summa kujuneb": one Nord-blue ramp from white to full blue, so the four steps read as a build-up. */
  --field-1: #ffffff;
  --field-1-ink: #141414;
  --field-2: #dcdcff;
  --field-2-ink: #141414;
  --field-3: #6e6ef9;
  --field-3-ink: #ffffff;
  --field-4: #2e2eff;
  --field-4-ink: #ffffff;
  --danger: #a5470a;

  --font-display: 'Raleway', 'Helvetica Neue', Arial, sans-serif;
  --font-text: 'PT Sans', 'Segoe UI', Arial, sans-serif;

  --step-small: 0.875rem; /* 14px */
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem); /* 17–19px */
  --step-lead: clamp(1.25rem, 1rem + 0.8vw, 1.75rem); /* 20–28px */
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem); /* 32–64px */
  --step-display: clamp(2.75rem, 1rem + 5.2vw, 5.5rem); /* 44–88px */

  --margin: clamp(1rem, 2.2vw, 2rem);
  --side: max(var(--margin), calc((100vw - 1240px) / 2)); /* content stays within ~1240px, wide screens get roomy sides */
  --gutter: clamp(1rem, 2vw, 2rem);
  --section: clamp(5rem, 12vw, 12rem);
  --radius: 0px; /* page-level shapes are square */
  --ui-radius: 6px; /* inside the calculator's own interface */

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-reveal: 800ms;
  color-scheme: light;
}

/* ——— Reset ——— */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-body) / 1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-anchor: none; /* with the sticky ledger, scroll anchoring made the page jump when the form grew */
  overflow-x: clip; /* the hero's glows spill past the edges */
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

:target {
  scroll-margin-top: 2rem;
}

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

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

.wrap {
  padding-inline: var(--side);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.display {
  font-size: var(--step-display);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-left: -0.04em;
}

.head {
  font-size: var(--step-head);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.lead {
  font-size: var(--step-lead);
  line-height: 1.35;
  max-width: 34ch;
}

.link {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
  transition: text-decoration-color var(--t-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .link:hover {
    text-decoration-color: currentColor;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.4rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}

.button:hover {
  background: var(--ink);
}

.button:active {
  transform: scale(0.97);
}

/* ——— Navigation ——— */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding-block: 28px;
  font-size: var(--step-small);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--ink);
  text-decoration: none;
  font: 800 clamp(22px, 1rem + 2vw, 40px) / 1 var(--font-display);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-brand img {
  height: 1.5em;
  width: auto;
}

.nav nav {
  display: flex;
  gap: 28px;
}

/* ——— Hero: the calculator ——— */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: start;
  padding-top: clamp(12px, 2vw, 32px);
}

.hero-text {
  grid-column: 1 / span 5;
  grid-row: 1;
  display: grid;
  gap: 20px;
  justify-items: start;
}

.hero-text .lead {
  margin-top: 8px;
}

.hero-form {
  grid-column: 1 / span 5;
  grid-row: 1;
  margin-top: 0;
}

/* Soft brand-colour glows behind the calculator: Nord blue left and right, a warm bronze hint between. */
.hero::before {
  content: '';
  position: absolute;
  inset: -8% -25% -15%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(28% 34% at 22% 78%, rgba(110, 110, 249, 0.45), transparent 70%),
    radial-gradient(18% 24% at 50% 42%, rgba(234, 114, 33, 0.16), transparent 70%),
    radial-gradient(26% 40% at 96% 58%, rgba(46, 46, 255, 0.32), transparent 70%);
  filter: blur(48px);
}

/* The result column: a plain card that sits level with the headline and stays in view. */
.stage {
  grid-column: 7 / -1;
  grid-row: 1 / span 2;
  align-self: stretch;
}

.ledger-note {
  max-width: 62ch;
  padding: 0 clamp(24px, 3.6vw, 56px) 32px;
  font-size: var(--step-small);
  line-height: 1.45;
  color: var(--muted);
}

/* ——— The calculator's own interface (data-ui) ——— */

.deal-form {
  font-size: 16px;
}

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

.deal-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.deal-picker legend,
.label,
.field > label:not(.switch),
.split-fields label {
  display: block;
  margin-bottom: 14px;
  font: 500 clamp(1.15rem, 1rem + 0.35vw, 1.35rem) / 1.2 var(--font-display);
  letter-spacing: -0.01em;
}

.split-fields label {
  font-size: 1rem;
}

.deal-picker label,
.choices label {
  position: relative;
  cursor: pointer;
}

.deal-picker input,
.choices input,
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.deal-picker span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--ui-radius);
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}

.deal-picker label:hover span {
  background: var(--accent-soft);
}

.deal-picker label:active span {
  transform: scale(0.98);
}

.deal-picker input:checked + span {
  background: var(--accent);
  color: var(--accent-ink);
}

.deal-picker input:focus-visible + span,
.choices input:focus-visible + span,
.switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.group {
  display: grid;
  gap: 36px;
}

.property-only {
  display: contents;
}

.field[hidden],
.group[hidden],
.property-only[hidden],
.extras[hidden] {
  display: none;
}

.money {
  display: flex;
  align-items: center;
  border-radius: var(--ui-radius);
  padding: 0 24px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px transparent;  /* taste-skill-ignore: inside the calculator (data-ui) */
  transition: box-shadow var(--t-hover) ease;
}

.money:focus-within {
  box-shadow: inset 0 0 0 2px var(--accent);  /* taste-skill-ignore: inside the calculator (data-ui) */
}

.money input,
.count,
select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 700 1.5rem/1.3 var(--font-text);
  font-variant-numeric: tabular-nums;
  padding: 10px 0;
}

.money input {
  font: 600 clamp(2.25rem, 1.5rem + 2vw, 3.5rem) / 1.1 var(--font-display); /* the total's face, two steps lighter */
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.03em;
  padding: 22px 0;
  outline: none;
}

.money input::placeholder {
  color: var(--muted);
}

.money span {
  font: 600 clamp(1.75rem, 1.2rem + 1.4vw, 2.75rem) / 1 var(--font-display);
  color: var(--ink);
}

.count {
  max-width: 10ch;
  font-size: 1.2rem;
  padding: 10px 20px;
  border-radius: var(--ui-radius);
  background: var(--surface);
}

.count:focus {
  box-shadow: inset 0 0 0 2px var(--accent); /* taste-skill-ignore: inside the calculator (data-ui) */
}

select {
  font: 400 16px/1.4 var(--font-text);
  padding: 15px 48px 15px 22px;
  border-radius: var(--ui-radius);
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23141414' stroke-width='2'/%3E%3C/svg%3E") right 22px center / 12px 8px no-repeat;
  cursor: pointer;
}

select:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent); /* taste-skill-ignore: inside the calculator (data-ui) */
}

[aria-invalid='true'] {
  color: var(--danger);
}

.money:has([aria-invalid='true']),
.count[aria-invalid='true'] {
  box-shadow: inset 0 0 0 2px var(--danger); /* taste-skill-ignore: inside the calculator (data-ui) */
}

.hint,
.error {
  margin-top: 8px;
  font-size: var(--step-small);
  line-height: 1.45;
  color: var(--muted);
}

.error {
  color: #a5470a;
  font-weight: 700;
}

.error:empty {
  display: none;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 32px;
}

/* Plain radio circles, like the result side: no tiles. */
.choices span {
  position: relative;
  display: block;
  padding-left: 34px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.choices span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px #c9c9c9; /* taste-skill-ignore: radio ring inside the calculator (data-ui) */
  transition: box-shadow var(--t-hover) ease;
}

.choices label:hover span::before {
  box-shadow: inset 0 0 0 1.5px var(--accent); /* taste-skill-ignore: radio ring inside the calculator (data-ui) */
}

.choices small,
.switch small {
  display: block;
  font-size: var(--step-small);
  font-weight: 400;
  color: var(--muted);
}

.choices input:checked + span::before {
  box-shadow: inset 0 0 0 7px var(--accent); /* taste-skill-ignore: filled radio inside the calculator (data-ui) */
}

.switch {
  position: relative;
  display: flex;
  cursor: pointer;
}

.switch span {
  position: relative;
  display: block;
  padding-left: 56px;
  font-weight: 700;
}

.switch span::before,
.switch span::after {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  transition: transform 0.2s var(--ease-out), background-color 0.2s ease;
}

.switch span::before {
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: #d9d9d9;
}

.switch span::after {
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: var(--surface);
}

.switch input:checked + span::before {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.remote {
  margin-top: 40px;
}

.remote .switch {
  padding: 16px 20px;
  border-radius: var(--ui-radius);
  background: var(--surface);
}

.extras {
  margin-top: 12px;
}

.extras summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 16px 22px;
  border-radius: var(--ui-radius);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
  font: 500 clamp(1.1rem, 1rem + 0.3vw, 1.25rem) / 1.2 var(--font-display);
  transition: background-color var(--t-hover) ease;
}

.extras summary:hover {
  background: var(--accent-soft);
}

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

.extras summary::-webkit-details-marker {
  display: none;
}

/* The + sits at the right end of the bar and turns into × while open. */
.extras summary::after {
  content: '+';
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: 400 24px/1 var(--font-text);
  transition: transform 0.42s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.extras[open]:not(.is-closing) summary::after {
  transform: rotate(45deg);
}

.extras summary small {
  font-family: var(--font-text);
  font-size: var(--step-small);
  font-weight: 400;
  color: var(--muted);
}

.extras .group {
  padding-top: 28px;
}

.min-hint {
  color: #a5470a;
  font-weight: 700;
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

/* ——— Ledger (data-ui) ——— */

.ledger {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  max-height: calc(100svh - 48px); /* the total always stays on screen; a long breakdown scrolls inside */
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  transition: opacity 0.25s ease;
}

.ledger-head {
  position: relative;
  z-index: 1;
  padding: clamp(32px, 3.4vw, 52px) clamp(24px, 3.6vw, 56px) 12px;
  background: var(--surface);
  transition: box-shadow var(--t-hover) ease;
}

/* Once the breakdown scrolls under the total, a soft shadow shows that lines are hidden above. */
.ledger.is-scrolled .ledger-head {
  box-shadow: 0 10px 18px -10px rgba(20, 20, 20, 0.28); /* taste-skill-ignore: scroll cue inside the calculator (data-ui) */
}

.ledger-title {
  font: 700 16px/1.3 var(--font-text);
}

.total {
  display: block;
  margin-top: 6px;
  font: 900 clamp(2.5rem, 1.6rem + 2.6vw, 4rem) / 1 var(--font-display);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.03em;
}

.basis {
  margin-top: 10px;
  font-size: 15px;
  color: var(--muted);
}

.ledger.updated .total {
  animation: refresh 0.4s var(--ease-out);
}

@keyframes refresh {
  from {
    opacity: 0.35;
  }
}

.ledger-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d6d6d6 transparent;
}

.breakdown {
  padding: 8px clamp(24px, 3.6vw, 56px) 24px;
}

.ledger.invalid .breakdown,
.ledger.invalid .ledger-head {
  opacity: 0.4;
}

.form-error {
  padding: 0 32px 24px;
  font-weight: 700;
  color: #a5470a;
}

.part {
  padding: 36px 0 4px;
}

.part-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.part-head h3,
.part-total {
  font: 500 clamp(1.4rem, 1.1rem + 0.8vw, 1.9rem) / 1.15 var(--font-display);
  letter-spacing: -0.01em;
}

.part-total {
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

/* The section total sits in the header now; the duplicate row stays for reference only. */
.subtotal.strong {
  display: none;
}

.ledger-cta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 24px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 17px/1.2 var(--font-text);
  text-decoration: none;
  transition: background-color var(--t-hover) ease;
}

.ledger-cta:hover {
  background: #1f1fd6;
}

.lines {
  padding: 0;
  list-style: none;
}

.line + .line {
  margin-top: 16px;
}

.row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.row-label {
  font-weight: 400;
}

.leader {
  flex: 1;
  min-width: 16px;
}

.amount {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.why {
  margin: 4px 0 8px;
  max-width: 62ch;
  font-size: 15px;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.chip {
  font-size: 13px;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 99px;
  color: var(--muted);
  background: var(--bg);
}

.chip a {
  color: inherit;
  text-decoration: none;
}

.chip:has(a) {
  color: var(--accent);
  background: var(--accent-soft);
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}

.chip:has(a):hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.subtotal {
  margin-top: 12px;
}

.subtotal .row-label {
  font-weight: 400;
  color: var(--muted);
}

.subtotal + .subtotal {
  margin-top: 4px;
}


.split .row + .row {
  margin-top: 6px;
}

.split .why {
  margin-top: 10px;
}

.empty {
  color: var(--muted);
}

.notes {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--ui-radius);
  background: #fbefe6;
  font-size: 15px;
}

.notes p + p {
  margin-top: 8px;
}

/* ——— Kuidas summa kujuneb: one card, four fields ——— */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: var(--section);
}

.field-step {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 84svh;
  padding: 28px var(--margin);
}

/* Each field carries a soft glow like the hero's, so the ramp feels lit rather than flat. */
.field-1 {
  background:
    radial-gradient(60% 45% at 85% 100%, rgba(110, 110, 249, 0.18), transparent 70%),
    var(--field-1);
  color: var(--field-1-ink);
}

.field-2 {
  background:
    radial-gradient(55% 40% at 20% 15%, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(60% 45% at 90% 95%, rgba(234, 114, 33, 0.14), transparent 70%),
    var(--field-2);
  color: var(--field-2-ink);
}

.field-3 {
  background:
    radial-gradient(60% 45% at 80% 20%, rgba(220, 220, 255, 0.45), transparent 70%),
    radial-gradient(70% 50% at 10% 100%, rgba(46, 46, 255, 0.55), transparent 70%),
    var(--field-3);
  color: var(--field-3-ink);
}

.field-4 {
  background:
    radial-gradient(55% 40% at 25% 20%, rgba(110, 110, 249, 0.75), transparent 70%),
    radial-gradient(50% 35% at 90% 100%, rgba(234, 114, 33, 0.28), transparent 70%),
    var(--field-4);
  color: var(--field-4-ink);
}

.step-heading {
  position: absolute;
  top: 28px;
  left: var(--margin);
  right: var(--margin);
  font-size: var(--step-lead);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.step-card {
  align-self: start;
  justify-self: center;
  width: min(300px, 100%);
  margin-top: 30svh;
  padding: 20px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--ui-radius);
  box-shadow: 0 0 0 1px #e3e3e3; /* taste-skill-ignore: data-ui receipt edge on the white field */
  font-size: 15px;
  transition: transform 300ms var(--ease-out);
}

.field-step:hover .step-card {
  transform: translateY(-6px);
}

.step-label {
  margin-bottom: 12px;
  font-weight: 700;
}

.receipt {
  margin: 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px;
  margin-inline: -8px;
  border-radius: 4px;
  color: var(--muted);
}

.receipt-row dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.receipt-row.is-new {
  background: var(--accent-soft);
  color: var(--ink);
}

.receipt-total {
  margin-top: 6px;
  color: var(--ink);
  font: 900 20px/1.2 var(--font-display);
}

.step-clause {
  font: 700 var(--step-lead) / 1.15 var(--font-display);
  letter-spacing: -0.015em;
  max-width: 14ch;
}

/* ——— Küsimused: sticky heading, filled tiles ——— */

.faq {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: start;
  margin-top: var(--section);
}

.faq-heading {
  grid-column: 1 / span 4;
  position: sticky;
  top: 96px;
  max-width: 9ch;
}

.faq-list {
  grid-column: 5 / -1;
  display: grid;
  gap: 8px;
}

.tile {
  background: var(--surface);
  border-radius: var(--radius);
  transition: background-color 240ms ease, color 240ms ease;
}

.tile summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 20px 72px 20px 24px;
  font: 500 var(--step-lead)/1.3 var(--font-display);
  cursor: pointer;
  list-style: none;
}

.tile summary::-webkit-details-marker {
  display: none;
}

.plus {
  position: absolute;
  right: 28px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
}

.plus::before,
.plus::after {
  content: '';
  position: absolute;
  left: 0;
  top: 6.5px;
  width: 16px;
  height: 3px;
  background: currentColor;
  transition: transform 240ms var(--ease-out);
}

.plus::after {
  transform: rotate(90deg);
}

.tile[open] {
  background: var(--accent);
  color: var(--accent-ink);
}

.tile[open] .plus::after {
  transform: rotate(0deg);
}

.tile:not([open]) summary:hover {
  background: var(--accent-soft);
}

.tile-body {
  display: grid;
  grid-template-rows: 1fr;
}

.tile-body > div {
  overflow: hidden;
}

.tile-body p {
  max-width: 52ch;
  padding: 0 24px 28px;
  font-size: var(--step-body);
}

/* ——— Footer: one quiet line ——— */

.footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--gutter);
  margin-top: 30svh;
  padding-bottom: 30px;
  font-size: var(--step-small);
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand a {
  display: inline-flex;
  transition: opacity var(--t-hover) ease;
}

.footer-brand a:hover {
  opacity: 0.75;
}

.footer-brand img {
  height: 28px;
  width: auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.footer-links a {
  color: var(--ink);
}

.footer-year {
  justify-self: end;
}

/* ——— Phone total bar ——— */

.total-bar {
  display: none;
}

/* ——— Motion (content is visible without script and with reduced motion) ——— */

@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] {
    opacity: 0;
    transform: translateY(18px);
    animation: rise var(--t-reveal) var(--ease-out) forwards;
    animation-delay: calc(var(--i, 0) * 90ms + 120ms);
  }

  .js [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out);
    transition-delay: calc(var(--i, 0) * 70ms);
  }

  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }

}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}


/* ——— Tablet ——— */

@media (max-width: 1100px) {
  .hero-text {
    grid-column: 1 / -1;
  }

  .hero-form {
    grid-column: 1 / -1;
  }

  .stage {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 32px;
  }

  .steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-step {
    min-height: 64svh;
    grid-template-rows: auto auto 1fr;
    padding: 24px var(--margin);
  }

  .step-heading {
    position: static;
    font-size: var(--step-lead);
    margin-bottom: 8px;
  }

  .step-clause {
    grid-row: 2;
  }

  .step-card {
    grid-row: 3;
    justify-self: start;
    margin-top: 32px;
  }
}

/* Tablet: in each stacked field the clause and the receipt share the width. */
@media (min-width: 761px) and (max-width: 1100px) {
  .field-step {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    column-gap: var(--gutter);
    align-items: end;
    min-height: 0;
    padding-block: 56px;
  }

  .step-heading {
    grid-column: 1;
    grid-row: 1;
  }

  .step-clause {
    grid-column: 1;
    grid-row: 2;
    max-width: none;
  }

  .step-card {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    margin-top: 0;
  }
}

/* The hero's glows spill sideways; clip them here so phones never get a wider layout viewport. */
main {
  overflow-x: clip;
}

/* ——— Phone ——— */

@media (max-width: 760px) {
  .nav nav {
    gap: 18px;
  }

  .nav nav {
    display: none;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 28px;
  }

  .hero-text,
  .hero-form,
  .stage {
    grid-column: 1;
  }

  .display {
    font-size: 11vw;
  }

  .faq-heading {
    font-size: var(--step-head);
  }

  .hero-form {
    grid-row: auto;
    margin-top: 0;
  }

  .money {
    padding: 0 22px;
  }

  .stage {
    grid-row: auto;
    margin-top: 0;
    margin-inline: calc(var(--margin) * -1);
  }

  .ledger {
    position: static;
    max-height: none;
    border-radius: 0;
  }

  .ledger-head,
  .breakdown,
  .ledger-note {
    padding-inline: 20px;
  }

  .field-step {
    min-height: 0;
    padding-block: 40px 48px;
  }

  .faq {
    grid-template-columns: minmax(0, 1fr);
  }

  .faq-heading {
    grid-column: 1;
    position: static;
    max-width: none;
    margin-bottom: 28px;
  }

  .faq-list {
    grid-column: 1;
    gap: 6px;
  }

  .tile summary {
    min-height: 64px;
    padding: 18px 60px 18px 20px;
  }

  .plus {
    right: 22px;
  }

  .tile-body p {
    padding: 0 20px 24px;
  }

  .footer {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 20svh;
    padding-bottom: 96px;
  }

  .footer-year {
    justify-self: start;
  }

  .total-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px var(--margin) calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--ink);
    color: var(--accent-ink);
    text-decoration: none;
    box-shadow: 0 -8px 24px rgb(20 20 20 / 0.18); /* taste-skill-ignore: sticky bar floats over content */
    transition: transform 240ms var(--ease-out);
  }

  .total-bar {
    font: 700 var(--step-lead)/1 var(--font-display);
    transform: translateY(110%);
  }

  .total-bar-figure {
    font-weight: 900;
    font-variant-numeric: tabular-nums;
  }

  .show-total-bar .total-bar {
    transform: none;
  }

  /* Calculator: denser pickers, nothing that wraps awkwardly. */
  .nav {
    padding-block: 20px;
  }

  .hero {
    padding-top: 4px;
  }

  .hero::before {
    inset: 0 -10% -5%;
    filter: blur(32px);
  }

  .deal-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 32px;
  }

  .deal-picker span {
    justify-content: center;
    height: 100%;
    min-height: 52px;
    padding: 10px 12px;
    text-align: center;
  }

  .group {
    gap: 30px;
  }

  .choices {
    flex-direction: column;
    gap: 14px;
  }

  .remote {
    margin-top: 32px;
  }

  .extras {
    margin-top: 12px;
  }

  .extras summary small {
    display: none;
  }

  .split-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .count {
    max-width: none;
    width: 100%;
  }

  .stage {
    margin-top: 40px;
  }

  .ledger-head {
    padding-top: 28px;
  }

  .part {
    padding-top: 28px;
  }

  .ledger-cta {
    padding: 20px;
  }

  /* "Kuidas summa kujuneb": compact stacked steps, receipts at full width. */
  .steps {
    margin-top: 48px;
  }

  .field-step {
    padding: 36px var(--margin) 40px;
  }

  .step-heading {
    font-size: 1.75rem;
    margin-bottom: 20px;
  }

  .step-clause {
    max-width: none;
    font-size: 1.35rem;
  }

  .step-card {
    justify-self: stretch;
    width: auto;
    margin-top: 20px;
  }

  .faq {
    margin-top: 72px;
  }

  .footer {
    margin-top: 72px;
    justify-items: center;
    gap: 20px;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
    gap: 10px 20px;
  }

  .footer-year {
    justify-self: center;
  }

  /* The floating total: brand blue, with the label it stands for. */
  .total-bar {
    align-items: center;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--accent);
    font: 700 1.05rem/1 var(--font-text);
  }

  .total-bar-figure {
    font: 900 1.6rem/1 var(--font-display);
    letter-spacing: -0.02em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Rows the ledger keeps for reference but does not show (e.g. a subtotal that would only repeat the line above). */
.row[hidden] {
  display: none;
}

.subtotal[hidden] + .subtotal {
  margin-top: 12px;
}

/* Extra-service amounts are secondary: keep their inputs compact. */
.extras .money input {
  font-size: 1.5rem;
  padding: 12px 0;
}

.extras .money span {
  font-size: 1.25rem;
}
