/* Shared light treatment for the free timber utility; cutting-map colours stay unchanged. */
:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1d3039;
  background: #f7f7f2;
  --ink: #1d3039;
  --muted: #53636c;
  --blue: #15546b;
  --paper: #fff;
  --wash: #f7f7f2;
  --soft: #e9f2f5;
  --line: #dce3e2;
  --control-line: #73838c;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; font-size: 16px; line-height: 1.65; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: #0e4054; text-decoration-thickness: 2px; }
.wrap { max-width: 1200px; margin: auto; padding: 0 24px; }
header { border-bottom: 1px solid var(--line); background: var(--paper); }
header nav { min-height: 76px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; padding-block: 12px !important; }
header nav div { display: flex; gap: 10px 22px; flex-wrap: wrap; }
header nav a { display: inline-flex; align-items: center; min-height: 44px; }
.brand { font-size: 23px; font-weight: 900; letter-spacing: -1px; text-decoration: none; color: var(--ink); }
.brand span { color: var(--blue); }
.crumbs { margin: 28px 0; color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--blue); }
h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.08; letter-spacing: -.04em; margin: 14px 0; }
h2 { font-size: 23px; line-height: 1.3; margin: 0 0 18px; }
h3 { font-size: 16px; line-height: 1.5; margin: 0 0 9px; }
.lead { font-size: 18px; line-height: 1.65; max-width: 850px; color: var(--muted); margin-bottom: 30px; }
.workspace { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(0, 1.35fr); gap: 22px; align-items: start; }
.card { border: 1px solid var(--line); background: var(--paper); border-radius: 18px; padding: 24px; min-width: 0; }
.controls { border-top: 3px solid var(--blue); }
.results { border-top: 3px solid #17664d; }
label { display: block; font-size: 14px; color: var(--ink); margin: 18px 0 7px; font-weight: 650; line-height: 1.5; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--control-line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 11px; min-width: 0; }
textarea { font-family: Consolas, "Liberation Mono", monospace; font-size: 17px; line-height: 1.7; resize: vertical; }
.input-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
button, .project-links a { min-height: 44px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--control-line); background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1.5; font-weight: 700; cursor: pointer; }
button:hover { background: var(--soft); border-color: var(--blue); }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-size: 16px; width: 100%; margin-top: 12px; }
.primary:hover { background: #0e4054; border-color: #0e4054; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.examples, .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.examples button { font-size: 13px; }
.hint, .legend { font-size: 14px; line-height: 1.65; color: var(--muted); }
.legend { margin: 20px 0; }
.error { border: 1px solid #b13737; background: #fff0ee; color: #9b2828; padding: 12px; border-radius: 8px; line-height: 1.5; }
.summary { font-size: 17px; color: #17664d; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats div { background: var(--wash); border: 1px solid var(--line); border-radius: 10px; padding: 14px 8px; text-align: center; }
.stats strong { display: block; font-size: 30px; line-height: 1.3; color: var(--ink); letter-spacing: -.04em; }
.stats span { display: block; font-size: 12px; line-height: 1.5; color: var(--muted); }
.board { padding: 18px 0; border-bottom: 1px solid var(--line); }
.cut-bar { width: 100%; display: flex; overflow: hidden; background: #bac3c7; height: 40px; border: 1px solid var(--muted); border-radius: 5px; }
/* Dark IDs retain at least 6.28:1 against all six existing JS segment colours. */
.cut-bar span { display: flex; flex-shrink: 0; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; font: 700 11px Consolas, "Liberation Mono", monospace; color: #082032; }
.part { border-right: 1px solid var(--ink); }
.kerf, .allowance { background: var(--ink); }
.offcut { background: repeating-linear-gradient(135deg, #87949a, #87949a 5px, #bac3c7 5px, #bac3c7 10px); }
.cut-sequence { font: 13px/1.7 Consolas, "Liberation Mono", monospace; color: var(--muted); overflow-wrap: anywhere; }
.actions { margin-top: 22px; }
details { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 6px; }
summary { cursor: pointer; color: var(--blue); font-weight: 650; line-height: 1.5; min-height: 44px; padding: 10px 0; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
caption { text-align: left; font-size: 13px; color: var(--muted); padding: 12px 0; }
.project-cta { margin: 28px 0; background: var(--soft); border-color: #b6ccd3; scroll-margin-top: 24px; }
.project-cta p, .guide { line-height: 1.8; }
.project-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.project-links a { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; color: var(--blue); }
.project-links a:hover { border-color: var(--blue); background: #f7fbfc; }
.guide { max-width: 850px; margin: 46px 0; }
.guide h2 { margin-top: 34px; }
.guide li { padding: 0 0 12px 6px; }
footer { border-top: 1px solid var(--line); font-size: 14px; line-height: 1.8; color: var(--muted); margin-top: 50px; padding-top: 24px !important; padding-bottom: 30px !important; }
[hidden] { display: none !important; }
code { font-family: Consolas, "Liberation Mono", monospace; color: var(--ink); }
@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
  .project-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 450px) {
  .wrap { padding: 0 16px; }
  .card { padding: 18px; }
  header nav { gap: 8px 12px; }
  header nav div { gap: 4px 14px; font-size: 14px; }
  .input-grid { gap: 8px; }
  .stats { gap: 6px; }
  .stats strong { font-size: clamp(20px, 6vw, 24px); }
  .actions button { flex: 1; }
  .project-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-links a { font-size: 13px; padding-inline: 8px; }
  .crumbs { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  :root { color-scheme: light; color: #111; background: white; }
  header, .crumbs, .controls, .lead, .eyebrow, .project-cta, .guide, footer, .actions, #share-status, #shared-link { display: none !important; }
  .workspace { display: block; }
  .wrap { max-width: none; padding: 0; }
  .card { border: 0; background: white; padding: 0; }
  .hint, .legend, .cut-sequence { color: #333; }
  .stats div { background: white; border: 1px solid #aaa; }
  .stats strong { color: #111; }
  .board { break-inside: avoid; border-color: #bbb; }
  .cut-bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .results details { display: block; }
  .results details > * { display: block !important; }
  h1 { font-size: 25px; }
  .summary { color: #111; }
  button { display: none !important; }
  body { margin: 10mm; }
}
