/* Layout: each sheet is a 1280 x 720 drawing sheet on a 12-column, 16-row grid.
   Every measurement inside a sheet is written in sheet pixels and scaled with --u,
   so the same sheet renders as a page in the PDF, a slide on screen, and a
   reflowed column on phones. */

@font-face { font-family: "Geist"; src: url("fonts/geist-300.woff2") format("woff2"); font-weight: 100 349; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-400.woff2") format("woff2"); font-weight: 350 449; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-500.woff2") format("woff2"); font-weight: 450 599; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-700.woff2") format("woff2"); font-weight: 600 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@property --u { syntax: "<length>"; inherits: true; initial-value: 1px; }

:root {
  /* paper (sheets are always printed matter, in every theme) */
  --paper: #ffffff;
  --ink: #131417;
  --ink-2: #3c3e44;
  --ink-3: #85878d;
  --rule: #dadbde;
  --accent: #283583;
  /* the desk around the sheets and the interface */
  --desk: #e6e7ea;
  --ui: #fbfbfc;
  --ui-ink: #131417;
  --ui-muted: #6a6c73;
  --ui-line: #d3d4d8;
  --ui-hover: rgb(19 20 23 / .06);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* master styles of the sheets (the Styles panel overrides these) */
  --pf-head: var(--font); --pf-body: var(--font); --pf-mono: var(--mono); --pf-head-w: 500;
  --fs-display: 108; --fs-title: 58; --fs-statement: 27; --fs-h2: 28; --fs-h3: 16;
  --fs-lead: 19; --fs-body: 12.5; --fs-small: 11; --fs-cap: 10.5; --fs-label: 9;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --desk: #0f1012; --ui: #18191c; --ui-ink: #ececee; --ui-muted: #9a9ca3; --ui-line: #2d2e33; --ui-hover: rgb(255 255 255 / .07); color-scheme: dark; }
}
:root[data-theme="dark"] { --desk: #0f1012; --ui: #18191c; --ui-ink: #ececee; --ui-muted: #9a9ca3; --ui-line: #2d2e33; --ui-hover: rgb(255 255 255 / .07); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--desk); color: var(--ui-ink); font-family: var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: calc(52px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 16px 0 20px;
  background: color-mix(in srgb, var(--desk) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  font-size: 13px; line-height: 1;
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ui-ink); text-decoration: none; font-weight: 500; letter-spacing: -0.005em; white-space: nowrap; }
.brand span { color: var(--ui-muted); font-weight: 400; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.btn {
  appearance: none; display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: 0;
  background: transparent; color: var(--ui-ink); font: 500 13px/1 var(--font); letter-spacing: -0.005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--ui-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .sheet a:focus-visible, [data-k]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.line { border-color: var(--ui-line); }
.btn.solid { background: var(--ui-ink); color: var(--desk); border-color: var(--ui-ink); }
.btn.solid:hover { background: color-mix(in srgb, var(--ui-ink) 86%, var(--desk)); }
.btn .k { font: 400 11px/1 var(--mono); color: var(--ui-muted); }
.btn.solid .k { color: color-mix(in srgb, var(--desk) 70%, transparent); }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------- Sheets on the desk ---------- */
.sheets { display: flex; flex-direction: column; align-items: center; gap: 32px; padding: calc(84px + env(safe-area-inset-top, 0px)) 24px 140px; }
.sheet-wrap {
  container-type: inline-size;
  width: min(100%, 1560px, max(1040px, calc((100dvh - 112px) * 16 / 9)));
  scroll-margin-top: 72px;
}
.sheet {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  --u: calc(100cqw / 1280);
  background: var(--paper); color: var(--ink);
  font-family: var(--pf-body); font-size: calc(var(--u) * var(--fs-body)); line-height: 1.6;
  font-feature-settings: "ss01" 0; font-kerning: normal; text-rendering: optimizeLegibility;
  box-shadow: 0 1px 2px rgb(18 20 32 / .06), 0 12px 40px -14px rgb(18 20 32 / .22);
}
.blk { position: absolute; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u)); width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u)); min-width: 0; }

