:root {
  --ink: #152a32;
  --muted: #607078;
  --paper: #fbfaf5;
  --surface: #ffffff;
  --line: #dce3df;
  --teal: #006b62;
  --teal-dark: #00534d;
  --mint: #d9f3e9;
  --lime: #dff26b;
  --coral: #ff7b64;
  --warning: #fff3d6;
  --shadow: 0 18px 50px rgba(21, 42, 50, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif; line-height: 1.6; }
a { color: inherit; }
button, input, select { font: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; background: var(--ink); color: white; padding: .75rem 1rem; z-index: 100; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.shell { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }

.site-header { background: rgba(251,250,245,.95); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; font-weight: 800; font-size: 1.25rem; letter-spacing: -.04em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--teal); color: var(--lime); border-radius: 11px; font-size: .9rem; transform: rotate(-3deg); }
.nav-toggle { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 10px; padding: .55rem .8rem; font-weight: 700; }
.site-nav { display: none; position: absolute; top: 69px; left: 0; right: 0; background: var(--surface); padding: 1rem; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.site-nav.open { display: grid; }
.site-nav a { padding: .65rem .85rem; text-decoration: none; border-radius: 9px; font-weight: 600; font-size: .94rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--mint); color: var(--teal-dark); }

.hero { padding: 3.25rem 0 2rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border: 36px solid var(--lime); border-radius: 50%; right: -130px; top: 5px; opacity: .45; z-index: -1; }
.breadcrumb { color: var(--muted); font-size: .88rem; margin-bottom: 1.2rem; }
.breadcrumb a { text-decoration: none; }
.kicker, .eyebrow { margin: 0 0 .5rem; color: var(--teal); font-size: .78rem; line-height: 1.3; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
h1, h2, h3 { font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; line-height: 1.15; letter-spacing: -.04em; }
h1 { font-size: clamp(2.35rem, 8vw, 4.75rem); max-width: 850px; margin: 0 0 1rem; }
h2 { font-size: clamp(1.7rem, 4.5vw, 2.65rem); margin: 0 0 1rem; }
h3 { font-size: 1.15rem; }
.lede { max-width: 690px; color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.18rem); margin: 0; }
.trust-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.4rem; }
.trust-row span { background: white; border: 1px solid var(--line); border-radius: 999px; padding: .45rem .75rem; font-size: .85rem; font-weight: 600; }

