* { box-sizing: border-box; }
:root { color-scheme: light; --bench: #eae8e2; --paper: #fffcf4; --ink: #252723; --muted: #55594f; --line: #bfc2b6; --blue: #263fbb; --blue-wash: #edf0ff; --amber: #754000; --amber-wash: #fff0d4; }
body { margin: 0; background: var(--bench); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
button, input, textarea { font: inherit; }
button, input[type='file']::file-selector-button { min-height: 44px; min-width: 44px; border: 1px solid #868c7e; border-radius: 3px; background: #f8f6ef; color: var(--ink); padding: 9px 14px; font-size: 14px; font-weight: 650; cursor: pointer; }
button:hover:not(:disabled), input[type='file']::file-selector-button:hover { background: #dedfd4; }
button.primary { background: var(--blue); color: white; border-color: var(--blue); }
button.primary:hover:not(:disabled) { background: #1b2e8d; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--blue); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
input:focus-visible, textarea:focus-visible { outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(26px, 2.8vw, 38px); letter-spacing: -.04em; line-height: 1.15; margin-bottom: 6px; font-weight: 750; }
h2 { font-size: 23px; letter-spacing: -.025em; line-height: 1.3; margin-bottom: 0; }
h3 { font-size: 16px; line-height: 1.4; }
.masthead { padding: 18px max(24px, calc((100vw - 1600px) / 2)); background: #f7f5ef; border-bottom: 1px solid var(--line); }
.brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.eyebrow { font-size: 12px; letter-spacing: .15em; font-weight: 750; margin-bottom: 6px; }
.tagline { color: var(--muted); margin-bottom: 0; }
.brand-row nav { flex-shrink: 0; }
.brand-row a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0 8px 8px; }
.utility-row { margin-top: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 18px; align-items: center; }
.origin { font-size: 14px; margin: 0; border-left: 4px solid var(--blue); padding-left: 10px; }
.save-status { font-size: 12px; color: var(--muted); margin: 0; max-width: 300px; }
.file-menu { min-width: 140px; }
.file-menu > summary { min-height: 44px; padding: 10px 14px; font-size: 14px; border: 1px solid #868c7e; border-radius: 3px; background: #f8f6ef; }
.file-menu[open] { grid-column: 1 / -1; grid-row: 2; }
.file-menu[open] > summary { width: fit-content; margin-bottom: 10px; }
.file-menu-content { border-top: 1px solid var(--line); padding-top: 12px; }
.file-menu-content .support { margin-bottom: 0; max-width: 720px; }
.file-tools, .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.workspace { max-width: 1648px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 28px; align-items: start; }
.reader-area, .proof-area { min-width: 0; }
.reader-area { border-right: 1px solid var(--line); padding-right: 24px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 14px; }
.section-heading p { font-size: 14px; color: var(--muted); margin-bottom: 0; }
.page-rail { display: grid; grid-template-columns: repeat(8, minmax(44px, 1fr)); gap: 8px; margin-bottom: 22px; }
.page-rail button { position: relative; min-height: 48px; font-size: 18px; padding: 8px; }
.page-rail button[aria-pressed='true'] { color: white; background: var(--blue); border-color: var(--blue); }
.page-rail button.has-overflow::after { content: '!'; position: absolute; right: -3px; top: -8px; background: var(--amber-wash); border: 1px solid var(--amber); color: var(--amber); border-radius: 50%; font: 700 12px/19px system-ui, sans-serif; width: 20px; height: 20px; }
.editor-layout { display: grid; grid-template-columns: minmax(230px, 1fr) 446px; gap: 22px; align-items: start; }
#editor { grid-column: 1; grid-row: 1; }
.reader-proof { grid-column: 2; grid-row: 1; min-width: 0; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
legend { padding: 0; font-size: 19px; font-weight: 700; margin-bottom: 18px; }
label { display: block; font-size: 14px; font-weight: 650; margin: 0 0 7px; }
input[type='text'], textarea { display: block; width: 100%; border: 1px solid #909588; border-radius: 3px; color: var(--ink); background: white; padding: 11px 12px; min-height: 48px; font-size: 16px; }
input[type='text'] { margin-bottom: 19px; }
textarea { min-height: 300px; resize: vertical; line-height: 1.55; }
.support { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 9px 0 15px; }
input[type='file'] { display: block; max-width: 100%; width: 100%; font-size: 14px; min-height: 44px; }
input[type='file']::file-selector-button { margin-right: 8px; padding: 9px 10px; }
.image-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.image-row p { font-size: 14px; margin: 0; }
.preview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 8px 14px 0; }
.preview-heading h3 { color: var(--blue); margin: 0; }
.preview-heading span { color: var(--muted); font-size: 14px; }
.reader-viewport { overflow: auto; max-width: 100%; padding: 0 8px 8px 0; }
.reader-pages { width: fit-content; box-shadow: 6px 6px 0 #d3d2c9; }
/* Fixed paper proofs show the 16pt story at 16.64 CSS pixels. */
.reader-pages > .paper { zoom: .78; outline: 2px solid var(--blue); outline-offset: -2px; }
.reader-actions { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 3px 0 12px; }
.reader-actions .support { margin: 0; }
.location-button { color: var(--blue); width: 100%; text-align: left; background: transparent; }
.count-label { font-size: 12px; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.proof-intro > .support { margin-top: -3px; }
.fit-panel { background: #dde8d8; border-left: 4px solid #3a603c; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 12px; }
.fit-panel p { margin: 0; color: #294c2c; font-size: 14px; font-weight: 700; }
.fit-panel button { flex-shrink: 0; background: var(--paper); }
.fit-panel.not-ready { background: var(--amber-wash); border-color: var(--amber); }
.fit-panel.not-ready p { color: var(--amber); }
.overflow-list { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.overflow-list:empty { margin-bottom: 18px; }
.overflow-list button { color: var(--amber); background: #fff7e8; border-color: #a2692a; text-align: left; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 18px; }
.sheet-figure { margin: 0; min-width: 0; }
.sheet-caption { margin-bottom: 9px; }
.sheet-caption h3 { margin: 0 0 4px; font-size: 16px; }
.sheet-caption p { display: flex; justify-content: space-between; gap: 6px; margin: 0; font-size: 14px; color: var(--muted); }
.sheet-caption .selected-label { color: var(--blue); font-weight: 700; }
.sheet { position: relative; display: flex; width: 297mm; height: 210mm; background: var(--paper); zoom: .195; box-shadow: 0 0 0 3px #8d9086, 10px 10px 0 #d3d2c9; }
.paper { flex: 0 0 148.5mm; position: relative; width: 148.5mm; height: 210mm; background: var(--paper); color: var(--ink); overflow: hidden; font-family: Georgia, 'Times New Roman', serif; }
.paper-content { position: absolute; top: 14mm; right: 14mm; bottom: 21mm; left: 14mm; overflow: hidden; }
.paper-title { margin: 0 0 7mm; font: 400 30pt/1.13 Georgia, 'Times New Roman', serif; letter-spacing: -.025em; white-space: pre-wrap; overflow-wrap: normal; }
.paper-title:empty { margin: 0; }
.paper-body { margin: 0; font: 400 16pt/1.43 Georgia, 'Times New Roman', serif; white-space: pre-wrap; overflow-wrap: normal; tab-size: 4; }
.paper-illustration { display: block; width: 100%; height: 48mm; margin: 0 0 6mm; object-fit: contain; background: #f1eee5; }
.paper-number { position: absolute; bottom: 8mm; left: 14mm; right: 14mm; padding-top: 3mm; border-top: .25mm solid #d3d0c5; text-align: center; font: 14pt/1.2 system-ui, sans-serif; }
.sheet > .paper + .paper { border-left: .25mm dashed #9ca290; }
.sheet > .paper.is-selected { outline: 2mm solid var(--blue); outline-offset: -2mm; background: #f6f6ff; }
.sheet > .paper.is-overflow { box-shadow: inset 0 0 0 1mm var(--amber); }
.print-label { display: none; }
.placement-status { margin: 24px 0 7px; padding-left: 14px; border-left: 4px solid var(--blue); font-size: 14px; color: var(--blue); }
.fold-area { grid-column: 1 / -1; border-top: 1px solid #adb3a4; padding-top: 14px; }
summary { cursor: pointer; min-height: 44px; padding: 9px 0; font-size: 18px; font-weight: 700; }
summary:hover { color: var(--blue); }
.fold-steps { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.fold-steps li { display: flex; gap: 15px; align-items: flex-start; }
.fold-steps svg { flex: 0 0 76px; width: 76px; height: 60px; }
.fold-steps h3 { margin-bottom: 6px; }
.fold-steps p { font-size: 14px; margin: 0; color: var(--muted); }
.diagram-paper { fill: var(--paper); stroke: #777e70; stroke-width: 1.5; }
.diagram-fold { fill: none; stroke: var(--blue); stroke-width: 2; stroke-dasharray: 4 3; }
.diagram-arrow { fill: none; stroke: var(--blue); stroke-width: 2; }
.diagram-inner { fill: var(--blue-wash); stroke: var(--blue); stroke-width: 2; }
.print-advice { font-size: 13px; max-width: 1050px; margin: 0; color: var(--muted); }
.feedback { color: #294c2c; font-size: 14px; margin: 12px 0 0; }
.error { padding: 12px; border-left: 4px solid #9b361b; color: #81290f; background: #fff0e8; font-size: 14px; margin: 12px 0 0; overflow-wrap: anywhere; }
.notice { background: var(--amber-wash); border: 1px solid #ad8046; padding: 16px; margin: 16px 0 0; }
.notice h2 { font-size: 18px; margin-bottom: 8px; }
.notice p { font-size: 14px; }
.notice .support { margin-bottom: 0; }
dialog { max-width: 520px; width: calc(100% - 32px); padding: 26px; border: 1px solid #848c7b; background: var(--paper); color: var(--ink); box-shadow: 0 20px 80px #171d1a55; }
dialog::backdrop { background: #25272388; }
dialog h2 { margin-bottom: 15px; }
dialog .button-row { justify-content: flex-end; margin-top: 24px; }
.mobile-only { display: none; }
@media (min-width: 1540px) { .workspace { grid-template-columns: minmax(0, 1fr) 540px; } .sheet { zoom: .23; } }
@media (max-width: 1319px) {
  .workspace { grid-template-columns: 1fr; max-width: 1060px; gap: 28px; }
  .reader-area { border-right: 0; padding-right: 0; }
  .editor-layout { grid-template-columns: minmax(230px, 1fr) 446px; gap: 30px; }
  .proof-area { border-top: 1px solid var(--line); padding-top: 24px; }
  .sheet { zoom: .42; }
}
@media (max-width: 1030px) { .sheet { zoom: .37; } }
@media (max-width: 920px) { .sheet { zoom: .33; } .fold-steps { grid-template-columns: 1fr; gap: 23px; } }
@media (max-width: 830px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .reader-proof { grid-column: 1; grid-row: 1; width: 446px; max-width: 100%; margin: 0 auto; }
  #editor { grid-column: 1; grid-row: 2; }
  .sheet { zoom: .30; }
  .utility-row { grid-template-columns: 1fr auto; }
  .save-status { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 690px) {
  .masthead { padding: 12px 16px; }
  .workspace { padding: 16px 16px 28px; gap: 24px; }
  .brand-row { gap: 10px; }
  .brand-row nav { font-size: 14px; }
  .eyebrow { font-size: 12px; letter-spacing: .07em; margin-bottom: 4px; }
  h1 { font-size: 25px; margin-bottom: 0; }
  .tagline { display: none; }
  .utility-row { grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin-top: 10px; }
  .origin { grid-column: 1 / -1; font-size: 14px; }
  .file-menu { grid-column: 1; grid-row: 2; min-width: 0; }
  .file-menu > summary { padding: 10px; }
  .save-status { grid-column: 2; grid-row: 2; }
  .file-menu[open] { grid-column: 1 / -1; grid-row: 3; }
  .file-menu[open] + .save-status { grid-column: 1 / -1; grid-row: 2; }
  .file-tools { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .section-heading { margin-bottom: 12px; }
  .section-heading h2 { font-size: 22px; }
  .page-rail { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 16px; }
  .page-rail button { min-height: 44px; padding: 6px; }
  .reader-proof { width: 100%; max-width: 446px; }
  .preview-heading { margin-bottom: 9px; }
  .reading-note { margin: 0 8px 12px 0; }
  /* The default phone view is a readable companion to the fixed sheet proof.
     These overrides affect only reader content, never the measured sheet pages. */
  .reader-viewport:not(.is-enlarged) .reader-pages { width: 100%; }
  .reader-viewport:not(.is-enlarged) .paper { zoom: 1; width: 100%; height: auto; min-height: 0; padding: 28px 24px 20px; overflow: visible; }
  .reader-viewport:not(.is-enlarged) .paper-content { position: static; overflow: visible; }
  .reader-viewport:not(.is-enlarged) .paper-title { font-size: 26px; line-height: 1.2; margin-bottom: 20px; overflow-wrap: anywhere; }
  .reader-viewport:not(.is-enlarged) .paper-title:empty { margin: 0; }
  .reader-viewport:not(.is-enlarged) .paper-body { font-size: 16.5px; line-height: 1.55; overflow-wrap: anywhere; }
  .reader-viewport:not(.is-enlarged) .paper-illustration { height: auto; max-height: 240px; margin-bottom: 20px; object-fit: contain; }
  .reader-viewport:not(.is-enlarged) .paper-number { position: static; margin-top: 32px; padding-top: 12px; font-size: 14px; line-height: 1.2; }
  .reader-viewport.is-enlarged .paper { zoom: .78; }
  .reader-actions button { flex-shrink: 0; }
  #enlarge-proof[aria-pressed='true'] { background: var(--blue); color: white; border-color: var(--blue); }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  textarea { min-height: 250px; }
  .sheet-grid { grid-template-columns: 1fr; gap: 25px; }
  .sheet-figure { width: 100%; max-width: 450px; margin: 0 auto; }
  .sheet { zoom: .39; }
  .fit-panel { flex-wrap: wrap; }
  .fold-area { margin-top: 0; }
}
@media (max-width: 490px) { .sheet-figure { max-width: 360px; } .sheet { zoom: .32; } }
@media (max-width: 410px) { .sheet-figure { max-width: 315px; } .sheet { zoom: .28; } }
@media (max-width: 350px) {
  .sheet-figure { max-width: 281px; }
  .sheet { zoom: .25; }
  .eyebrow { letter-spacing: 0; }
  h1 { font-size: 23px; }
  .section-heading { gap: 4px 8px; }
  .reader-viewport:not(.is-enlarged) .paper { padding-right: 20px; padding-left: 20px; }
}
@page { size: A4 landscape; margin: 0; }
@media print {
  html, body { width: 297mm; margin: 0 !important; padding: 0 !important; background: white; }
  .screen-only, dialog, noscript { display: none !important; }
  .workspace, .proof-area, .sheet-grid { display: block; width: 297mm; max-width: none; padding: 0; margin: 0; border: 0; gap: 0; }
  .sheet-figure { display: block; width: 297mm; max-width: none; height: 210mm; padding: 0; margin: 0; break-inside: avoid; break-after: page; page-break-after: always; }
  .sheet-figure:last-child { break-after: auto; page-break-after: auto; }
  .sheet-caption { display: none; }
  .sheet { zoom: 1; width: 297mm; height: 210mm; box-shadow: none; overflow: hidden; }
  .paper, .sheet > .paper.is-selected, .sheet > .paper.is-overflow { background: white; outline: none; box-shadow: none; }
  .paper-illustration { background: transparent; }
  .print-label { display: block; position: absolute; bottom: 2mm; left: 0; right: 0; text-align: center; font: 8pt/1.2 system-ui, sans-serif; color: #454a40; }
}