/* ---------- Type ---------- */
.txt p { margin: 0; }
.blk-text .txt, .blk-title .tt { text-box: trim-both cap alphabetic; }
.blk-title .no { margin-bottom: calc(var(--u) * 26) !important; }
h1.txt, h2.txt, h3.txt, h1.tt { margin: 0; font: inherit; letter-spacing: inherit; color: inherit; white-space: pre-wrap; }
.sr { position: absolute; left: 0; top: 0; margin: 0; font-size: 1px; line-height: 1; color: transparent; pointer-events: none; user-select: none; }
.txt p + p { margin-top: .72em; }
.t-display { font-size: calc(var(--u) * var(--fs-display)); line-height: .88; letter-spacing: -0.048em; font-family: var(--pf-head); font-weight: var(--pf-head-w); }
.t-statement { font-size: calc(var(--u) * var(--fs-statement)); line-height: 1.3; letter-spacing: -0.018em; font-family: var(--pf-head); font-weight: 400; text-wrap: pretty; }
.t-h1 { font-size: calc(var(--u) * var(--fs-title)); line-height: .96; letter-spacing: -0.038em; font-family: var(--pf-head); font-weight: var(--pf-head-w); text-wrap: balance; }
.t-h2 { font-size: calc(var(--u) * var(--fs-h2)); line-height: 1.08; letter-spacing: -0.024em; font-family: var(--pf-head); font-weight: var(--pf-head-w); text-wrap: balance; }
.t-h3 { font-size: calc(var(--u) * var(--fs-h3)); line-height: 1.3; letter-spacing: -0.01em; font-family: var(--pf-head); font-weight: var(--pf-head-w); }
.t-lead { font-size: calc(var(--u) * var(--fs-lead)); line-height: 1.4; letter-spacing: -0.014em; font-weight: 400; text-wrap: pretty; }
.t-body { font-size: calc(var(--u) * var(--fs-body)); line-height: 1.62; color: var(--ink-2); text-wrap: pretty; hyphens: manual; }
.t-small { font-size: calc(var(--u) * var(--fs-small)); line-height: 1.5; color: var(--ink-2); }
.t-label { font-family: var(--pf-mono); font-size: calc(var(--u) * var(--fs-label)); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.c-accent, .c-accent .txt { color: var(--accent); }
.blk.sized { font-size: calc(var(--u) * var(--size)); }
.c-muted, .c-muted .txt { color: var(--ink-3); }

/* ---------- Figures ---------- */
.blk-fig { display: flex; flex-direction: column; gap: calc(var(--u) * 8); }
.frame { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; }
.frame > img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  object-fit: var(--fit, cover); object-position: var(--pos, 50% 50%);
  transform: scale(var(--z, 1)); transform-origin: var(--pos, 50% 50%);
  user-select: none; -webkit-user-drag: none;
}
.cap { flex: none; display: flex; gap: calc(var(--u) * 9); align-items: baseline; font-size: calc(var(--u) * var(--fs-cap)); line-height: 1.4; color: var(--ink-3); min-width: 0; }
.cap .tag { flex: none; font-family: var(--pf-mono); font-weight: 400; font-size: calc(var(--u) * var(--fs-cap)); color: var(--accent); }
.cap .ctext { min-width: 0; }
.cap-end .cap { justify-content: flex-end; }
.zoomable .frame { cursor: zoom-in; }
.sheet-tools .btn.on { color: var(--accent); }

/* label layer on a drawing (tiny on the sheet, readable when zoomed or in the PDF) */
.ovl { position: absolute; inset: 0; pointer-events: none; }
.ovl span { position: absolute; transform: translateY(-15%); font-size: calc(var(--fs) * var(--u)); line-height: 1.05; color: #2b2e3a; white-space: pre; }

/* ---------- Galleries ---------- */
.blk-gallery { display: flex; flex-direction: column; gap: calc(var(--u) * 8); }
.grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: calc(var(--u) * 16); }
.cell { display: flex; flex-direction: column; gap: calc(var(--u) * 7); min-height: 0; min-width: 0; }
.round .frame { border-radius: 50%; aspect-ratio: 1; flex: none; width: 100%; }
.round .cell { gap: calc(var(--u) * 10); }

/* ---------- Project title ---------- */
.blk-title .no { display: block; font-family: var(--pf-mono); font-size: calc(var(--u) * 12); letter-spacing: .02em; color: var(--accent); margin-bottom: calc(var(--u) * 20); }
.blk-title .tt { font-size: calc(var(--u) * var(--fs-title)); line-height: .96; letter-spacing: -0.04em; font-family: var(--pf-head); font-weight: var(--pf-head-w); text-wrap: balance; }

