/* LazySums — shared styles. No frameworks, no build step. */

@font-face {
  font-family: "Bricolage";
  src: url("/assets/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("/assets/fonts/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("/assets/fonts/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #eef0f7;
  --surface: #ffffff;
  --ink: #1a1f36;
  --muted: #5b6178;
  --line: #d6d9e8;
  --accent: #3b2fd9;
  --accent-ink: #ffffff;
  --sun: #ffd23f;
  --sun-ink: #1a1f36;
  --panel: #1a1f36;
  --panel-ink: #f4f5fb;
  --panel-muted: #a9aecb;
  --panel-line: #343a5c;
  --error: #b42318;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --body: "Atkinson", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121428;
    --surface: #1b1e38;
    --ink: #eceefb;
    --muted: #a3a8c3;
    --line: #2f3456;
    --accent: #a69cff;
    --accent-ink: #121428;
    --panel: #262a52;
    --panel-ink: #f4f5fb;
    --panel-muted: #b5b9d6;
    --panel-line: #3d4372;
    --error: #ff8a7a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* Header */
.site-head { padding: 20px 0; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 1.35rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--sun);
  display: grid; place-items: center; color: var(--sun-ink);
  font-size: 1.3rem; line-height: 1; font-weight: 800; transform: rotate(-6deg);
}
.site-head nav a { color: var(--ink); font-weight: 700; text-decoration: none; }
.site-head nav a:hover { text-decoration: underline; }

/* Type */
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.025em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 750; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 700; margin-top: 2.2em; margin-bottom: 0.5em; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 60ch; margin-top: 12px; }

.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }

/* Calculator layout */
.calc-head { padding: 12px 0 28px; }
.calc {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }

.inputs {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { font-weight: 700; font-size: 0.98rem; }
.hint { color: var(--muted); font-size: 0.88rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } }

input[type="text"], input[type="number"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  min-height: 50px;
  font-variant-numeric: tabular-nums;
}
input:hover, select:hover { border-color: var(--line); }
input:focus, select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input[aria-invalid="true"] { border-color: var(--error); }

.unit-input { position: relative; }
.unit-input span {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-weight: 700;
}
.unit-input input { padding-right: 46px; }

/* Segmented choice (radio buttons) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.seg legend { font-weight: 700; font-size: 0.98rem; margin-bottom: 6px; padding: 0; }
.seg label {
  position: relative; cursor: pointer;
}
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  background: var(--bg); border: 2px solid transparent; font-weight: 700; font-size: 0.95rem;
}
.seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  padding: 5px 11px; border-radius: 999px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.check { display: flex; gap: 10px; align-items: center; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.btn-quiet {
  font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
  background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline;
  text-underline-offset: 3px;
}

/* The answer panel — the one loud thing on the page */
.answer {
  background: var(--panel);
  color: var(--panel-ink);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: sticky; top: 16px;
}
@media (max-width: 860px) { .answer { position: static; } }
.answer-text {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.4vw, 2.15rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0;
  min-height: 2.6em;
}
.answer-text mark {
  background: var(--sun);
  color: var(--sun-ink);
  padding: 0 0.18em;
  border-radius: 6px;
  font-weight: 800;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-variant-numeric: tabular-nums;
}
.answer-text.is-empty { color: var(--panel-muted); font-weight: 500; }
.answer-text.is-error { color: #ffb4a8; font-weight: 500; }
.answer.flash .answer-text mark { animation: pop 380ms ease-out; }
@keyframes pop { 0% { transform: scale(0.96); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .answer.flash .answer-text mark { animation: none; } }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0; margin: 24px 0 0; padding: 0;
  border: 1px solid var(--panel-line); border-radius: 14px; overflow: hidden;
}
.facts:empty { display: none; }
.facts div { padding: 12px 14px; border-right: 1px solid var(--panel-line); border-bottom: 1px solid var(--panel-line); margin: 0 -1px -1px 0; }
.facts dt { color: var(--panel-muted); font-size: 0.86rem; }
.facts dd { margin: 2px 0 0; font-family: var(--display); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.answer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.answer-actions button {
  font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--panel-ink);
  border: 1.5px solid var(--panel-line); border-radius: 999px; padding: 8px 15px;
}
.answer-actions button:hover { border-color: var(--sun); }
.answer-actions button:disabled { opacity: 0.4; cursor: default; }
.answer-actions .copied { border-color: var(--sun); color: var(--sun); }

.working { margin-top: 18px; border-top: 1px solid var(--panel-line); padding-top: 14px; }
.working summary { cursor: pointer; font-weight: 700; color: var(--panel-ink); }
.working ol { margin: 12px 0 0; padding-left: 1.3em; color: var(--panel-muted); font-variant-numeric: tabular-nums; }
.working li { margin-bottom: 6px; }
.working li strong { color: var(--panel-ink); }

/* Tables (schedules) */
.table-wrap { overflow-x: auto; margin-top: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 700; background: var(--bg); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }

.bars { display: grid; gap: 6px; margin-top: 16px; }
.bar-row { display: grid; grid-template-columns: 3.2em 1fr; gap: 10px; align-items: center; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--line); }
.bar i { display: block; height: 100%; }
.bar .b1 { background: var(--accent); }
.bar .b2 { background: var(--sun); }
.legend { display: flex; gap: 16px; font-size: 0.85rem; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.legend span.l2::before { background: var(--sun); }

/* Hours worked rows */
.days { display: grid; gap: 8px; }
.day {
  display: grid; grid-template-columns: 3.2em minmax(0, 1fr) minmax(0, 1fr) 5.5em; gap: 8px; align-items: center;
}
.day input { min-width: 0; }
.day .dname { font-weight: 700; }
.day input { min-height: 44px; padding: 8px 9px; font-size: 1rem; }
.days-head { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) minmax(0, 1fr) 5.5em; gap: 8px; font-size: 0.82rem; color: var(--muted); }
@media (max-width: 420px) {
  .day, .days-head { grid-template-columns: 2.4em minmax(0, 1fr) minmax(0, 1fr) 3.6em; gap: 5px; }
  .day input { padding: 8px 4px; font-size: 0.9rem; }
  .day input::-webkit-calendar-picker-indicator { display: none; }
  .inputs { padding: 18px; }
}

