/* agecalculator.com — mockup styles. Tokens are explained in SPEC.md. */
@font-face {
  font-family: "Libre Franklin";
  src: url("fonts/libre-franklin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "LF Fallback";
  src: local("Arial"), local("Liberation Sans");
  size-adjust: 104.6%;
  ascent-override: 92.4%;
  descent-override: 23.5%;
  line-gap-override: 0%;
}
:root {
  /* Ink and paper, taken from a printed wall calendar */
  --ink: #1c1c1a;          /* calendar black */
  --ink-2: #45443f;        /* secondary text, 9.6:1 on white */
  --ink-3: #66655e;        /* captions, 5.8:1 on white */
  --rule: #cfcdc4;         /* printed rules */
  --rule-soft: #e4e2db;
  --paper: #ffffff;
  --desk: #f1f1ec;         /* the band the pad sits on */
  --sunday: #b4231b;       /* the red that calendars print Sundays and holidays in, 6.4:1 */
  --sunday-tint: #fbeae8;
  --link: #1b4d8c;         /* almanac blue for links, 8.2:1 */
  --focus: #1b4d8c;
  --ease-out: cubic-bezier(.25, .8, .3, 1);

  --s1: 3px; --s2: 6px; --s3: 10px; --s4: 14px; --s5: 20px; --s6: 28px; --s7: 40px; --s8: 56px; --s9: 80px;
  --body: 17px;
  --measure: 66ch;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Libre Franklin", "LF Fallback", Arial, sans-serif;
  font-size: var(--body);
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: lining-nums;
}
a { color: var(--link); text-underline-offset: 2px; text-decoration-thickness: 1px; }
@media (hover: hover) {
  a:hover { text-decoration-thickness: 2px; }
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.embed-preview:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0 0 var(--s4); text-wrap: pretty; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: var(--s3) var(--s4); z-index: 5; }
.skip:focus { left: var(--s3); }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 var(--s5); }

/* ---------- Masthead ---------- */
.mast { border-bottom: 1px solid var(--rule); }
.mast .wrap { display: flex; align-items: center; gap: var(--s6); min-height: 58px; }
.brand { display: inline-flex; align-items: baseline; gap: 0; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.005em; white-space: nowrap; }
.brand span { font-weight: 800; color: inherit; letter-spacing: inherit; }
.brand svg { flex: none; margin-inline-end: var(--s3); align-self: center; }
.mast nav { margin-left: auto; }
.mast nav ul { list-style: none; display: flex; gap: var(--s5); margin: 0; padding: 0; font-size: 15px; }
.mast nav a { color: var(--ink-2); text-decoration: none; padding: var(--s3) 0; }
.mast nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
@media (hover: hover) {
  .mast nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
}
.mast .tools-link { display: none; margin-left: auto; font-size: 15px; }

/* ---------- Calculator band ---------- */
.band { background: var(--desk); border-bottom: 1px solid var(--rule); }
.band .wrap { padding-top: var(--s6); padding-bottom: var(--s7); }
.crumbs { font-size: 14px; color: var(--ink-3); margin: 0 0 var(--s3); }
.crumbs a { color: var(--ink-2); }
.intro h1 { font-size: 36px; font-weight: 750; }
.intro p { margin: var(--s2) 0 0; color: var(--ink-2); max-width: 54ch; }

.calc { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: var(--s7); margin-top: var(--s6); align-items: start; }

/* Date entry */
.entry fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.entry legend { font-weight: 700; font-size: 17px; padding: 0; margin-bottom: var(--s3); }
.fields { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: var(--s3); }
.fields label { display: block; font-size: 14px; color: var(--ink-2); }
.fields label span { display: block; margin-bottom: var(--s1); }
.fields input {
  display: block; width: 100%; height: 56px; margin: 0;
  font: 600 26px/1 inherit; font-family: inherit; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 2px; padding: 0 var(--s3);
  -moz-appearance: textfield; appearance: none;
}
.fields input::placeholder { color: #9b9a92; font-weight: 400; }
.fields input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.fields input[aria-invalid="true"] { border-color: var(--sunday); box-shadow: inset 0 0 0 1px var(--sunday); }
.field-msg { min-height: 24px; margin: var(--s2) 0 0; font-size: 15px; color: var(--sunday); font-weight: 600; }
.field-msg:empty { min-height: 0; margin: 0; }

.on { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--rule); font-size: 15px; color: var(--ink-2); }
.on p { margin: 0; }
.on strong { color: var(--ink); font-weight: 600; }
.textbtn { font: inherit; color: var(--link); background: none; border: 0; padding: var(--s1) 0; margin-left: var(--s2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
@media (hover: hover) {
  .textbtn:hover { text-decoration-thickness: 2px; }
}
.on fieldset { margin-top: var(--s4); }
.on .fields input { height: 46px; font-size: 20px; border-width: 1.5px; }
.on legend { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---------- The leaf: a page torn from a day-to-a-page calendar ---------- */
.leaf {
  position: relative;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  /* the next sheets of the pad, peeking out */
  box-shadow: 5px 5px 0 -1.5px var(--paper), 5px 5px 0 0 var(--ink), 10px 10px 0 -1.5px var(--paper), 10px 10px 0 0 var(--rule);
  padding: 0 var(--s6) var(--s5);
  margin-right: 10px;
  min-height: 300px;
}
.leaf::before { /* red binding strip with punched holes */
  content: ""; display: block; height: 22px; margin: 0 calc(var(--s6) * -1) var(--s4);
  background:
    radial-gradient(circle at 50% 50%, var(--desk) 0 4px, var(--ink) 4.5px 5.5px, transparent 6px) 0 50% / 26px 22px repeat-x,
    var(--sunday);
  border-bottom: 1.5px solid var(--ink);
}
.leaf-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); font-size: 15px; color: var(--ink-2); margin-bottom: var(--s2); }
.leaf-head b { color: var(--ink); font-weight: 600; }
.leaf-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s5) var(--s6); align-items: start; }
.lead { padding-top: var(--s3); }
.big { margin: 0; display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.big .num { font-size: 104px; font-weight: 800; line-height: .92; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.big .num.long { font-size: 76px; }
.big .unit { font-size: 24px; font-weight: 700; }
.rest { font-size: 21px; font-weight: 500; margin: var(--s2) 0 0; color: var(--ink); }
.leaf .msg { font-size: 20px; font-weight: 600; margin: var(--s3) 0 var(--s2); max-width: 30ch; }
.leaf .hint { color: var(--ink-2); font-size: 16px; margin: 0; max-width: 40ch; }

/* Mini month, Monday first, Sundays in red */
.month { width: 196px; font-variant-numeric: tabular-nums; }
.month-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin: 0 0 var(--s2); display: flex; justify-content: space-between; }
.month-name span { font-weight: 500; color: var(--ink-3); letter-spacing: .04em; }
.month table { border-collapse: collapse; width: 100%; font-size: 13px; }
.month th { font-weight: 600; color: var(--ink-3); padding: 0 0 var(--s1); text-align: center; border-bottom: 1px solid var(--ink); }
.month td { position: relative; text-align: center; height: 25px; padding: 0; color: var(--ink-2); }
.month th:last-child, .month td:last-child { color: var(--sunday); }
.month td.hit { color: var(--ink); font-weight: 800; }
.month td.today::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: 2px; height: 2px; background: var(--ink); }
.ring { position: absolute; left: 50%; top: 50%; width: 40px; height: 34px; margin: -18px 0 0 -20px; overflow: visible; pointer-events: none; }
.ring path { fill: none; stroke: var(--sunday); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 150; stroke-dashoffset: 0; }
.ring.draw path { animation: ink 520ms var(--ease-out) both; }
@keyframes ink { from { stroke-dashoffset: 150; } }
@media (prefers-reduced-motion: reduce) { .ring.draw path { animation: none; } }

