/* Box Size Calculator — styles
   Concept: the page as a packaging dieline sheet.
   Magenta = cut line, cyan = fold line, kraft = board. */

:root {
  --paper: #F5F6F4;
  --panel: #FFFFFF;
  --ink: #1C2330;
  --ink-2: #4B5565;
  --rule: #D6DBE0;
  --grid: #E4E8EC;
  --cut: #C8125F;
  --crease: #0A7FB8;
  --kraft: #B8864E;
  --kraft-tint: #F0E4D2;
  --good: #1F7A4D;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
img, svg { max-width: 100%; }
a { color: var(--crease); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--crease); outline-offset: 2px; border-radius: 2px; }

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

h1, h2, h3 {
  font-stretch: 70%;
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.005em;
  margin: 0 0 0.45em;
  color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); max-width: 18ch; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin-top: 1.8em; }
h3 { font-size: 1.4rem; font-stretch: 82%; margin-top: 1.6em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.prose { max-width: 70ch; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.4em; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--ink-2); }
.small { font-size: 0.9rem; }

/* Header: a single fold line sits beneath it */
.site-header { border-bottom: 2px dashed var(--crease); background: var(--paper); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span { font-stretch: 68%; font-weight: 800; font-size: 1.45rem; line-height: 1; }
.nav ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-stretch: 88%; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--cut); }
.nav-toggle { display: none; background: none; border: 1px solid var(--rule); border-radius: 4px; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 70px; background: var(--paper); border-bottom: 2px dashed var(--crease); z-index: 5; }
  .nav-open .nav { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: 8px 20px 16px; }
  .nav a { display: block; padding: 10px 0; }
  .site-header { position: relative; }
}

.crumbs { font-size: 0.9rem; color: var(--ink-2); padding-top: 18px; }
.crumbs a { color: var(--ink-2); }

.hero { padding-top: 34px; padding-bottom: 8px; }
main section { padding-bottom: 8px; }

/* Tool layout */
.tool { display: grid; grid-template-columns: minmax(300px, 5fr) 7fr; gap: 24px; margin: 28px 0 12px; align-items: start; }
.tool.single { grid-template-columns: minmax(300px, 5fr) 6fr; }
@media (max-width: 900px) { .tool, .tool.single { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: 22px; }
.panel h2, .panel h3 { margin-top: 0; }

.field { margin-bottom: 18px; }
.field > label, .field > .label, fieldset legend { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dims label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 4px; }

input[type="number"], input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #B9C1CA;
  border-radius: 4px;
  padding: 10px 12px;
}
input[type="number"] { font-stretch: 80%; font-weight: 700; font-size: 1.35rem; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--crease); outline: 2px solid var(--crease); outline-offset: 0; }
.hint { font-size: 0.85rem; color: var(--ink-2); margin-top: 4px; }

