/* mvybiral.com — personal site
 *
 * Visual language borrowed from clip.md: monochrome, warm, unhurried.
 * Single stylesheet, no build step, no framework. Fraunces for prose,
 * IBM Plex Mono for labels and structure.
 */

/* --- Color tokens ---------------------------------------------------- */

:root {
  /* light mode (default) */
  --bg:        #faf8f3;
  --text:      #2a211a;
  --muted:     #9a8470;
  --code-bg:   #f3efe6;
  --selection: #e8dcc4;
}

/* dark mode follows the OS unless an explicit [data-theme] override is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #1a1410;
    --text:      #f0e8da;
    --muted:     #6b5b4a;
    --code-bg:   #241b15;
    --selection: #3a2e22;
  }
}

/* explicit override always wins (set by the footer toggle) */
:root[data-theme="dark"] {
  --bg:        #1a1410;
  --text:      #f0e8da;
  --muted:     #6b5b4a;
  --code-bg:   #241b15;
  --selection: #3a2e22;
}

/* --- Reset ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body { margin: 0; }

/* --- Texture: paper grain --------------------------------------------
 *
 * A barely-visible noise overlay covers the page. Inline SVG fractalNoise
 * tinted via feColorMatrix, embedded as a CSS data URI so there's no HTTP
 * request. z-index -2 puts it behind everything; position: fixed pins it
 * to the viewport so it stays still while the page scrolls past it. If the
 * grain is consciously noticeable, it is too strong.
 */
html::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.16  0 0 0 0 0.13  0 0 0 0 0.10  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"])::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.94  0 0 0 0 0.91  0 0 0 0 0.85  0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  }
}
html[data-theme="dark"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.94  0 0 0 0 0.91  0 0 0 0 0.85  0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* --- Texture: vignette ----------------------------------------------- */
html::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(42, 33, 26, 0.035) 100%
  );
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"])::after {
    background: radial-gradient(
      ellipse at center,
      transparent 40%,
      rgba(0, 0, 0, 0.25) 100%
    );
  }
}
html[data-theme="dark"]::after {
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(0, 0, 0, 0.25) 100%
  );
}

img, svg { max-width: 100%; height: auto; display: block; }

::selection { background: var(--selection); color: var(--text); }

/* --- Page shell ------------------------------------------------------ */

body {
  color: var(--text);
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-size: 18.5px;
  font-weight: 400;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga" 1, "dlig" 1, "kern" 1;
  font-variant-numeric: oldstyle-nums proportional-nums;
  hanging-punctuation: first last;
  animation: settle 200ms ease-out both;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main {
  flex: 1;
}

@keyframes settle {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 6rem 1.25rem 0;
  width: 100%;
}

/* --- Header / masthead ----------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 0 0 3rem;
}
.masthead-text {
  min-width: 0;
}

.name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 2.25em;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

.tagline {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  margin: 0.85rem 0 0;
  letter-spacing: 0.01em;
}

/* --- Intro / prose --------------------------------------------------- */

.intro p {
  margin: 0 0 1em;
}
.intro > :last-child { margin-bottom: 0; }

.intro em { font-style: italic; }
.intro strong { font-weight: 600; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.18em;
  transition: text-decoration-color 150ms ease;
}
a:hover {
  text-decoration-color: var(--text);
}

/* --- Article page ----------------------------------------------------
 *
 * Standalone essays live at /writing/<slug>.html. They reuse the .page
 * shell (same column width and texture) and add a reading-tuned prose
 * scale. The home page's Writing list links here.
 */

.article-back {
  display: inline-block;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  margin: 0 0 3rem;
}
.article-back:hover { color: var(--text); }

.article-header {
  margin: 0 0 2.5rem;
}
.article-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 2em;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
.article-date {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  margin: 0.9rem 0 0;
}

/* Quiet marker for pages that are scaffolded but not yet written. */
.article-draft {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}

.article-body {
  margin: 0;
}
.article-body > :first-child { margin-top: 0; }
.article-body > :last-child { margin-bottom: 0; }
.article-body p { margin: 0 0 1.2em; }
.article-body h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.3em;
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin: 2.4em 0 0.8em;
}
.article-body h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.1em;
  margin: 2em 0 0.6em;
}
.article-body ul,
.article-body ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.article-body li { margin: 0 0 0.4em; }
.article-body em { font-style: italic; }
.article-body strong { font-weight: 600; }
.article-body blockquote {
  margin: 1.6em 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--muted);
  color: var(--muted);
  font-style: italic;
}
.article-body code {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.article-body pre {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 1.2em;
}
.article-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}
/* Section breaks are spacing only — no visible rule. */
.article-body hr {
  border: none;
  height: 0;
  margin: 2.4em 0;
}
.article-body figure { margin: 1.6em 0; }
.article-body figcaption {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  margin-top: 0.6em;
  text-align: center;
}

/* --- CV page ---------------------------------------------------------
 *
 * A standalone résumé at /cv.html, intentionally unlinked from the home
 * page. Same warm, monochrome language. .cv-ph marks placeholder copy to
 * be replaced — muted and italic so unfilled gaps are obvious at a glance.
 */