.bday-text { font-size: 16px; margin: var(--s3) 0 0; max-width: 196px; line-height: 1.38; }
.bday-text .k { display: block; font-size: 14px; color: var(--ink-3); }
.bday-text strong { font-weight: 700; }
.bday-text .count { color: var(--sunday); font-weight: 700; font-style: normal; }
.bday-note { font-size: 14px; color: var(--ink-3); margin: var(--s2) 0 0; max-width: 196px; }

/* Leader-dot ledger, like a printed almanac table */
.ledger { margin: var(--s5) 0 0; padding: var(--s3) 0 0; border-top: 1.5px solid var(--ink); display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s7); font-variant-numeric: tabular-nums; }
.ledger div { display: flex; align-items: baseline; gap: var(--s2); padding: 5px 0; border-bottom: 1px solid var(--rule-soft); }
.ledger dt { flex: 1 1 auto; display: flex; align-items: baseline; gap: var(--s2); color: var(--ink-2); min-width: 0; }
.ledger dt::after { content: ""; flex: 1; min-width: 12px; border-bottom: 1.5px dotted #a9a79e; transform: translateY(-4px); }
.ledger dd { margin: 0; font-weight: 700; text-align: right; flex: 0 1 auto; max-width: 55%; }
.ledger dd small { white-space: normal; }
.leaf-old .ledger dd small { display: block; }
.ledger small { font-weight: 400; color: var(--ink-3); font-size: 14px; }
[data-clock] { white-space: nowrap; }


/* ---------- Content ---------- */
.page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s8); padding-top: var(--s8); padding-bottom: var(--s9); }
.content { max-width: 720px; }
.content > section { margin-bottom: var(--s8); }
.content > section.tight { margin-bottom: var(--s6); }
.content h2 { font-size: 25px; margin-bottom: var(--s4); }
.content h3 { font-size: 18px; margin: var(--s5) 0 var(--s2); }
.content p, .content li { max-width: var(--measure); }
.content ul, .content ol { padding-left: 1.2em; margin: 0 0 var(--s4); }
.content li { margin-bottom: var(--s2); }
.placeholder-note { display: inline-block; font-size: 13px; color: var(--ink-2); border: 1px dashed var(--ink-3); padding: 2px var(--s2); margin-bottom: var(--s5); }

/* Worked example: the sum written out the way you'd do it on paper */
.working { border-collapse: collapse; width: 100%; max-width: 560px; margin: var(--s4) 0 var(--s5); font-variant-numeric: tabular-nums; }
.working td { padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.working td:last-child { text-align: right; font-weight: 700; white-space: nowrap; padding-right: 0; }
.working tr.total td { border-top: 1.5px solid var(--ink); border-bottom: 3px double var(--ink); font-weight: 700; }
.working .from { color: var(--ink-3); white-space: nowrap; }

/* Birth-year almanac */
.years { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5) var(--s6); margin-top: var(--s5); }
.years table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.years caption { text-align: left; font-weight: 700; font-size: 15px; padding-bottom: var(--s1); border-bottom: 1.5px solid var(--ink); }
.years td { padding: 3px 0; border-bottom: 1px solid var(--rule-soft); }
.years td:last-child { text-align: right; }
.years tr.this td { font-weight: 700; background: var(--sunday-tint); }

/* FAQ */
.faq details { border-top: 1px solid var(--rule); }
.faq details:last-of-type { border-bottom: 1px solid var(--rule); }
.faq summary { list-style: none; cursor: pointer; padding: var(--s4) 36px var(--s4) 0; position: relative; font-weight: 600; font-size: 18px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { /* a drawn plus that becomes a minus */
  content: ""; position: absolute; right: 6px; top: 50%; width: 15px; height: 15px; margin-top: -7px;
  background: linear-gradient(var(--ink), var(--ink)) 50% 50% / 15px 2px no-repeat, linear-gradient(var(--ink), var(--ink)) 50% 50% / 2px 15px no-repeat;
}
.faq details[open] summary::after { background-size: 15px 2px, 0 0; }
.faq details > div { padding: 0 0 var(--s4); }
.faq details > div p:last-child { margin-bottom: 0; }

.related { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: var(--s7); }
.related li { break-inside: avoid; padding: var(--s2) 0; border-bottom: 1px solid var(--rule-soft); }

/* Sidebar */
.side h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s3); }
.side ul { list-style: none; padding: 0; margin: 0; font-size: 16px; }
.side li { padding: 7px 0; border-bottom: 1px solid var(--rule-soft); }
.side li:first-child { border-top: 1.5px solid var(--ink); }
.side a { text-decoration: none; }
@media (hover: hover) {
  .side a:hover { text-decoration: underline; }
}

/* Footer */
.foot { border-top: 1.5px solid var(--ink); font-size: 15px; color: var(--ink-2); }
.foot .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s6); padding-top: var(--s6); padding-bottom: var(--s7); }
.foot h2 { font-size: 15px; color: var(--ink); margin-bottom: var(--s2); }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: var(--s1); }
.foot p { max-width: 46ch; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1080px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .calc { grid-template-columns: minmax(0, 1fr); gap: var(--s6); max-width: 720px; }
  .entry { max-width: 420px; }
}
@media (max-width: 760px) {
  .mast nav { display: none; }
  .mast .tools-link { display: inline; }
  .wrap { padding: 0 var(--s4); }
  .band .wrap { padding-top: var(--s5); padding-bottom: var(--s6); }
  .intro h1 { font-size: 29px; }
  .intro p { font-size: 16px; }
  .calc { margin-top: var(--s5); gap: var(--s5); }
  .entry { max-width: none; }
  .on { margin-top: var(--s4); padding-top: var(--s3); }
  .leaf { padding: 0 var(--s4) var(--s4); min-height: 0; margin-right: 8px;
    box-shadow: 4px 4px 0 -1.5px var(--paper), 4px 4px 0 0 var(--ink), 8px 8px 0 -1.5px var(--paper), 8px 8px 0 0 var(--rule); }
  .leaf::before { margin: 0 calc(var(--s4) * -1) var(--s3); height: 18px; background-size: 22px 18px, auto; }
  .leaf-body { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .big .num { font-size: 76px; }
  .big .num.long { font-size: 54px; }
  .big .unit { font-size: 20px; }
  .rest { font-size: 19px; }
  .bday { display: grid; grid-template-columns: 158px minmax(0, 1fr); gap: var(--s4); align-items: start; border-top: 1px solid var(--rule); padding-top: var(--s4); }
  .month { width: 158px; }
  .month td { height: 22px; }
  .bday-text { margin-top: 0; max-width: none; }
  .bday-note { max-width: none; grid-column: 1 / -1; }
  .ledger { grid-template-columns: 1fr; margin-top: var(--s4); }
  .page { padding-top: var(--s7); padding-bottom: var(--s8); }
  .content > section { margin-bottom: var(--s7); }
  .content h2 { font-size: 22px; }
  .years { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5) var(--s5); }
  .related { columns: 1; }
  .foot .wrap { grid-template-columns: 1fr 1fr; }
  .foot .wrap > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 370px) {
  .bday { grid-template-columns: minmax(0, 1fr); }
  .big .num { font-size: 66px; }
}

