/* HomeCostMath — shared styles
   Tokens: sage paper, pine ink, tape-measure yellow for results. */

@font-face { font-family: "Barlow"; src: url("/assets/fonts/barlow-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/assets/fonts/barlow-600.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/assets/fonts/barlow-condensed-600.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("/assets/fonts/barlow-condensed-700.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #F3F5F1;
  --panel: #FFFFFF;
  --ink: #1E2B27;
  --ink-soft: #4F5D58;
  --line: #CFD7D1;
  --pine: #24614A;
  --pine-dark: #184634;
  --tape: #F4C430;
  --tape-deep: #E2B11E;
  --mark: #B8322A;

  --body: "Barlow", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", "Segoe UI", system-ui, sans-serif;

  --wrap: 1120px;
  --text: 68ch;
  --radius: 6px;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--pine); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--pine-dark); text-decoration-thickness: 2px; }

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

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2.3rem, 5.4vw, 3.5rem); letter-spacing: -0.005em; }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.55rem, 3vw, 1.9rem); margin-top: 2.2em; }
h3 { font-family: var(--body); font-weight: 600; font-size: 1.15rem; margin-top: 1.6em; }
p, ul, ol, dl { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
.site-header { background: var(--panel); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.45rem; letter-spacing: 0.005em; }
.logo:hover { color: var(--ink); }
.logo-mark { width: 30px; height: 30px; flex: none; }
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1rem; }
.site-nav a:hover { color: var(--pine); text-decoration: underline; }

/* Breadcrumbs */
.crumbs { display: flex; gap: 8px; font-size: 0.95rem; color: var(--ink-soft); padding-top: 22px; }
.crumbs a { color: var(--ink-soft); }

/* Home */
.hero { padding: 48px 0 36px; display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.15fr 0.85fr; padding: 72px 0 56px; gap: 56px; } }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.4rem); max-width: 14ch; margin-bottom: 0.35em; }
.hero-lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 46ch; margin-bottom: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 0; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--ink-soft); }

.calc-rows { list-style: none; margin: 0 0 56px; padding: 0; }
.calc-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 18px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.calc-row:hover { background: var(--panel); color: var(--ink); }
.calc-row:hover .calc-row-name { text-decoration: underline; text-decoration-thickness: 2px; }
.calc-row-name { font-family: var(--display); font-weight: 700; font-size: 1.6rem; line-height: 1.2; color: var(--pine-dark); }
.calc-row-blurb { grid-column: 1; color: var(--ink-soft); }
.calc-row-unit { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); background: var(--tape); padding: 2px 10px; border-radius: 3px; white-space: nowrap; }
@media (min-width: 720px) {
  .calc-row { grid-template-columns: 15rem 1fr auto; align-items: center; padding: 20px 8px; }
  .calc-row-blurb { grid-column: 2; }
  .calc-row-unit { grid-column: 3; grid-row: 1; }
}

.home-notes { display: grid; gap: 28px; padding-bottom: 64px; }
@media (min-width: 900px) { .home-notes { grid-template-columns: repeat(3, 1fr); gap: 40px; } }
.home-notes h2 { margin-top: 0; font-size: 1.45rem; }
.home-notes p { color: var(--ink-soft); margin: 0; }

/* Tape-measure result panel: the one loud element on the site */
.reading {
  position: relative;
  background: var(--tape);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 34px 22px 20px;
  box-shadow: inset 0 -3px 0 var(--tape-deep);
}
.reading::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  background:
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 96px) 0 0 / 100% 20px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px 48px) 0 0 / 100% 14px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 12px) 0 0 / 100% 8px no-repeat;
  background-position: 12px 0, 12px 0, 12px 0;
  opacity: 0.85;
}
.reading-label { margin: 0 0 2px; font-weight: 600; font-size: 1rem; }
.reading-value { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums lining-nums; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 10px; }
.reading-number { font-size: clamp(3.4rem, 9vw, 4.8rem); letter-spacing: -0.01em; }
.reading-unit { font-size: 1.7rem; font-weight: 600; }
.reading-sub { margin: 10px 0 0; font-size: 1.1rem; font-weight: 600; }
.reading-list { margin: 16px 0 0; padding: 0; border-top: 1.5px solid rgba(30, 43, 39, 0.35); }
.reading-list div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed rgba(30, 43, 39, 0.3); font-size: 0.98rem; }
.reading-list dt { margin: 0; }
.reading-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.reading-note { margin: 12px 0 0; font-size: 0.92rem; }
.reading.is-empty .reading-number { font-size: 2.4rem; }

.hero-example { display: block; text-decoration: none; }
.hero-example:hover { color: var(--ink); }
.hero-example .reading-label, .hero-example .reading-sub { display: block; }
.hero-example .reading-sub { font-weight: 400; max-width: 34ch; }
.hero-example .reading-cta { display: inline-block; margin-top: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 0.2em; }

