/* Tag & Tally: thrift price tags on kraft shipping boxes. Paper, kraft, ink and tag red. Square corners, no shadows. */
:root {
  --paper: #f7f3ea; --white: #fff; --ink: #1d1a15; --muted: #50483d; --line: #cfc3ae; --kraft: #c9a170; --kraft-lt: #e7d6b8; --kraft-dk: #6e4f2a;
  --red: #b3261e; --red-dk: #8a1c16; --loss: #b3261e; --gain: #1d5e3a; --field: #6f6455;
  --head: "Big Shoulders Stencil Display", "Arial Narrow", Impact, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1140px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 400 18px/1.55 var(--body); font-variant-numeric: tabular-nums; }
a { color: var(--red-dk); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--ink); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 9; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
h1, h2 { font-family: var(--head); font-weight: 800; line-height: .98; letter-spacing: .005em; margin: 0 0 .4em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h3 { font: 700 1.12rem/1.3 var(--body); margin: 0 0 .4em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.15rem; max-width: 36em; }
.stamp { display: inline-block; border: 2px solid var(--red); color: var(--red); font: 700 15px/1.2 var(--body); padding: 4px 10px; margin-bottom: 16px; transform: rotate(-1.5deg); background: var(--white); }

/* Header: a strip of kraft tape */
.site-head { background: var(--kraft); border-bottom: 3px solid var(--ink); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 10px 0; }
.brand svg { width: 38px; height: 24px; flex: none; }
.brand span { font: 800 1.85rem/1 var(--head); letter-spacing: .01em; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { color: var(--ink); text-decoration: none; font: 600 16px/1 var(--body); padding: 10px 10px; }
.nav a:hover { text-decoration: underline; }
.nav a[aria-current="page"] { background: var(--ink); color: var(--white); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin-top: 24px; }
.btn { display: inline-block; background: var(--red); color: #fff; text-decoration: none; border: 2px solid var(--red); font: 700 17px/1 var(--body); padding: 14px 20px; cursor: pointer; }
.btn:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }

/* Price tag: angled end, punched hole, 2px outline (outer = outline colour, inner = tag) */
.tag { position: relative; background: var(--ink); padding: 2px; clip-path: polygon(34px 0, 100% 0, 100% 100%, 34px 100%, 0 calc(100% - 34px), 0 34px); }
.tag-in { background: var(--white); clip-path: polygon(33px 0, 100% 0, 100% 100%, 33px 100%, 0 calc(100% - 33px), 0 33px); padding: 20px 22px 18px 52px; }
.tag-in::before { content: ""; position: absolute; left: 18px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid var(--ink); background: var(--paper); border-radius: 50%; }
.tag.kraft .tag-in { background: var(--kraft-lt); }
.tag-lab { font: 700 16px/1.3 var(--body); color: var(--muted); }
.big { font: 800 clamp(3rem, 7vw, 4.4rem)/1 var(--head); color: var(--red); margin: 4px 0 2px; }
.big.neg { color: var(--ink); }
.rows { list-style: none; margin: 12px 0 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 17px; }
.rows li span:last-child { font-weight: 600; text-align: right; white-space: nowrap; }
.rows li.sum { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 9px; font-weight: 700; }
.rows li.minus span:last-child { color: var(--loss); }
.rows li.head { border-bottom: 2px solid var(--ink); font-weight: 700; padding-top: 14px; }

/* Hero */
.hero { padding: 56px 0 60px; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 54px; align-items: center; }
.string { display: block; width: 120px; height: 46px; margin: 0 0 -6px 6px; color: var(--kraft-dk); }

/* Sections */
.block { padding: 56px 0; border-top: 3px solid var(--ink); background: var(--white); }
.block.plain { background: var(--paper); }
.two { display: grid; grid-template-columns: .85fr 1.15fr; gap: 54px; }
.bins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 28px; }
.bins a { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); border: 2px solid var(--ink); background: var(--paper); }
.bins .lab { display: block; background: var(--kraft); border-bottom: 2px solid var(--ink); padding: 10px 14px; font: 800 1.9rem/1 var(--head); }
.bins .t { display: block; font: 700 18px/1.3 var(--body); padding: 14px 14px 6px; }
.bins .d { display: block; font-size: 16px; color: var(--muted); padding: 0 14px; flex: 1; }
.bins .go { display: block; padding: 12px 14px 14px; font-weight: 700; color: var(--red-dk); }
.bins a:hover .t { text-decoration: underline; }
.quotes { list-style: none; margin: 0; padding: 0; }
.quotes li { border-left: 4px solid var(--kraft); padding: 2px 0 2px 18px; margin: 0 0 24px; }
.quotes q { display: block; font-size: 18px; font-style: italic; }
.quotes .src { display: block; font-size: 15px; color: var(--muted); margin-top: 4px; }
.quotes .fix { display: block; font-size: 16px; margin-top: 6px; }

