/* RealCostCalc — shared styles. Change the brand colors in :root. */
:root {
  --paper: #F4F7F5;
  --card: #FFFFFF;
  --ink: #14231F;
  --muted: #55645E;
  --line: #D3DCD7;
  --green: #146C43;
  --green-ink: #0E5132;
  --green-soft: #E2EFE8;
  --hi: #FFE36E;
  --danger: #A8261B;
  --radius: 10px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1614;
    --card: #15201D;
    --ink: #E6EEEA;
    --muted: #9BABA4;
    --line: #2A3833;
    --green: #4CC38A;
    --green-ink: #7BD9AB;
    --green-soft: #173228;
    --hi: #7A6414;
    --danger: #F08A80;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, svg { max-width: 100%; }
a { color: var(--green-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .5rem 1rem; z-index: 10; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.prose { max-width: 68ch; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); background: var(--card); padding-top: env(safe-area-inset-top, 0px); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; padding: .6rem 0; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: .35rem 0; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--green); }

/* Headings */
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); font-weight: 800; margin: .4rem 0 .5rem; }
h2 { font-size: 1.45rem; font-weight: 800; margin: 2.4rem 0 .6rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.6rem 0 .3rem; }
.lede { color: var(--muted); font-size: 1.12rem; margin: 0 0 1.5rem; max-width: 60ch; }

.crumbs { font-size: .9rem; color: var(--muted); padding-top: 1.4rem; }
.crumbs a { color: var(--muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: .4rem; opacity: .6; }

/* Calculator layout */
.calc { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; margin: 1rem 0 2rem; }
@media (max-width: 820px) { .calc { grid-template-columns: 1fr; } }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.6rem); }
.panel h2 { margin-top: 0; font-size: 1.1rem; }
form.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.05rem; }
.field, .two > * { min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 460px) { .two { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }

.field { display: grid; gap: .35rem; }
.field > label, .field > .label { font-weight: 600; font-size: .95rem; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
.input {
  display: flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--card);
  min-height: 48px; transition: border-color .15s;
}
.input:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.input span { padding: 0 .75rem; color: var(--muted); font-weight: 600; }
.input input, .input select {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 1.05rem; padding: .7rem .75rem; outline: none;
}
.input span + input { padding-left: 0; }
.input input + span { padding-left: 0; }
.input select { cursor: pointer; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }

/* Segmented mode switch */
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 8px; padding: 3px; gap: 3px; background: var(--paper); }
.seg label { flex: 1; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .55rem .5rem; border-radius: 6px; font-weight: 600; font-size: .92rem; color: var(--muted); }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(20,35,31,.15); }
.seg input:focus-visible + span { outline: 3px solid var(--green); }

/* Result "stub" — the pay-stub look is the site's signature */
.stub {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius); padding: 1.6rem clamp(1.1rem, 3vw, 1.6rem) 1.3rem;
  border-top: 0; margin-top: 9px;
}
.stub::before {
  content: ""; position: absolute; left: -1px; right: -1px; top: -9px; height: 10px;
  background:
    radial-gradient(circle at 7px 0, transparent 5px, var(--line) 5px, var(--line) 6px, var(--card) 6.5px) 0 0 / 14px 10px repeat-x;
}
@media (min-width: 821px) { .stub { position: sticky; top: 1.2rem; } }
.stub-label { font-weight: 600; color: var(--muted); margin: 0; font-size: .95rem; }
.big {
  display: inline-block; font-size: clamp(2.3rem, 6vw, 3.3rem); font-weight: 800; letter-spacing: -.03em;
  line-height: 1.1; margin: .2rem 0 .3rem;
  background: linear-gradient(transparent 60%, var(--hi) 60%, var(--hi) 90%, transparent 90%);
  padding: 0 .1em;
}
.big-sub { margin: 0 0 1rem; color: var(--muted); font-size: .95rem; }
.rows { margin: .6rem 0 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .98rem; }
.row dt { color: var(--muted); }
.row dd { margin: 0; font-weight: 600; text-align: right; }
.row.total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: .25rem; padding-top: .7rem; }
.row.total dt, .row.total dd { color: var(--ink); font-weight: 800; }
.minus { color: var(--danger); }

table.ledger { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.ledger th, table.ledger td { padding: .5rem .4rem; text-align: right; border-bottom: 1px dashed var(--line); white-space: nowrap; }
table.ledger th:first-child, table.ledger td:first-child { text-align: left; }
table.ledger thead th { color: var(--muted); font-weight: 600; border-bottom: 1.5px solid var(--line); }
.scroll { overflow-x: auto; }

.bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: .6rem 0 .5rem; background: var(--line); }
.bar i { display: block; height: 100%; transition: width .3s; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--muted); margin: 0 0 .5rem; padding: 0; list-style: none; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: 0; }

.note { background: var(--green-soft); border-radius: 8px; padding: .75rem .9rem; font-size: .93rem; margin: 1rem 0 0; }
.warn { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--ink); border-left: 4px solid var(--danger); border-radius: 6px; padding: .75rem .9rem; font-size: .95rem; margin: .8rem 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
}
.btn:hover { border-color: var(--green); }
.stub-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }

/* Article content */
.content { padding-bottom: 2rem; }
.content p, .content li { max-width: 68ch; }
.formula { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 6px; padding: .8rem 1rem; font-weight: 600; overflow-x: auto; max-width: 68ch; }
.faq details { border-bottom: 1px solid var(--line); padding: .9rem 0; max-width: 68ch; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 800; color: var(--green); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: .6rem 0 0; color: var(--muted); }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; padding: 0; list-style: none; }
.related a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; text-decoration: none; color: var(--ink); font-weight: 600; }
.related a:hover { border-color: var(--green); }
.related small { display: block; color: var(--muted); font-weight: 400; }
.updated { font-size: .88rem; color: var(--muted); }

/* Home */
.hero { padding: clamp(2.2rem, 7vw, 4.5rem) 0 1.5rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); max-width: 16ch; }
.group { margin: 1.5rem 0 2.5rem; }
.group h2 { margin: 0 0 .2rem; }
.group > p { color: var(--muted); margin: 0 0 1rem; }
.tools { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.tools li { border-bottom: 1px solid var(--line); }
.tools a { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: 1rem .25rem; text-decoration: none; color: var(--ink); }
.tools a:hover { background: var(--card); }
.tools strong { font-size: 1.1rem; }
.tools span { color: var(--muted); grid-column: 1; font-size: .96rem; }
.tools em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-weight: 800; background: linear-gradient(transparent 60%, var(--hi) 60%, var(--hi) 90%, transparent 90%); }
@media (max-width: 520px) { .tools em { display: none; } .tools a { grid-template-columns: 1fr; } }

/* Footer */
.site-foot { border-top: 1px solid var(--line); background: var(--card); margin-top: 2rem; padding: 2rem 0 2.5rem; font-size: .92rem; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.5rem; }
.site-foot h2 { font-size: .95rem; margin: 0 0 .5rem; color: var(--ink); }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.site-foot a { color: var(--muted); }
.disclaimer { margin-top: 1.8rem; max-width: 80ch; font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .site-head, .site-foot, .stub-actions, .content, .crumbs { display: none; } body { background: #fff; } }
