/* KeelCoolers.com: light engineering-handbook layout with a left contents rail */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --wash: #e2efec;
  --ink: #11211f;
  --text: #22312f;
  --muted: #586b67;
  --line: #d2dcd9;
  --brand: #0a6b61;
  --brand-dark: #064a43;
  --hot: #c2412d;
  --cold: #1c75a6;
  --water: #dcecf2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --rail: 272px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 20px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.62 var(--sans); }
svg { max-width: 100%; display: block; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--cold); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.15; font-weight: 600; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.1rem, 4vw, 3.3rem); letter-spacing: -.015em; margin-bottom: .45em; }
h1 em { font-style: italic; color: var(--brand); }
h2 { font-size: 1.5rem; margin: 2em 0 .5em; }
h3 { font-size: 1.22rem; margin-bottom: .3em; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* shell */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.page { min-width: 0; display: flex; flex-direction: column; }
main { flex: 1; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 44px; }

/* rail */
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 28px 22px 32px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-name { font: 600 1.5rem/1 var(--serif); letter-spacing: -.01em; }
.brand-name i { color: var(--brand); }
.brand-mark { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); position: relative; }
.brand-mark::before { content: ""; position: absolute; inset: 10px 7px; background: repeating-linear-gradient(to bottom, #fff 0 2px, transparent 2px 6px); }
.rail-tag { font-size: .84rem; line-height: 1.4; color: var(--muted); margin: 12px 0 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.top-nav { display: none; }
.rail-group { margin-top: 22px; }
.rail-h { font: 600 .72rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.rail-h a { color: inherit; text-decoration: none; }
.rail-h a:hover, .rail-h a[aria-current] { color: var(--brand); }
.rail-group ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.rail-group li a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text); text-decoration: none; font-size: .93rem; line-height: 1.35; }
.rail-group li a:hover { color: var(--brand); border-left-color: var(--line); }
.rail-group li a[aria-current] { color: var(--brand-dark); font-weight: 600; border-left-color: var(--brand); background: linear-gradient(90deg, var(--wash), transparent); }

/* line art */
.art { color: currentColor; width: 100%; height: auto; }
.art .hot { stroke: var(--hot); }
.art .cold { stroke: var(--cold); }
.art .sea { stroke: var(--cold); opacity: .8; }
.art .plate { fill: var(--surface); }
.art .water { fill: var(--water); }
.art .hullfill { fill: var(--surface); }
.art text { font: 600 9px var(--mono); letter-spacing: .12em; fill: currentColor; stroke: none; }

/* labels */
.eyebrow, .label, .meta, .num { font: 500 .75rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.eyebrow { margin: 0 0 1.4em; }
.eyebrow a { color: inherit; }
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--muted); max-width: 64ch; }

/* hero */
.hero { padding-top: 56px; }
.hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.8rem); max-width: 17ch; }
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.6em 0 2.4em; }
.btn { display: inline-block; background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; padding: 11px 22px; border-radius: 999px; border: 2px solid var(--brand); }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand-dark); }
.btn.ghost:hover { background: var(--wash); color: var(--brand-dark); }
.plate { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--ink); }
.plate svg { width: 100%; max-height: 440px; padding: 20px 20px 0; }
.plate figcaption { border-top: 1px solid var(--line); padding: 12px 20px; font-size: .9rem; color: var(--muted); background: var(--surface); }
.plate figcaption span { font: 600 .75rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-right: 8px; }

/* page head */
.sec-head { padding: 56px 0 8px; }
.sec-head .wrap { padding-bottom: 28px; border-bottom: 2px solid var(--ink); }
.sec-head .lede { margin-bottom: 0; }
.block { padding-top: 44px; padding-bottom: 4px; }
.block-intro { color: var(--muted); max-width: 70ch; }
.rule { font-size: 1.55rem; margin: 0 0 22px; padding-left: 14px; border-left: 4px solid var(--brand); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats div { background: var(--wash); border-radius: 10px; padding: 20px 18px; }
.stats b { display: block; font: 600 2.2rem/1 var(--serif); color: var(--brand-dark); margin-bottom: 8px; }
.stats span { font-size: .88rem; color: var(--text); line-height: 1.4; display: block; }

/* indexed guide list */
.index { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 44px; border-top: 1px solid var(--line); }
.index li { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); position: relative; }
.index .num { font-size: .95rem; color: var(--brand); padding-top: 4px; flex: none; }
.index h3 a { color: var(--ink); text-decoration: none; }
.index h3 a::after { content: ""; position: absolute; inset: 0; }
.index li:hover h3 a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; }
.index p { margin: 0; font-size: .95rem; color: var(--muted); }