/* Calculator page */
.page-head { padding: 14px 0 8px; }
.page-head h1 { margin-bottom: 0.25em; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; margin-bottom: 0.4em; }
.updated { font-size: 0.92rem; color: var(--ink-soft); margin: 0; }

.calc { display: grid; gap: 20px; margin: 26px auto 8px; align-items: start; }
@media (min-width: 900px) {
  .calc { grid-template-columns: 1.1fr 0.9fr; gap: 32px; }
  .calc .reading { position: sticky; top: 20px; }
}

.calc-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; }
@media (min-width: 720px) { .calc-form { padding: 26px 26px 22px; } }
.calc-form fieldset { border: 0; padding: 0; margin: 0 0 6px; min-width: 0; }
.calc-form legend { font-family: var(--display); font-weight: 600; font-size: 1.3rem; padding: 0; margin-bottom: 10px; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.fields.three { grid-template-columns: repeat(3, 1fr); }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 420px) { .fields.three { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-weight: 600; font-size: 0.98rem; }
.field-hint { font-size: 0.88rem; color: var(--ink-soft); }
.input-unit { position: relative; display: flex; }
.input-unit input { padding-right: 3.2rem; }
.input-unit .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-size: 0.95rem; pointer-events: none; }
.input-unit .unit-before { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.input-unit .unit-before + input { padding-left: 1.7rem; }

input[type="number"], select {
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-size: 1.08rem;
  color: var(--ink);
  background: var(--panel);
  border: 1.5px solid #AEB9B2;
  border-radius: 5px;
  padding: 8px 12px;
  font-variant-numeric: tabular-nums;
}
input[type="number"]:hover, select:hover { border-color: var(--ink-soft); }
input[type="number"]:focus, select:focus { border-color: var(--pine); outline: 2px solid var(--pine); outline-offset: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--pine); margin: 0; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 9px 16px; border: 1.5px solid #AEB9B2; border-radius: 999px; font-weight: 600; background: var(--panel); }
.segmented input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.segmented input:focus-visible + span { outline: 3px solid var(--pine); outline-offset: 2px; }

.optional-title { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 6px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }

[hidden] { display: none !important; }

/* Article content */
.article { max-width: var(--text); padding-bottom: 24px; }
.article > h2:first-child { margin-top: 1.4em; }
.article ul, .article ol { padding-left: 1.3em; }
.article li { margin-bottom: 0.4em; }
.article table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-variant-numeric: tabular-nums; background: var(--panel); }
.article caption { text-align: left; font-weight: 600; padding-bottom: 6px; }
.article th, .article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.article thead th { border-bottom: 2px solid var(--ink); font-weight: 600; }

.formula { background: var(--panel); border-left: 4px solid var(--tape); padding: 14px 18px; margin: 0 0 1.2em; font-size: 1.02rem; }
.formula p { margin: 0.2em 0; }
.formula strong { font-weight: 600; }

.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style-position: outside; margin-left: 1.1em; }
.faq summary::marker { color: var(--pine); }
.faq details p { margin: 0 0 14px 1.1em; }

.note { font-size: 0.95rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 2em; }

.related { max-width: var(--text); padding-bottom: 56px; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.related li a { font-weight: 600; }
.related li span { color: var(--ink-soft); }

/* Simple pages */
.contact-email { font-size: 1.3rem; font-weight: 600; }
.prose { max-width: var(--text); padding: 18px 0 64px; }
.prose h1 { margin-top: 0.4em; }

/* Footer */
.site-footer { background: var(--ink); color: #DCE3DE; margin-top: 24px; }
.site-footer a { color: #FFFFFF; }
.site-footer .logo, .site-footer .logo:hover { color: #FFFFFF; }
.footer-inner { display: grid; gap: 28px; padding-top: 40px; padding-bottom: 28px; }
@media (min-width: 820px) { .footer-inner { grid-template-columns: 2fr 1fr 1fr; gap: 48px; } }
.footer-brand p { margin: 12px 0 0; max-width: 44ch; font-size: 0.95rem; }
.footer-nav { display: flex; flex-direction: column; gap: 6px; }
.footer-title { font-family: var(--display); font-weight: 600; font-size: 1.2rem; color: #FFFFFF; margin: 0 0 4px; }
.footer-nav a { text-decoration: none; font-size: 0.98rem; }
.footer-nav a:hover { text-decoration: underline; color: #FFFFFF; }
.footer-base { border-top: 1px solid rgba(255, 255, 255, 0.15); padding-top: 14px; padding-bottom: 24px; font-size: 0.9rem; }
.footer-base p { margin: 0; }

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

@media print {
  .site-header, .site-footer, .related, .crumbs { display: none; }
  .reading { box-shadow: none; border: 2px solid #000; }
}
