:root {
  --navy: #102a2c;
  --navy-soft: #183b3e;
  --paper: #f7f2e8;
  --paper-light: #fffdf8;
  --ink: #182322;
  --muted: #64706d;
  --line: #d9d2c4;
  --gold: #d6a936;
  --gold-light: #f3df9e;
  --green: #2c775c;
  --red: #9b3434;
  --shadow: 0 22px 60px rgb(16 42 44 / 12%);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: #e9e5dc;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

a { color: inherit; }

.hero {
  position: relative;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(rgb(255 255 255 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px),
    var(--navy);
  background-size: 36px 36px;
}

.hero::after {
  position: absolute;
  inset: auto -8% -90px auto;
  width: 420px;
  height: 420px;
  border: 1px solid rgb(214 169 54 / 30%);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgb(214 169 54 / 5%), 0 0 0 120px rgb(214 169 54 / 3%);
  content: "";
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 40px));
  min-height: 430px;
  margin: 0 auto;
  padding: 30px 0 72px;
}

.hero__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lang-switch { display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px 8px 8px; border: 1px solid rgb(255 255 255 / 25%); border-radius: 999px; color: #e6ece9; font-size: .78rem; font-weight: 700; text-decoration: none; transition: border-color .18s, background .18s; }
.lang-switch:hover { border-color: var(--gold); background: rgb(214 169 54 / 12%); color: white; }
.lang-switch__flag { display: grid; min-width: 30px; padding: 3px 6px; place-items: center; border-radius: 999px; background: var(--gold-light); color: var(--navy); font-family: ui-monospace, monospace; font-size: .66rem; font-weight: 850; letter-spacing: .04em; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: white; font-weight: 800; text-decoration: none; letter-spacing: .02em; }
.brand__seal { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-light); font-family: Georgia, serif; }
.hero__copy { max-width: 790px; margin-top: 64px; }
.eyebrow { margin: 0 0 10px; color: var(--gold-light); font-size: .76rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow--gold { color: #705510; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 20px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 7vw, 5.8rem); font-weight: 500; letter-spacing: -.055em; line-height: .95; }
h1 em { color: var(--gold-light); font-weight: inherit; }
.hero__lead { max-width: 680px; margin: 0; color: #d8e0dd; font-size: clamp(1rem, 2vw, 1.2rem); }
.hero__stamp { position: absolute; right: 4%; bottom: 48px; display: grid; width: 158px; height: 158px; place-content: center; border: 3px double var(--gold); border-radius: 50%; color: var(--gold-light); text-align: center; text-transform: uppercase; transform: rotate(-8deg); }
.hero__stamp span, .hero__stamp small { font-size: .64rem; letter-spacing: .14em; }
.hero__stamp strong { font-family: Georgia, serif; font-size: 1.35rem; }

.page-shell { width: min(1160px, calc(100% - 32px)); margin: -38px auto 70px; position: relative; z-index: 2; }
.calculator { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr); gap: 22px; align-items: stretch; }
.paper-card, .result-card { border: 1px solid rgb(24 35 34 / 10%); border-radius: var(--radius); box-shadow: var(--shadow); }
.paper-card { background: var(--paper-light); }
.input-card { padding: clamp(24px, 4vw, 42px); }
.section-heading h2 { margin: 4px 0 3px; font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.25rem); font-weight: 600; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: var(--muted); }
.section-number { color: var(--green); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.section-heading--row, .section-heading--wide { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-heading--wide > p { max-width: 510px; }

.primary-fields { display: grid; gap: 20px; margin-top: 30px; }
.field { display: grid; gap: 7px; }
.field > span:first-child, .endings legend { font-size: .78rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.field small { color: var(--muted); }
.money-input, .unit-input { display: flex; overflow: hidden; border: 1px solid #b9b5ac; border-radius: 10px; background: white; transition: box-shadow .18s, border-color .18s; }
.money-input:focus-within, .unit-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgb(44 119 92 / 14%); }
.money-input input, .unit-input input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 13px 14px; background: transparent; color: var(--ink); font-size: 1.08rem; font-weight: 750; }
.money-input b, .unit-input b { display: grid; place-items: center; padding: 0 14px; color: var(--muted); background: #f0ede6; font-size: .82rem; }

.fine-settings { margin-top: 26px; border-top: 1px dashed var(--line); padding-top: 18px; }
.fine-settings summary { color: var(--green); font-weight: 750; cursor: pointer; }
.secondary-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.endings { grid-column: 1 / -1; display: flex; gap: 8px; margin: 0; padding: 0; border: 0; flex-wrap: wrap; }
.endings legend { width: 100%; margin-bottom: 7px; }
.endings label input { position: absolute; opacity: 0; }
.endings label span { display: block; min-width: 56px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; text-align: center; font-weight: 800; }
.endings label input:checked + span { border-color: var(--gold); background: #fff4c9; }
.endings label input:focus-visible + span { outline: 3px solid rgb(44 119 92 / 30%); outline-offset: 2px; }
.form-error { margin-top: 18px; padding: 12px 14px; border-left: 4px solid var(--red); background: #fceaea; color: #6f2020; }

.result-card { position: relative; overflow: hidden; padding: clamp(25px, 4vw, 42px); color: white; background: var(--navy); }
.result-card::before { position: absolute; inset: 0; background: radial-gradient(circle at 85% 10%, rgb(214 169 54 / 18%), transparent 34%); content: ""; pointer-events: none; }
.result-card > * { position: relative; }
.result-card__topline { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.result-card h2 { margin-bottom: 0; font-size: 1rem; font-weight: 650; }
.status-dot { display: flex; gap: 7px; align-items: center; color: #c9d8d4; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; text-align: right; }
.status-dot i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #72d6a4; box-shadow: 0 0 0 4px rgb(114 214 164 / 13%); }
.hero-price { margin: 58px 0 42px; }
.hero-price span { display: block; margin-bottom: 2px; color: #b7c9c5; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.hero-price strong { display: block; color: var(--gold-light); font-family: Georgia, serif; font-size: clamp(3rem, 7vw, 5rem); font-weight: 500; letter-spacing: -.05em; line-height: 1; }
.breakdown { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0; overflow: hidden; border: 1px solid rgb(255 255 255 / 12%); border-radius: 10px; background: rgb(255 255 255 / 12%); }
.breakdown div { padding: 14px; background: rgb(255 255 255 / 5%); }
.breakdown dt { color: #aebfbc; font-size: .7rem; }
.breakdown dd { margin: 3px 0 0; font-weight: 800; }
.rounding-note { display: flex; gap: 12px; margin: 24px 0; color: #cfdbd8; font-size: .82rem; }
.rounding-note p { margin: 0; }
.rounding-note__icon { display: grid; width: 28px; height: 28px; flex: none; place-items: center; border: 1px solid rgb(255 255 255 / 22%); border-radius: 50%; color: var(--gold-light); }
.copy-button { width: 100%; padding: 13px 18px; border: 1px solid var(--gold); border-radius: 10px; color: var(--navy); background: var(--gold-light); font-weight: 850; }
.copy-button:hover { background: #ffe99d; }

.installment-card, .method-card { margin-top: 22px; padding: clamp(24px, 4vw, 40px); }
.table-wrap { overflow-x: auto; margin-top: 15px; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th:last-child, td:last-child { text-align: left; }
tbody tr.is-adjustment { background: #fff7da; }

.comparison-card { margin-top: 64px; padding: clamp(24px, 4vw, 40px); }
.comparison-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
.comparison-delta { min-height: 1.4em; margin: 18px 0 0; color: var(--green); font-size: .84rem; font-weight: 750; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 14px; }
.comparison-column { padding: 20px; border: 1px solid #cfc8ba; border-radius: 14px; background: var(--paper-light); }
.comparison-column__head { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.comparison-column__label { color: var(--green); font-family: ui-monospace, monospace; font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.comparison-column__head strong { display: block; margin: 8px 0 6px; font-family: Georgia, serif; font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 600; }
.comparison-column__meta { margin: 0; color: var(--muted); font-size: .76rem; }
.comparison-column__rounding { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .73rem; }
.comparison-column__rounding b { color: var(--ink); font-weight: 750; }
.comparison-column th:last-child, .comparison-column td:last-child { text-align: right; }
.comparison-column tbody th { font-weight: 750; }
.comparison-column tfoot th, .comparison-column tfoot td { border-top: 2px solid var(--gold); border-bottom: none; font-weight: 800; }
.comparison-column tr.is-adjustment { background: #fff7da; }
.cent-flag { border: none; color: var(--gold); cursor: help; font-weight: 800; text-decoration: none; }
.fraction-cell { color: var(--muted); font-family: ui-monospace, monospace; font-size: .72rem; white-space: nowrap; }
.fraction-cell i { font-style: normal; }
.fraction-cell .rounds-up { color: var(--gold); }
.fraction-cell .rounds-down { color: #9aa39c; }
.comparison-card .disclaimer { margin-top: 20px; }

.golden-section { margin-top: 64px; }
.golden-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 24px; }
.golden-card { display: flex; min-height: 205px; flex-direction: column; padding: 20px; border: 1px solid #cfc8ba; border-radius: 14px; background: var(--paper-light); }
.golden-card--best { border: 2px solid var(--gold); background: #fff7da; transform: translateY(-5px); box-shadow: 0 16px 40px rgb(87 65 9 / 12%); }
.golden-card__label { color: var(--green); font-family: ui-monospace, monospace; font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.golden-card strong { margin: 18px 0 8px; font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 600; }
.golden-card p { color: var(--muted); font-size: .78rem; }
.golden-card button { margin-top: auto; padding: 9px 10px; border: 1px solid var(--navy); border-radius: 8px; background: transparent; color: var(--navy); font-weight: 750; }
.golden-card button:hover { color: white; background: var(--navy); }
.empty-state { display: flex; gap: 18px; align-items: center; margin-top: 24px; padding: 25px; border: 1px dashed #aaa397; border-radius: 14px; background: rgb(255 255 255 / 45%); }
.empty-state > span { font-size: 2rem; }
.empty-state p { margin: 2px 0 0; color: var(--muted); }

.method-card { display: grid; grid-template-columns: .8fr 1.7fr; gap: 40px; margin-top: 64px; }
.method-card ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0; padding: 0; list-style: none; }
.method-card li { padding-left: 14px; border-left: 2px solid var(--gold); }
.method-card li > span { color: var(--green); font-family: ui-monospace, monospace; font-size: .7rem; }
.method-card li p { margin: 7px 0 0; font-size: .82rem; }
.disclaimer { grid-column: 1 / -1; margin: 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }

footer { display: flex; width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 45px; border-top: 1px solid #c9c4ba; justify-content: space-between; gap: 24px; color: var(--muted); font-size: .76rem; }
footer p { margin: 0; }
footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
footer a:hover { color: var(--ink); }

button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgb(214 169 54 / 55%); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 980px) {
  .hero__stamp { opacity: .38; }
  .calculator { grid-template-columns: 1fr; }
  .golden-grid { grid-template-columns: repeat(2, 1fr); }
  .comparison-grid { grid-template-columns: 1fr; }
  .method-card { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .hero__inner { min-height: 390px; padding-bottom: 62px; }
  .hero__copy { margin-top: 54px; }
  .hero__stamp { display: none; }
  .page-shell { width: min(100% - 20px, 1160px); }
  .secondary-fields, .method-card ol, .comparison-fields { grid-template-columns: 1fr; }
  .golden-grid { grid-template-columns: 1fr; }
  .golden-card--best { transform: none; }
  .section-heading--row, .section-heading--wide, .result-card__topline, footer { align-items: flex-start; flex-direction: column; }
  .breakdown { grid-template-columns: 1fr; }
  .hero-price { margin-top: 42px; }
}

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

@media print {
  body { background: white; }
  .hero, .input-card, .golden-section, footer, .copy-button, .lang-switch { display: none; }
  .page-shell { width: 100%; margin: 0; }
  .calculator { display: block; }
  .result-card { color: black; background: white; box-shadow: none; }
  .result-card * { color: black !important; }
  .paper-card { box-shadow: none; }
}
