/* Freestimator — shared styles */
:root {
  --ink: #18242f;
  --slate: #2c3e4f;
  --steel: #5b6f80;
  --line: rgba(24, 36, 47, 0.12);
  --paper: #eef2f4;
  --card: rgba(255, 255, 255, 0.62);
  --card-solid: #ffffff;
  --tape: #f2b705;
  --teal: #12a594;
  --sky: #3a78c2;
  --good: #0f7a5c;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -22px rgba(24,36,47,.45);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --grad: linear-gradient(115deg, var(--tape), #ff8a3d, var(--teal), var(--sky), var(--tape));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-variation-settings: "wdth" 100;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

/* Ambient color field behind glass panels */
.ambient {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: var(--paper);
}
.ambient span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  animation: drift 26s ease-in-out infinite alternate;
}
.ambient span:nth-child(1) { width: 46vw; height: 46vw; background: #ffd65c; top: -12vw; left: -10vw; }
.ambient span:nth-child(2) { width: 40vw; height: 40vw; background: #7fd6c9; top: 20vh; right: -14vw; animation-delay: -8s; }
.ambient span:nth-child(3) { width: 36vw; height: 36vw; background: #a9c6ef; bottom: -16vw; left: 24vw; animation-delay: -16s; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vw, 4vh) scale(1.08); }
  100% { transform: translate(-4vw, 8vh) scale(.95); }
}

a { color: var(--sky); text-underline-offset: 3px; }
a:hover { color: var(--slate); }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.prose { max-width: 70ch; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(238, 242, 244, .72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; }
.brand b { font-size: 21px; font-weight: 800; font-variation-settings: "wdth" 112; letter-spacing: -.01em; }
.nav { display: flex; gap: 22px; font-size: 15px; font-weight: 600; }
.nav a { color: var(--slate); text-decoration: none; }
.nav a:hover { color: var(--ink); text-decoration: underline; }

/* Type */
h1, h2, h3 { line-height: 1.12; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(34px, 5.4vw, 60px); font-weight: 800; font-variation-settings: "wdth" 118; }
h2 { font-size: clamp(26px, 3.2vw, 36px); font-weight: 750; font-variation-settings: "wdth" 110; margin-top: 2.2em; }
h3 { font-size: 20px; font-weight: 700; margin-top: 1.6em; }
p { margin: 0 0 1em; }
.lede { font-size: 19px; color: var(--slate); max-width: 62ch; }
.crumbs { font-size: 14px; color: var(--steel); margin: 28px 0 14px; }
.crumbs a { color: var(--steel); }
.updated { font-size: 14px; color: var(--steel); }

/* Glass panel */
.glass {
  background: var(--card);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.75);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* Calculator layout */
.calc { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 22px; margin: 26px 0 10px; align-items: start; }
.calc-inputs { padding: 26px; }
.calc-result { padding: 26px; position: sticky; top: 84px; }
.field { margin-bottom: 22px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.hint { font-size: 13.5px; color: var(--steel); margin: 6px 0 0; }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; border-radius: var(--radius-md); background: rgba(24,36,47,.06); }
.seg button {
  font: inherit; font-size: 14.5px; font-weight: 650; border: 0; cursor: pointer;
  padding: 10px 8px; border-radius: 10px; background: transparent; color: var(--slate);
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s, color .2s;
}
.seg button svg { width: 18px; height: 18px; flex: none; }
.seg button[aria-pressed="true"] { background: var(--card-solid); color: var(--ink); box-shadow: 0 2px 8px -3px rgba(24,36,47,.35); }

/* Number inputs */
.num { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.85); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.num:focus-within { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(58,120,194,.15); }
.num input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 20px; font-weight: 700; padding: 12px 14px; color: var(--ink); }
.num input:focus { outline: none; }
.num .unit { display: flex; align-items: center; padding: 0 14px; font-size: 14px; font-weight: 600; color: var(--steel); background: rgba(24,36,47,.04); }
.num-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: #b42318; font-size: 13.5px; font-weight: 600; margin: 6px 0 0; min-height: 0; }

/* Material tiles (SVG buttons) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.tile {
  position: relative; font: inherit; cursor: pointer; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  background: rgba(255,255,255,.7); padding: 12px 10px 10px; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px; transition: transform .18s, border-color .2s, background .2s;
}
.tile svg { width: 44px; height: 32px; }
.tile .t-name { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.tile .t-price { font-size: 12.5px; color: var(--steel); }
.tile:hover { transform: translateY(-2px); border-color: rgba(58,120,194,.45); }
.tile[aria-pressed="true"] { background: #fff; border-color: transparent; }
.tile[aria-pressed="true"]::before {
  content: ""; position: absolute; inset: -1.5px; border-radius: inherit; padding: 2px;
  background: var(--grad); background-size: 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: hue-run 6s linear infinite;
}

/* Select-like pill groups */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills button {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 9px 14px;
  border-radius: 999px; border: 1.5px solid var(--line); background: rgba(255,255,255,.7); color: var(--slate);
  display: inline-flex; align-items: center; gap: 7px; transition: border-color .2s, background .2s;
}
.pills button svg { width: 16px; height: 16px; }
.pills button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Toggle */
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 600; font-size: 15px; }
.check input { position: absolute; opacity: 0; }
.check .box { flex: none; width: 46px; height: 26px; border-radius: 99px; background: rgba(24,36,47,.18); position: relative; transition: background .25s; margin-top: 1px; }
.check .box::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .25s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.check input:checked + .box { background: var(--teal); }
.check input:checked + .box::after { transform: translateX(20px); }
.check input:focus-visible + .box { outline: 3px solid var(--sky); outline-offset: 2px; }
.check small { display: block; font-weight: 400; color: var(--steel); font-size: 13.5px; }

/* Result */
.r-label { font-size: 14px; font-weight: 650; color: var(--steel); margin: 0; }
.r-total {
  font-size: clamp(42px, 5.6vw, 60px); font-weight: 800; line-height: 1; margin: 6px 0 4px;
  font-variation-settings: "wdth" 120; letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--ink) 0%, var(--slate) 35%, var(--sky) 55%, var(--teal) 75%, var(--ink) 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hue-run 9s linear infinite;
}
.r-range { font-size: 16px; color: var(--slate); margin: 0 0 18px; }
.r-range b { color: var(--ink); }

