/* PetCalcKit — base styles */
:root {
  --paper: #F3F6F4;
  --surface: #FFFFFF;
  --ink: #1C2A28;
  --muted: #52625C;
  --line: #D3DDD8;
  --brand: #2E6B5A;
  --brand-ink: #1F4D40;
  --brand-tint: #E2EEE9;
  --ball: #F2C94C;
  --ball-deep: #E0B12C;
  --ok: #2E6B5A;
  --warn: #9A5B00;
  --warn-bg: #FFF1D6;
  --danger: #A8321C;
  --danger-bg: #FBE3DD;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --display: "Bricolage Grotesque", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 68ch;
}

*, *::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;
}
img, svg { max-width: 100%; }
a { color: var(--brand-ink); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--ball-deep); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 16px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.site-nav { display: flex; gap: 20px; }
.site-nav a { text-decoration: none; color: var(--muted); font-weight: 700; font-size: 0.98rem; }
.site-nav a:hover { color: var(--ink); }

/* Type */
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 0.5em; }
h1 { font-weight: 800; font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-weight: 800; font-size: clamp(1.45rem, 3vw, 1.85rem); margin-top: 2.2em; }
h3 { font-weight: 600; font-size: 1.2rem; margin-top: 1.6em; }
p, li { max-width: var(--measure); }
.lede { font-size: 1.18rem; color: var(--muted); margin: 0 0 1.5rem; max-width: 60ch; }