/* Segmented choices */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { border: 1px solid #B9C1CA; border-radius: 4px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 0.92rem; background: #fff; user-select: none; }
.seg input:checked + label { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg input:focus-visible + label { outline: 3px solid var(--crease); outline-offset: 2px; }

/* Dieline sheet */
.sheet {
  background-color: #fff;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 14px;
}
.sheet svg { display: block; width: 100%; height: auto; }
.sheet .cut { fill: rgba(184, 134, 78, 0.10); stroke: var(--cut); stroke-width: 2.2; stroke-linejoin: round; }
.sheet .slot { stroke: var(--cut); stroke-width: 2.2; }
.sheet .fold { stroke: var(--crease); stroke-width: 1.6; stroke-dasharray: 7 5; fill: none; }
.sheet .glue { fill: rgba(184, 134, 78, 0.28); }
.sheet text { font-family: "Archivo", sans-serif; font-stretch: 75%; fill: var(--ink); }
.sheet .plabel { font-size: 15px; font-weight: 700; }
.sheet .pval { font-size: 13px; fill: var(--ink-2); }
.sheet .dimline { stroke: var(--ink-2); stroke-width: 1; }
.sheet .dimtext { font-size: 13px; font-weight: 700; fill: var(--ink-2); }
.draw-in .cut, .draw-in .slot { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 1.3s ease-out forwards; }
.draw-in .fold, .draw-in .glue, .draw-in text { opacity: 0; animation: fadein 0.5s ease-out 1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .draw-in .cut, .draw-in .slot, .draw-in .fold, .draw-in .glue, .draw-in text { animation: none; stroke-dashoffset: 0; opacity: 1; } .draw-in .cut, .draw-in .slot { stroke-dasharray: none; } html { scroll-behavior: auto; } }

.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.88rem; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 26px; height: 0; vertical-align: middle; margin-right: 6px; }
.legend .l-cut { border-top: 2.5px solid var(--cut); }
.legend .l-fold { border-top: 2px dashed var(--crease); }
.legend .l-glue { height: 10px; background: rgba(184, 134, 78, 0.35); }

/* Results */
.results { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 14px; border-top: 1px solid var(--rule); margin-top: 16px; }
.results > div { padding: 14px 14px 12px 0; border-bottom: 1px solid var(--rule); }
.results dt { font-size: 0.88rem; color: var(--ink-2); font-weight: 600; }
.results dd { margin: 2px 0 0; font-stretch: 72%; font-weight: 800; font-size: 1.4rem; line-height: 1.15; }
.results dd small { display: block; font-stretch: 100%; font-weight: 400; font-size: 0.85rem; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.results .key dd { color: var(--cut); }
.big-result { font-stretch: 68%; font-weight: 800; font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1; margin: 4px 0 6px; color: var(--cut); }
.empty { color: var(--ink-2); padding: 12px 0; }

.btn { display: inline-block; background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; border: 0; border-radius: 4px; padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--cut); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* Steps (real sequence) */
ol.steps { list-style: none; counter-reset: s; padding: 0; max-width: 70ch; }
ol.steps li { counter-increment: s; position: relative; padding: 0 0 18px 52px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border: 2px dashed var(--crease); border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-stretch: 75%; color: var(--crease); }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0 20px; }
table.data { border-collapse: collapse; width: 100%; min-width: 560px; background: var(--panel); font-size: 0.95rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data th { font-stretch: 85%; font-weight: 800; background: #EEF1F3; }
table.data td.n { white-space: nowrap; font-weight: 600; }
table.data tr.fits td { background: #EAF5EF; }
table.data tr.fits td:first-child { box-shadow: inset 4px 0 0 var(--good); }
table.data tr.hidden { display: none; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--rule); padding: 4px 0; max-width: 76ch; }
.faq summary { cursor: pointer; font-weight: 700; padding: 12px 28px 12px 0; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 8px; font-size: 1.4rem; color: var(--crease); font-weight: 400; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 14px; color: var(--ink-2); }

/* Quote band */
.quote-band { background: var(--kraft-tint); border-top: 2px dashed var(--kraft); border-bottom: 2px dashed var(--kraft); margin: 48px 0 0; padding: 34px 0; }
.quote-band .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.quote-band h2 { margin: 0 0 6px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.quote-band p { margin: 0; max-width: 58ch; color: #5A4630; }

/* Guides list */
.guide-list { list-style: none; padding: 0; max-width: 76ch; }
.guide-list li { border-bottom: 1px solid var(--rule); padding: 18px 0; }
.guide-list a { font-stretch: 75%; font-weight: 800; font-size: 1.5rem; text-decoration: none; color: var(--ink); line-height: 1.15; }
.guide-list a:hover { color: var(--cut); }
.guide-list p { margin: 6px 0 0; color: var(--ink-2); }

.article-meta { color: var(--ink-2); font-size: 0.92rem; margin-bottom: 24px; }
.callout { border-left: 4px solid var(--crease); background: var(--panel); padding: 14px 18px; margin: 20px 0; max-width: 70ch; }
.tool-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 56px; padding: 36px 0 28px; font-size: 0.93rem; color: var(--ink-2); }
.quote-band + .site-footer { margin-top: 0; }
.foot-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 24px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > div:first-child { grid-column: 1 / -1; } }
.site-footer h3 { font-size: 1.05rem; font-stretch: 85%; margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }
.copy { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--rule); }

.notfound { padding-top: 80px; padding-bottom: 80px; }
@media (max-width: 560px) { .results { grid-template-columns: 1fr 1fr; } }

/* ---------- Formula calculators, hub and blog ---------- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: 14px; }
.fgrid .field { display: flex; flex-direction: column; justify-content: flex-end; }
.fgrid .field.wide { grid-column: 1 / -1; }
.results.gen { grid-template-columns: 1fr 1fr; }
.results.gen .big-result { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.guide-list.two-col { max-width: none; }
@media (min-width: 820px) { .guide-list.two-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; } }
.guide-list.two-col a { font-size: 1.25rem; }
.article-meta { color: var(--ink-2); font-size: 0.92rem; margin-top: -6px; }
.prose ol li { margin-bottom: 8px; }