/* Tape-measure range */
.tape { position: relative; height: 54px; margin: 8px 0 30px; }
.tape-track {
  position: absolute; inset: 14px 0 auto; height: 26px; border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, rgba(24,36,47,.55) 0 1px, transparent 1px 10px) bottom/100% 7px no-repeat,
    repeating-linear-gradient(90deg, rgba(24,36,47,.75) 0 1.5px, transparent 1.5px 50px) bottom/100% 13px no-repeat,
    #ffe58f;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
}
.tape-fill {
  position: absolute; top: 14px; height: 26px; border-radius: 6px;
  background: var(--grad); background-size: 300% 100%; opacity: .9;
  animation: hue-run 7s linear infinite; transition: left .45s cubic-bezier(.2,.8,.2,1), width .45s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 0 2px rgba(255,255,255,.6) inset;
}
.tape-pin { position: absolute; top: 4px; width: 3px; height: 46px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); transition: left .45s cubic-bezier(.2,.8,.2,1); }
.tape-pin::after { content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--ink); }
.tape-labels { position: absolute; top: 44px; left: 0; right: 0; font-size: 12.5px; font-weight: 650; color: var(--steel); }
.tape-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; transition: left .45s cubic-bezier(.2,.8,.2,1); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: rgba(255,255,255,.7); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat b { display: block; font-size: 18px; font-weight: 800; }
.stat span { font-size: 12.5px; color: var(--steel); }

.breakdown { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.breakdown td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.breakdown td:last-child { text-align: right; font-weight: 700; white-space: nowrap; padding-left: 10px; }
.breakdown tr.total td { border-bottom: 0; font-weight: 800; font-size: 15.5px; padding-top: 12px; }
.breakdown small { display: block; color: var(--steel); font-size: 12.5px; }

.split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin: 16px 0 6px; background: rgba(24,36,47,.08); }
.split i { display: block; height: 100%; }
.split i:first-child { background: var(--sky); }
.split i:last-child { background: var(--teal); }
.split-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--steel); }