/* ---------- Date field: plain-English box plus day/month/year ---------- */
.entry { display: flex; flex-direction: column; gap: var(--s5); }
.datefield { min-width: 0; }
.df-label, .entry legend, .name { display: block; font-weight: 700; font-size: 17px; margin-bottom: var(--s2); padding: 0; }
.quick {
  display: block; width: 100%; height: 56px; margin: 0; padding: 0 var(--s4);
  font: 600 22px/1 "Libre Franklin", "LF Fallback", Arial, sans-serif; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 2px;
}
.quick::placeholder { color: #8f8e86; font-weight: 400; }
.quick[aria-invalid="true"] { border-color: var(--sunday); box-shadow: inset 0 0 0 1px var(--sunday); }
.parts { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: var(--s2); margin-top: var(--s3); }
.parts.two { grid-template-columns: 1fr 1fr; margin-top: 0; }
.parts label { display: block; font-size: 13px; color: var(--ink-3); }
.parts label span { display: block; margin-bottom: 2px; }
.parts input, .name input {
  display: block; width: 100%; height: 40px; margin: 0; padding: 0 var(--s3);
  font: 500 18px/1 "Libre Franklin", "LF Fallback", Arial, sans-serif; font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--paper); border: 1.5px solid #8f8e86; border-radius: 2px;
}
.parts.two input { height: 56px; font-size: 24px; font-weight: 600; border: 2px solid var(--ink); }
.parts input[aria-invalid="true"] { border-color: var(--sunday); }
.name { font-size: 15px; font-weight: 600; }
.name input { margin-top: var(--s1); font-size: 17px; }
.name.year-in input, .name.big-num input { height: 56px; font-size: 24px; font-weight: 600; border: 2px solid var(--ink); max-width: 160px; }
.readback { font-size: 15px; color: var(--ink-2); margin: var(--s2) 0 0; min-height: 22px; }
.readback:empty { min-height: 22px; }
.readback b { color: var(--ink); font-weight: 600; }
.readback.err { color: var(--sunday); font-weight: 600; }
.readback .textbtn { font-size: 15px; }
.year-note { font-size: 15px; background: var(--paper); border-left: 3px solid var(--sunday); padding: var(--s2) var(--s3); margin: 0; }
.prefill-on #on-box[hidden] { display: block !important; visibility: hidden; }
/* year= also reveals #year-note and fills the on-date readback; reserve that space too. */
.prefill-on #year-note[hidden] { display: block !important; visibility: hidden; min-height: 77px; }
.prefill-on [data-datefield="on"] .readback { min-height: 36px; }
.prefill-on .on > p { display: flex; flex-wrap: wrap; align-items: flex-end; min-height: 84px; }
.prefill-on #on-toggle { min-width: 70px; }
.entry .on { margin-top: 0; }
.on .zone { display: block; min-height: 1.45em; color: var(--ink-3); font-size: 14px; }
#on-box { margin-top: var(--s4); }
.df-small .quick { height: 46px; font-size: 19px; border-width: 1.5px; }
.df-small .df-label { font-size: 15px; }
.zone-pick { display: block; font-size: 14px; color: var(--ink-2); margin-top: var(--s2); }
.zone-pick select { display: block; margin-top: 3px; font: inherit; font-size: 15px; height: 36px; max-width: 100%; border: 1.5px solid #8f8e86; border-radius: 2px; background: var(--paper); color: var(--ink); }
.pair { border-left: 3px solid var(--rule); padding-left: var(--s4); }
.pair + .pair { border-left-color: var(--ink); }
.pair .name { margin-bottom: var(--s3); }
.pet-age, .opts { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Square tick and radio rows, drawn rather than default */
.check, .opt { display: flex; align-items: center; gap: var(--s3); font-size: 16px; cursor: pointer; }
.check input, .opt input { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border: 2px solid var(--ink); background: var(--paper); border-radius: 0; display: grid; place-content: center; }
.opt input { border-radius: 50%; }
.check input:checked { background: var(--ink); }
.check input:checked::after { content: ""; width: 10px; height: 5px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.opt input:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.check input:focus-visible, .opt input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.opts .opt { padding: var(--s2) 0; border-bottom: 1px solid var(--rule); }
.opts .opt:first-of-type { border-top: 1px solid var(--rule); }
.opts .opt span b { font-weight: 600; margin-right: var(--s2); }
.opts .opt span { color: var(--ink-2); }
.opts .opt span b { color: var(--ink); }
.opts.row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.opts.row legend { width: 100%; }
.opts.row .opt { border: 0; padding: var(--s1) 0; }

.btn { font: 600 16px/1 "Libre Franklin", "LF Fallback", Arial, sans-serif; color: #fff; background: var(--ink); border: 2px solid var(--ink); border-radius: 2px; padding: 0 var(--s4); height: 44px; cursor: pointer; }
@media (hover: hover) {
  .btn:hover { background: #000; }
}
.btn-quiet { color: var(--ink); background: var(--paper); }
@media (hover: hover) {
  .btn-quiet:hover { background: var(--desk); }
}
.slip-actions { display: flex; flex-direction: column; gap: var(--s2); min-width: 170px; }
.big .num.code { font-size: 88px; letter-spacing: -.01em; }
.bday-text strong.mid { display: block; font-size: 40px; font-weight: 800; line-height: 1; margin-top: 2px; }
.muted { color: var(--ink-3); font-weight: 400; }
.leaf[data-state="notice"] .msg { color: var(--ink); }

/* Class sheet (chronological age) */
.sheet { border: 1.5px solid var(--ink); background: var(--paper); padding: var(--s5); margin-top: var(--s4); }
.sheet-top { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); margin-bottom: var(--s4); }
.sheet-top label { font-size: 14px; font-weight: 600; }
.sheet-top input, .sheet-table input { display: block; font: 400 16px/1 "Libre Franklin", "LF Fallback", Arial, sans-serif; height: 38px; padding: 0 var(--s2); border: 1.5px solid #8f8e86; border-radius: 2px; margin-top: 3px; width: 100%; min-width: 0; color: var(--ink); }
.sheet-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.sheet-table th { text-align: left; font-size: 14px; border-bottom: 1.5px solid var(--ink); padding: var(--s2) var(--s2) var(--s2) 0; }
.sheet-table td { padding: var(--s1) var(--s2) var(--s1) 0; border-bottom: 1px solid var(--rule-soft); }
.sheet-table td input { border-color: transparent; margin: 0; padding: 0 3px; }
@media (hover: hover) {
  .sheet-table td input:hover { border-color: var(--rule); }
}
.sheet-table td.out { font-weight: 700; white-space: nowrap; width: 18%; }
.sheet-table td.m { font-weight: 400; width: 10%; }
.sheet-actions { display: flex; gap: var(--s3); margin-top: var(--s4); flex-wrap: wrap; }
.sheet-foot { font-size: 13px; color: var(--ink-3); margin: var(--s4) 0 0; }

/* Footer fix */
.foot .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.foot-tools { columns: 2; column-gap: var(--s6); }
.foot-tools li { break-inside: avoid; margin-bottom: var(--s2); }
.foot-tools span { display: block; font-size: 14px; color: var(--ink-3); }

/* Embed page */
.embed-page { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: var(--s8); padding-top: var(--s6); padding-bottom: var(--s9); align-items: start; }
.embed-page h1 { font-size: 34px; margin-bottom: var(--s4); }
.embed-page h2 { font-size: 21px; margin: var(--s7) 0 var(--s3); }
.embed-copy p, .embed-copy li { max-width: 62ch; }
.snippet { background: var(--desk); border-left: 3px solid var(--ink); padding: var(--s4); overflow-x: auto; font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; margin: 0 0 var(--s3); white-space: pre-wrap; word-break: break-all; }
.embed-preview { position: sticky; top: var(--s5); background: var(--desk); padding: var(--s5); border: 1px solid var(--rule); }
.preview-label { font-size: 14px; color: var(--ink-3); margin-bottom: var(--s3); }
.embed-preview iframe { display: block; background: var(--paper); }
.embed-preview p:last-child { font-size: 14px; margin: var(--s2) 0 0; }

/* Widget (inside someone else's page) */
body.widget { background: var(--paper); padding: var(--s4) var(--s4) 0; font-size: 16px; }
.widget .calc { display: block; margin: 0; }
.widget .entry { gap: var(--s4); margin-bottom: var(--s5); }
.widget .w-title { font-weight: 800; font-size: 19px; margin: 0; }
.widget .leaf { padding: 0 var(--s4) var(--s4); margin-right: 8px; min-height: 0; }
.widget #leaf { min-height: 470px; }
.widget .leaf::before { margin: 0 calc(var(--s4) * -1) var(--s3); height: 16px; background-size: 20px 16px, auto; }
.widget .leaf-body { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
.widget .big .num { font-size: 64px; }
.widget .bday { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--s3); border-top: 1px solid var(--rule); padding-top: var(--s3); }
.widget .month { width: 150px; }
.widget .month td { height: 21px; }
.widget .ledger { grid-template-columns: 1fr; font-size: 15px; }
.widget .credit { font-size: 14px; margin: 6px 0 0; }

@media (max-width: 1080px) { .embed-page { grid-template-columns: minmax(0, 1fr); } .embed-preview { position: static; } }
@media (max-width: 760px) {
  .entry { gap: var(--s4); }
  .quick { height: 52px; font-size: 20px; }
  .parts input { height: 38px; }
  .slip-actions { flex-direction: row; flex-wrap: wrap; }
  .big .num.code { font-size: 62px; }
  .foot-tools { columns: 1; }
  .foot .wrap { grid-template-columns: minmax(0, 1fr); }
  .sheet { padding: var(--s3); }
  .embed-page { padding-top: var(--s5); gap: var(--s6); }
}

/* ---------- Print ---------- */
@page { size: A4; margin: 16mm 15mm; }
@media print {
  body { font-size: 11pt; background: #fff; }
  .mast, .foot, .side, .intro p, .crumbs, .skip, .entry, .faq, .slip-actions, .sheet-actions { display: none !important; }
  body[data-page] .content > *:not(.sheet-section) { display: none !important; }
  .band { background: none; border: 0; }
  .band .wrap, .wrap { padding: 0; max-width: none; }
  .page { display: block; padding: 0; }
  .calc { display: block; margin: 0; }
  .leaf { box-shadow: none; margin: 0; break-inside: avoid; }
  .leaf::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body[data-print="sheet"] .band { display: none; }
  body[data-print="sheet"] .sheet-section > h2, body[data-print="sheet"] .sheet-section > p { display: none; }
  body[data-print="slip"] .content { display: none; }
  body:not([data-print="sheet"]) .sheet-section { display: none !important; }
  .sheet { border: 0; padding: 0; }
  .sheet-table input { border: 0 !important; padding: 0; height: auto; font-size: 11pt; }
  .sheet-top input { border: 0; border-bottom: 1px solid #000; border-radius: 0; padding: 0; }
  .sheet-table tr:has(input[aria-label="Name"]:placeholder-shown):has(.out:empty) { display: none; }
  .sheet::before { content: "Chronological age, class sheet"; display: block; font-size: 18pt; font-weight: 800; margin-bottom: 6mm; }
  body[data-print="slip"] .leaf::after, body[data-page="chronological-age"]:not([data-print]) .leaf::after { content: "Worked out at agecalculator.com/chronological-age. A date-difference helper, not an official publisher tool. Check your test manual’s rounding rule."; display: block; font-size: 9pt; color: #444; margin-top: 4mm; }
  a { color: inherit; text-decoration: none; }
  .obj-pair { display: block; grid-template-columns: none; }
  .obj-pair .pair-say { margin-top: 4mm; display: flex; max-width: none; width: auto; }
  .obj-pair .pair-say .unit { display: inline; width: auto; }
  .pair-leaves, .span-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); max-width: none; }
  .pair-say, .lead { min-width: 0; overflow: visible; }
}

.name.inline { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-top: calc(var(--s3) * -1); }
.name.inline input { height: 38px; font-size: 16px; }
@media (max-width: 760px) {
  .entry.multi .parts { display: none; }
  .entry.multi .readback { min-height: 44px; margin-top: var(--s1); }
  .prefill-on .entry.multi [data-datefield="on"] .readback { min-height: 36px; }
  .entry.multi .quick { height: 50px; }
  .entry.multi { gap: var(--s3); }
  .entry.multi .name.inline { margin-top: 0; }
  .entry.multi .name.inline input { height: 36px; }
}

.chart { border-collapse: collapse; width: 100%; max-width: 460px; font-variant-numeric: tabular-nums; font-size: 15px; margin: var(--s2) 0 var(--s4); }
.chart th { text-align: right; font-size: 13px; font-weight: 600; color: var(--ink-3); border-bottom: 1.5px solid var(--ink); padding: 0 0 var(--s1) var(--s3); }
.chart td { text-align: right; padding: 4px 0 4px var(--s3); border-bottom: 1px solid var(--rule-soft); }
.chart th:first-child, .chart td:first-child { text-align: left; padding-left: 0; font-weight: 700; }
.chart td:last-child:not(:nth-child(2)) { color: var(--ink-2); }

.diagram { margin: var(--s5) 0 22px; max-width: 640px; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { font-size: 14px; color: var(--ink-3); margin-top: var(--s2); }
.faq { margin-top: 72px; }
.content > section.tight + section { margin-top: 12px; }
.working { margin-bottom: 26px; }

@media (max-width: 1080px) { .mast nav { display: none; } .mast .tools-link { display: inline; } }

/* ---- polish pass, 16 Nov ---- */
.after-leaf { margin: var(--s4) 0 0; }
.widget .parts, .widget .zone-pick { display: none; }
.widget .on .zone { display: none; min-height: 0; }
.widget .readback { min-height: 1.45em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget .ledger dd small { display: inline; white-space: nowrap; }
@media (max-width: 360px) {
  .widget .bday { display: block; }
  .widget .bday .month { display: none; }
  .widget .bday-text, .widget .bday-note { max-width: none; }
  .widget .readback { white-space: normal; }
  .widget #leaf { min-height: 0; }
}
.widget .ledger div:nth-child(n+4) { display: none; }
.widget .entry { gap: var(--s3); margin-bottom: var(--s4); }
.widget .on { padding-top: var(--s3); font-size: 14px; }
@media (max-width: 760px) {
  .band .wrap { padding-top: 14px; }
  .crumbs { margin-bottom: var(--s2); }
  .calc { margin-top: var(--s4); }
  .after-leaf { margin-top: var(--s3); }
}

/* =====================================================================
   Polish v3. Moves the site away from the grand.deals family (white bar
   + text nav, H1 + grey subtitle, ruled white boxes, outlined inputs,
   white footer) and gives each tool its own paper object. SPEC.md §15.
   ===================================================================== */
:root { --tint: var(--desk); --paper-old: #f6efe0; --ink-old: #3a2e20; --indigo: #26365e; --manila: #ecdfbd; --school: #d3dfee; }
body[data-page="past"] { --tint: #ece5d6; }
body[data-page="korean-age"] { --tint: #e8ebf2; }
body[data-page="dog-age"], body[data-page="cat-age"] { --tint: #e7ebe1; }
body[data-page="chronological-age"] { --tint: #e9eef3; }
body[data-page="birthday-countdown"] { --tint: #f2e9e6; }
body[data-page="how-old-will-i-be"], body[data-page="what-year-was-i-born"] { --tint: #ecece4; }

/* Masthead: sits on the desk, no nav row. A red rule across the top like a calendar's header band. */
.mast { background: var(--tint); border-bottom: 0; border-top: 5px solid var(--sunday); }
.mast .wrap { min-height: 54px; gap: var(--s5); }
.mast nav { display: none; }
.dateline { margin: 0 0 0 auto; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dateline b { color: var(--ink); font-weight: 600; }
.dateline span::before { content: "·"; margin: 0 var(--s2); color: var(--ink-3); }
.mast .tools-link { display: inline; margin-left: 0; font-size: 15px; padding-left: var(--s5); border-left: 1px solid var(--rule); }

/* Band: per-page desk tint, ends in a perforation rather than a rule. */
.band { background: var(--tint); border-bottom: 0; position: relative; }
.band::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 10px;
  background: radial-gradient(circle, var(--paper) 0 3px, transparent 3.5px) 0 0 / 14px 10px repeat-x; }
.band .wrap { padding-top: var(--s3); padding-bottom: var(--s8); }

/* Intro: H1 in the entry column, the lede in ink against a short rule in the result column. */
.intro { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: var(--s7); align-items: end; }
.intro h1 { font-size: 36px; font-weight: 800; letter-spacing: -.012em; line-height: 1.12; }
.intro .lede { margin: 0; color: var(--ink); font-size: 18px; max-width: 58ch; padding-left: var(--s4); border-left: 3px solid var(--sunday); }
.calc { margin-top: var(--s6); }

/* Inputs: writing on a line. Paper fill so the field keeps a shape, one heavy baseline. */
.quick { border: 0; border-bottom: 2.5px solid var(--ink); border-radius: 0; background: var(--paper); box-shadow: 0 1px 0 var(--paper); }
.quick[aria-invalid="true"] { border-bottom-color: var(--sunday); box-shadow: none; }
.parts input, .name input, .zone-pick select { border: 0; border-bottom: 1.5px solid var(--ink-2); border-radius: 0; background: rgba(255,255,255,.75); }
.parts.two input, .name.year-in input, .name.big-num input { border: 0; border-bottom: 2.5px solid var(--ink); background: var(--paper); }
.parts input[aria-invalid="true"] { border-bottom-color: var(--sunday); }
.quick:focus, .parts input:focus, .name input:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.df-label, .entry legend, .name { letter-spacing: -.003em; }
.on { border-top: 0; padding-top: 0; }
.on p { padding: var(--s2) 0; border-top: 1px dotted var(--ink-3); border-bottom: 1px dotted var(--ink-3); }

/* Body copy: headings hung in the margin, like an almanac. */
.page { padding-top: 72px; }
.content { max-width: 800px; }
.content > section:not(.faq) { display: grid; grid-template-columns: 180px minmax(0, 1fr); column-gap: var(--s6); grid-auto-flow: dense; }
body[data-page="difference"] .content > section:not(.faq),
body[data-page="chronological-age"] .content > section:not(.faq) { grid-template-columns: 200px minmax(0, 1fr); }
.content > section:not(.faq) > h2 { grid-column: 1; grid-row: 1 / span 30; font-size: 18px; line-height: 1.25; padding-top: 3px; border-top: 3px solid var(--ink); align-self: start; }
.content > section:not(.faq) > *:not(h2) { grid-column: 2; }
.content > section:not(.faq) > .years { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.content > .placeholder-note { margin-left: 176px; }

/* FAQ shown in full, two columns of question and answer. */
.faq { margin-top: var(--s8); padding-top: var(--s5); border-top: 3px solid var(--ink); }
.faq h2 { font-size: 25px; margin-bottom: var(--s6); }
.qa-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6) var(--s7); }
.qa dt { font-weight: 700; font-size: 18px; line-height: 1.3; margin-bottom: var(--s2); }
.qa dd { margin: 0; color: var(--ink-2); }
.qa dd p:last-child { margin-bottom: 0; }

/* Footer: dark, an index of every calculator. */
.foot { background: var(--ink); color: #d8d6cd; border-top: 0; }
.foot .wrap { display: block; padding-top: var(--s7); padding-bottom: var(--s7); }
.foot h2 { color: #fff; font-size: 19px; margin-bottom: var(--s5); }
.foot-tools { columns: 3; column-gap: var(--s7); }
.foot-tools li { margin-bottom: var(--s4); }
.foot a { color: #fff; }
.foot-tools span { color: #a8a69d; }
.foot-small { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s4) var(--s7); margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid #45443f; font-size: 14px; color: #a8a69d; }
.foot-small p { margin: 0; }
.foot-small b { color: #fff; }

/* ---------- wide layout for two-date tools ---------- */
.calc.wide { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.calc.wide .entry { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4) var(--s8); max-width: none; }
.calc.wide .entry .col { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.intro:has(+ .calc.wide), .band:has(.calc.wide) .intro { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); }

/* Objects that replace the standard leaf */
.leaf.obj { border: 0; box-shadow: none; background: none; padding: 0; margin-right: 0; min-height: 0; }
.leaf.obj::before { display: none; }
.leaf .hint { margin-top: var(--s4); }

/* mini leaves (difference, days between) */
.mini-leaf { position: relative; background: var(--paper); border: 1.5px solid var(--ink); text-align: center; padding: 0 var(--s3) var(--s4); box-shadow: 4px 4px 0 -1.5px var(--paper), 4px 4px 0 0 var(--ink); }
.mini-leaf::before { content: ""; display: block; height: 16px; margin: 0 calc(var(--s3) * -1) var(--s3); border-bottom: 1.5px solid var(--ink);
  background: radial-gradient(circle, var(--tint) 0 3px, var(--ink) 3.5px 4.5px, transparent 5px) 0 50% / 20px 16px repeat-x, var(--sunday); }
.mini-leaf p { margin: 0; }
.ml-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-day { font-size: 76px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: var(--s2) !important; }
.ml-my { font-size: 16px; font-weight: 600; }
.ml-wd { font-size: 14px; color: var(--ink-3); }
.mini-leaf.blank .ml-day { color: var(--rule); }
.mini-leaf.elder::before { background-color: var(--ink); }

.pair-leaves, .span-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) 180px; align-items: center; }
.gap-measure { display: flex; flex-direction: column; align-items: center; margin: 0 var(--s5); }
.gm-label { font-size: 15px; color: var(--ink-2); text-align: center; margin-bottom: var(--s2); font-variant-numeric: tabular-nums; }
.gm-label b { display: block; font-size: 28px; color: var(--ink); font-weight: 800; letter-spacing: -.01em; }
.gm-line { display: block; width: 100%; height: 16px; border-left: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink);
  background: linear-gradient(var(--sunday), var(--sunday)) 50% 50% / 100% 2px no-repeat; }
.pair-say { margin-top: var(--s6); display: flex; align-items: baseline; gap: var(--s5); flex-wrap: wrap; }
.pair-say .big .num { font-size: 76px; }
.pair-say .rest { margin: 0; }

.ruler { margin: 0 var(--s4); text-align: center; }
.span-label { display: block; font-size: 18px; font-weight: 600; margin-bottom: var(--s2); }
.span-label b { font-size: 56px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rule-ticks { display: block; height: 30px; background-color: var(--paper); border: 1.5px solid var(--ink); border-top: 3px solid var(--sunday);
  background-image: repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px calc(100% / var(--weeks, 8))), repeating-linear-gradient(90deg, #8f8e86 0 1px, transparent 1px calc(100% / var(--weeks, 8) / 7));
  background-size: 100% 60%, 100% 30%; background-position: 0 0, 0 0; background-repeat: no-repeat; }
.span-sub { display: block; font-size: 15px; color: var(--ink-2); margin-top: var(--s2); }

/* past: an old leaf, the date stamped */
.leaf.leaf-old { background: var(--paper-old); border-color: var(--ink-old); color: var(--ink-old);
  box-shadow: 5px 5px 0 -1.5px var(--paper-old), 5px 5px 0 0 var(--ink-old), 10px 10px 0 -1.5px #efe6d1, 10px 10px 0 0 #b9a888; }
.leaf.leaf-old::before { background: radial-gradient(circle at 50% 50%, var(--tint) 0 4px, var(--ink-old) 4.5px 5.5px, transparent 6px) 0 50% / 26px 22px repeat-x, #7d5a3c; border-bottom-color: var(--ink-old); }
.leaf-old .leaf-head { align-items: center; justify-content: flex-start; }
.stamp { display: inline-block; font-size: 17px; font-weight: 800; letter-spacing: .1em; color: #8c2f1c; border: 3px double #8c2f1c; padding: 3px var(--s3) 2px; transform: rotate(-3deg); margin-left: var(--s2); }
.leaf-old .ledger { border-top-color: var(--ink-old); }
.leaf-old .ledger div { border-bottom-color: #e2d6bd; }
.leaf-old .month th { border-bottom-color: var(--ink-old); }

/* countdown: tear-off pad, depth set by days left */
.leaf.leaf-stack { margin-bottom: 24px; }
.leaf.leaf-stack::after { content: ""; position: absolute; left: 0; right: 0; top: 22px; height: 7px;
  background: linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 9px 7px repeat-x, linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 9px 7px repeat-x, #d8d6cd; }

/* korean: lunar-style leaf, indigo binding, three counts side by side */
.leaf.leaf-lunar::before { background: radial-gradient(circle at 50% 50%, var(--tint) 0 4px, var(--ink) 4.5px 5.5px, transparent 6px) 0 50% / 26px 22px repeat-x, var(--indigo); }
.leaf.leaf-lunar { box-shadow: 5px 5px 0 -1.5px var(--paper), 5px 5px 0 0 var(--indigo), 10px 10px 0 -1.5px var(--paper), 10px 10px 0 0 #b6bdd0; }
.kcols { display: grid; grid-template-columns: 1.25fr 1fr 1fr; margin-top: var(--s3); }
.kcol { padding: 0 var(--s5); border-left: 1px solid var(--rule); }
.kcol:first-child { padding-left: 0; border-left: 0; }
.kcol p { margin: 0; }
.k-ko { font-size: 16px; color: var(--indigo); font-weight: 600; }
.k-n { font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: var(--s2) 0 !important; }
.kcol.main .k-n { font-size: 104px; }
.k-en { font-size: 16px; font-weight: 700; }
.k-how { font-size: 14px; color: var(--ink-2); margin-top: var(--s1) !important; max-width: 24ch; }
.k-ny { margin: var(--s5) 0 0; padding-top: var(--s3); border-top: 1.5px solid var(--indigo); font-size: 16px; }
.k-ny b { color: var(--sunday); }

/* chronological age: a school record slip */
.slip { position: relative; background: var(--paper); border: 1.5px solid var(--ink); padding: var(--s4) var(--s5) var(--s5) 70px;
  background-image: linear-gradient(90deg, transparent 52px, #e3a59f 52px 53.5px, transparent 53.5px); }
.slip::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 20px;
  background: radial-gradient(circle, var(--tint) 0 7px, var(--ink) 7.5px 8.5px, transparent 9px) 50% 22% / 20px 20px no-repeat, radial-gradient(circle, var(--tint) 0 7px, var(--ink) 7.5px 8.5px, transparent 9px) 50% 78% / 20px 20px no-repeat; }
.slip-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.5px solid var(--ink); padding-bottom: var(--s2); margin-bottom: var(--s3); }
.slip-head b { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; }
.slip-head span { font-size: 14px; color: var(--ink-3); }
.slip-name { font-size: 16px; margin: 0 0 var(--s3); border-bottom: 1px solid var(--school); padding-bottom: var(--s2); }
.slip-name span { color: var(--ink-3); margin-right: var(--s3); font-size: 14px; }
.slip-sum { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.slip-sum th { text-align: left; font-weight: 500; font-size: 14px; color: var(--ink-2); padding: var(--s1) var(--s5) var(--s1) 0; }
.slip-sum thead th { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; text-align: center; padding: 0 0 var(--s1); }
.slip-sum td { width: 86px; text-align: center; font-size: 26px; font-weight: 600; height: 40px; border-bottom: 1px solid var(--school); border-left: 1px solid var(--school); }
.slip-sum td.blank { background: repeating-linear-gradient(90deg, transparent 0 6px, var(--school) 6px 7px) 50% 85% / 70% 1px no-repeat; }
.slip-sum tr.ans th { font-weight: 700; color: var(--ink); font-size: 15px; }
.slip-sum tr.ans td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
.slip-foot { display: flex; align-items: center; gap: var(--s3) var(--s6); flex-wrap: wrap; margin-top: var(--s5); }
.slip-foot .big .num.code { font-size: 64px; }
.slip-foot .rest { margin: 0; font-size: 18px; flex: 1 1 140px; }
.slip-foot .slip-actions { flex-direction: row; min-width: 0; }
.slip .ledger { margin-top: var(--s4); }

/* dog, cat: vet record card in a manila tab */
.leaf.obj-record { padding-top: 30px; }
.leaf.obj-record .record { margin-top: 0; }
.record { position: relative; margin-top: 30px; background: var(--manila); border: 1.5px solid var(--ink); padding: var(--s4) var(--s5) var(--s5); }
.rec-tab { position: absolute; left: -1.5px; top: -30px; height: 30px; padding: 5px var(--s5) 0; background: var(--manila); border: 1.5px solid var(--ink); border-bottom: 0; font-weight: 800; font-size: 15px; letter-spacing: .04em; }
.rec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: #5b5039; margin: 0 0 var(--s3); }
.rec-lines { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s5); }
.rec-lines > div:nth-child(2) { grid-column: 1 / -1; order: 3; }
.rec-lines dt { font-size: 13px; color: #5b5039; }
.rec-lines dd { margin: 0; font-weight: 600; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.rec-lines dd small { display: block; font-weight: 400; font-size: 13px; color: #5b5039; }
.rec-result { margin-top: var(--s5); }
.record .ledger, .slip .ledger { grid-template-columns: minmax(0, 1fr); }
.record .ledger dd small { display: block; white-space: normal; }
.record .ledger { border-top-color: var(--ink); }
.record .ledger div { border-bottom-color: #d5c79f; }
.record .ledger dt::after { border-bottom-color: #9e9068; }
.record .chart td { border-bottom-color: #d5c79f; }
.record .chart th { color: #5b5039; }
.record .hint { color: #4a4130; }

/* how old will I be: year planner strip */
.planner { background: var(--paper); border: 1.5px solid var(--ink); padding: var(--s3) var(--s5) var(--s5); }
.pl-year { font-size: 44px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 var(--s3); line-height: 1; }
.pl-months { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border-top: 1.5px solid var(--ink); }
.pl-months li { position: relative; height: 62px; border-right: 1px solid var(--rule-soft); padding: var(--s1) 0 0 var(--s1); }
.pl-months li:last-child { border-right: 0; }
.pl-m { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.pl-after { background: var(--sunday-tint); }
.pl-b { background: linear-gradient(90deg, var(--paper) 50%, var(--sunday-tint) 50%); }
.pl-b .pl-m { color: var(--sunday); }
.pl-d { position: absolute; left: 50%; top: 30px; transform: translateX(-50%); font-weight: 800; font-size: 18px; }
.pl-d .ring { width: 40px; height: 34px; }
.pl-ages { display: flex; margin: var(--s2) 0 0; font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.pl-ages span { border-top: 3px solid var(--ink); padding-top: 2px; }
.pl-ages span:first-child { flex: 0 0 var(--w); }
.pl-ages span:last-child { flex: 1; border-top-color: var(--sunday); color: var(--sunday); padding-left: var(--s2); }
.planner-say { margin-top: var(--s5); display: flex; align-items: baseline; gap: var(--s5); flex-wrap: wrap; }
.planner-say .rest { margin: 0; }

/* what year was I born: divider tabs */
.ytabs { display: flex; align-items: flex-end; gap: var(--s5); flex-wrap: wrap; }
.ytab { position: relative; margin-top: 30px; background: var(--paper); border: 1.5px solid var(--ink); padding: var(--s3) var(--s6) var(--s4); min-width: 220px; }
.ytab.second { background: #f7f6f1; }
.yt-tab { position: absolute; left: -1.5px; top: -28px; height: 28px; padding: 4px var(--s4) 0; background: inherit; border: 1.5px solid var(--ink); border-bottom: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.ytab.second .yt-tab { left: auto; right: -1.5px; }
.yt-year { font-size: 104px; font-weight: 800; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 0; }
.ytab.blank .yt-year { color: var(--ink-3); }
.yt-cap { margin: var(--s2) 0 0; font-size: 16px; color: var(--ink-2); max-width: 24ch; }
.yt-or { margin: 0 0 var(--s7); font-size: 18px; font-weight: 600; color: var(--ink-3); }
.obj-tabs > .rest { margin-top: var(--s4); }

@media (max-width: 1080px) {
  .intro, .intro:has(+ .calc.wide), .band:has(.calc.wide) .intro { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .content > section:not(.faq) { display: block; }
  .content > section:not(.faq) > h2 { border-top: 0; padding-top: 0; font-size: 22px; margin-bottom: var(--s4); }
  .content > .placeholder-note { margin-left: 0; }
}
.dateline .dl-short { display: none; }
.dateline:empty { display: none; }
@media (max-width: 760px) {
  .dateline .dl-doy,
  .dateline > span:not(.dl-wd):not(.dl-long):not(.dl-short) { display: none; }
  .dateline { font-size: 14px; }
  .mast .wrap { min-height: 46px; }
  .mast .tools-link { display: none; }
  .band .wrap { padding-top: var(--s2); padding-bottom: var(--s7); }
  .intro h1 { font-size: 28px; }
  .intro .lede { font-size: 15px; padding-left: var(--s3); border-left-width: 2px; }
  .calc { margin-top: var(--s4); }
  .calc.wide .entry { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .pair-leaves, .span-row { grid-template-columns: 96px minmax(0, 1fr) 96px; }
  .mini-leaf { padding: 0 var(--s2) var(--s2); }
  .mini-leaf::before { margin: 0 calc(var(--s2) * -1) var(--s2); height: 12px; background-size: 16px 12px, auto; }
  .ml-name { font-size: 11px; }
  .ml-day { font-size: 40px; }
  .ml-my { font-size: 13px; }
  .ml-wd { font-size: 12px; }
  .gap-measure, .ruler { margin: 0 var(--s2); }
  .gm-label { font-size: 13px; }
  .gm-label b { font-size: 18px; }
  .span-label { font-size: 14px; }
  .span-label b { font-size: 34px; }
  .span-sub { font-size: 13px; }
  .pair-say { margin-top: var(--s4); gap: var(--s2) var(--s4); }
  .pair-say .big .num { font-size: 54px; }
  .kcols { grid-template-columns: 1.1fr 1fr 1fr; }
  .kcol { padding: 0 var(--s2); }
  .k-n { font-size: 44px; }
  .kcol.main .k-n { font-size: 60px; }
  .k-en { font-size: 13px; }
  .k-ko { font-size: 13px; }
  .k-how { display: none; }
  .k-ny { font-size: 15px; }
  .slip { padding: var(--s3) var(--s3) var(--s4) 44px; background-image: linear-gradient(90deg, transparent 34px, #e3a59f 34px 35.5px, transparent 35.5px); }
  .slip::before { left: 8px; }
  .slip-sum td { width: 64px; font-size: 21px; height: 34px; }
  .slip-sum th { padding-right: var(--s3); font-size: 13px; }
  .slip-foot { margin-top: var(--s3); }
  .slip-foot .big .num.code { font-size: 48px; }
  .record { padding: var(--s3) var(--s4) var(--s4); }
  .pl-year { font-size: 34px; }
  .planner { padding: var(--s2) var(--s3) var(--s4); }
  .pl-months li { height: 54px; padding: 2px 0 0 1px; }
  .pl-m { font-size: 10px; letter-spacing: 0; }
  .pl-d { font-size: 15px; top: 26px; }
  .yt-year { font-size: 72px; }
  .ytab { min-width: 0; flex: 1 1 140px; padding: var(--s2) var(--s4) var(--s3); }
  .yt-or { margin: 0; flex-basis: 100%; display: none; }
  .ytabs { gap: var(--s4); }
  .qa-list { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .foot-tools { columns: 1; }
  .faq h2 { font-size: 22px; }
}
@media print {
  .band::after, .mast { display: none; }
}
/* v3 fixes after first look */
.obj-pair { display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 1fr); column-gap: var(--s7); align-items: center; }
.obj-pair > .ledger, .obj-pair > .hint { grid-column: 1 / -1; }
.obj-pair .pair-say { margin-top: 0; display: block; }
.obj-pair .pair-say .unit { display: block; width: 100%; }
.pair-leaves, .span-row { align-items: stretch; }
.gap-measure, .ruler { align-self: center; }
.dateline { white-space: nowrap; }
.leaf.leaf-stack { box-shadow: none; }
.leaf.leaf-stack::after { top: 23.5px; height: 9px; background: #cfcdc4;
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 12px 100%;
          mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 12px 100%; }
.leaf.leaf-stack .leaf-head { margin-top: var(--s3); }
@media (max-width: 760px) {
  .dl-wd { display: none; }
  .obj-pair { display: block; }
  .obj-pair .pair-say { margin-top: var(--s4); display: flex; }
  .obj-pair .pair-say .unit { display: inline; width: auto; }
  .calc.wide .name.inline { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: var(--s3); font-size: 14px; margin: 0; }
  .calc.wide .name.inline input { margin: 0; height: 36px; }
}
.dateline span::before { content: none; }
.dateline > span:not(.dl-wd)::before { content: "·"; margin: 0 var(--s2); color: var(--ink-3); }
.obj-pair .pair-say .unit { display: inline; width: auto; }
@media (max-width: 760px) {
  .ytabs { flex-wrap: nowrap; }
  .ytab { flex: 1 1 0; }
  .yt-year { font-size: 50px; }
  .yt-cap { font-size: 14px; }
}
.widget .big .num { font-size: 60px; } .widget .big .num.long { font-size: 48px; }
@media print { .band, .mast { background: none !important; } .slip::before { display: none; } }

/* Preview-only strip. Remove at launch with the noindex tags. */
.preview-banner {
  background: var(--ink);
  color: var(--desk);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  padding: 8px 20px;
}
.slip-borrow {
  margin: var(--s3) 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 36em;
}
.rule-line {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 36em;
}
@media print {
  .preview-banner, .rule-line { display: none !important; }
}


/* Reserve the empty result card's height so JS drawing the calendar or
   paper object doesn't push the page down (mobile CLS).
   Heights are the measured empty-state card at that width, rounded up. */
body[data-page="dog-age"] .leaf[data-state="empty"],
body[data-page="cat-age"] .leaf[data-state="empty"] { min-height: 425px; }
@media (max-width: 760px) {
  body[data-page="home"] .leaf[data-state="empty"] { min-height: 480px; }
  body[data-page="past"] .leaf[data-state="empty"] { min-height: 456px; }
  body[data-page="korean-age"] .leaf[data-state="empty"] { min-height: 456px; }
  body[data-page="birthday-countdown"] .leaf[data-state="empty"] { min-height: 456px; }
  body[data-page="how-old-will-i-be"] .leaf[data-state="empty"] { min-height: 182px; }
  body[data-page="difference"] .leaf[data-state="empty"],
  body[data-page="days-between-dates"] .leaf[data-state="empty"] { min-height: 150px; }
  body[data-page="chronological-age"] .leaf[data-state="empty"] { min-height: 314px; }
  body[data-page="what-year-was-i-born"] .leaf[data-state="empty"] { min-height: 156px; }
  body[data-page="dog-age"] .leaf[data-state="empty"] { min-height: 438px; }
  body[data-page="cat-age"] .leaf[data-state="empty"] { min-height: 438px; }
}
@media (max-width: 390px) {
  body[data-page="what-year-was-i-born"] .leaf[data-state="empty"] { min-height: 180px; }
  body[data-page="cat-age"] .leaf[data-state="empty"] { min-height: 438px; }
}
@media (max-width: 360px) {
  body[data-page="home"] .leaf[data-state="empty"] { min-height: 496px; }
  body[data-page="korean-age"] .leaf[data-state="empty"] { min-height: 472px; }
  body[data-page="chronological-age"] .leaf[data-state="empty"] { min-height: 324px; }
}
@media (max-width: 320px) {
  body[data-page="chronological-age"] .leaf[data-state="empty"] { min-height: 400px; }
  body[data-page="dog-age"] .leaf[data-state="empty"] { min-height: 461px; }
}


/* Prefill result height: when the URL has a query, reserve the filled-card
   height so JS drawing the result doesn't shift the page. --leaf-h is set per
   page below. Empty-state min-heights still apply without a query. */
body[data-page="home"] { --leaf-h: 694px; }
@media (min-width: 761px) {
  body[data-page="home"] { --leaf-h: 518px; }
  body[data-page="home"] .leaf[data-state="empty"] { min-height: 314px; }
  .prefill #leaf { min-height: var(--leaf-h); }
}
@media (max-width: 360px) {
  body[data-page="home"] { --leaf-h: 764px; }
}
@media (max-width: 320px) {
  body[data-page="home"] { --leaf-h: 804px; }
}
body[data-page="difference"] { --leaf-h: 463px; }
body[data-page="past"] { --leaf-h: 604px; }
body[data-page="days-between-dates"] { --leaf-h: 336px; }
body[data-page="chronological-age"] { --leaf-h: 497px; }
body[data-page="dog-age"] { --leaf-h: 404px; }
body[data-page="cat-age"] { --leaf-h: 398px; }
body[data-page="korean-age"] { --leaf-h: 282px; }
body[data-page="birthday-countdown"] { --leaf-h: 596px; }
body[data-page="how-old-will-i-be"] { --leaf-h: 494px; }
body[data-page="what-year-was-i-born"] { --leaf-h: 184px; }
body.widget { --leaf-h: 470px; }

@media (max-width: 760px) {
  .prefill #leaf { min-height: var(--leaf-h); }
  .ledger dd small { display: block; }
  .preview-banner { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 14px; }
  .slip-sum td { height: 30px; font-size: 20px; }
  .slip-head { margin-bottom: 6px; }
  .slip-name { margin-bottom: 6px; padding-bottom: 3px; }
}

.widget #leaf { min-height: 470px; }
@media (max-width: 360px) {
  .widget #leaf { min-height: 0; }
}

/* Print layout must come after the later screen grid rules, otherwise those
   rules undo the print stacking and squeeze the difference result into a
   narrow column on A4 (RETEST M3). */
@media print {
  .obj-pair {
    display: block;
    grid-template-columns: none;
  }
  .obj-pair .pair-say {
    margin-top: 4mm;
    display: flex;
    align-items: baseline;
    gap: 8pt;
    flex-wrap: wrap;
    max-width: none;
    width: auto;
  }
  .obj-pair .pair-say .unit { display: inline; width: auto; }
  .pair-say, .lead { min-width: 0; overflow: visible; }
}

/* N2: mast date at narrow widths, and the 7px /difference overflow at 768px. */
@media (max-width: 379px) {
  .mast .wrap { gap: var(--s3); max-width: 100%; }
  .dateline { white-space: normal; min-width: 0; text-align: right; line-height: 1.3; }
  .dateline .dl-long { display: none; }
  .dateline .dl-short { display: inline; }
}
.obj-pair .pair-say { min-width: 0; }
@media (min-width: 761px) and (max-width: 1080px) {
  /* calc is capped at 720px in this range, so a 640px first column
     leaves only ~40px for the result and the page scrolls sideways. */
  .obj-pair { grid-template-columns: minmax(0, 1fr) min-content; }
}