/* Page */
.page-head { padding: 40px 0 8px; }
.crumbs { font-size: 0.92rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.prose { padding-bottom: 56px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.reviewed { font-size: 0.92rem; color: var(--muted); }

/* Calculator shell */
.calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin: 8px 0 12px; }
@media (min-width: 880px) { .calc { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.calc-form { padding: 24px; }
.calc-out { padding: 24px; background: var(--brand-tint); border-top: 1px solid var(--line); }
@media (min-width: 880px) { .calc-out { border-top: 0; border-left: 1px solid var(--line); } }

.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 6px; }
.hint { display: block; font-size: 0.9rem; color: var(--muted); margin-top: 6px; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
input[type="number"], select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid #B9C7C1; border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 48px; width: 100%;
}
input[type="number"]:focus, select:focus { border-color: var(--brand); outline: 3px solid rgba(46,107,90,0.2); outline-offset: 0; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2352625C' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.seg { display: inline-flex; border: 1.5px solid #B9C7C1; border-radius: var(--radius-sm); overflow: hidden; flex: none; background: var(--surface); }
.seg button { font: inherit; font-weight: 700; font-size: 0.95rem; border: 0; background: transparent; color: var(--muted); padding: 0 14px; min-height: 45px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.btn { font: inherit; font-weight: 700; border: 0; border-radius: var(--radius-sm); background: var(--brand); color: #fff; padding: 12px 20px; min-height: 48px; cursor: pointer; width: 100%; }
.btn:hover { background: var(--brand-ink); }

.form-error { color: var(--danger); font-weight: 700; margin: 0 0 12px; }

/* Result: the tennis-ball tag */
.result-empty { color: var(--muted); }
.tag { background: var(--ball); border-radius: var(--radius-lg); padding: 20px 22px; position: relative; }
.tag::before { content: ""; position: absolute; top: 16px; right: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--brand-tint); box-shadow: inset 0 0 0 3px var(--ball-deep); }
.tag-label { margin: 0; font-weight: 700; font-size: 0.98rem; }
.tag-value { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 7vw, 3.6rem); line-height: 1; margin: 6px 0 6px; letter-spacing: -0.02em; }
.tag-value small { font-size: 0.42em; font-weight: 600; letter-spacing: 0; }
.tag-sub { margin: 0; }

.facts { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.facts li { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; }
.facts b { display: block; font-family: var(--display); font-size: 1.25rem; }
.facts span { font-size: 0.88rem; color: var(--muted); }

/* Severity panels */
.sev { border-radius: var(--radius-lg); padding: 20px 22px; border: 2px solid transparent; }
.sev h2 { margin: 0 0 6px; font-size: 1.45rem; }
.sev p { margin: 6px 0; }
.sev-low { background: var(--surface); border-color: var(--line); }
.sev-mild { background: var(--warn-bg); border-color: #E8C27A; }
.sev-severe, .sev-critical { background: var(--danger-bg); border-color: #E3A091; }
.sev-critical { border-width: 3px; border-color: var(--danger); }
.sev .dose { font-family: var(--display); font-weight: 800; font-size: 2.4rem; line-height: 1.05; margin: 2px 0 4px; }
.sev .dose small { font-size: 0.45em; font-weight: 600; }
.call { margin-top: 14px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius-sm); }
.call a { font-weight: 700; }

/* Dose scale */
.scale { margin: 18px 0 4px; }
.scale svg { display: block; width: 100%; height: auto; }

/* Growth chart */
.chart { margin-top: 20px; background: var(--surface); border-radius: var(--radius-sm); padding: 10px 8px 4px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-cap { font-size: 0.88rem; color: var(--muted); margin: 4px 6px 6px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 12px 0 8px; }
table { border-collapse: collapse; width: 100%; min-width: 420px; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; background: #E9EFEC; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; margin: 10px 0; max-width: var(--measure); }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style-position: outside; }
.faq details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.faq details p { margin: 8px 0 14px; }

/* Related */
.related { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); max-width: none; }
.related li { margin: 0; max-width: none; }
.related a { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 700; }
.related a:hover { border-color: var(--brand); }
.related span { display: block; font-weight: 400; color: var(--muted); font-size: 0.92rem; }

/* Home */
.home-hero { padding: 56px 0 24px; }
.home-hero h1 { max-width: 16ch; font-size: clamp(2.3rem, 6.4vw, 4rem); }
.home-hero .lede { font-size: 1.25rem; }
.shelf { padding: 8px 0 40px; }
.shelf h2 { display: flex; align-items: center; gap: 12px; }
.tools { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); max-width: none; }
.tools li { max-width: none; margin: 0; border-bottom: 1px solid var(--line); }
.tools a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 18px 4px; text-decoration: none; color: var(--ink); align-items: center; }
.tools a:hover { background: var(--surface); }
.tool-name { font-family: var(--display); font-weight: 800; font-size: 1.35rem; }
.tool-desc { grid-column: 1; color: var(--muted); }
.tool-go { grid-column: 2; grid-row: 1 / span 2; font-weight: 700; color: var(--brand); white-space: nowrap; }
.soon { color: var(--muted); }
.soon-list { color: var(--muted); padding-left: 1.2em; }

/* Notes */
.note { background: var(--surface); border-left: 4px solid var(--ball-deep); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; max-width: var(--measure); }

/* Footer */
.site-footer { background: var(--ink); color: #D9E3DF; margin-top: 40px; }
.footer-grid { display: grid; gap: 24px; padding-top: 36px; padding-bottom: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .footer-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.footer-brand { font-family: var(--display); font-weight: 800; font-size: 1.2rem; color: #fff; margin: 0 0 6px; }
.footer-note { margin: 0; color: #B9C7C1; font-size: 0.95rem; }
.site-footer nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; align-content: start; }
.site-footer a { color: #D9E3DF; font-size: 0.95rem; }
.footer-base { padding-bottom: 28px; font-size: 0.88rem; color: #93A49D; }

@media (max-width: 520px) {
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 0.92rem; }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calc-form, .calc-out { padding: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tag, .sev { animation: pop 220ms ease-out; }
  @keyframes pop { from { transform: scale(0.985); opacity: 0.6; } to { transform: none; opacity: 1; } }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
tr.past td { color: var(--muted); }
.prose .related { padding-left: 0; }
@media (max-width: 520px) {
  .calc-out { padding: 14px; }
  .sev, .tag { padding: 16px; }
  .sev .dose { font-size: 2.1rem; }
}
figure.chart { margin: 20px 0 0; }
table.table-compact { min-width: 0; }
.table-compact td.num { white-space: nowrap; }
