/* Yard & Build — replacement stylesheet, 2026-09-26.
   Existing classes, data/ARIA hooks and --survey are preserved.
   Font URLs are self-hosted; see DESIGN-NOTES.md for installation. */

/* 01 変数 / fonts & tokens */
@font-face { font-family: "Alfa Slab One"; src: url("/assets/fonts/alfa-slab-one-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url("/assets/fonts/libre-franklin-latin-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Permanent Marker"; src: url("/assets/fonts/permanent-marker-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plexmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/plexmono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
/* Fallback faces while the web fonts load, sized to match them (size-adjust etc. measured from the font files) so the text does not jump when the real font swaps in */
@font-face { font-family: "Alfa Slab Fallback"; src: local("Georgia Bold"), local("Georgia-Bold"); font-weight: 400; size-adjust: 104.23%; ascent-override: 99.39%; descent-override: 31.95%; line-gap-override: 0%; }
@font-face { font-family: "Alfa Slab Caps Fallback"; src: local("Georgia Bold"), local("Georgia-Bold"); font-weight: 400; size-adjust: 98%; ascent-override: 106%; descent-override: 34%; line-gap-override: 0%; }
@font-face { font-family: "Libre Franklin Fallback"; src: local("Arial"), local("ArialMT"); font-weight: 100 500; size-adjust: 100.87%; ascent-override: 95.77%; descent-override: 24.39%; line-gap-override: 0%; }
@font-face { font-family: "Libre Franklin Fallback"; src: local("Arial Bold"), local("Arial-BoldMT"); font-weight: 600 900; size-adjust: 100.87%; ascent-override: 95.77%; descent-override: 24.39%; line-gap-override: 0%; }
@font-face { font-family: "IBM Plex Mono Fallback"; src: local("Courier New"), local("CourierNewPSMT"); font-weight: 100 500; size-adjust: 99.98%; ascent-override: 102.52%; descent-override: 27.5%; line-gap-override: 0%; }
@font-face { font-family: "IBM Plex Mono Fallback"; src: local("Courier New Bold"), local("CourierNewPS-BoldMT"); font-weight: 600 900; size-adjust: 99.98%; ascent-override: 102.52%; descent-override: 27.5%; line-gap-override: 0%; }
:root {
  color-scheme: light;
  --paper: #efe3cc; --panel: #fffaf0; --white: #ffffff;
  --ink: #2a2420; --ink-2: #625345;
  --red: #a8322d; --red-hover: #832520; --green: #2f5d46;
  --yellow: #f2b632; --yellow-hover: #e6a820;
  --plank: #8a5a34; --wood-dark: #593c29;
  --rule: #c9b897; --gravel: #82735f; --control-rule: #82735f;
  --ticket: #fff6d6; --ticket-ink: #2a2420;
  --survey: #9b285a; --focus: #145da0;
  --error: #982b27; --error-bg: #fff0eb; --success: #2f5d46;
  --disabled: #e5dccd; --disabled-ink: #625345;
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4rem;
  --radius: 4px; --radius-lg: 8px;
  --line: 1px; --line-strong: 2px;
  --shadow: 0 8px 20px -12px #2a24204d, 0 2px 0 #2a242014;
  --display: "Alfa Slab One", "Alfa Slab Fallback", Rockwell, Georgia, serif;
  --body: "Libre Franklin", "Libre Franklin Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Permanent Marker", cursive;
  --mono: "IBM Plex Mono", "IBM Plex Mono Fallback", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --measure: 49.5rem; /* about 72 characters of Libre Franklin at 16px; rem, not ch, so the width does not change while the fallback font shows */
}

/* 02 基本 / base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-block: 1rem 10rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.65 var(--body); }
img, svg { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--red-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 3px var(--white); }
[id] { scroll-margin-block: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 24px; }
main.wrap { padding-block: 24px 0; }
h1, h2, h3 { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: -.012em; }
h1 { font-size: clamp(1.875rem, 1.25rem + 2.3vw, 3rem); line-height: 1.18; max-width: 28ch; margin-block: 12px 16px; text-wrap: balance; }
h2 { font-size: clamp(1.375rem, 1.1rem + .8vw, 1.875rem); line-height: 1.3; margin-block: 48px 16px; }
h3 { font: 700 1.125rem/1.4 var(--body); margin-block: 32px 8px; }
p { margin-block: 0 16px; }
.lede { max-width: calc(var(--measure) * 1.0625); margin-block: 0 32px; font-size: 1.0625rem; line-height: 1.65; color: var(--ink-2); }
.lede strong { color: var(--ink); font-weight: 700; }
strong, b { font-weight: 700; }
sup { line-height: 0; }
sup > a { display: inline-block; padding-inline: 3px; color: var(--red); font-weight: 600; text-decoration: underline; }
/* Inline citation links retain the inline-text target-size exception. */

/* 03 ヘッダー / header, sign and footer */
.site-head { background: var(--wood-dark); border-bottom: 4px solid var(--plank); }
.site-head .wrap { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 16px; }
.brand { display: inline-flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 14px 7px; border: 2px solid var(--panel); outline: 2px solid var(--red); background: var(--red); color: var(--panel); text-decoration: none; }
.brand span { color: inherit; }
.brand:hover { color: var(--white); background: var(--red-hover); }
.brand-name { display: flex; justify-content: center; gap: .22em; font: 400 clamp(1.5rem, .9rem + 1.2vw, 1.75rem)/1.05 "Alfa Slab One", "Alfa Slab Caps Fallback", Rockwell, Georgia, serif; /* all caps: its own fallback size */ text-transform: uppercase; white-space: nowrap; }
/* 看板の中の下段: 全ページで計算サイトだと分かるように。字間で上段の幅にそろえる */
.brand-tag { font: 700 clamp(.645rem, .387rem + .516vw, .75rem)/1.2 var(--body); letter-spacing: .25em; text-align: center; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 359px) { .brand-name { font-size: 1.375rem; } .brand-tag { font-size: .59rem; } } /* とても狭い画面でも List と1行に収める */
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--panel); font-size: .9375rem; font-weight: 600; padding: 8px 4px; text-decoration: none; }
.site-nav a:hover { color: var(--panel); text-decoration: underline; }
.list-link { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; min-width: 72px; background: var(--yellow); color: var(--ink); border: 2px solid var(--yellow); border-radius: var(--radius); font-weight: 700; padding: 8px 12px; white-space: nowrap; text-decoration: none; }
.list-link:hover { color: var(--ink); background: var(--yellow-hover); border-color: var(--yellow-hover); }
.list-link b { font: 600 1rem var(--mono); }
.crumbs { font-size: .875rem; color: var(--ink-2); margin: 0 0 8px; overflow-wrap: anywhere; }
.crumbs a { color: var(--ink-2); display: inline-flex; align-items: center; min-height: 44px; }
.site-foot { margin-top: 64px; padding: 24px 0 32px; color: var(--panel); background: var(--wood-dark); border-top: 4px solid var(--plank); font-size: .875rem; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-bottom: 16px; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--panel); }
.site-foot p { margin: 0; max-width: 53rem; }
/* Optional additions documented in HTML-CHANGES.md; existing markup works alone. */
.aisle-sign { position: relative; display: inline-block; margin: 24px 0 16px; padding: 8px 16px; background: var(--green); color: var(--panel); border: 2px solid var(--ink); font: 600 .8125rem/1.5 var(--body); letter-spacing: .1em; text-transform: uppercase; }
.aisle-sign::before, .aisle-sign::after { content: ""; position: absolute; top: -18px; width: 2px; height: 16px; background: var(--wood-dark); }
.aisle-sign::before { left: 24px; } .aisle-sign::after { right: 24px; }
.aisle-sign.poles-snapped::before, .aisle-sign.poles-snapped::after { width: var(--pole-w); right: auto; } /* app.js の evenSigns: 画素に合わせて左右対称に */
.aisle-sign.poles-snapped::before { left: var(--pole-l); } .aisle-sign.poles-snapped::after { left: var(--pole-r); }
.aisle-sign b { display: inline-block; margin-right: .6em; padding-right: .6em; border-right: 2px solid var(--yellow); color: var(--yellow); font-weight: 700; }
main > .aisle-sign { margin: 20px 0 4px; }
.article .aisle-sign { margin: 28px 0 12px; }
.aisle-group + .aisle-group { margin-top: 32px; }
.shelf-note { display: inline-block; padding: 8px 12px; background: var(--yellow); color: var(--ink); font: 400 1rem/1.5 var(--hand); border-bottom: 3px solid var(--plank); }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: 32px; margin-block: 16px 32px; }
.home-hero > * { min-width: 0; }
.home-hero .lede { margin-bottom: 0; }
.kicker { margin: 0 0 12px; color: var(--green); font: 600 .8125rem/1.5 var(--body); letter-spacing: .1em; text-transform: uppercase; }
.tool-board { margin: 0; background: var(--paper); background-image: radial-gradient(circle at 12px 12px, #c9b897 1.5px, transparent 2px); background-size: 24px 24px; border: 8px solid var(--plank); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.tool-board svg { display: block; width: 100%; }
.home-page .article { max-width: none; }
.home-page #all, .home-page #projects, .home-page #guides { background: var(--green); color: var(--panel); padding: 12px 16px; width: fit-content; max-width: 100%; font-size: 1.5rem; }
.home-page .related { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
/* Weekend projects: 作例のカード（絵・見出し・数字・例を開くリンク） */
.article .projects { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 24px; }
.article .projects li { display: flex; flex-direction: column; max-width: none; margin: 0; background: var(--panel); border: 1px solid var(--rule); border-top: 3px solid var(--plank); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.project-art { display: flex; align-items: center; justify-content: center; height: 150px; padding: 16px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.project-art svg { display: block; width: 100%; max-width: 240px; height: 100%; }
.article .projects h3 { margin: 16px 16px 8px; font: 400 1.25rem/1.3 var(--display); }
.article .projects p { max-width: none; margin: 0 16px 16px; font-variant-numeric: tabular-nums; }
.article .projects a { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; margin: auto 16px 16px; font-weight: 700; }
.article .projects a::after { content: " →"; white-space: pre; }

/* 04 計算機 / form */
.tool { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 32px; }
.tool > *, .calc, .step, .fields > *, .ticket-col, #calc, #ticket, #plan { min-width: 0; }
.calc { position: relative; background: var(--panel); border: 1px solid var(--rule); border-top: 8px solid var(--plank); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.step { border: 0; padding: 0; margin: 0 0 24px; }
.step > legend { width: 100%; padding: 0 0 8px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); color: var(--green); font: 700 .8125rem/1.5 var(--body); letter-spacing: .1em; text-transform: uppercase; }
.shapes { display: flex; flex-wrap: wrap; gap: 8px; }
.shape-btn, .view-btn, .chip, .btn { appearance: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 10px 12px; border: 2px solid var(--control-rule); border-radius: var(--radius); color: var(--ink); background: var(--panel); font: 600 .875rem/1.4 var(--body); cursor: pointer; overflow-wrap: anywhere; }
.shape-btn { position: relative; background: var(--paper); }
.shape-btn svg { flex: 0 0 20px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.shape-btn[aria-pressed="true"], .view-btn[aria-pressed="true"] { color: var(--panel); background: var(--green); border-color: var(--green); box-shadow: inset 0 -4px 0 var(--yellow); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 16px; }
.field label, .field .label { display: block; margin-bottom: 4px; font-size: .9375rem; line-height: 1.5; font-weight: 600; }
.num { display: flex; width: 100%; border: 2px solid var(--control-rule); border-radius: var(--radius); background: var(--white); }
.num input { width: 100%; flex: 1 1 0; min-width: 0; min-height: 44px; border: 0; padding: 8px 10px; border-radius: 2px 0 0 2px; background: var(--white); color: var(--ink); font: 400 1rem/1.5 var(--mono); font-variant-numeric: tabular-nums; }
.num select { flex: 0 1 auto; min-width: 52px; max-width: 62%; min-height: 44px; border: 0; border-left: 1px solid var(--control-rule); border-radius: 0 2px 2px 0; padding: 8px 4px; color: var(--ink); background: var(--paper); font: 400 1rem/1.5 var(--mono); }
.num:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.num input:focus-visible, .num select:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; box-shadow: none; }
.select, .text-in { width: 100%; min-width: 0; min-height: 48px; padding: 10px 8px; border: 2px solid var(--control-rule); border-radius: var(--radius); color: var(--ink); background: var(--white); font: 400 1rem/1.5 var(--body); }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 1; }
.hint { margin-top: 8px; font-size: .875rem; line-height: 1.55; color: var(--ink-2); }
label.hint { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--green); flex-shrink: 0; }
.field.invalid .num, .field.invalid > .select, .field.invalid > .text-in { border: 2px solid var(--error); box-shadow: 0 0 0 1px var(--error); background: var(--error-bg); }
.field.invalid .num input { background: var(--error-bg); }
.err { color: var(--error); font-size: .875rem; font-weight: 600; line-height: 1.5; margin-top: 8px; padding-left: 8px; border-left: 3px solid var(--error); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { background: var(--yellow); border-color: var(--plank); font-size: .8125rem; padding: 10px; }
/* Exact quantities remain in Libre Franklin; handwriting is reserved for optional notes. */
.chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 -3px var(--ink); text-decoration: underline; }
.section-row { border-top: 1px dashed var(--control-rule); padding-top: 16px; margin-top: 16px; }
.section-row:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font: 600 .875rem/1.5 var(--mono); }
.link-btn { appearance: none; min-width: 44px; min-height: 44px; padding: 8px 4px; border: 0; background: transparent; color: var(--red); font: 600 .875rem/1.5 var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.add-section { margin-top: 8px; }
details.more { border-top: 1px solid var(--rule); margin: 0; padding-top: 4px; }
summary { min-height: 44px; padding-block: 10px; cursor: pointer; font-weight: 600; line-height: 1.5; }
details.more summary { font-size: .9375rem; }
details.more[open] { padding-bottom: 8px; }
summary::marker { color: var(--green); }
/* All interactive states: no opacity reduction that lowers text contrast. */
@media (hover: hover) {
  .shape-btn:not(:disabled):not([aria-disabled="true"]):hover, .view-btn:not(:disabled):not([aria-disabled="true"]):hover, .btn:not(.primary):not(:disabled):not([aria-disabled="true"]):hover { background: var(--paper); color: var(--ink); border-color: var(--ink); }
  .shape-btn[aria-pressed="true"]:not(:disabled):not([aria-disabled="true"]):hover, .view-btn[aria-pressed="true"]:not(:disabled):not([aria-disabled="true"]):hover { background: var(--ink); color: var(--panel); }
  .chip:not(:disabled):not([aria-disabled="true"]):hover { background: var(--yellow-hover); border-color: var(--ink); }
  .link-btn:not(:disabled):hover { color: var(--red-hover); text-decoration-thickness: 2px; }
}
:is(.shape-btn, .view-btn, .chip, .btn, .link-btn):not(:disabled):not([aria-disabled="true"]):active { transform: translateY(1px); box-shadow: inset 0 2px 0 #2a242026; }
:is(button, input, select, textarea):disabled, [aria-disabled="true"], :is(.shape-btn, .view-btn, .chip, .btn, .link-btn):is(:disabled, [aria-disabled="true"]) { color: var(--disabled-ink); background: var(--disabled); border-color: var(--control-rule); border-style: dashed; cursor: not-allowed; opacity: 1; box-shadow: none; -webkit-text-fill-color: var(--disabled-ink); }
.num select:disabled { border-style: solid; }

/* 05 伝票 / order slip */
.ticket { position: relative; border: 1px solid var(--rule); border-radius: 2px; padding: 24px; color: var(--ticket-ink); background: var(--ticket); box-shadow: var(--shadow); font-family: var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ticket::before, .ticket::after { content: ""; position: absolute; left: 12px; right: 12px; height: 4px; background: radial-gradient(circle, var(--rule) 1px, transparent 1.5px) 0 0 / 8px 4px repeat-x; pointer-events: none; }
.ticket::before { top: 5px; } .ticket::after { bottom: 5px; }
.ticket-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 2px dashed var(--red); color: var(--red); font: 600 .75rem/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.ticket .big { font: 600 clamp(2.25rem, 1.8rem + 1.5vw, 3.25rem)/1.2 var(--mono); letter-spacing: -.04em; overflow-wrap: anywhere; }
.ticket .big small { display: inline-block; margin-left: 8px; font-size: 1rem; font-weight: 400; line-height: 1.5; letter-spacing: 0; }
.ticket .sub { margin-block: 8px 16px; color: var(--ink-2); font-size: .8125rem; line-height: 1.6; }
.ticket table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .875rem; line-height: 1.65; }
.ticket th, .ticket td { padding-block: 8px; vertical-align: top; border-bottom: 1px dotted var(--rule); }
.ticket th { width: 57%; padding-right: 12px; text-align: left; color: var(--ink-2); font-family: var(--body); font-weight: 400; }
.ticket td { width: 43%; text-align: right; font-weight: 600; }
.ticket td span { font-weight: 400; }
.ticket .group { color: var(--green); margin-block: 20px 4px; padding-block: 4px; border-bottom: 1px solid var(--rule); font: 600 .75rem/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.ticket .note { color: var(--ink-2); margin-block: 16px 0; font: 400 .875rem/1.55 var(--body); }
.ticket .note b { color: var(--ink); }
.ticket .empty { font: 400 1rem/1.6 var(--body); padding: 12px; border-left: 4px solid var(--error); background: var(--error-bg); color: var(--error); margin: 0; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.btn { color: var(--ink); border-color: var(--ink); background: transparent; text-decoration: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--panel); box-shadow: 0 2px 0 var(--red-hover); }
.btn.primary:not(:disabled):not([aria-disabled="true"]):hover { background: var(--red-hover); border-color: var(--red-hover); color: var(--panel); }
.btn.primary:disabled, .btn.primary[aria-disabled="true"] { color: var(--disabled-ink); background: var(--disabled); border-color: var(--control-rule); box-shadow: none; }
.status { color: var(--success); margin-top: 8px; min-height: 1.5em; font: 600 .875rem/1.5 var(--body); }
.status:empty { min-height: 0; margin: 0; }
#project-list { max-width: 960px; }
#project-list .ticket { margin-bottom: 0; }
/* 材料リスト: 1件ずつ伝票＋図。上に件数と「全部印刷」 */
.list-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.list-bar p { margin: 0; }
.list-bar-actions, .item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#project-list .list-item { margin: 0 0 32px; padding-bottom: 32px; border-bottom: 2px dashed var(--rule); }
.item-actions { margin-top: 16px; }
.item-date { margin-left: auto; color: var(--ink-2); font-size: .875rem; }
/* リストでは伝票の見出し（例: Pea gravel order）を項目の見出しとして大きく */
#project-list .ticket-head { align-items: baseline; }
#project-list .ticket-head span:first-child { color: var(--ink); font: 400 clamp(1.25rem, 1.1rem + .5vw, 1.5rem)/1.25 var(--display); letter-spacing: 0; text-transform: none; }
/* 印刷用の図（計算機ページでは印刷のときだけ、材料リストでは画面にも出す） */
.print-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; margin-top: 16px; }
.pf { min-width: 0; }
.pf-cap { margin: 0 0 6px; color: var(--green); font: 600 .75rem/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.pf .plan { margin: 0; }
.pf img { display: block; width: 100%; height: auto; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); }
#project-list .ticket h2 { margin-top: 16px; }
#project-list .ticket a { color: var(--red); }

/* 06 図 / plan and canvas */
#plan { margin-top: 24px; }
.plan-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.view-btn.reset { margin-left: auto; }
.plan { margin: 0; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.plan svg { display: block; width: 100%; height: auto; overflow: visible; }
.plan .grid line { stroke: #e7decd; stroke-width: 1; }
.plan .shape { fill: #c9b897; stroke: var(--ink); stroke-width: 1.5; }
.plan .shape.sub { fill: var(--panel); stroke-dasharray: 4 3; }
.plan .dim line, .plan .dim path { stroke: var(--survey); stroke-width: 1.4; fill: none; }
/* A light halo keeps dimension text legible where it overlaps a material. */
.plan .dim text { fill: var(--survey); stroke: var(--panel); stroke-width: 3px; paint-order: stroke; stroke-linejoin: round; font: 600 12px var(--mono); }
.plan figcaption { margin: 8px 0 0; padding: 0; font: 400 .8125rem/1.55 var(--body); color: var(--ink-2); }
.plan.can3d { cursor: zoom-in; }
.plan.can3d:hover { border-color: var(--ink); }
.plan3d canvas { display: block; width: 100%; height: 300px; border-radius: 2px; background: var(--panel); touch-action: none; cursor: grab; }
.plan3d canvas:active { cursor: grabbing; }

/* 07 本文 / working, tables, warnings, FAQ, sources */
.work { margin-top: 32px; padding: 24px; border: 1px solid var(--rule); border-left: 4px solid var(--green); border-radius: var(--radius); background: var(--panel); }
.work h2 { margin: 0 0 12px; font: 700 1rem/1.5 var(--body); }
.work ol { margin: 0; padding-left: 1.6em; font: 400 .875rem/1.85 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.work li + li { margin-top: 4px; }
.article { max-width: var(--measure); margin-top: 32px; }
.article p, .article li { max-width: var(--measure); }
.article > :first-child { margin-top: 0; }
.article > ol, .article > ul { padding-left: 1.5em; }
.article li + li { margin-top: 4px; }
.formula { margin: 16px 0; padding: 16px; border-left: 4px solid var(--green); background: var(--panel); color: var(--ink); font: 400 .9375rem/1.8 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.table-wrap { max-width: 100%; margin-block: 16px; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.data { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .875rem; line-height: 1.6; }
.data th, .data td { padding: 12px 16px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.data thead th { background: var(--green); color: var(--panel); font: 600 .75rem/1.6 var(--body); letter-spacing: .05em; text-transform: uppercase; }
.data tbody tr:nth-child(even) { background: var(--paper); }
.data tbody tr:last-child > * { border-bottom: 0; }
.data th:first-child, .data td:first-child { min-width: 160px; }
.data td.n { white-space: nowrap; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.data sup a { color: var(--red); }
/* Tables with 6+ columns need room for sources and explanatory prose. */
.data:has(tr > :nth-child(6)) { min-width: 960px; }
.data:has(tr > :nth-child(6)) td:nth-last-child(2) { min-width: 240px; }
.article:has(> .table-wrap .data tr > :nth-child(6)) { max-width: none; }
.caution { padding: 16px 20px; border: 1px solid var(--plank); border-left: 6px solid var(--plank); border-radius: var(--radius); background: var(--yellow); color: var(--ink); font-size: .9375rem; }
.caution a, .caution sup a { color: var(--ink); }
.faq details { border-bottom: 1px solid var(--rule); padding: 4px 0; }
.faq summary { padding-right: 8px; }
.faq details[open] { padding-bottom: 16px; }
.faq details p { margin: 8px 0 0; }
.sources ol { padding-left: 1.5em; font-size: .875rem; line-height: 1.7; }
.sources li { margin-bottom: 12px; overflow-wrap: anywhere; }
.sources li:target { background: var(--ticket); outline: 2px solid var(--green); outline-offset: 4px; }
.byline { border-top: 1px solid var(--rule); margin-top: 32px; padding-top: 16px; font-size: .875rem; color: var(--ink-2); }
ul.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; padding: 0; list-style: none; }
.related li, .article .related li + li { margin: 0; min-width: 0; }
.related a { display: block; height: 100%; padding: 16px; border: 1px solid var(--rule); border-top: 3px solid var(--green); border-radius: var(--radius); background: var(--panel); color: var(--red); font-weight: 600; text-decoration: none; }
.related a:hover { border-color: var(--green); background: var(--ticket); }
.related a span { display: block; margin-top: 8px; color: var(--ink-2); font-size: .875rem; line-height: 1.6; font-weight: 400; }

/* 08 スマホ / responsive */
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }
  .ticket-col { position: sticky; top: 16px; }
}
/* A tall result must remain scrollable, especially at browser zoom. */
@media (min-width: 960px) and (max-height: 1050px) { .ticket-col { position: static; } }
.mbar { display: none; }
@media (max-width: 959px) {
  body.has-calc { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
  .mbar { position: fixed; inset: auto 0 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 2px dashed var(--red); color: var(--ink); background: var(--ticket); box-shadow: 0 -6px 20px #2a242014; font: 400 .8125rem/1.5 var(--mono); }
  .mbar > span { min-width: 0; overflow-wrap: anywhere; }
  .mbar b { font: 600 1.25rem/1.4 var(--mono); }
  .mbar a { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 12px; border-radius: var(--radius); background: var(--red); color: var(--panel); font: 600 .875rem/1.5 var(--body); }
  .mbar a:hover { background: var(--red-hover); }
  .mbar.hidden { display: none; }
}
@media (max-width: 699px) {
  .wrap { padding-inline: 16px; }
  main.wrap { padding-top: 16px; }
  .site-head .wrap { gap: 12px; min-height: 76px; padding-block: 12px; flex-wrap: wrap; }
  .site-nav { display: none; }
  .brand { padding: 6px 10px; }
  h1 { font-size: clamp(1.875rem, 7.4vw, 2.5rem); line-height: 1.2; margin-block: 8px 12px; }
  h2 { margin-top: 32px; }
  .lede { font-size: 1rem; margin-bottom: 24px; }
  .tool { gap: 24px; }
  .calc { padding: 20px 16px 16px; border-top-width: 6px; }
  .fields { grid-template-columns: repeat(auto-fit, minmax(min(136px, 100%), 1fr)); gap: 12px; }
  .field:has(> .select) { grid-column: 1 / -1; }
  details.more .fields { grid-template-columns: minmax(0, 1fr); }
  .shape-btn { padding-inline: 10px; font-size: .8125rem; }
  .shapes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shape-btn { justify-content: flex-start; }
  .step { margin-bottom: 24px; }
  .ticket { padding: 24px 16px; }
  .ticket .big { font-size: 2.5rem; }
  .ticket table { font-size: .8125rem; }
  .ticket th { width: 54%; padding-right: 8px; }
  .ticket td { width: 46%; }
  .ticket-actions > .primary { flex-basis: 100%; }
  .ticket-actions > .btn:not(.primary) { flex: 1; }
  .work { padding: 16px; margin-top: 24px; }
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tool-board { max-width: 420px; width: 100%; }
  .site-foot { margin-top: 48px; }
}
@media (max-width: 359px) { .fields { grid-template-columns: minmax(0, 1fr); } }
@media (max-height: 500px) and (max-width: 959px) {
  .mbar { position: static; margin-top: 24px; } body.has-calc { padding-bottom: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  :is(.shape-btn, .view-btn, .chip, .btn) { transition: background-color 120ms ease, transform 100ms ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  :is(.shape-btn, .view-btn, .chip, .btn, .link-btn):active { transform: none !important; }
}
@media (forced-colors: active) {
  .shape-btn[aria-pressed="true"], .view-btn[aria-pressed="true"] { border: 3px double Highlight; }
  :focus-visible { outline-color: Highlight; }
  .ticket, .calc, .caution { border: 1px solid CanvasText; }
}

/* 09 印刷 / ticket only; a long project list may flow onto additional pages */
.print-only { display: none; }
@media print {
  @page { size: auto; margin: 14mm; }
  html, body, body.has-calc { padding: 0; margin: 0; background: #fff; color: #000; font-size: 10pt; }
  body > :not(main), main > :not(.tool):not(#project-list):not(:has(#project-list)):not(.print-only), .tool > :not(.ticket-col), .ticket-col > :not(#ticket):not(.print-slot), .no-print, .ticket-actions, .status, #plan, .mbar, .home-hero { display: none !important; }
  .article:has(#project-list) { display: block; max-width: none; margin: 0; }
  .article:has(#project-list) > :not(#project-list) { display: none !important; }
  .wrap, main.wrap { max-width: none; width: auto; margin: 0; padding: 0; }
  .tool { display: block; margin: 0; }
  .ticket-col { position: static; }
  .ticket { padding: 8mm; margin: 0 0 6mm; border: 1px solid #000; border-radius: 0; background: #fff !important; box-shadow: none; color: #000; break-inside: auto; }
  .ticket *, .ticket a, #project-list .ticket a { color: #000 !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; }
  .ticket::before, .ticket::after { display: none; }
  .ticket-head { border-color: #000; }
  .ticket th, .ticket td, .ticket .group { border-color: #666; font-size: 10pt; }
  .ticket tr, .ticket .note, .ticket .big { break-inside: avoid; }
  .ticket .group { break-after: avoid; }
  .ticket .big { font-size: 28pt; }
  .ticket .note { font-size: 9pt; }
  .print-only { display: block !important; }
  .print-figs { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6mm; margin: 0 0 6mm; break-inside: avoid; }
  .pf-cap { color: #000; font-size: 8pt; }
  .pf .plan { padding: 2mm; border: 1px solid #000; border-radius: 0; background: #fff !important; box-shadow: none; }
  .pf .plan figcaption { font-size: 8pt; color: #000; }
  .pf img { border: 1px solid #000; border-radius: 0; background: #fff; }
  #project-list .list-item { margin: 0; padding: 0; border: 0; }
  body:not(.print-one) #project-list .list-item + .list-item { break-before: page; }
  body.print-one #project-list .list-item:not(.print-this) { display: none !important; }
}
