/* Bag & Barrow. Fury Goods family palette, with a tape-measure identity of its own. */
:root {
  color-scheme: light;
  --ink: #182628;
  --dark-green: #244542;
  --cream: #f6f0e1;
  --paper: #fbf8ef;
  --honey: #e3b763;
  --muted: #4b5e5a;
  --line: #d8d9cd;
  --card: #fffdf8;
  --sage: #e1e9e0;
  --rust: #9a3b12;
  --error: #a4161a;
  --focus: #b56d15;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.6 system-ui, -apple-system, 'Segoe UI', sans-serif; overflow-wrap: anywhere; }
a { color: var(--dark-green); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .13em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; }
h1 { font-size: clamp(2.2rem, 5.5vw, 4.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; letter-spacing: -.02em; }
p { margin: 0; }
code, pre { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .92em; }
.wrap { width: min(100% - 3rem, 76rem); margin-inline: auto; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; top: 0; left: .75rem; transform: translateY(-125%); padding: .65rem 1rem; background: var(--honey); color: var(--ink); z-index: 5; }
.skip:focus { transform: translateY(0); }

/* header and footer */
.site-header, .site-footer { background: var(--ink); color: var(--cream); }
.site-header a, .site-footer a { color: inherit; }
.header-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1.5rem; }
.header-inner { min-height: 4.4rem; padding-block: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 760; font-size: 1.15rem; letter-spacing: -.02em; white-space: nowrap; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.2rem; font-size: .95rem; }
.site-header nav a, .site-footer nav a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.site-header nav a:hover, .site-footer nav a:hover { text-decoration: underline; }
/* tape-measure strip: the site's signature */
.ruler { height: 12px; background-color: var(--honey);
  background-image:
    repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 50px),
    repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10px);
  background-size: 100% 12px, 100% 5px; background-repeat: no-repeat; }