/* product and maker cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 32px 24px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.card { position: relative; display: flex; flex-direction: column; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card:hover h3 a { color: var(--brand); }
.card p { font-size: .95rem; color: var(--muted); margin-bottom: .6em; }
.card p:last-child { margin-bottom: 0; }
.card-art { display: block; color: var(--brand-dark); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin-bottom: 14px; transition: border-color .15s; }
.card:hover .card-art { border-color: var(--brand); }
.meta { margin: 0 0 .6em; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.meta a { color: inherit; position: relative; z-index: 1; }
.tag { background: var(--wash); color: var(--brand-dark); padding: 2px 9px; border-radius: 999px; letter-spacing: .06em; }
.maker { padding: 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.more { font-weight: 600; text-decoration: none; position: relative; z-index: 1; }
.more::after { content: " \203A"; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.4em; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font: 600 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--brand-dark); background: var(--wash); white-space: nowrap; }
tbody th { font-weight: 600; color: var(--ink); min-width: 9em; }
tbody tr:hover > * { background: #f8fbfa; }

/* article */
.article { padding-top: 56px; padding-bottom: 24px; }
.article.narrow { max-width: 860px; margin-left: 0; }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 44px; align-items: start; margin-top: 28px; padding-top: 32px; border-top: 2px solid var(--ink); }
.prose { min-width: 0; }
.prose > h2:first-child { margin-top: 0; }
.prose p, .prose li { max-width: 70ch; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--brand); }
.note { font-size: .9rem; color: var(--muted); background: var(--wash); border-radius: 8px; padding: 12px 16px; margin-top: 2em; }
.side { position: sticky; top: 24px; }
.side h2 { font: 600 .72rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.side-art { color: var(--brand-dark); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 22px; }
.facts { margin: 0; border-top: 2px solid var(--brand); }
.facts div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { font: 500 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: .94rem; color: var(--ink); overflow-wrap: anywhere; }
.toc .label { margin: 0 0 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); font-size: .93rem; }
.toc li a { display: block; padding: 5px 0 5px 14px; text-decoration: none; color: var(--text); line-height: 1.35; }
.toc li a:hover { color: var(--brand); }
.source { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-top: 2.2em; }
.source .label { margin: 0 0 8px; color: var(--brand); }
.source ul { list-style: none; padding: 0; margin: 0 0 .6em; }
.source li { font-weight: 600; }
.source-note { font-size: .88rem; color: var(--muted); margin: 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 44px; }
.pager a { text-decoration: none; font: 600 1.05rem var(--serif); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.pager a:hover { border-color: var(--brand); color: var(--brand-dark); }
.pager a span { display: block; font: 500 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.pager .next { text-align: right; }

/* faq, glossary */
.qa { border-top: 1px solid var(--line); margin-bottom: 1em; }
.qa details { border-bottom: 1px solid var(--line); }
.qa summary { cursor: pointer; padding: 14px 0; font: 600 1.1rem var(--serif); color: var(--ink); }
.qa summary:hover { color: var(--brand); }
.qa details p { padding: 0 0 16px 18px; margin: 0; max-width: 78ch; }
.glossary { margin: 28px 0 0; border-top: 2px solid var(--ink); }
.glossary div { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.glossary dt { font: 600 1.05rem var(--serif); color: var(--ink); }
.glossary dd { margin: 0; }

/* footer */
.foot { margin-top: 64px; border-top: 1px solid var(--line); padding: 24px 44px 32px; font-size: .88rem; color: var(--muted); }
.foot p { max-width: 1040px; margin: 0 auto; }
.foot b { color: var(--ink); }

@media (max-width: 1180px) {
  .article-grid { grid-template-columns: 1fr; gap: 28px; }
  .side { position: static; display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; grid-row: 1; }
  .side > :only-child, .side h2 { grid-column: 1 / -1; }
  .side-art { margin-bottom: 0; }
  .side h2 + .facts { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 20px 0; }
  .rail-tag, .rail-nav { display: none; }
  .top-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-top: 10px; }
  .top-nav a { font: 600 .74rem var(--mono); letter-spacing: .1em; text-transform: uppercase; text-decoration: none; color: var(--muted); padding: 8px 0 10px; border-bottom: 3px solid transparent; }
  .top-nav a[aria-current] { color: var(--brand-dark); border-bottom-color: var(--brand); }
  .wrap { padding: 0 20px; }
  .foot { padding: 24px 20px 32px; }
  .hero, .sec-head, .article { padding-top: 32px; }
  .index { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .glossary div { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .side { display: block; }
  .side-art { margin-bottom: 20px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
  .plate svg { padding: 10px 6px 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card-art { transition: none; } }
@media print { .rail, .foot, .pager, .hero-links { display: none; } .shell { display: block; } body { background: #fff; } }