/* Workbook shelf: a kraft box flap */
.shelf { background: var(--kraft-lt); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); padding: 54px 0; }
.shelf ul { margin: 0 0 22px; padding-left: 20px; }
.shelf li { margin-bottom: 8px; }
.shelf small { display: block; margin-top: 14px; font-size: 15px; color: var(--ink); max-width: 34em; }
.price { display: inline-block; background: var(--white); border: 2px solid var(--ink); font: 700 16px/1.2 var(--body); padding: 5px 10px; margin-bottom: 14px; }

/* Tool pages */
.tool-head { padding: 44px 0 26px; }
.tool-head .lede { margin-bottom: 0; }
.tool-wrap { padding: 0 0 56px; }
.tool { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: start; }
form fieldset { border: 2px solid var(--ink); background: var(--white); margin: 0 0 20px; padding: 18px 20px 6px; min-width: 0; }
form legend { font: 700 18px/1.2 var(--body); padding: 0 8px; margin-left: -8px; background: var(--white); }
form legend b { display: inline-block; background: var(--ink); color: #fff; width: 26px; height: 26px; line-height: 26px; text-align: center; margin-right: 8px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.field { margin-bottom: 16px; min-width: 0; }
.field label, .field .lab { display: block; font: 600 16px/1.3 var(--body); margin-bottom: 6px; }
.hint { font-size: 15px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
input[type=text], select { width: 100%; font: 400 18px/1.2 var(--body); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--white); border: 2px solid var(--field); border-radius: 0; padding: 11px 12px; min-height: 48px; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d1a15' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center; }
input[type=text]:focus, select:focus { border-color: var(--ink); outline: 3px solid var(--kraft); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--red); background: #fff3f1; }
.affix { position: relative; }
.affix i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); pointer-events: none; font-size: 18px; }
.affix input { padding-left: 28px; }
.affix.suf i { left: auto; right: 12px; }
.affix.suf input { padding-left: 12px; padding-right: 32px; }
.check { display: flex; gap: 10px; align-items: flex-start; font: 400 17px/1.4 var(--body); margin-bottom: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--red); flex: none; }
.seg { display: flex; flex-wrap: wrap; border: 2px solid var(--field); }
.seg label { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 12px; font: 600 16px/1.2 var(--body); cursor: pointer; min-height: 46px; }
.seg label + label { border-left: 2px solid var(--field); }
.seg input { accent-color: var(--red); width: 18px; height: 18px; margin: 0; }
.seg label:has(input:checked) { background: var(--kraft-lt); }
.result { position: sticky; top: 20px; }
.msg { font-size: 16px; margin-top: 14px; min-height: 1em; }
.msg:empty { display: none; }
.note { font-size: 15px; color: var(--muted); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 17px; margin-top: 12px; }
.tbl th, .tbl td { text-align: right; padding: 9px 8px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl thead th { font-weight: 700; font-size: 15px; border-bottom: 2px solid var(--ink); color: var(--ink); }
.tbl td small { display: block; font-size: 14px; color: var(--muted); font-weight: 400; }
.tbl tr.best td { background: var(--kraft-lt); font-weight: 700; }
.tbl tr.now td { background: var(--kraft-lt); font-weight: 700; }
.tbl td.neg { color: var(--loss); }
.pill { display: inline-block; border: 2px solid var(--red); color: var(--red); font: 700 14px/1 var(--body); padding: 3px 6px; margin-left: 6px; vertical-align: 2px; background: var(--white); }

/* Explain */
.explain { background: var(--white); border-top: 3px solid var(--ink); padding: 48px 0 52px; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; }
.formula { font: 600 16px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--paper); border-left: 4px solid var(--kraft); padding: 10px 12px; }
.prose { max-width: 46em; }
.prose h2 { font-size: 2.1rem; margin-top: 1.4em; }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.src-tbl { width: 100%; border-collapse: collapse; font-size: 16px; margin: 10px 0 18px; }
.src-tbl th, .src-tbl td { text-align: left; border-bottom: 1px dashed var(--line); padding: 8px 8px 8px 0; vertical-align: top; }
.src-tbl thead th { border-bottom: 2px solid var(--ink); }
.checked { display: inline-block; border: 2px solid var(--ink); background: var(--kraft-lt); font: 700 16px/1.2 var(--body); padding: 5px 10px; margin: 4px 0 12px; }

