/* Design sheets — chooser, input forms, A4 calculation report */

/* ---------- chooser ---------- */
.sheet-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.sheet-card {
  display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--ink); background: var(--surface);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.sheet-card:hover { transform: translateY(-3px); box-shadow: 6px 6px 0 var(--ink); }
.sheet-card__fig { border-bottom: 1px solid var(--ink); background:
    linear-gradient(rgba(28,63,196,0.07) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, rgba(28,63,196,0.07) 1px, transparent 1px) 0 0 / 20px 20px, #fff;
  aspect-ratio: 16 / 7; display: grid; place-items: center; padding: 16px; position: relative; }
.sheet-card__fig svg { width: 100%; height: 100%; }
.sheet-card__no { position: absolute; top: 0; left: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; padding: 6px 10px; background: var(--yellow); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.sheet-card__body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 10px; }
.sheet-card h2 { font-size: 26px; letter-spacing: -0.025em; }
.sheet-card p { color: var(--muted); margin: 0; font-size: 15.5px; }
.sheet-card .chip-list { margin-top: 4px; }
.sheet-card .read-more { margin-top: 10px; }
.sheet-card:hover .read-more svg { transform: translateX(4px); }
.soon-card { border: 1px dashed var(--ink); padding: 22px 24px 24px; display: flex; flex-direction: column; }
.soon-card .soon__list { margin-top: 14px; }
@media (max-width: 820px) { .sheet-cards { grid-template-columns: 1fr; } }

/* ---------- sheet page ---------- */
.sheet-intro { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; margin-bottom: 32px; align-items: start; }
.sheet-intro > div:first-child { grid-column: 1 / span 7; }
.sheet-intro > aside { grid-column: 9 / -1; border: 1px solid var(--ink); background: var(--surface); padding: 18px 20px; }
.sheet-intro aside h2 { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.sheet-intro aside ol { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.sheet-intro aside li { margin-bottom: 6px; }
.sheet-intro p { color: var(--ink-2); margin: 0 0 12px; max-width: 62ch; }
@media (max-width: 900px) { .sheet-intro > * { grid-column: 1 / -1 !important; } }

.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; font-size: 15px; border-bottom: 2px solid var(--ink); margin-bottom: 20px; }
.back-link svg { width: 16px; height: 16px; }

/* ---------- form ---------- */
.sheet-form { display: grid; gap: 20px; }
.fs { border: 1px solid var(--ink); background: var(--surface); margin: 0; padding: 0 24px 24px; min-width: 0; }
.fs[hidden] { display: none; }
.fs legend { float: left; width: calc(100% + 48px); margin: 0 -24px 20px; padding: 14px 24px; border-bottom: 1px solid var(--ink); background: var(--bg); font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.015em; display: flex; align-items: center; gap: 12px; }
.fs legend + * { clear: both; }
.fs-n { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--ink); background: var(--yellow); padding: 3px 7px; border: 1px solid var(--ink); }
.fs-note { color: var(--muted); font-size: 14.5px; margin: 0 0 16px; }
.fs-fig { border: 1px solid var(--line); background: #fff; margin-bottom: 18px; padding: 10px; }
.fs-fig svg { width: 100%; max-height: 260px; }
.fs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 20px; }
.fs-grid .field { margin-bottom: 14px; }
.fs-grid .field--wide { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.with-unit { display: flex; align-items: stretch; }
.with-unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.with-unit .unit { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--bg); font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.fs .field label { font-size: 13.5px; }
@media (max-width: 980px) { .fs-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .fs-grid { grid-template-columns: 1fr; } .fs { padding: 0 16px 16px; } .fs legend { width: calc(100% + 32px); margin: 0 -16px 16px; padding: 12px 16px; } }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.form-actions .form-status { margin: 0; flex-basis: 100%; }

/* ---------- output bar ---------- */
.sheet-output[hidden] { display: none; }
.out-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); margin-bottom: 24px; position: sticky; top: 72px; background: var(--bg); z-index: 5; padding-top: 12px; }
.out-title { font-size: 28px; letter-spacing: -0.03em; outline: none; }
.out-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.out-actions .btn { min-height: 44px; }
.out-actions .btn:disabled { opacity: .5; cursor: progress; }
.pdf-status { font-size: 14px; color: var(--ink-2); min-height: 1.4em; margin: -12px 0 12px; }
.paper-wrap { width: 100%; overflow: hidden; }

