@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
/* Extra letters for names in the proof. Each file is fetched only when a page shows one of its letters. */
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-latin-ext.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-vietnamese.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-greek.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF; }
@font-face { font-family: "EB Garamond"; src: url("/fonts/eb-garamond-cyrillic.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

:root {
  --bg: #ffffff; --surface: #f1f1f1; --border: #e0e0e0; --ink: #000000; --muted: #666666;
  --accent: #000000; --on-accent: #ffffff; --error: #a8201a; --ok: #1d6b43;
  --paper: #ffffff; --paper-ink: #000000;
  --r-pill: 9999px; --r-card: 6px; --r-paper: 1px;
  --shadow-paper: rgba(0,0,0,0.02) 0 4px 6px, rgba(0,0,0,0.05) 0 0 2px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c0c0c; --surface: #1a1a1a; --border: #303030; --ink: #ffffff; --muted: #a3a3a3; --accent: #ffffff; --on-accent: #000000; --error: #ff9a91; --ok: #7ad3a0; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3, p, ul, ol, figure, fieldset, legend, table { margin: 0; padding: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; }
a { color: inherit; text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 50; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.wordmark { font-weight: 600; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 8px; }
.wordmark svg { width: 18px; height: 18px; }

.hero { padding: 16px 0 24px; }
.hero p { color: var(--muted); margin-top: 8px; max-width: 56ch; }

/* Controls */
label, .label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
input[type=text], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 11px 16px; min-height: 48px; appearance: none;
}
textarea { border-radius: var(--r-card); min-height: 120px; resize: vertical; padding: 12px; line-height: 1.45; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 21px) 21px, calc(100% - 16px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; font: inherit; font-weight: 500; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--bg); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { opacity: 0.86; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 13px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-pill); border: 1px solid transparent; background: none; color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--border); }
.icon-btn[disabled] { opacity: 0.3; cursor: default; }
.icon-btn svg { width: 16px; height: 16px; }

/* Builder */
.builder { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-bottom: 40px; }
fieldset { border: 0; min-width: 0; }
.group { padding: 24px 0; border-top: 1px solid var(--border); }
.group:first-child { border-top: 0; padding-top: 0; }
legend, .legend { font-size: 18px; font-weight: 600; margin-bottom: 16px; padding: 0; }
.field { margin-bottom: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.well { display: flex; align-items: center; gap: 16px; border: 1px dashed var(--border); border-radius: var(--r-card); padding: 16px; cursor: pointer; min-height: 88px; }
.well.over { border: 1px solid var(--ink); background: var(--surface); }
.well img { width: 56px; height: 56px; object-fit: cover; border-radius: 2px; }
.well input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.well:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.notice { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-card); margin-top: 8px; }
.notice svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.notice.err { color: var(--error); border-color: currentColor; }
.notice { flex-wrap: wrap; }
.notice .fixes { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.notice .fix { flex: none; min-height: 44px; }
.notice p { flex: 1 1 200px; overflow-wrap: anywhere; }
.hint.guide.bad, .muted.bad { color: var(--error); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.pill[aria-expanded=true] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.menu { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.menu button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; min-height: 48px; padding: 10px 16px; font: inherit; background: var(--bg); color: var(--ink); border: 0; border-top: 1px solid var(--border); cursor: pointer; }
.menu button:first-child { border-top: 0; }
.menu button:hover, .menu button:focus-visible { background: var(--surface); }
.menu button span:last-child { color: var(--muted); font-size: 13px; text-align: right; }
.items { list-style: none; margin-top: 16px; display: grid; gap: 8px; }
.item { border: 1px solid var(--border); border-radius: var(--r-card); padding: 12px; }
.item-head { display: flex; align-items: center; gap: 4px; }
.item-kind { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-width: 68px; }
.item-head input { min-height: 40px; padding: 6px 12px; border-color: transparent; font-weight: 500; flex: 1; min-width: 0; }
.item-head input:hover { border-color: var(--border); }
.item-check { margin: 6px 2px 0; }
.item details { margin-top: 4px; }
.item summary { font-size: 13px; color: var(--muted); cursor: pointer; min-height: 48px; display: flex; align-items: center; }
.item summary::before, details.group > summary::before { content: "+"; display: inline-block; width: 16px; flex: none; font-weight: 600; }
.item details[open] > summary::before, details.group[open] > summary::before { content: "\2013"; }
.item summary::-webkit-details-marker, details.group > summary::-webkit-details-marker { display: none; }
.item summary, details.group > summary { list-style: none; }
details.group > summary { min-height: 48px; display: flex; align-items: center; }
.item details .field { margin: 8px 0 0; }
.item textarea { min-height: 160px; font-size: 14px; }
.empty { color: var(--muted); font-size: 14px; padding: 16px; border: 1px dashed var(--border); border-radius: var(--r-card); margin-top: 16px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 16px; font-weight: 400; margin: 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.cta { padding-top: 24px; border-top: 1px solid var(--border); }
.cta .hint { text-align: center; margin-top: 12px; }

/* Preview */
.preview-inner { display: grid; gap: 16px; }
/* Notes sit above the proof so an error is seen without scrolling. */
#notices { order: -1; }
#notices:empty { display: none; }
#notices .notice:first-child { margin-top: 0; }
.paper { background: var(--paper); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); outline: 1px solid var(--border); aspect-ratio: 148 / 210; width: 100%; max-width: 440px; margin: 0 auto; overflow: hidden; touch-action: pan-y; }
.paper svg { display: block; width: 100%; height: 100%; }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }
.pager output { min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; margin: 0 auto; }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; min-height: 40px; padding: 0 12px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg input:checked + span { background: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.seg-wrap { text-align: center; }
.status { font-size: 14px; text-align: center; color: var(--muted); }
.status.ok { color: var(--ok); }
.proofbar { display: none; }
.sheet-close { display: none; }

/* Result */
.result { border-top: 1px solid var(--border); padding: 40px 0; }
.result h2 { margin-bottom: 8px; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 24px 0; }
.sheet-fig { border: 1px solid var(--border); border-radius: var(--r-card); padding: 12px; }
.sheet-fig figcaption { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.sheet-fig svg { display: block; width: 100%; height: auto; color: var(--ink); }
.sheet-fig .half-num { font: 600 22px "Instrument Sans", system-ui, sans-serif; fill: currentColor; }
.sheet-fig .side { font: 500 9px "Instrument Sans", system-ui, sans-serif; fill: var(--muted); letter-spacing: 0.06em; }
.sheet-fig .rect { fill: none; stroke: currentColor; stroke-width: 1; }
.sheet-fig .fold { stroke: currentColor; stroke-width: 1; stroke-dasharray: 3 3; }
.sheet-fig .staple { stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.sheet-fig.pending { opacity: 0.25; }
.sheet-fig { transition: opacity 0.2s ease; }
.buy { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); margin-top: 24px; }
.plan { border: 1px solid var(--border); border-radius: var(--r-card); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.plan .price { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.plan .price s { color: var(--muted); font-weight: 400; font-size: 18px; margin-right: 8px; }
.plan ul { list-style: none; display: grid; gap: 6px; font-size: 14px; color: var(--muted); flex: 1; }
.plan li::before { content: "\2013\00a0"; }
.files { list-style: none; display: grid; gap: 8px; margin-top: 16px; }
.files a { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--ink); border-radius: var(--r-card); padding: 14px 16px; text-decoration: none; font-weight: 500; min-height: 48px; }
.files a span:last-child { font-size: 13px; color: var(--muted); font-weight: 400; text-align: right; }
.steps { counter-reset: s; list-style: none; display: grid; gap: 12px; margin-top: 16px; }
.steps li { counter-increment: s; padding-left: 36px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ink); font-size: 13px; font-weight: 600; display: grid; place-items: center; }

/* Sections and articles */
.section { border-top: 1px solid var(--border); padding: 40px 0; }
.section > h2 { margin-bottom: 16px; }
.cols { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
.card { border: 1px solid var(--border); border-radius: var(--r-card); padding: 24px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14px; }
.lib { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 24px; }
.lib li { border-top: 1px solid var(--border); }
.lib a { display: flex; justify-content: space-between; gap: 8px; padding: 12px 0; text-decoration: none; min-height: 48px; align-items: center; }
.lib a:hover { text-decoration: underline; }
.lib span { color: var(--muted); font-size: 13px; }
.prose { max-width: 720px; }
.prose h1 { margin: 24px 0 12px; }
.prose h2 { margin: 40px 0 12px; }
.prose h3 { margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin-bottom: 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.lead { font-size: 18px; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); padding-top: 8px; }
.crumbs a { color: inherit; }
.table-wrap { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--border); border-radius: var(--r-card); }

.table-wrap.wide table { min-width: 640px; }
.table-wrap.wide td:first-child, .table-wrap.wide th:first-child { min-width: 9rem; }
.table-wrap.wide td.num:first-child, .table-wrap.wide th.num:first-child { min-width: 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
thead th { border-top: 0; font-weight: 600; background: var(--surface); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.words { font-family: "EB Garamond", Georgia, serif; font-size: 19px; line-height: 1.4; background: var(--paper); color: var(--paper-ink); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); outline: 1px solid var(--border); padding: 32px 24px; text-align: center; margin: 16px 0 24px; }
.words.left { text-align: left; }
.words p { margin: 0 0 14px; }
.words p:last-child { margin-bottom: 0; }
.words .credit { font-size: 15px; color: #555; }
.callout { border: 1px solid var(--ink); border-radius: var(--r-card); padding: 20px; margin: 24px 0; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.callout p { margin: 0; flex: 1 1 260px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; border: 1px solid currentColor; border-radius: var(--r-pill); padding: 1px 8px; white-space: nowrap; }
.tag.ok { color: var(--ok); } .tag.no { color: var(--error); }
.faq dt { font-weight: 600; margin-top: 16px; }
.faq dd { margin: 4px 0 0; color: var(--muted); }
.feedback { display: grid; gap: 12px; max-width: 560px; }
.feedback textarea { min-height: 88px; }
footer { border-top: 1px solid var(--border); padding: 32px 0 96px; font-size: 13px; color: var(--muted); }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
footer a { color: inherit; }
.drop { border: 1px dashed var(--border); border-radius: var(--r-card); padding: 32px 16px; text-align: center; }
.drop.over { border: 1px solid var(--ink); background: var(--surface); }

@media (min-width: 900px) {
  h1 { font-size: 40px; }
  .wrap { padding: 0 32px; }
  .hero { padding: 32px 0 40px; }
  .builder { grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); gap: 64px; align-items: start; }
  /* The proof and its notes scroll inside the column, so a note is never stuck below the bottom of the window. */
  .preview { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px 8px; margin: -2px -8px 0; }
  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .buy { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section, .result { padding: 64px 0; }
}
@media (max-width: 899px) {
  .proofbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg); border-top: 1px solid var(--border); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); align-items: center; justify-content: space-between; gap: 12px; }
  .proofbar .status { text-align: left; }
  .preview { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 30; background: var(--surface); transform: translateY(102%); visibility: hidden; transition: transform 0.25s ease, visibility 0s linear 0.25s; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .preview.open { transform: none; visibility: visible; transition: transform 0.25s ease; }
  .sheet-close { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .paper { max-width: min(100%, calc((100vh - 290px) * 148 / 210)); }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .words { font-size: 16px; padding: 24px 12px; }
}
@media (max-width: 600px) {
  /* Row one: the kind label and the three buttons. Row two: the title, at the full width of the phone. */
  .item-head { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px 44px; gap: 0 2px; align-items: center; }
  .item-kind { grid-column: 1; grid-row: 1; min-width: 0; padding-left: 2px; }
  .item-head .icon-btn { grid-row: 1; width: 44px; height: 44px; }
  .item-head input { grid-column: 1 / -1; grid-row: 2; padding: 6px 10px; border-color: var(--border); border-radius: var(--r-card); min-height: 48px; }
}
@media (max-width: 600px) {
  /* Tables on a phone: nothing may be cut off at the edge of the screen.
     Two-column tables wrap their text. Wide tables turn each row into a card,
     with the column heading (data-label, added at build time) beside each value. */
  th, td { overflow-wrap: break-word; }
  thead th { white-space: normal; }
  .table-wrap { overflow-x: visible; }
  .table-wrap.wide { border: 0; border-radius: 0; }
  .table-wrap.wide table, .table-wrap.wide tbody, .table-wrap.wide tr, .table-wrap.wide td { display: block; min-width: 0; width: auto; }
  .table-wrap.wide table { min-width: 0; }
  .table-wrap.wide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap.wide tr { border: 1px solid var(--border); border-radius: var(--r-card); margin-bottom: 8px; }
  .table-wrap.wide td, .table-wrap.wide td.num { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; text-align: left; padding: 8px 12px; }
  .table-wrap.wide td:first-child { border-top: 0; }
  .table-wrap.wide td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .table-wrap.wide td:first-child:not(.num) { display: block; font-weight: 600; }
  .table-wrap.wide td:first-child:not(.num)::before { content: none; }
  .table-wrap.wide td:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print { .top, footer, .proofbar, .feedback, .callout .btn { display: none !important; } }