/* Mobile result peek */
.peek { display: none; }

/* Footer */
.site-foot { background: var(--ink); color: #eee6d8; padding: 40px 0 34px; font-size: 16px; }
.site-foot .wrap { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 30px; }
.site-foot a { color: #fff; }
.site-foot strong { font: 800 1.6rem/1 var(--head); color: #fff; display: block; margin-bottom: 8px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 8px; }
.site-foot .fine { grid-column: 1 / -1; border-top: 1px solid #5a5145; padding-top: 18px; margin: 6px 0 0; font-size: 15px; color: #d9cfbf; }

@media (max-width: 960px) {
  .hero .wrap, .two, .tool { grid-template-columns: 1fr; gap: 34px; }
  .bins { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; gap: 10px; }
  .result { position: static; }
  .site-foot .wrap { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .wrap { padding: 0 18px; }
  .site-head .wrap { gap: 0; padding-bottom: 6px; }
  .nav { width: 100%; margin: 0 -10px; }
  .nav a { padding: 10px 9px; font-size: 16px; }
  .hero { padding: 34px 0 40px; }
  .bins { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  form fieldset { padding: 16px 14px 4px; }
  .tag-in { padding: 18px 16px 16px 46px; }
  .tbl { font-size: 16px; }
  .tbl th, .tbl td { padding: 8px 5px; }
  body.has-peek { padding-bottom: 64px; }
  .peek { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; align-items: center; gap: 12px; background: var(--ink); color: #fff; text-decoration: none; padding: 12px 18px; border-top: 3px solid var(--kraft); }
  .peek.off { display: none; }
  .peek-l { font-size: 16px; }
  .peek-v { font: 800 1.7rem/1 var(--head); margin-left: auto; }
  .peek-go { font-size: 20px; }
}
@media print { .site-head, .site-foot, .peek, .shelf { display: none; } }
[hidden] { display: none !important; }
.wrap.prose { max-width: var(--max); }
.prose > * { max-width: 46em; }
/* Article pages (guides) */
.article .tbl-scroll { overflow-x: auto; margin: 6px 0 16px; }
.article .tbl-scroll table { margin-top: 0; }
.article .tbl th, .article .tbl td { text-align: left; }
.article .tbl th:last-child, .article .tbl td:last-child { text-align: right; white-space: nowrap; }
@media (max-width: 600px) { .article .src-tbl { font-size: 15px; } .article .tbl { font-size: 15px; } }
.article .faq h3 { margin-top: 1.1em; }
.article .faq p { margin-top: 0; }
.article .sources li { font-size: 16px; }
.guide-link { margin-top: 18px; font-size: 17px; }