.footer-inner { min-height: 5rem; padding-block: 1rem; font-size: .92rem; }
.footer-inner p { max-width: 44rem; color: #eee7d5; }

/* home */
.hero { background: var(--ink); color: var(--cream); }
.hero-inner { padding-block: clamp(2rem, 6vw, 4.5rem); }
.hero-inner p { max-width: 40rem; margin-top: 1.2rem; font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: #eee7d5; }
.hero-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .5rem 1.5rem; margin: 1.6rem 0 0; padding: 0; list-style: none; max-width: 52rem; }
.hero-points li { padding-left: 1.4rem; position: relative; color: #eee7d5; }
.hero-points li::before { content: ''; position: absolute; left: 0; top: .55em; width: .7rem; height: .7rem; background: var(--honey); border-radius: 2px; }
.catalogue { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.collection { scroll-margin-top: 1rem; }
.collection + .collection { margin-top: clamp(2.2rem, 5vw, 3.5rem); padding-top: 1.6rem; border-top: 1px solid var(--line); }
.collection > p { margin-top: .4rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin: 1.2rem 0 0; padding: 0; list-style: none; }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--honey); border-radius: .5rem; padding: 1.1rem 1.2rem 1.25rem; }
.card h3 a { text-decoration: none; color: var(--ink); }
.card h3 a::after { content: ''; position: absolute; inset: 0; }
.card:hover { border-color: var(--dark-green); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.card h3 a:focus-visible { outline: none; }
.card p { margin-top: .45rem; color: var(--muted); }
.help { background: #eeede2; border-top: 1px solid var(--line); }
.help-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem clamp(2rem, 6vw, 6rem); padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.help h2 { margin-bottom: .8rem; }

/* calculator pages */
.calc-hero { background: var(--ink); color: var(--cream); padding-block: clamp(1.4rem, 4vw, 2.8rem) clamp(1.6rem, 4vw, 2.6rem); }
.calc-hero a { color: var(--honey); }
.crumbs { font-size: .9rem; margin-bottom: .8rem; }
.crumbs a { display: inline-flex; min-height: 44px; align-items: center; }
.lede { margin-top: 1rem; max-width: 46rem; font-size: clamp(1rem, 1.5vw, 1.15rem); }
.calc-hero .lede { color: #eee7d5; }
.calc-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.calc-form { display: grid; gap: 1.25rem; min-width: 0; }
.part { background: var(--card); border: 1px solid var(--line); border-radius: .6rem; padding: clamp(1rem, 2.5vw, 1.4rem); display: grid; gap: .9rem; }
.part > h2 { font-size: 1.45rem; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; }
.units { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; background: var(--sage); border-radius: .6rem; padding: .8rem 1rem; }
.units legend { float: left; width: 100%; margin-bottom: .2rem; }
.units .hint { width: 100%; }
.field { display: grid; gap: .3rem; align-content: start; min-width: 0; }
.field > label, .field > legend { font-weight: 650; font-size: .95rem; }
.hint { color: var(--muted); font-size: .9rem; }
input[type='text'], select {
  width: 100%; min-height: 44px; padding: .5rem .65rem; font: inherit; color: var(--ink);
  background: #fff; border: 2px solid #6f7b75; border-radius: .35rem;
}
input[type='text']:focus, select:focus { border-color: var(--dark-green); }
input::placeholder { color: #6c7773; }
.input-unit { display: flex; align-items: stretch; }
.input-unit input { flex: 1 1 auto; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.suffix { display: inline-flex; align-items: center; padding: 0 .6rem; min-width: 2.6rem; justify-content: center; background: #eeede2; border: 2px solid #6f7b75; border-left: 0; border-radius: 0 .35rem .35rem 0; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--dark-green); margin: 0; flex: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
[aria-invalid='true'] { border-color: var(--error) !important; box-shadow: 0 0 0 1px var(--error); }
fieldset[aria-invalid='true'] { box-shadow: none; outline: 2px solid var(--error); outline-offset: 4px; }
.field-error { color: var(--error); font-weight: 650; font-size: .92rem; }
.field-error::before { content: '! '; }

.rows { display: grid; gap: .8rem; }
.row { position: relative; border: 1px solid var(--line); border-left: 5px solid var(--dark-green); border-radius: .45rem; padding: .7rem .9rem .9rem; background: #fff; }
.row.subtract { border-left-color: var(--rust); background: #fdf6f0; }
.row legend { font-size: .95rem; padding: 0 .25rem; }
.row-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: .6rem .8rem; margin-top: .2rem; }
.row-grid .wide { grid-column: 1 / -1; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .05rem .45rem; border-radius: 1rem; vertical-align: middle; }
.tag.plus { background: var(--sage); color: var(--dark-green); }
.tag.minus { background: #f6dccb; color: var(--rust); }
.row .remove { margin-top: .7rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.notice { background: #fff4d8; border: 1px solid var(--honey); padding: .8rem 1rem; border-radius: .4rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem 1rem; font: inherit; font-weight: 650; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: .4rem; cursor: pointer; }
.btn:hover { background: var(--cream); }
.btn.primary { background: var(--ink); color: var(--cream); font-size: 1.05rem; justify-self: start; padding-inline: 1.6rem; }
.btn.primary:hover { background: var(--dark-green); }
.btn.small { min-height: 44px; padding: .35rem .8rem; font-size: .9rem; }

/* results: a merchant's docket */
.results { position: sticky; top: 1rem; background: var(--card); border: 2px solid var(--ink); border-radius: .6rem; padding: clamp(1rem, 2.5vw, 1.4rem); box-shadow: 6px 6px 0 var(--honey); min-width: 0; }
.results > h2 { font-size: 1.6rem; padding-bottom: .6rem; border-bottom: 2px dashed var(--line); margin-bottom: .9rem; }
#results-body { display: grid; gap: 1rem; }
.estimate-badge { justify-self: start; background: #fff4d8; border: 1px solid var(--honey); border-radius: 2rem; padding: .25rem .8rem; font-size: .85rem; font-weight: 650; }
.estimate-badge.stale { background: #f6dccb; border-color: var(--rust); }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 .4rem .4rem 0; border-bottom: 1px solid var(--line); }
table.list td { vertical-align: top; padding: .6rem .5rem .6rem 0; border-bottom: 1px dashed var(--line); }
table.list td.qty { white-space: nowrap; width: 1%; padding-right: 1rem; }
table.list td.qty strong { font-size: 1.35rem; font-family: Georgia, serif; }
td .note { display: block; font-size: .88rem; color: var(--muted); }
.summary { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; font-size: .95rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 650; }
.warnings { background: #fff4d8; border-left: 4px solid var(--honey); padding: .7rem .9rem; border-radius: .3rem; }
.warnings ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.tools { display: flex; flex-wrap: wrap; gap: .5rem; }
details { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 650; padding: .7rem 0; min-height: 44px; }
details ol, details ul { margin: 0 0 .6rem; padding-left: 1.3rem; font-size: .93rem; }
details li + li { margin-top: .3rem; }
.error-summary { border: 3px solid var(--error); border-radius: .4rem; padding: .8rem 1rem; background: #fff; }
.error-summary h3 { color: var(--error); }
.error-summary ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.error-summary a { color: var(--error); font-weight: 650; }

/* long-form sections */
.prose { max-width: 50rem; padding-block: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 6vw, 4.5rem); }
.prose section + section { margin-top: 2.2rem; }
.prose h2 { margin: 2rem 0 .8rem; }
.prose section > h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.4rem 0 .5rem; }
.prose p + p, .prose p + pre, .prose pre + p { margin-top: .9rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .4rem; }
.formula { background: var(--ink); color: var(--cream); padding: 1rem 1.2rem; border-radius: .5rem; overflow-x: auto; white-space: pre-wrap; line-height: 1.7; border-left: 6px solid var(--honey); }
.estimate-note { background: #fff4d8; border-left: 4px solid var(--honey); padding: .8rem 1rem; }
.sources { font-size: .93rem; }
.related { columns: 2 14rem; }
.simple-top { min-height: 55vh; }
.simple-top h1 { margin-bottom: .2rem; }

@media (max-width: 64rem) {
  .calc-layout { grid-template-columns: 1fr; }
  .results { position: static; }
}
@media (max-width: 40rem) {
  .wrap { width: calc(100% - 2rem); }
  .help-inner { grid-template-columns: 1fr; }
  .results { box-shadow: 4px 4px 0 var(--honey); }
  table.list td.qty { white-space: normal; width: 38%; padding-right: .6rem; }
  table.list td.qty strong { font-size: 1.15rem; display: block; }
  .summary { grid-template-columns: 1fr; gap: 0; }
  .summary dd { margin-bottom: .4rem; }
}
@media (max-width: 22rem) {
  .wrap { width: calc(100% - 1.25rem); }
  .brand span { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media print {
  .site-header nav, .skip, .calc-hero .crumbs, .calc-form, .prose, .site-footer nav, .tools, .ruler { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .calc-hero { background: #fff; color: #000; }
  .calc-hero .lede { display: none; }
  .calc-layout { display: block; padding: 0; }
  .results { position: static; border: 1px solid #000; box-shadow: none; }
  a { color: #000; }
}
