/* ==========================================================================
   B-Codex website
   Concept: the shop counter. Thermal receipt paper, price tags, register keys.
   Palette: register blue, price-tag yellow, stamp coral, thermal white, ink navy.
   Type: Archivo, a variable family whose width axis gives two voices:
         wide and heavy for headlines, normal width for reading.
   Brand colours (--blue, --yellow) are overridden per site from content/settings.json.
   ========================================================================== */

:root {
  --blue: #2336e5;
  --blue-ink: #ffffff;
  --blue-deep: #1a28b0;
  --blue-soft: #8d98f4;
  --yellow: #ffd83d;
  --yellow-ink: #14183a;
  --coral: #ff5a4e;
  --navy: #0b1033;
  --ink: #14183a;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #e9ecf4;
  --text: #14183a;
  --muted: #575e82;
  --line: #d9deec;
  --link: var(--blue);
  --focus: var(--blue);
  --hero-bg: var(--blue);
  --band-bg: var(--navy);
  --active-bg: var(--ink);
  --active-fg: #ffffff;

  --font: "Archivo", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1200px;
  --gut: clamp(20px, 4vw, 40px);
}

:root[data-theme="dark"] {
  --bg: #0a0e2b;
  --surface: #121846;
  --surface-2: #161d54;
  --text: #eef0fa;
  --muted: #a3abd6;
  --line: #272f6b;
  --link: var(--blue-soft);
  --focus: var(--yellow);
  --hero-bg: var(--blue-deep);
  --band-bg: #060820;
  --active-bg: var(--yellow);
  --active-fg: var(--yellow-ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e2b;
    --surface: #121846;
    --surface-2: #161d54;
    --text: #eef0fa;
    --muted: #a3abd6;
    --line: #272f6b;
    --link: var(--blue-soft);
    --focus: var(--yellow);
    --hero-bg: var(--blue-deep);
    --band-bg: #060820;
    --active-bg: var(--yellow);
    --active-fg: var(--yellow-ink);
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
img { height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.06; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-weight: 800; font-stretch: 118%; }
h2 { font-weight: 800; font-stretch: 110%; font-size: clamp(1.8rem, 3.6vw, 2.75rem); }
h3 { font-weight: 700; font-stretch: 104%; font-size: 1.25rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.hero :focus-visible, .page-head :focus-visible, .site-footer :focus-visible, .band-ink :focus-visible { outline-color: var(--yellow); }
.cta-band :focus-visible { outline-color: var(--ink); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
.wrap-mid { max-width: 920px; }
.wrap-narrow { max-width: 760px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip:focus { left: 12px; }
.mt { margin-top: 32px; }
.nw { white-space: nowrap; }
.link { color: var(--link); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.link:hover { text-decoration-color: var(--yellow); }
.lead { font-size: clamp(1.1rem, 1.7vw, 1.3rem); line-height: 1.55; max-width: 56ch; }

/* ---------------------------------------------------------------- buttons
   Buttons are register keys: a flat face with a darker lower edge that
   presses in when clicked. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 24px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-weight: 700; font-stretch: 104%; line-height: 1.1; text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22); }
.btn svg { flex: none; }
.btn-yellow { background: var(--yellow); color: var(--yellow-ink); }
.btn-blue { background: var(--blue); color: var(--blue-ink); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-outline-light { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.btn-outline-light:active { box-shadow: inset 0 0 0 2px #fff; }
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.1); }
.btn-outline-ink { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn-sm { padding: 10px 18px; font-size: 0.92rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.brand-mark { border-radius: 8px; }
.brand-word { font-weight: 800; font-stretch: 118%; font-size: 1.25rem; letter-spacing: -0.01em; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; font-stretch: 104%; }
.nav a:hover { background: var(--surface-2); }
.nav a.is-active { background: var(--blue); color: var(--blue-ink); }
.bar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border: 2px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--text); }
.i-sun { display: none; }
.i-moon, .i-sun { line-height: 0; }
:root[data-theme="dark"] .i-sun { display: inline; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: inline; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}
.menu-btn { display: none; }
.menu-btn .i-close { display: none; }
.menu-open .menu-btn .i-close { display: inline; }
.menu-open .menu-btn .i-open { display: none; }
.mobile-nav { display: none; border-top: 1px solid var(--line); padding: 12px 0 20px; }
.mobile-nav .wrap { display: grid; gap: 4px; }
.mobile-nav a:not(.btn) { padding: 12px 8px; text-decoration: none; font-weight: 700; font-size: 1.15rem; font-stretch: 108%; border-bottom: 1px solid var(--line); }
.mobile-nav .btn { margin-top: 14px; }
.menu-open .mobile-nav { display: block; }

/* ------------------------------------------------------- blue bands & edges
   Every blue band ends in a torn-paper edge, like a receipt ripped off the roll. */
.hero, .page-head { position: relative; background: var(--hero-bg); color: #fff; }
.hero::after, .page-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 14px; background: var(--bg);
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 28px 100%;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) 50% / 28px 100%;
}

/* ------------------------------------------------------------------ hero */
.hero { padding: clamp(48px, 8vw, 104px) 0 clamp(72px, 9vw, 124px); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero-title { font-size: clamp(2.5rem, 6.2vw, 5.25rem); line-height: 0.98; letter-spacing: -0.025em; margin-bottom: 0.4em; }
.hero .lead { color: rgba(255, 255, 255, 0.9); }

/* The receipt: paper slides out of a printer slot, line by line, once. */
.printer { position: relative; width: min(100%, 370px); margin: 0 auto; transform: rotate(2.5deg); filter: drop-shadow(0 22px 26px rgba(4, 8, 70, 0.4)); }
.printer-slot { position: relative; z-index: 2; height: 24px; border-radius: 12px; background: var(--navy); box-shadow: inset 0 -5px 0 rgba(255, 255, 255, 0.12); }
.receipt-window { overflow: hidden; margin-top: -10px; padding-bottom: 18px; }
.receipt {
  position: relative; background: #fff; color: var(--ink); font-family: var(--mono); font-size: 14px; line-height: 1.45;
  padding: 34px 26px 30px;
  animation: print 3.4s steps(36, end) 0.5s both;
}
@keyframes print { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.rc-edge { position: absolute; left: 0; bottom: -8px; width: 100%; height: 9px; color: #fff; }
.rc-head { display: grid; justify-items: center; gap: 4px; text-align: center; }
.rc-head img { border-radius: 7px; }
.rc-head strong { font-size: 19px; font-weight: 500; letter-spacing: 0.14em; }
.rc-head span { font-size: 11.5px; opacity: 0.65; }
.rc-rule { border-top: 2px dashed rgba(20, 24, 58, 0.35); margin: 14px 0; }
.rc-lines { list-style: none; display: grid; gap: 10px; }
.rc-lines li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rc-item b { display: block; font-weight: 500; text-transform: uppercase; }
.rc-item small { display: block; font-size: 12px; opacity: 0.62; }
.rc-status { font-weight: 500; text-transform: uppercase; }
.rc-total { display: flex; justify-content: space-between; font-size: 15px; font-weight: 500; }
.rc-barcode { width: 100%; height: 46px; margin: 18px 0 10px; color: var(--ink); }
.rc-note { margin: 0; text-align: center; font-size: 12px; }

/* --------------------------------------------------------------- sections */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-soft { background: var(--surface-2); }
.section-head { max-width: 62ch; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head p { color: var(--muted); font-size: 1.12rem; margin: 0; }
.section-head.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; max-width: none; }
.section-head.row h2 { margin: 0; }
.band-ink { background: var(--band-bg); color: #fff; }

/* ------------------------------------------------- products as price tags */
.tags { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: clamp(20px, 3vw, 32px); align-items: start; }
.tag {
  --cut: 30px;
  position: relative; background: var(--tag); color: var(--tag-ink);
  padding: 66px 28px 28px; transform-origin: 50% 0;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%, 0 var(--cut));
  transition: transform 0.25s ease;
}
.tag-0 { transform: rotate(-1deg); }
.tag-1 { transform: rotate(0.9deg); }
.tag-2 { transform: rotate(-0.5deg); }
.tag:hover, .tag:focus-within { transform: rotate(0deg) translateY(-4px); }
.tag-hole { position: absolute; top: 20px; left: 50%; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.16); }
.tag-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.tag-icon { width: 56px; height: 56px; border-radius: 15px; }
.tag-initial { display: grid; place-items: center; background: var(--tag-ink); color: var(--tag); font-weight: 900; font-size: 1.3rem; }
.chip { display: inline-block; padding: 3px 11px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.8rem; font-weight: 700; line-height: 1.5; }
.chip-ink { background: var(--tag-ink); color: var(--tag); }
.tag h3 { font-size: clamp(1.7rem, 2.6vw, 2.1rem); font-weight: 800; font-stretch: 114%; line-height: 1.02; margin: 0 0 12px; }
.tag-main { color: inherit; text-decoration: none; }
.tag-main::after { content: ""; position: absolute; inset: 0; }
.tag-line { font-size: 1.02rem; opacity: 0.92; }
.ticks { list-style: none; display: grid; gap: 8px; margin: 18px 0 0; }
.ticks li { position: relative; padding-left: 28px; }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 0.45em; width: 11px; height: 6px; border-left: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(-45deg); }
.ticks-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px 40px; font-size: 1.12rem; }
.tag-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 26px; padding-top: 16px; border-top: 2px dashed color-mix(in srgb, var(--tag-ink) 40%, transparent); }
.tag-link { position: relative; z-index: 1; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }

/* --------------------------------------------- key points as an itemised bill */
.ledger-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.ledger-intro h2 { color: #fff; }
.ledger-intro .lead { color: rgba(255, 255, 255, 0.82); }
.ledger-row { display: grid; grid-template-columns: minmax(130px, 1fr) 2fr; gap: 24px; padding: 22px 0; border-top: 2px dotted rgba(255, 255, 255, 0.3); }
.ledger-row h3 { margin: 0; font-size: 1.2rem; }
.ledger-row p { margin: 0; color: rgba(255, 255, 255, 0.84); }
.ledger-total { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding-top: 28px; border-top: 3px solid #fff; }
.ledger-total strong { display: block; font-size: clamp(2.3rem, 4.6vw, 3.6rem); font-weight: 900; font-stretch: 125%; line-height: 1; color: var(--yellow); }
.ledger-total span { display: block; margin-top: 8px; color: rgba(255, 255, 255, 0.86); font-size: 0.98rem; line-height: 1.35; }
.ledger-total-solo { border-top: 0; padding-top: 0; }

/* ------------------------------------------------------------------ work */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip-btn { padding: 7px 16px; border: 2px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; }
.chip-btn:hover { border-color: var(--text); }
.chip-btn.is-active { background: var(--active-bg); border-color: var(--active-bg); color: var(--active-fg); }
.work-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(28px, 4vw, 48px) clamp(20px, 3vw, 32px); }
.work-item { display: block; color: inherit; text-decoration: none; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.work-fig { margin: 0; overflow: hidden; border-radius: 10px; background: var(--surface-2); aspect-ratio: 10 / 7; }
.work-fig img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
a.work-item:hover .work-fig img { transform: scale(1.035); }
.work-blank { display: grid; place-items: center; height: 100%; font-size: 3rem; font-weight: 900; color: var(--muted); }
.work-meta { padding-top: 16px; }
.work-meta h3 { font-size: 1.5rem; margin-bottom: 6px; }
a.work-item:hover h3 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-color: var(--yellow); }
.work-meta p { color: var(--muted); margin-bottom: 10px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 20px 48px; margin: 0 0 36px; padding: 0 0 24px; border-bottom: 2px dotted var(--line); }
.meta-row dt { font-size: 0.85rem; color: var(--muted); }
.meta-row dd { margin: 2px 0 0; font-weight: 700; }
.results { list-style: none; display: grid; gap: 12px; margin: 32px 0; font-size: 1.15rem; font-weight: 600; }
.results li { padding-left: 20px; border-left: 5px solid var(--yellow); }
.next-up { margin: 0 0 6px; color: var(--muted); }
.next-link { font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 800; font-stretch: 118%; letter-spacing: -0.02em; text-decoration: none; line-height: 1.05; }
.next-link:hover { text-decoration: underline; text-decoration-thickness: 5px; text-underline-offset: 8px; text-decoration-color: var(--yellow); }

/* ---------------------------------------------- client comments as receipts */
.slips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); align-items: start; }
.slips-all { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.slip {
  --s: 18px;
  margin: 0; padding: 28px 26px 44px; background: #fff; color: var(--ink);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--s) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--s) 100%;
}
.slips .slip:nth-child(3n + 2) { margin-top: 28px; }
.stars { width: 92px; height: 17px; margin-bottom: 14px; }
.star-on { fill: #f5b400; }
.star-off { fill: #dfe3ef; }
.slip blockquote { margin: 0; }
.slip blockquote p { margin: 0 0 18px; font-size: 1.18rem; line-height: 1.5; font-weight: 500; }
.slip figcaption { display: flex; align-items: center; gap: 14px; padding-top: 16px; border-top: 2px dashed #d3d8e8; }
.avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--yellow); }
.avatar-initials { display: grid; place-items: center; background: var(--blue); color: var(--blue-ink); font-weight: 800; }
.slip-who strong, .slip-who span, .slip-who a { display: block; line-height: 1.3; }
.slip-who span, .slip-who a { color: #575e82; font-size: 0.9rem; }
.slip-who a { text-decoration: underline; }
.slip-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 0 0 18px; }
.slip-photos img { aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: 6px; }

/* ------------------------------------------------------------------ blog */
.blog-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 32px; margin-bottom: 8px; }
.blog-tools .chips { margin-bottom: 20px; }
.search input { width: min(100%, 260px); padding: 10px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.search input:focus { outline: none; border-color: var(--blue); }
.post-list { border-bottom: 1px solid var(--line); }
.post-row { display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 8px 28px; align-items: start; padding: 28px 0; border-top: 1px solid var(--line); }
.post-row[hidden] { display: none; }
.post-row time { color: var(--muted); font-size: 0.95rem; padding-top: 6px; }
.post-main h3 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); margin-bottom: 8px; }
.post-main h3 a { text-decoration: none; }
.post-main h3 a:hover { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.post-main p { color: var(--muted); margin: 0; max-width: 62ch; }
.taglist { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 12px 0 0; }
.taglist li { padding: 2px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8rem; color: var(--muted); }
.post-thumb { width: 168px; height: 112px; object-fit: cover; border-radius: 8px; }
.empty { color: var(--muted); padding: 24px 0; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 28px; color: var(--muted); font-size: 0.95rem; }
.post-cover { margin: 0 0 32px; }
.post-cover img { width: 100%; border-radius: 12px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 56px; padding-top: 28px; border-top: 2px dotted var(--line); }
.post-nav a { text-decoration: none; font-weight: 700; font-stretch: 104%; }
.post-nav a:last-child { text-align: right; }
.post-nav a:hover { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; }
.post-nav small { display: block; font-weight: 500; color: var(--muted); }

/* ---------------------------------------------------------------- prose */
.prose { max-width: 68ch; font-size: 1.125rem; line-height: 1.72; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); margin: 2em 0 0.55em; }
.prose h3 { font-size: 1.25rem; margin: 1.7em 0 0.4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.4em; padding-left: 0.2em; }
.prose a { color: var(--link); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 5px solid var(--yellow); font-size: 1.2rem; font-weight: 500; }
.prose code { padding: 2px 6px; border-radius: 5px; background: var(--surface-2); font-family: var(--mono); font-size: 0.92em; }
.prose pre { overflow: auto; padding: 18px 20px; border-radius: 10px; background: var(--navy); color: #eef0fa; line-height: 1.5; }
.prose pre code { padding: 0; background: none; color: inherit; }
.prose figure { margin: 2em 0; }
.prose img { border-radius: 10px; }
.prose figcaption { margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.prose hr { margin: 2.4em 0; border: 0; border-top: 2px dotted var(--line); }

/* ------------------------------------------------------------ page heads */
.page-head { padding: clamp(44px, 7vw, 88px) 0 clamp(52px, 7vw, 84px); }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 3.9rem); line-height: 1.02; max-width: 22ch; margin-bottom: 0.35em; }
.page-head .lead { color: rgba(255, 255, 255, 0.9); margin: 0; }
.page-head a { color: #fff; }
.crumbs { margin: 0 0 20px; font-size: 0.95rem; color: rgba(255, 255, 255, 0.85); }
.crumbs span { margin: 0 10px; opacity: 0.6; }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.device { margin: 0; transform: rotate(-2deg); }
.device img { width: 100%; border-radius: 26px; box-shadow: 0 34px 60px -26px rgba(2, 6, 60, 0.65); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(32px, 6vw, 72px); align-items: start; }
.glance { padding: 24px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.glance h2 { font-size: 1.2rem; margin-bottom: 14px; }
.glance dl { margin: 0; display: grid; gap: 4px; }
.glance dt { font-size: 0.85rem; color: var(--muted); margin-top: 10px; }
.glance dd { margin: 0; font-weight: 700; }
.glance dd a { color: var(--link); }
.glance-swatch { display: block; height: 8px; border-radius: 4px; margin-top: 22px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.gallery-1 { grid-template-columns: minmax(0, 820px); }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); }
.gallery a { display: block; cursor: zoom-in; }
.gallery figcaption { margin-top: 10px; color: var(--muted); font-size: 0.95rem; }

/* ------------------------------------------------------------ cta + footer */
.cta-band { background: var(--yellow); color: var(--yellow-ink); }
.cta-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px 48px; align-items: center; padding-top: clamp(48px, 7vw, 80px); padding-bottom: clamp(48px, 7vw, 80px); }
.cta-inner h2 { margin: 0; max-width: 26ch; font-size: clamp(1.7rem, 3.5vw, 2.8rem); }
.cta-inner .cta-row { margin: 0; }
.site-footer { background: var(--navy); color: rgba(255, 255, 255, 0.86); padding: clamp(48px, 7vw, 80px) 0 28px; }
.foot-top { margin-bottom: 40px; }
.foot-word { margin: 0 0 8px; color: #fff; font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 900; font-stretch: 125%; letter-spacing: -0.02em; line-height: 1; }
.foot-tag { margin: 0; max-width: 46ch; }
.foot-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; padding: 36px 0; border-top: 2px dotted rgba(255, 255, 255, 0.25); }
.foot-h { margin: 0 0 14px; color: #fff; font-size: 1rem; font-weight: 700; font-stretch: 104%; letter-spacing: 0; }
.foot-cols ul { list-style: none; display: grid; gap: 8px; }
.foot-cols a { text-decoration: none; overflow-wrap: anywhere; }
.foot-cols a:hover, .foot-bottom a:hover { color: var(--yellow); text-decoration: underline; }
.foot-bottom { display: flex; justify-content: space-between; gap: 16px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.16); font-size: 0.92rem; }
.foot-bottom p { margin: 0; }
.foot-bottom a { text-decoration: none; }

/* ------------------------------------------------------------------ about */
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(32px, 6vw, 80px); }
.about-grid .prose h2 { margin-top: 0; }

/* ---------------------------------------------------------------- contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.field { margin-bottom: 20px; }
.field label { display: block; margin-bottom: 7px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; padding: 14px 16px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 25%, transparent); }
.form-status { margin: 16px 0 0; font-weight: 600; min-height: 1.5em; }
.contact-side { padding: 28px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.contact-side h2 { font-size: 1.4rem; }
.contact-list { list-style: none; }
.contact-list li { padding: 14px 0; border-top: 2px dotted var(--line); overflow-wrap: anywhere; }
.contact-list span { display: block; font-size: 0.85rem; color: var(--muted); }
.contact-list a { font-weight: 700; color: var(--link); }

/* --------------------------------------------------------------- privacy */
.policy-index { list-style: none; margin: 0 0 56px; }
.policy-index a { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; padding: 16px 20px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.policy-index a:hover { border-color: var(--blue); }
.policy-index img { border-radius: 12px; }
.policy-index strong { display: block; font-size: 1.15rem; }
.policy-index small { color: var(--muted); }
.privacy-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(28px, 6vw, 72px); align-items: start; }
.toc { position: sticky; top: 92px; display: grid; gap: 2px; font-size: 0.95rem; }
.toc-h { margin: 0 0 8px; font-weight: 700; }
.toc a { padding: 6px 12px; border-left: 3px solid var(--line); color: var(--muted); text-decoration: none; }
.toc a:hover { border-left-color: var(--blue); color: var(--text); }
.policy-list { margin: 0 0 1.2em; }
.policy-list dt { margin-top: 1em; font-weight: 700; }
.policy-list dd { margin: 2px 0 0; }
.policy h2 { scroll-margin-top: 92px; }

/* -------------------------------------------------------------------- CV */
.cv-head-inner { display: flex; align-items: center; gap: clamp(20px, 4vw, 44px); }
.cv-photo { flex: none; width: 132px; height: 132px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 5px var(--yellow); }
.cv-photo-initials { display: grid; place-items: center; background: var(--yellow); color: var(--yellow-ink); font-size: 2.6rem; font-weight: 900; box-shadow: none; }
.cv-head h1 { margin-bottom: 0.15em; }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(32px, 6vw, 72px); align-items: start; }
.cv-main section, .cv-side section { margin-bottom: 44px; }
.cv-main h2 { font-size: 1.6rem; padding-bottom: 10px; border-bottom: 3px solid var(--text); margin-bottom: 24px; }
.cv-side h2 { font-size: 1.1rem; padding-bottom: 8px; border-bottom: 3px solid var(--text); margin-bottom: 16px; }
.cv-side h3 { font-size: 0.95rem; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }
.cv-summary { font-size: 1.2rem; line-height: 1.6; max-width: 62ch; }
.timeline { list-style: none; margin-left: 7px; border-left: 3px solid var(--line); }
.timeline > li { position: relative; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 24px; padding: 0 0 34px 30px; }
.timeline > li::before { content: ""; position: absolute; left: -10px; top: 6px; width: 17px; height: 17px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px var(--bg); }
.tl-meta span { display: block; font-size: 0.92rem; color: var(--muted); }
.tl-meta .tl-period { color: var(--text); font-weight: 700; }
.tl-body h3 { margin-bottom: 2px; }
.tl-company { margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.tl-body ul { padding-left: 1.2em; display: grid; gap: 6px; }
.cv-projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.cv-project { display: block; padding: 20px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
a.cv-project:hover { border-color: var(--blue); }
.cv-project img { margin-bottom: 14px; border-radius: 8px; }
.cv-project h3 { margin-bottom: 6px; }
.cv-project p { margin: 0; color: var(--muted); font-size: 0.98rem; }
.cv-contact { margin: 0; }
.cv-contact dt { font-size: 0.85rem; color: var(--muted); margin-top: 12px; }
.cv-contact dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cv-links { list-style: none; display: grid; gap: 6px; }
.cv-links a { color: var(--link); font-weight: 600; }
.skill-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.skill-chips li { padding: 4px 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 0.95rem; font-weight: 600; }
.edu { margin-bottom: 14px; }
.edu strong, .edu span, .edu small { display: block; }
.edu span { color: var(--muted); }
.edu small { color: var(--muted); }
.lang-list { list-style: none; display: grid; gap: 6px; }
.lang-list li { display: flex; justify-content: space-between; gap: 12px; }
.lang-list small { color: var(--muted); font-size: 0.95rem; }

/* -------------------------------------------------------------- lightbox */
.lb { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 20px 24px; background: rgba(5, 8, 32, 0.93); }
.lb-img { max-width: min(1100px, 100%); max-height: 76vh; width: auto; border-radius: 12px; background: #fff; }
.lb-cap { margin: 16px 0 0; color: #fff; text-align: center; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, 0.26); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; }
.lb-next { right: 16px; top: 50%; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1020px) {
  .nav, .bar-cta { display: none; }
  .menu-btn { display: inline-grid; }
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); }
  .printer { margin-top: 8px; }
  .device { max-width: 560px; }
  .ledger-wrap, .detail-grid, .cv-grid, .privacy-layout, .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
  .slips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slips .slip:nth-child(3n + 2) { margin-top: 0; }
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  body { font-size: 1rem; }
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .span-7, .span-5 { grid-column: auto; }
  .slips { grid-template-columns: minmax(0, 1fr); }
  .ledger-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ledger-total { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .post-row { grid-template-columns: minmax(0, 1fr); }
  .post-thumb { width: 100%; height: auto; aspect-ratio: 3 / 2; order: -1; }
  .post-row time { padding-top: 0; }
  .cta-inner, .about-grid { grid-template-columns: minmax(0, 1fr); }
  .timeline > li { grid-template-columns: minmax(0, 1fr); }
  .cv-head-inner { flex-direction: column; align-items: flex-start; }
  .section-head.row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .foot-bottom { flex-direction: column; }
}

/* Motion: the receipt print is the one non-interactive animation, and it stops for anyone who asks. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ----------------------------------------------------------------- print
   "Download as PDF" on the CV page uses the browser's print dialog. */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .site-header, .site-footer, .cta-band, .no-print, .skip, .hero::after, .page-head::after { display: none !important; }
  .page-head { background: none; color: #000; padding: 0 0 12pt; }
  .page-head h1, .page-head .lead { color: #000; }
  .cv-photo { box-shadow: none; border: 2px solid #000; }
  .section { padding: 10pt 0; }
  .cv-grid { grid-template-columns: minmax(0, 1fr) 210px; gap: 22pt; }
  .timeline > li, .cv-project, .edu { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