/* Article content below the tool */
.explain { max-width: 68ch; padding-bottom: 24px; }
.explain h2:first-child { margin-top: 56px; }
.explain ul, .explain ol { padding-left: 1.3em; }
.explain li { margin-bottom: 0.4em; }
.formula {
  font-family: var(--display); font-weight: 600; font-size: 1.1rem;
  background: var(--surface); border-left: 4px solid var(--sun); padding: 14px 18px; border-radius: 0 12px 12px 0;
  overflow-x: auto;
}
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

.related { margin-top: 8px; }
.related ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a {
  display: inline-block; padding: 9px 15px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem;
}
.related a:hover { border-color: var(--accent); color: var(--accent); }

/* Home */
.hero { padding: 40px 0 36px; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5.4rem); line-height: 0.98; letter-spacing: -0.045em; max-width: 13ch; }
.hero .lede { font-size: 1.25rem; }
.finder { margin-top: 28px; max-width: 520px; }
.finder input { background: var(--surface); border: 2px solid var(--line); font-size: 1.15rem; min-height: 58px; padding-left: 18px; }
.finder input:focus { border-color: var(--accent); }

.group { margin-top: 40px; }
.group h2 { margin: 0 0 4px; font-size: 1.3rem; color: var(--muted); font-weight: 600; }
.calc-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.calc-list li { border-bottom: 1px solid var(--line); }
.calc-list a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; align-items: baseline;
  padding: 18px 4px; text-decoration: none; color: var(--ink);
}
.calc-list .name { font-family: var(--display); font-weight: 700; font-size: clamp(1.25rem, 2.6vw, 1.6rem); letter-spacing: -0.02em; }
.calc-list .ask { color: var(--muted); grid-column: 1; }
.calc-list .eg {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font-size: 0.92rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.calc-list a:hover .name { color: var(--accent); }
.calc-list a:hover .eg { background: var(--sun); color: var(--sun-ink); border-color: var(--sun); }
@media (max-width: 600px) {
  .calc-list a { grid-template-columns: 1fr; }
  .calc-list .eg { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
}
.no-match { color: var(--muted); padding: 18px 4px; }

.promise { margin-top: 56px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.promise h3 { margin-bottom: 6px; }
.promise p { color: var(--muted); margin: 0; }

/* Plain pages */
.page { max-width: 68ch; padding: 12px 0 40px; }
.page h1 { margin-bottom: 16px; }

/* Footer */
.site-foot { margin-top: 64px; padding: 32px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 18px; }
.site-foot a { color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