/* ---------- A4 paper ---------- */
.paper {
  --p-ink: #0f1216; --p-muted: #4b5360; --p-line: #c9c6bc; --p-blue: #1c3fc4;
  width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; color: var(--p-ink);
  padding: 12mm 12mm 14mm; box-shadow: 0 1px 0 var(--ink), 0 0 0 1px var(--ink), 8px 8px 0 rgba(15,18,22,.12);
  font-family: var(--font-body); font-size: 10.5pt; line-height: 1.45; transform-origin: top left;
}
.paper.exporting { box-shadow: none; padding-top: 2mm; }
.paper table { border-collapse: collapse; width: 100%; }

.tb { border: 1.5px solid var(--p-ink); display: grid; grid-template-columns: 1fr 1.4fr; margin-bottom: 6mm; }
.tb-brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-right: 1px solid var(--p-ink); border-bottom: 1px solid var(--p-ink); }
.tb-brand strong { display: block; font-family: var(--font-display); font-size: 11.5pt; letter-spacing: -0.01em; }
.tb-brand span { display: block; font-family: var(--font-mono); font-size: 7.5pt; color: var(--p-muted); }
.tb-title { padding: 8px 10px; border-bottom: 1px solid var(--p-ink); background: #fbefc4; }
.tb-title strong { display: block; font-family: var(--font-display); font-size: 14pt; letter-spacing: -0.02em; line-height: 1.15; }
.tb-k { display: block; font-family: var(--font-mono); font-size: 6.8pt; letter-spacing: .08em; text-transform: uppercase; color: var(--p-muted); }
.tb-code { font-family: var(--font-mono); font-size: 7.5pt; }
.tb-grid { grid-column: 1 / -1; }
.tb-grid td { border-right: 1px solid var(--p-ink); border-top: 1px solid var(--p-line); padding: 5px 10px; font-size: 9.5pt; vertical-align: top; width: 33.3%; }
.tb-grid tr:first-child td { border-top: 0; }
.tb-grid td:last-child { border-right: 0; }

.p-sec { margin-bottom: 6mm; }
.p-sec--calc { page-break-before: always; break-before: page; }
.paper:not(.exporting) .p-sec--calc { border-top: 1px dashed var(--p-line); padding-top: 6mm; }
.p-h { font-family: var(--font-mono); font-size: 8.5pt; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1.5px solid var(--p-ink); padding-bottom: 3px; margin-bottom: 3mm; break-after: avoid; }
.sum { border: 1.5px solid var(--p-ink); }
.sum-status { padding: 6px 10px; font-weight: 700; font-size: 10.5pt; border-bottom: 1px solid var(--p-ink); }
.sum.ok .sum-status { background: #e3f3e6; }
.sum.ok .sum-status::before { content: "✓  "; }
.sum.ng .sum-status { background: #fde8e6; }
.sum.ng .sum-status::before { content: "✕  "; }
.sum-tab td { padding: 4px 10px; border-bottom: 1px solid var(--p-line); font-size: 9.8pt; }
.sum-tab tr:last-child td { border-bottom: 0; }
.sum-tab td:first-child { width: 45%; color: var(--p-muted); }
.sum-tab td:last-child { font-weight: 600; }


/* fixed layout so long option labels wrap inside the page instead of running past it */
.in-tab { table-layout: fixed; }
.in-tab td, .in-tab th { padding: 2.5px 8px; border-bottom: 1px solid #ebe9e3; font-size: 9pt; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.in-tab .in-c1 { width: 42%; }
.in-tab td:last-child { font-family: var(--font-mono); font-size: 8.6pt; text-align: right; }
.sum-tab, .tb-grid { table-layout: fixed; }
.sum-tab td, .tb-grid td { overflow-wrap: anywhere; }
.in-tab .in-g th { background: #f5f4ef; font-family: var(--font-mono); font-weight: 500; font-size: 7.6pt; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--p-ink); padding-top: 5px; }

.calc { table-layout: fixed; }
.calc .col-ref { width: 23mm; }
.calc .col-out { width: 40mm; }
.calc thead th { font-family: var(--font-mono); font-size: 7.5pt; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding: 4px 6px; border-top: 1.5px solid var(--p-ink); border-bottom: 1px solid var(--p-ink); background: #f5f4ef; }
.calc td { padding: 3.5px 6px; vertical-align: top; border-bottom: 1px solid #eeece6; }
.calc td.c-ref { font-family: var(--font-mono); font-size: 7.4pt; color: var(--p-blue); border-right: 1px solid var(--p-line); line-height: 1.35; padding-top: 5px; overflow-wrap: anywhere; }
.calc td.c-out { border-left: 1px solid var(--p-line); font-size: 9.2pt; }
.calc td.c-calc { font-size: 9.8pt; overflow-wrap: anywhere; }
.calc td.c-calc p { margin: 0; }
.calc .sym { font-style: italic; font-family: "Cambria Math", "Times New Roman", serif; font-size: 10.8pt; }
.calc .ex { font-family: var(--font-mono); font-size: 8.8pt; color: #2a3038; }
.calc .u { font-size: 8.8pt; color: var(--p-muted); }
.calc .o { font-weight: 700; display: inline-block; background: #fbefc4; padding: 0 4px; }
.calc .note { color: var(--p-muted); font-size: 8.8pt; }
.calc .r-h td { padding-top: 10px; font-family: var(--font-display); font-weight: 700; font-size: 11.5pt; border-bottom: 1px solid var(--p-ink); letter-spacing: -0.01em; }
.calc .r-n { color: var(--p-blue); margin-right: 4px; }
.calc .r-sh td { font-weight: 600; font-size: 10pt; padding-top: 7px; border-bottom: 1px dashed var(--p-line); }
.calc .r-fig td, .calc .r-wide td { border-bottom: 0; }
.calc figure { margin: 6px 0 8px; border: 1px solid var(--p-line); padding: 8px; break-inside: avoid; }
.calc figure svg { width: 100%; height: auto; display: block; }
.calc figcaption { font-family: var(--font-mono); font-size: 7.6pt; color: var(--p-muted); margin-top: 4px; }
.chk { display: block; }
.badge { display: inline-block; font-family: var(--font-mono); font-size: 7.6pt; font-weight: 500; letter-spacing: .06em; padding: 1px 6px; border: 1px solid; }
.badge.ok { color: #116329; background: #e3f3e6; }
.badge.ng { color: #a40e26; background: #fde8e6; }
.r-tab { margin: 4px 0 8px; }
.r-tab th, .r-tab td { border: 1px solid var(--p-line); padding: 3px 6px; font-size: 8.8pt; text-align: center; }
.r-tab th { background: #f5f4ef; font-weight: 600; }
.r-tab td:first-child, .r-tab th:first-child { text-align: left; }
.p-err { color: #a40e26; font-weight: 600; }
.p-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--p-ink); margin-top: 6mm; padding-top: 3px; font-family: var(--font-mono); font-size: 7.4pt; color: var(--p-muted); }

/* ---------- print: A4, only the sheet ---------- */
@media print {
  @page { size: A4; margin: 10mm 0 12mm; }
  html, body { background: #fff !important; }
  .site-header, .site-footer, .skip-link, .mobile-menu, .page-hero, .out-bar, .pdf-status, .back-link, .sheet-intro, .cta, .progress { display: none !important; }
  main, .section, .wrap { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .paper-wrap { height: auto !important; overflow: visible; }
  .paper { transform: none !important; box-shadow: none; width: 100%; min-height: 0; padding: 0 12mm; }
  .calc tr, figure, .tb, .sum { break-inside: avoid; }
  .p-h { break-after: avoid; }
}
