/* Sample size calculator page. Uses the colour tokens from site.css.
   Layout: the form on the left, the live write-up on a sheet of A4 on the right; one column on phones. */

.calc { --container: 1280px; font-size: 15px; line-height: 1.5; padding-block: 28px 40px; }

/* page title */
.top { display: grid; gap: 6px; margin-bottom: 22px; max-width: 760px; }
.top h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(28px, 4.4vw, 40px); line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
.top h1::after { content: ""; display: block; width: 56px; height: 3px; background: var(--gold); margin-top: 12px; border-radius: 2px; }
.top p { margin: 4px 0 0; color: var(--muted); max-width: 64ch; }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.col { display: grid; gap: 18px; min-width: 0; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 20px; display: grid; gap: 14px; min-width: 0; }
.card-h { display: flex; align-items: baseline; gap: 10px; }
.card-h .step { font-family: var(--f-display); font-weight: 600; font-size: 15px; color: var(--accent); min-width: 1.2em; }
.card-h h2 { font-family: var(--f-display); font-weight: 600; font-size: 19px; margin: 0; }
.card-h .aside { margin-left: auto; font-size: 13px; color: var(--muted); }

/* fields */
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > label, .lbl { font-size: 13px; font-weight: 500; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.span2 { grid-column: 1 / -1; }
.calc input[type="text"], .calc input[type="number"], .calc select, .calc textarea {
  width: 100%; min-width: 0; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 15px; line-height: 1.35;
}
.calc textarea { resize: vertical; min-height: 64px; }
.calc input::placeholder, .calc textarea::placeholder { color: var(--muted); opacity: .75; }
.with-unit { position: relative; }
.with-unit input { padding-right: 34px; font-variant-numeric: tabular-nums; }
.with-unit span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }

/* design list */
.aims { display: grid; gap: 6px; }
.aim { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: var(--surface); }
.aim:hover { border-color: var(--line-strong); }
.aim input { margin: 3px 0 0; accent-color: var(--accent); }
.aim-t { font-size: 14px; font-weight: 500; line-height: 1.3; }
.aim-s { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.aim:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); border: 1px solid currentColor; border-radius: 999px; padding: 1px 7px; white-space: nowrap; align-self: center; }
.note { font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: grid; gap: 8px; }
.note p { margin: 0; }
.note b { font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { color: var(--accent); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* segmented control */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; gap: 3px; background: var(--surface-2); }
.seg label { text-align: center; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--muted); line-height: 1.25; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.example { display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--gold); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 7px 10px; }
.subhead { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 0 -4px; }
details.adv summary { cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--muted); }
details.adv[open] summary { margin-bottom: 10px; }
.radios { display: grid; gap: 6px; font-size: 14px; }
.radios label { display: flex; gap: 8px; align-items: flex-start; }
.radios input { accent-color: var(--accent); margin-top: 4px; }

/* result */
.result { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.res-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.res-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.res-num { font-family: var(--f-display); font-weight: 600; font-size: clamp(44px, 7vw, 64px); line-height: 1; color: var(--accent); font-variant-numeric: lining-nums tabular-nums; }
.res-unit { font-size: 16px; color: var(--ink); }
.res-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.msgs { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.msgs li { font-size: 13.5px; padding: 8px 10px 8px 12px; border-radius: 8px; border-left: 3px solid var(--warn); background: var(--warn-soft); }
.msgs li.err { border-left-color: var(--bad); background: var(--bad-soft); }
.honest { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.honest h3 { margin: 0; font-size: 14px; font-weight: 600; }
.honest ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13.5px; color: var(--ink); }

/* write-up sheet */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; min-width: 0; overflow: hidden; }
.sheet-tools { padding: 14px 16px; display: grid; gap: 12px; border-bottom: 1px solid var(--line); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px 12px; }
.tools-grid .field > label { font-size: 12px; color: var(--muted); font-weight: 500; }
.tools-grid select, .tools-grid input { font-size: 14px; padding: 6px 8px; }
.margins { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 460px) { .margins { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.act-status { font-size: 13px; color: var(--muted); }
.desk { background: var(--desk); padding: 22px 16px 28px; overflow-x: auto; min-width: 0; }
.page { margin: 0 auto; background: var(--paper); color: var(--paper-ink); box-shadow: var(--shadow); width: 100%; max-width: 760px; aspect-ratio: 210 / 297; }
.page.letter { aspect-ratio: 8.5 / 11; }
.page p, .page h3, .page h4 { margin: 0; }
.page .d-title { font-weight: 700; line-height: 1.2; }
.page .d-h { font-weight: 700; }
.page sup, .page sub { font-size: .68em; line-height: 0; }
.page .d-ref { display: grid; grid-template-columns: 1.6em minmax(0, 1fr); }
.page .placeholder { color: var(--paper-muted); font-family: var(--f-ui); font-size: 14px; text-align: center; padding-top: 30%; }
.copybox { width: 100%; min-height: 160px; font-family: var(--f-mono); font-size: 12.5px; }
.calc-foot { margin-top: 28px; color: var(--muted); font-size: 13px; max-width: 80ch; display: grid; gap: 6px; }
.calc-foot p { margin: 0; }