/* ---------- Facts (title-block strip) ---------- */
.facts { margin: 0; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); column-gap: calc(var(--u) * 16); row-gap: calc(var(--u) * 14); align-content: start; padding-top: calc(var(--u) * 11); border-top: 1px solid var(--ink); }
.fact { min-width: 0; }
.fact dt { font-family: var(--pf-mono); font-size: calc(var(--u) * var(--fs-label)); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: calc(var(--u) * 5); line-height: 1.3; }
.fact dd { margin: 0; font-size: calc(var(--u) * var(--fs-body) * .96); line-height: 1.42; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- CV entries ---------- */
.etitle { margin: 0 0 calc(var(--u) * 12); padding-bottom: calc(var(--u) * 8); border-bottom: 1px solid var(--ink); font-size: calc(var(--u) * 12); font-weight: 500; line-height: 1.3; color: var(--accent); }
.etitle.sub { margin-top: calc(var(--u) * 20); }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: calc(var(--u) * 10); margin-bottom: calc(var(--u) * 11); font-size: calc(var(--u) * var(--fs-body) * .92); line-height: 1.45; }
.ea { font-weight: 500; color: var(--ink); }
.ed { font-family: var(--pf-mono); font-size: calc(var(--u) * var(--fs-label)); letter-spacing: .02em; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: calc(var(--u) * 1.5); white-space: nowrap; }
.eb { grid-column: 1 / -1; color: var(--ink-2); }
.ec { grid-column: 1 / -1; color: var(--ink-3); margin-top: calc(var(--u) * 3); }
.lst { list-style: none; margin: 0; padding: 0; font-size: calc(var(--u) * var(--fs-body) * .92); line-height: 1.62; color: var(--ink-2); }
.icons { display: grid; grid-template-columns: repeat(5, calc(var(--u) * 34)); justify-content: space-between; row-gap: calc(var(--u) * 14); align-items: center; margin: calc(var(--u) * 2) 0 calc(var(--u) * 4); }
.icons img { display: block; width: 100%; height: calc(var(--u) * 30); object-fit: contain; object-position: 0 50%; filter: grayscale(1); }

/* ---------- Contents ---------- */
.card { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card .frame { flex: 0 0 calc(var(--u) * 268); }
.card-meta { display: flex; justify-content: space-between; margin-top: calc(var(--u) * 16); font-family: var(--pf-mono); font-size: calc(var(--u) * 11); letter-spacing: .02em; }
.card-meta .no { color: var(--accent); }
.card-meta .pg { color: var(--ink-3); }
.card-pg { margin-top: calc(var(--u) * 12); font-family: var(--pf-mono); font-size: calc(var(--u) * 11); letter-spacing: .02em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* an empty place still holds its line, so page numbers align across the cards */
.card-loc { min-height: 1.45em; }
body:not(.editing) .card .card-loc.is-empty { display: block; visibility: hidden; }
.card-title { margin-top: calc(var(--u) * 8); font-size: calc(var(--u) * 24); line-height: 1.08; letter-spacing: -0.025em; font-family: var(--pf-head); font-weight: var(--pf-head-w); }
.card-sub { margin-top: calc(var(--u) * 10); font-size: calc(var(--u) * var(--fs-body)); line-height: 1.45; color: var(--ink-2); }
.card-loc { margin-top: calc(var(--u) * 3); font-size: calc(var(--u) * 11); line-height: 1.45; color: var(--ink-3); }
@media (hover: hover) { body:not(.editing) .card:hover .card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .14em; } }
.card-drawing .card-meta { margin-top: 0; align-items: baseline; }
.card-drawing .card-meta .no { font-family: var(--pf-head); font-size: calc(var(--u) * 44); line-height: 1; font-weight: 300; letter-spacing: -0.03em; color: var(--ink); }
.card-drawing .card-title { margin-top: calc(var(--u) * 22); }
.card-drawing .frame { flex: 0 0 calc(var(--u) * 120); margin-top: auto; }
.toc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: calc(var(--u) * 16); border-top: 1px solid var(--ink); padding-top: calc(var(--u) * 11); }
.toc a { display: flex; justify-content: flex-start; align-items: baseline; gap: calc(var(--u) * 10); color: var(--ink); text-decoration: none; font-size: calc(var(--u) * var(--fs-body)); line-height: 1.4; }
.toc .pg { font-family: var(--pf-mono); font-size: calc(var(--u) * 11); color: var(--ink-3); }
@media (hover: hover) { body:not(.editing) .toc a:hover span:first-child { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .14em; } }