.tool-layout { display: grid; gap: 1.25rem; align-items: start; padding-bottom: 4.5rem; }
.calculator-card, .result, .content-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.calculator-card { padding: clamp(1.1rem, 4vw, 2rem); box-shadow: var(--shadow); }
.card-head { margin-bottom: 1.4rem; }
.card-head h2 { font-size: 1.45rem; margin-bottom: .35rem; }
.card-head p { margin: 0; color: var(--muted); }
.fields { display: grid; gap: 1rem; }
label { display: grid; position: relative; gap: .4rem; color: #35474e; font-size: .88rem; font-weight: 700; }
input, select { width: 100%; min-height: 52px; background: #fcfcfa; color: var(--ink); border: 1.5px solid #becbc6; border-radius: 11px; padding: .7rem .8rem; font-size: 1.05rem; font-weight: 600; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,107,98,.1); outline: 0; }
.suffix { position: absolute; right: .85rem; bottom: .8rem; color: var(--muted); }
.data-row { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; align-items: end; padding: 1rem 0; border-top: 1px solid var(--line); }
.data-row:first-child { border-top: 0; padding-top: 0; }
.remove { grid-column: 1 / -1; justify-self: start; border: 0; padding: .25rem 0; color: #a13e31; background: transparent; font-size: .82rem; font-weight: 700; cursor: pointer; }
.add-button { width: 100%; margin-top: .7rem; padding: .75rem; border: 1.5px dashed var(--teal); color: var(--teal-dark); background: #f4fbf8; border-radius: 11px; font-weight: 800; cursor: pointer; }
.add-button:hover { background: var(--mint); }
.result { padding: clamp(1.2rem, 4vw, 2rem); border-top: 6px solid var(--teal); min-height: 160px; }
.result.success { border-top-color: #2b9e6e; background: #f5fcf8; }
.result.warning { border-top-color: #e4a32c; background: var(--warning); }
.result p { margin: .5rem 0 0; }
.result-title { font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 800; line-height: 1.3; letter-spacing: -.03em; }
.result-number { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; font-size: clamp(2.7rem, 9vw, 4.5rem); line-height: 1; font-weight: 800; letter-spacing: -.05em; }
.grade-badge { display: inline-flex; align-items: center; min-height: 38px; background: var(--lime); color: var(--ink); padding: .3rem .65rem; border-radius: 10px; font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; font-size: .9rem; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.content-wrap { background: #eef5f1; padding: 4.5rem 0; }
.content-grid { display: grid; gap: 1.25rem; }
.content-card { padding: clamp(1.2rem, 4vw, 2rem); }
.content-card p, .content-card li { color: #43565e; }
.formula { overflow-x: auto; background: var(--ink); color: white; border-radius: 13px; padding: 1.1rem 1.2rem; font: 600 .92rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.example { border-left: 5px solid var(--coral); background: #fff8f4; padding: 1rem 1.15rem; border-radius: 0 12px 12px 0; }
.faq { border-top: 1px solid var(--line); padding: 1rem 0; }
.faq:first-of-type { border-top: 0; }
.faq h3 { margin: 0 0 .4rem; }
.faq p { margin: 0; }

.grade-table-wrap { overflow-x: auto; margin-top: 1.5rem; max-height: 520px; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; text-align: right; }
th { position: sticky; top: 0; background: var(--ink); color: white; }
th, td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
tr.active td { background: var(--lime); font-weight: 800; }

.tools-section { padding: 4.5rem 0; }
.tools-grid { display: grid; gap: 1rem; }
.tool-link { display: block; min-height: 170px; padding: 1.3rem; border: 1px solid var(--line); border-radius: 18px; background: white; text-decoration: none; transition: transform .18s, box-shadow .18s; }
.tool-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tool-link span { color: var(--teal); font-weight: 800; }
.tool-link p { color: var(--muted); }
.home-hero { padding: clamp(4rem, 10vw, 7.5rem) 0 5rem; }
.home-hero h1 { max-width: 950px; }
.home-hero .accent { color: var(--teal); position: relative; }
.home-hero .accent::after { content: ""; position: absolute; height: 12px; left: 0; right: 0; bottom: 2px; background: var(--lime); z-index: -1; transform: rotate(-1deg); }
.home-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; padding: .7rem 1rem; background: var(--teal); color: white; text-decoration: none; font-weight: 800; }
.button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.site-footer { background: var(--ink); color: white; padding: 2.5rem 0; }
.footer-inner { display: flex; flex-direction: column; gap: 1rem; }
.site-footer p { color: #bdc9cc; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a { color: white; }

@media (min-width: 720px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; position: static; box-shadow: none; padding: 0; border: 0; background: transparent; }
  .site-nav a { padding: .45rem .55rem; font-size: .78rem; }
  .fields.two { grid-template-columns: repeat(2, 1fr); }
  .fields.three { grid-template-columns: repeat(3, 1fr); }
  .remove { grid-column: auto; padding: .8rem .2rem; }
  .data-row { grid-template-columns: 1fr 1fr 70px; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr 1fr; }
  .content-card.wide { grid-column: 1 / -1; }
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; }
}

@media (min-width: 960px) {
  .tool-layout { grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); }
  .result { position: sticky; top: 96px; }
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
  .site-nav a { padding-inline: .7rem; font-size: .84rem; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
@media print { .site-header, .site-footer, .nav-toggle, .add-button, .remove, .tools-section { display: none !important; } body { background: white; } .hero { padding-top: 1rem; } .result { position: static; } }