/* The CV is meant to be printed / exported to PDF, so it runs wider than
 * the site's reading column — and it's a document, not the site's quiet
 * reading page. The site's warm muted tone (#9a8470) only clears ~3:1 on
 * the cream background, which washes out on paper, so the CV uses a firmer
 * muted with real contrast in both themes. */
.cv-page {
  max-width: 860px;
  --muted: #6a5340;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cv-page { --muted: #b3a288; }
}
:root[data-theme="dark"] .cv-page { --muted: #b3a288; }

.cv-contact {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  margin: 0.9rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
}

.cv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cv-entry {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  margin: 0 0 1.6rem;
}
.cv-entry:last-child { margin-bottom: 0; }

.cv-when {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  flex-shrink: 0;
  width: 10rem;
  line-height: 1.5;
  white-space: nowrap;
}
.cv-what { min-width: 0; }
.cv-role {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.05em;
  margin: 0;
}
.cv-org { color: var(--muted); font-weight: 400; }
.cv-note {
  margin: 0.4rem 0 0;
  font-size: 0.95em;
}

/* Placeholder copy — replace as you fill the CV in. */
.cv-ph {
  color: var(--muted);
  font-style: italic;
}

/* Skills — a labelled-row grid matching the experience layout: a mono
 * category on the left, the items on the right. */
.cv-skills { margin: 0; }
.cv-skill-row {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  margin: 0 0 0.7rem;
}
.cv-skill-row:last-child { margin-bottom: 0; }
.cv-skill-cat {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  width: 8.5rem;
  line-height: 1.5;
}
.cv-skill-items { min-width: 0; }

/* --- Sections -------------------------------------------------------- */

.section {
  margin-top: 4rem;
}

.section-label {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* --- Writing list ---------------------------------------------------- */

.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.posts li {
  margin: 0 0 1.25rem;
}
.posts li:last-child { margin-bottom: 0; }

.post-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
}
.post-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.05em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.18em;
  transition: text-decoration-color 150ms ease;
}
.post-link:hover .post-title {
  text-decoration-color: var(--text);
}
.post-date {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

/* --- Work list ------------------------------------------------------- */

.work {
  list-style: none;
  margin: 0;
  padding: 0;
}
.work li {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin: 0 0 1.1rem;
}
.work li:last-child { margin-bottom: 0; }

.work-year {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  flex-shrink: 0;
  width: 3rem;
}
.work-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem 0.7rem;
}
.work-link {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.18em;
  word-break: break-all;
  transition: text-decoration-color 150ms ease;
}
.work-link:hover {
  text-decoration-color: var(--text);
}

/* Award badge — a quiet outlined pill next to a work link. */
.work-badge {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--muted);
  border-radius: 999px;
  padding: 0.2em 0.55em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease;
}
.work-badge:hover {
  color: var(--text);
  border-color: var(--text);
}

/* --- Links list ------------------------------------------------------ */

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.links li {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}
.links .link-kind {
  color: var(--muted);
  min-width: 6.5rem;
  flex-shrink: 0;
}
.links a {
  text-decoration-color: var(--muted);
}

/* --- Encrypted email puzzle ------------------------------------------ */

/* The address is XOR-encrypted with a secret keyword and shown as a lock
 * icon. Clicking reveals a riddle whose answer is the key; solving it
 * decrypts the address client-side. The plaintext lives nowhere in the page. */
.cipher {
  display: inline-flex;
  align-items: center;
}
.cipher-text {
  font: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: color 150ms ease;
}
.cipher-text:hover { color: var(--text); }
.cipher-text:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 3px;
}
.cipher-lock { display: block; }

.cipher-puzzle {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
}
.cipher [hidden] { display: none; }
.cipher-q {
  color: var(--muted);
}
.cipher-input {
  font: inherit;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--muted);
  padding: 0 0 2px;
  width: 6.5rem;
  outline: none;
  transition: border-color 150ms ease;
}
.cipher-input::placeholder { color: var(--muted); opacity: 0.7; }
.cipher-input:focus { border-bottom-color: var(--text); }
.cipher-input.wrong {
  border-bottom-color: var(--text);
  animation: cipher-shake 300ms ease;
}

@keyframes cipher-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .cipher-input.wrong { animation: none; }
}

/* --- Footer ---------------------------------------------------------- */