/* ---------- Table ---------- */
.blk-table table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: calc(var(--u) * var(--fs-body) * .78); line-height: 1.36; }
.blk-table col.c1 { width: 30%; } .blk-table col.c2 { width: 35%; } .blk-table col.c3 { width: 11%; } .blk-table col.c4 { width: 9%; } .blk-table col.c5 { width: 15%; }
.blk-table th { text-align: left; vertical-align: bottom; font-family: var(--pf-mono); font-weight: 400; font-size: calc(var(--u) * var(--fs-label) * .95); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: 0 calc(var(--u) * 10) calc(var(--u) * 7) 0; border-bottom: 1px solid var(--ink); }
.blk-table td { padding: calc(var(--u) * 4.2) calc(var(--u) * 10) calc(var(--u) * 4.2) 0; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-2); }
.blk-table td:first-child { color: var(--ink); font-weight: 500; }
.blk-table td:nth-child(3), .blk-table td:nth-child(4) { font-variant-numeric: tabular-nums; }

/* ---------- Stat, legend, toc ---------- */
.blk-stat .sv { font-size: calc(var(--u) * 76); line-height: .86; letter-spacing: -0.05em; font-family: var(--pf-head); font-weight: var(--pf-head-w); color: var(--ink); }
.blk-stat .sl { margin-top: calc(var(--u) * 12); font-size: calc(var(--u) * 11.5); line-height: 1.45; color: var(--ink-2); }
.blk-legend { display: flex; flex-direction: column; gap: calc(var(--u) * 8); font-size: calc(var(--u) * var(--fs-cap)); line-height: 1.3; color: var(--ink-2); }
.lg { display: flex; align-items: center; gap: calc(var(--u) * 9); }
.lg i { flex: none; width: calc(var(--u) * 10); height: calc(var(--u) * 10); }