/* Buttons with color-shifting gradient */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 16px; border-radius: 12px; border: 0; color: var(--ink);
  background: var(--grad); background-size: 300% 100%;
  animation: hue-run 8s linear infinite;
  box-shadow: 0 10px 24px -12px rgba(18,165,148,.7);
  transition: transform .15s, box-shadow .2s;
}
.btn::before { content: ""; position: absolute; inset: 2px; border-radius: 10px; background: rgba(255,255,255,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: -1; transition: background .25s; }
.btn:hover::before { background: rgba(255,255,255,.25); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(58,120,194,.7); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.quiet { background: rgba(24,36,47,.08); animation: none; box-shadow: none; }
.btn.quiet::before { display: none; }
.btn.quiet:hover { background: rgba(24,36,47,.14); }
.toast { font-size: 13.5px; color: var(--good); font-weight: 650; min-height: 20px; margin: 8px 0 0; }

@keyframes hue-run { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }

/* Compare table */
.compare { padding: 24px; margin-top: 22px; }
.compare h2 { margin-top: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
table.data th, table.data td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { font-size: 13.5px; color: var(--steel); font-weight: 700; }
table.data td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th.n { text-align: right; }
table.data tr.is-current td { background: rgba(242,183,5,.16); font-weight: 700; }
.best { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 700; color: var(--good); background: rgba(15,122,92,.1); padding: 2px 7px; border-radius: 99px; }

/* Article */
.article { padding: 10px 0 40px; }
.article ul, .article ol { padding-left: 1.2em; }
.article li { margin-bottom: .45em; }
.note { border-left: 4px solid var(--tape); background: rgba(255,255,255,.6); padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.2em 0; }
details.faq { border-bottom: 1px solid var(--line); padding: 14px 0; }
details.faq summary { cursor: pointer; font-weight: 700; font-size: 17.5px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary svg { width: 20px; height: 20px; flex: none; transition: transform .25s; margin-top: 3px; }
details.faq[open] summary svg { transform: rotate(45deg); }
details.faq p { margin: 10px 0 0; color: var(--slate); }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.related .item { padding: 16px; border-radius: var(--radius-md); }
.related .item b { display: block; }
.related .item span { font-size: 13.5px; color: var(--steel); }

/* Home */
.hero { padding: 64px 0 30px; }
.hero h1 { max-width: 16ch; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 30px 0 60px; }
.cat { padding: 22px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 10px; transition: transform .2s; }
a.cat:hover { transform: translateY(-3px); color: var(--ink); }
.cat svg { width: 56px; height: 40px; }
.cat b { font-size: 20px; font-weight: 750; }
.cat span { font-size: 15px; color: var(--slate); }
.cat .soon { font-size: 13px; font-weight: 700; color: var(--steel); }
.cat .go { font-size: 14px; font-weight: 700; color: var(--sky); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--steel); background: rgba(238,242,244,.7); }

/* Mobile estimate bar */
.mbar { display: none; }
@media (max-width: 920px) {
  .mbar {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px;
    color: var(--ink); text-decoration: none; font-weight: 700;
    background: rgba(255,255,255,.72); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(255,255,255,.8); box-shadow: 0 14px 30px -14px rgba(24,36,47,.55);
    transition: transform .3s, opacity .3s;
  }
  .mbar span { font-size: 14px; color: var(--steel); }
  .mbar b { margin-left: auto; font-size: 20px; font-weight: 800; }
  .mbar svg { width: 20px; height: 20px; }
  .mbar.is-hidden { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .site-footer { padding-bottom: 96px; }
}

/* Responsive */
@media (max-width: 920px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc-result { position: static; }
  .tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .calc-inputs, .calc-result, .compare { padding: 18px; }
  .nav { gap: 14px; font-size: 14px; }
  .stats { gap: 6px; }
  .stat { padding: 9px 8px; }
  .stat b { font-size: 15.5px; }
  .stat span { font-size: 11.5px; }
}
@media (max-width: 400px) {
  .nav a:last-child { display: none; }
  .actions { grid-template-columns: 1fr; }
  .num-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .site-header, .site-footer, .ambient, .mbar, .calc-inputs, .actions, .article, .compare .hint, .toast { display: none !important; }
  .calc { display: block; }
  .glass { background: #fff; box-shadow: none; border: 1px solid #ccc; backdrop-filter: none; }
  .r-total { color: #000; background: none; -webkit-background-clip: initial; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