.footer {
  margin: 4rem 0 3rem;
  padding: 0 1.25rem;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Masthead orb — a live render of the kanwas generative-fabric engine,
 * clipped to a circle. The gradient is a fallback shown before the canvas
 * paints (or if WebGL2 is unavailable and the canvas removes itself). */
.sigil {
  flex-shrink: 0;
  display: block;
  width: 100px;
  height: 100px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: radial-gradient(circle at 35% 30%, #3a73c4, #1a1410 80%);
  border: none;
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.sigil:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 4px;
}
.sigil-canvas {
  width: 100%;
  height: 100%;
  display: block;
  /* Ignore the cursor so the orb doesn't warp toward it on hover; the click
   * still lands on the parent .sigil button. */
  pointer-events: none;
}

/* --- Full-screen kanwas view ----------------------------------------- */

.kanwas-fs {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  cursor: pointer;
  touch-action: none;          /* no pan/zoom gestures inside the overlay */
  overscroll-behavior: none;   /* don't chain scroll to the page behind */
}
.kanwas-fs[hidden] { display: none; }
.kanwas-fs-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* While the full-screen art is open, freeze the page behind it. iOS has no
 * element fullscreen, so the overlay is just a fixed layer over a scrollable
 * page — this is what actually stops the stray vertical scroll on mobile. */
html.kanwas-fs-lock,
body.kanwas-fs-lock {
  overflow: hidden;
  height: 100%;
  touch-action: none;
  overscroll-behavior: none;
}

/* Close affordance — phones have no Esc key, so the overlay needs a visible
 * exit. 44px target = comfortable tap. Sits clear of notches via safe-area. */
.kanwas-fs-close {
  /* Hidden on desktop — Esc closes there. Shown only on touch devices below. */
  display: none;
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 0; /* hide the text glyph; the X is drawn from pseudo-elements */
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 150ms ease;
}
/* Two crossed bars, centered with translate(-50%) — font-independent. */
.kanwas-fs-close::before,
.kanwas-fs-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.7);
  transition: background 150ms ease;
}
.kanwas-fs-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.kanwas-fs-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.kanwas-fs-close:hover,
.kanwas-fs-close:focus-visible {
  background: rgba(0, 0, 0, 0.45);
  outline: none;
}
.kanwas-fs-close:hover::before,
.kanwas-fs-close:hover::after,
.kanwas-fs-close:focus-visible::before,
.kanwas-fs-close:focus-visible::after {
  background: #fff;
}
/* Default (desktop) hint wording; the touch variant is hidden until below. */
.kanwas-fs-hint-touch { display: none; }
/* Touch devices (no hover, coarse pointer) get the visible close button
   and the tap/✕ wording instead of the click/esc wording. */
@media (hover: none) and (pointer: coarse) {
  .kanwas-fs-close { display: block; }
  .kanwas-fs-hint-desktop { display: none; }
  .kanwas-fs-hint-touch { display: inline; }
}
.kanwas-fs-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: kanwas-hint 3.5s ease forwards;
}
@keyframes kanwas-hint {
  0%, 55% { opacity: 0.55; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kanwas-fs-hint { animation: none; opacity: 0.4; }
}
.footer a {
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease;
}
.footer a:hover {
  color: var(--text);
}
.footer .sep {
  display: inline-block;
  margin: 0 0.75em;
}

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  line-height: 1;
  transition: color 150ms ease;
}
.theme-toggle:hover {
  color: var(--text);
}
.theme-toggle:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 3px;
}

/* --- Print -----------------------------------------------------------
 *
 * Chiefly for the CV: force the light palette regardless of theme, drop the
 * paper grain, vignette, footer and any interactive chrome, and tighten the
 * layout so the browser's "Save as PDF" yields a clean, conventional page.
 */
@media print {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --bg:      #ffffff;
    --text:    #1a1a1a;
    --muted:   #555555;
    --code-bg: #f2f2f2;
  }
  html { background: #fff; }
  html::before,
  html::after { display: none !important; }

  /* Keep the firmer CV muted dark on paper — never let the screen
   * dark-mode tone leak onto a white page. */
  .cv-page { --muted: #5a4a39 !important; }

  body {
    animation: none;
    font-size: 10.5pt;
    line-height: 1.4;
    min-height: 0;
  }
  .page { padding: 0; max-width: 100%; }

  .footer,
  .theme-toggle,
  .sigil,
  .kanwas-fs { display: none !important; }

  a { text-decoration: none; color: inherit; }

  .section { margin-top: 1.4rem; }
  .section-label { margin-bottom: 0.8rem; }
  .cv-entry,
  .work li { break-inside: avoid; page-break-inside: avoid; }

  /* One-page export: the CV is a digital document, not a printed sheet, so
   * the page is sized to the content (a single tall page) rather than split
   * across A4/Letter. Re-measure and adjust the height if the CV grows. */
  @page { size: 210mm 392mm; margin: 1.3cm; }
}

/* --- Mobile ---------------------------------------------------------- */

@media (max-width: 640px) {
  .page { padding-top: 3.5rem; }
  .name { font-size: 2em; }
  .masthead { margin-bottom: 2.5rem; }
  .section { margin-top: 3rem; }
  .footer { margin-top: 6rem; }
  .post-link { flex-direction: column; gap: 0.15rem; }
  .article-title { font-size: 1.7em; }
  .article-back { margin-bottom: 2.25rem; }
  .cv-entry { flex-direction: column; gap: 0.15rem; }
  .cv-when { width: auto; }
  .cv-skill-row { flex-direction: column; gap: 0.15rem; }
  .cv-skill-cat { width: auto; }
}