/* ---------- Folio (the sheet's title block) ---------- */
.folio {
  position: absolute; left: calc(var(--u) * 48); right: calc(var(--u) * 48); top: calc(var(--u) * 690);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: calc(var(--u) * 16);
  font-family: var(--pf-mono); font-size: calc(var(--u) * var(--fs-label)); line-height: 1; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  pointer-events: none;
}
.f-name { grid-column: 1 / span 4; }
.f-sec { grid-column: 5 / span 6; display: flex; gap: calc(var(--u) * 14); }
.f-sec b { font-weight: 400; color: var(--accent); }
.editing .folio { pointer-events: auto; }
.f-no { grid-column: 12; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.folio.f-ends { display: flex; justify-content: space-between; }
.folio.f-ends > :only-child.f-no { margin-left: auto; }

/* empty optional fields stay out of the finished page */
body:not(.editing) .is-empty, body:not(.editing) .fact.is-blank, body:not(.editing) .cap.is-blank, body:not(.editing) .blk.is-blank { display: none; }

/* ---------- Phones: the sheet reflows into a column ---------- */
@container (max-width: 760px) {
  .sheet { aspect-ratio: auto; --u: 1.12px; display: flex; flex-direction: column; gap: 18px; padding: 30px 20px 34px; box-shadow: none; font-size: 15px; }
  .blk { position: static; width: auto; height: auto; }
  .blk-fig, .cell { justify-content: flex-start !important; }
  .blk-fig .frame, .card .frame, .grid .frame { flex: none !important; width: auto !important; height: auto !important; margin-left: 0 !important; aspect-ratio: var(--ar, 1.5); }
  .cap { margin-left: 0 !important; max-width: none !important; }
  .mark .frame { width: 44px !important; aspect-ratio: 1; }
  .portrait .frame { width: 56% !important; }
  .legend-imgs .grid { max-width: 260px; }
  .blk-title, .blk-text.t-h2 { order: -1; }
  .cover-sheet .sheet { padding-block: 64px 72px; gap: 26px; }
  .blk-fig .frame > img { object-fit: contain; }
  .blk-fig.mobile-cover .frame > img { object-fit: cover; }
  .grid { grid-auto-rows: auto; grid-template-columns: repeat(var(--mcols, 2), minmax(0, 1fr)); gap: 14px !important; }
  .grid .frame { flex: none; aspect-ratio: var(--ar, 1.4); }
  .grid .frame > img { object-fit: contain; }
  .round .frame > img { object-fit: cover; }
  .t-display { font-size: 58px; }
  .blk.sized { font-size: min(calc(var(--size) * 1.12px), 17cqw); }
  .card-drawing .frame { width: 62% !important; }
  .t-h1, .blk-title .tt { font-size: 40px; }
  .t-h2 { font-size: 26px; }
  .t-statement { font-size: 21px; }
  .t-lead { font-size: 18px; }
  .t-body, .entry, .lst { font-size: calc(var(--fs-body) * 1.2px); }
  .cap { font-size: calc(var(--fs-cap) * 1.14px); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts.is-contact { grid-template-columns: minmax(0, 1fr); }
  .icons { grid-template-columns: repeat(5, 34px); justify-content: start; column-gap: 22px; }
  .icons img { height: 30px; }
  .toc { grid-template-columns: 1fr; row-gap: 10px; }
  .blk-table { overflow-x: auto; }
  .blk-table table { min-width: 560px; font-size: 12px; }
  .folio { position: static; order: -2; display: flex; justify-content: space-between; font-size: 10px; }
  .f-name { display: none; }
  .bleed-pad { margin-inline: -20px; }
  .sheet-wrap.cover-sheet .blk-fig, .sheet-wrap.back-sheet .blk-fig { margin-inline: -20px; margin-bottom: -34px; }
  .ovl { display: none; }
}
@media (max-width: 760px) {
  .sheets { padding: calc(64px + env(safe-area-inset-top, 0px)) 0 96px; gap: 10px; }
  .topbar { padding-left: 16px; }
  .brand span, .hide-sm { display: none !important; }
}

/* ---------- Overlays: index, present, zoom ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; background: var(--desk); overflow: auto; }
.overlay-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px 0 24px; background: color-mix(in srgb, var(--desk) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 13px; }
.overlay-head h2 { margin: 0; font-size: 13px; font-weight: 500; }
.overlay-head p { margin: 0; color: var(--ui-muted); font-size: 13px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 28px 20px; padding: 12px 24px 64px; }
.thumb { display: flex; flex-direction: column; gap: 10px; cursor: pointer; border: 0; padding: 0; background: none; text-align: left; color: var(--ui-ink); }
.thumb .sheet-wrap { width: 100%; pointer-events: none; }
.thumb .sheet { box-shadow: 0 0 0 1px var(--ui-line); }
.thumb:hover .sheet, .thumb:focus-visible .sheet { box-shadow: 0 0 0 2px var(--accent); }
.thumb-label { display: flex; gap: 10px; font-size: 12px; line-height: 1.3; }
.thumb-label b { font: 400 11px/1.3 var(--mono); color: var(--ui-muted); }
.thumb.is-off .sheet { opacity: .35; }
.thumb.drag-over .sheet { box-shadow: -4px 0 0 0 var(--accent); }
.thumb-tools { display: none; gap: 2px; }
.editing .thumb-tools { display: flex; }
.thumb-tools .btn { height: 26px; padding: 0 8px; font-size: 12px; }

.present { position: fixed; inset: 0; z-index: 80; background: #0b0b0c; display: grid; place-items: center; }
.present .stage { width: min(100vw, calc(100vh * 16 / 9)); }
.present .stage .sheet-wrap { width: 100%; }
.present .stage .sheet { box-shadow: none; }
.present .pcount { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); font: 400 11px/1 var(--mono); color: #8a8b90; letter-spacing: .06em; transition: opacity .4s; }
.present .pnav { position: fixed; top: 0; bottom: 0; width: 22vw; border: 0; background: transparent; cursor: pointer; }
.present .pnav.prev { left: 0; cursor: w-resize; } .present .pnav.next { right: 0; cursor: e-resize; }
.present .pclose { position: fixed; top: 12px; right: 12px; z-index: 2; color: #cfd0d4; }
.present .pclose:hover { background: rgb(255 255 255 / .08); }

.zoom { position: fixed; inset: 0; z-index: 90; background: rgb(250 250 250 / .98); overflow: hidden; cursor: grab; touch-action: none; }
.zoom.dragging { cursor: grabbing; }
.zoom .zstage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.zoom .zstage img { display: block; width: 100%; height: 100%; }
.zoom .zstage .ovl span { color: #2b2e3a; }
.zoom .zbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 16px; padding: 14px 20px; color: #3c3e44; font-size: 12.5px; background: linear-gradient(to top, rgb(250 250 250 / .96) 60%, transparent); pointer-events: none; }
.zoom .zbar .hint { margin-left: auto; color: #85878d; font: 400 11px/1 var(--mono); letter-spacing: .04em; }
.zoom .zclose { position: fixed; top: 12px; right: 12px; z-index: 2; color: #131417; }
.zoom .zclose:hover { background: rgb(0 0 0 / .06); }

/* ---------- Editing ---------- */
.editing .sheets { gap: 64px; }
.editing .sheet-wrap { scroll-margin-top: 112px; }
.sheet-tools { display: none; }
.editing .sheet-tools { display: flex; align-items: center; gap: 2px; height: 34px; margin: -40px 0 6px; font-size: 12px; color: var(--ui-ink); }
.sheet-tools .pn { font: 400 11px/1 var(--mono); color: var(--ui-muted); margin-right: 8px; letter-spacing: .04em; }
.sheet-tools .sn { font-weight: 500; margin-right: auto; padding: 4px 6px; outline: none; min-width: 60px; }
.sheet-tools .sn:hover { background: var(--ui-hover); }
.sheet-tools .sn:focus { outline: 1px solid var(--accent); }
.sheet-tools .btn { height: 28px; padding: 0 9px; font-size: 12px; color: var(--ui-muted); }
.sheet-wrap:hover > .sheet-tools .btn, .sheet-tools .btn:focus-visible { color: var(--ui-ink); }
.sheet-tools .btn.on, .sheet-wrap:hover > .sheet-tools .btn.on { color: var(--accent); }
.editing .sheet-wrap.is-hidden .sheet { opacity: .4; }
.sheet-wrap.is-hidden { display: none; }
.editing .sheet-wrap.is-hidden { display: block; }

.editing [data-k] { cursor: text; outline: 1px dashed transparent; outline-offset: 2px; border-radius: 1px; transition: outline-color .15s; }
.editing [data-k]:hover { outline-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.editing [data-k]:focus { outline: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.editing [data-k].is-empty::before { content: attr(data-ph); color: color-mix(in srgb, var(--accent) 50%, #ffffff); font-style: normal; }
.editing [data-k].raw { white-space: pre-wrap; }
.editing .card, .editing .toc a { cursor: default; }
.editing .blk.overflow { box-shadow: inset 0 -2px 0 #d1432f; }

.editing .blk:hover, .editing .blk.sel { outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }
.editing .blk.sel { outline-style: solid; }
.bgrip, .bsize, .imgbar { display: none; }
.editing .blk:hover > .bgrip, .editing .blk.sel > .bgrip, .editing .blk:hover > .bsize, .editing .blk.sel > .bsize { display: flex; }
.bgrip { position: absolute; left: 0; top: 0; z-index: 5; align-items: center; gap: 6px; height: 22px; padding: 0 8px; background: var(--accent); color: #fff; font: 500 11px/1 var(--font); cursor: grab; user-select: none; transform: translateY(-100%); }
.blk[style*="--y:0;"] > .bgrip { transform: none; }
.bgrip:active { cursor: grabbing; }
/* editing controls must not inherit the type settings of the block they sit on */
.bgrip, .bmenu, .imgbar { letter-spacing: normal; text-transform: none; text-align: left; line-height: 1; white-space: nowrap; font-style: normal; }
.img-ph { letter-spacing: normal; text-transform: none; line-height: 1.4; }
.bsize { position: absolute; right: 0; bottom: 0; z-index: 5; width: 12px; height: 12px; background: #fff; border: 1.5px solid var(--accent); cursor: nwse-resize; }
.bmenu { position: absolute; z-index: 6; display: flex; gap: 2px; padding: 3px; background: var(--ui); border: 1px solid var(--ui-line); box-shadow: 0 8px 24px rgb(0 0 0 / .14); color: var(--ui-ink); }
.bmenu .btn { height: 26px; padding: 0 8px; font-size: 12px; }
.bmenu select { height: 26px; font: 500 12px var(--font); border: 1px solid var(--ui-line); background: var(--ui); color: var(--ui-ink); }

.editing .frame { cursor: move; }
.editing .frame.fit-contain { cursor: default; }
.editing .frame:hover > .imgbar, .editing .cell:hover .imgbar { display: flex; }
.imgbar { position: absolute; top: 6px; right: 6px; z-index: 4; gap: 2px; padding: 3px; background: rgb(255 255 255 / .94); border: 1px solid #d3d4d8; box-shadow: 0 4px 16px rgb(0 0 0 / .12); }
.imgbar button { appearance: none; border: 0; background: transparent; height: 24px; padding: 0 8px; font: 500 11.5px/1 var(--font); color: #131417; cursor: pointer; }
.imgbar button:hover { background: rgb(0 0 0 / .07); }
.img-ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; background: #f2f3f5; color: #6a6c73; font: 500 12px/1.4 var(--font); text-align: center; }
.frame.drop { outline: 2px solid var(--accent); outline-offset: -2px; }
.frame.drop::after { content: "Drop to replace"; position: absolute; inset: 0; display: grid; place-items: center; background: rgb(40 53 131 / .55); color: #fff; font: 500 14px var(--font); }

.gridlines { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; }
.editing.arranging .gridlines { display: block; }
.gridlines i { position: absolute; background: rgb(40 53 131 / .06); outline: 1px solid rgb(40 53 131 / .12); }

.editbar {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 50; transform: translateX(-50%);
  display: none; align-items: center; gap: 2px; padding: 5px; background: var(--ui); border: 1px solid var(--ui-line);
  box-shadow: 0 10px 34px -8px rgb(0 0 0 / .28); font-size: 13px; white-space: nowrap;
}
.editing .editbar { display: flex; }
.editbar .sep { width: 1px; height: 22px; background: var(--ui-line); margin: 0 6px; }
.editbar .status { padding: 0 10px; color: var(--ui-muted); font-size: 12px; min-width: 150px; }

.drawer { position: fixed; top: calc(52px + env(safe-area-inset-top, 0px)); right: 0; bottom: 0; z-index: 60; width: min(380px, 100vw); overflow-y: auto; background: var(--ui); border-left: 1px solid var(--ui-line); box-shadow: -18px 0 44px -24px rgb(0 0 0 / .35); color: var(--ui-ink); font-size: 13px; line-height: 1.45; }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 12px 20px; background: var(--ui); border-bottom: 1px solid var(--ui-line); }
.drawer-head h2 { margin: 0; font-size: 14px; font-weight: 500; }
.drawer-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px 96px; }
.drawer h3 { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--ui-line); font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.drawer h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.drawer .hint { margin: 0; color: var(--ui-muted); font-size: 12px; }
.drawer label { color: var(--ui-ink); }
.drawer input[type=text], .drawer input[type=number], .drawer select, .drawer textarea { width: 100%; min-width: 0; height: 32px; padding: 0 9px; border: 1px solid var(--ui-line); border-radius: 0; background: var(--desk); color: var(--ui-ink); font: 13px var(--font); }
.drawer textarea { height: 96px; padding: 8px 9px; resize: vertical; font: 12px/1.4 var(--mono); }
.drawer input:focus, .drawer select:focus, .drawer textarea:focus { outline: 2px solid var(--ui-ink); outline-offset: -1px; }
.drawer .frow { display: grid; gap: 5px; }
.drawer .fline { display: flex; gap: 6px; }
.drawer .fstatus { min-height: 16px; color: var(--ui-muted); font-size: 11.5px; }
.drawer .srow { display: grid; grid-template-columns: 1fr 84px; align-items: center; gap: 10px; }
.drawer .check { display: flex; align-items: center; gap: 8px; }
.drawer .check input { width: 15px; height: 15px; accent-color: var(--ui-ink); }
.drawer input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--ui-line); background: var(--desk); }
.drawer .btns { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 1100px) {
  body:has(.drawer) .sheets { padding-right: 404px; }
  body:has(.drawer) .editbar { left: calc(50% - 190px); }
}
.vlist { display: flex; flex-direction: column; border-top: 1px solid var(--ui-line); }
.vitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 9px 0; border-bottom: 1px solid var(--ui-line); }
.vitem b { font-weight: 500; overflow-wrap: anywhere; }
.vitem small { grid-column: 1; color: var(--ui-muted); font-size: 11.5px; }
.vitem .btns { grid-column: 2; grid-row: 1 / span 2; align-self: center; gap: 0; }
.vitem .btn { height: 26px; padding: 0 7px; font-size: 12px; }
.vempty { padding: 10px 0; color: var(--ui-muted); }
#snap-btn[aria-pressed=false] { color: var(--ui-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgb(15 16 18 / .42); }
.mbox { width: min(420px, 100%); display: grid; gap: 12px; padding: 22px 22px 18px; background: var(--ui); color: var(--ui-ink); border: 1px solid var(--ui-line); box-shadow: 0 24px 60px -20px rgb(0 0 0 / .45); font-size: 13px; line-height: 1.5; }
.mbox h2 { margin: 0; font-size: 15px; font-weight: 500; }
.mbox p { margin: 0; color: var(--ui-muted); }
.mbox input { height: 36px; padding: 0 10px; border: 1px solid var(--ui-line); background: var(--desk); color: var(--ui-ink); font: 14px var(--font); }
.mbox input:focus { outline: 2px solid var(--ui-ink); outline-offset: -1px; }
.mbox .merr { color: #d1432f; }
.mbox .merr:empty { display: none; }
.mbox .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
/* formatting inside text */
[data-k] a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
[data-k] a:hover { text-decoration-color: currentColor; }
.rt-accent { color: var(--accent); }
.rt-muted { color: var(--ink-3); }
.fmtbar { position: fixed; z-index: 66; display: flex; align-items: center; gap: 1px; padding: 4px; background: var(--ui); color: var(--ui-ink); border: 1px solid var(--ui-line); box-shadow: 0 10px 30px -12px rgb(0 0 0 / .35); }
.fmtbar .fb { appearance: none; border: 0; background: transparent; height: 28px; min-width: 28px; padding: 0 8px; font: 500 12.5px/1 var(--font); color: inherit; cursor: pointer; }
.fmtbar .fb:hover { background: var(--ui-hover); }
.fmtbar .fb.b { font-weight: 700; }
.fmtbar .fb.i { font-style: italic; }
.fmtbar .sw { width: 28px; padding: 0; }
.fmtbar .sw::before { content: ""; display: block; width: 14px; height: 14px; margin: auto; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.fmtbar .sw-accent { --sw: var(--accent); }
.fmtbar .sw-muted { --sw: #85878d; }
.fmtbar .sw-ink { --sw: #131417; }
.fmtbar .fsep { width: 1px; height: 18px; margin: 0 4px; background: var(--ui-line); }
@media print { .fmtbar { display: none !important; } }
.toast { position: fixed; left: 50%; bottom: 84px; z-index: 95; transform: translate(-50%, 8px); max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; background: var(--ui-ink); color: var(--desk); font-size: 13px; line-height: 1.45; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .btn { color: var(--desk); height: 26px; margin-left: 8px; border-color: color-mix(in srgb, var(--desk) 40%, transparent); }

.guide { position: fixed; right: 20px; bottom: 84px; z-index: 55; width: min(360px, calc(100vw - 40px)); padding: 18px 20px 16px; background: var(--ui); border: 1px solid var(--ui-line); box-shadow: 0 16px 44px -10px rgb(0 0 0 / .3); color: var(--ui-ink); font-size: 13px; line-height: 1.5; }
.guide h3 { margin: 0 0 10px; font-size: 14px; font-weight: 500; }
.guide ol { margin: 0 0 14px; padding-left: 18px; color: var(--ui-muted); }
.guide li { margin-bottom: 6px; }
.guide li b { color: var(--ui-ink); font-weight: 500; }

.menu { position: absolute; z-index: 75; min-width: 200px; padding: 4px; background: var(--ui); border: 1px solid var(--ui-line); box-shadow: 0 14px 40px -8px rgb(0 0 0 / .3); }
.menu button { display: flex; width: 100%; justify-content: space-between; gap: 16px; padding: 9px 10px; border: 0; background: none; font: 400 13px/1.2 var(--font); color: var(--ui-ink); text-align: left; cursor: pointer; }
.menu button:hover { background: var(--ui-hover); }
.menu button small { color: var(--ui-muted); }

/* ---------- Print: one sheet per page, exactly 1280 x 720 ---------- */
@page { size: 1280px 720px; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .topbar, .editbar, .toast, .guide, .overlay, .present, .zoom, .sheet-tools, .bgrip, .bsize, .imgbar, .bmenu, .gridlines, .menu { display: none !important; }
  .sheets { display: block; padding: 0; gap: 0; }
  .sheet-wrap { width: 1280px !important; height: 720px; margin: 0; break-after: page; break-inside: avoid; }
  .sheet-wrap.is-hidden, .editing .sheet-wrap.is-hidden { display: none !important; }
  .sheet-wrap.last-visible { break-after: auto; }
  .sheet { box-shadow: none !important; --u: 1px; opacity: 1 !important; }
  .editing [data-k] { outline: none !important; background: none !important; }
  .editing [data-k].is-empty::before { content: none; }
  .editing .is-empty, .editing .fact.is-blank, .editing .cap.is-blank, .blk.is-blank, .img-ph { display: none !important; }
  .editing .blk { outline: none !important; box-shadow: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
