/* ==========================================================
   AKSHAY KRISHNA SIRIGANA — PORTFOLIO, ISSUE 01
   "The Engineer's Monograph" — Swiss-editorial, PAPER/INK
   Set in Archivo, Fraunces & Spline Sans Mono
   ========================================================== */

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

/* ----------------------------------------------------------
   THEMES
   ---------------------------------------------------------- */

:root,
[data-theme="paper"] {
  --bg: #F7F4EE;            /* warm newsprint */
  --ink: #131311;
  --muted: #6E6A62;
  --hairline: #DDD8CE;
  --surface: #FDFCFA;
  --accent: #E8380D;        /* Swiss vermilion */
  --accent-text: #B92D0A;   /* darkened for small text */
  --on-accent: #F7F4EE;
}

[data-theme="ink"] {
  --bg: #141312;
  --ink: #F0EDE6;
  --muted: #9B958A;
  --hairline: #2E2C28;
  --surface: #1B1A18;
  --accent: #FF4A1F;
  --accent-text: #FF6A45;
  --on-accent: #141312;
}

/* Smooth theme flip (class added temporarily by JS) */
html.theming body,
html.theming body * {
  transition: background-color 0.24s ease, color 0.24s ease, border-color 0.24s ease !important;
}

/* ----------------------------------------------------------
   BASE
   ---------------------------------------------------------- */

body {
  font-family: "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  font-size: 17px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

.mono {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.06em;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.8rem;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ----------------------------------------------------------
   RUNNING HEADER
   ---------------------------------------------------------- */

.running-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 48px);
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
  transform: translateY(-101%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.running-header.visible,
.running-header:focus-within {
  transform: translateY(0);
}

.rh-wordmark {
  font-family: "Archivo", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1rem;
}

.rh-wordmark:hover {
  color: var(--accent-text);
}

.rh-folio {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rh-actions {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.5vw, 28px);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.theme-switch .ts-opt {
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

[data-theme="ink"] .theme-switch .ts-ink,
[data-theme="paper"] .theme-switch .ts-paper {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.theme-switch:hover .ts-opt {
  color: var(--ink);
}

.rh-resume {
  color: var(--accent-text);
}

.rh-resume:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
}

.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ----------------------------------------------------------
   000 — MASTHEAD
   ---------------------------------------------------------- */

.masthead {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 20px clamp(16px, 4vw, 48px) 28px;
}

.mast-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}

.mast-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4vh 0 2vh;
}

.mast-line {
  display: block;
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(2.7rem, 13.8vw, 13.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

html.js.anim .mast-line {
  animation: mast-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html.js.anim .mast-line:nth-child(2) {
  animation-delay: 0.09s;
}

@keyframes mast-in {
  from {
    opacity: 0;
    transform: translateY(0.25em);
    font-stretch: 62%;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    font-stretch: 125%;
  }
}

.mast-dek {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-weight: 380;
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  line-height: 1.4;
  max-width: 30em;
  margin-bottom: clamp(28px, 5vh, 56px);
}

.mast-dek em {
  font-style: italic;
  color: var(--accent-text);
}

.mast-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(20px, 4vw, 56px);
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
}

.mast-meta a {
  color: var(--accent-text);
}

.mast-meta a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.mast-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.mast-facts {
  color: var(--muted);
  padding: 14px 0 0;
  border-top: 1px solid var(--hairline);
}

.mast-scrollcue {
  margin-top: clamp(16px, 3vh, 32px);
  color: var(--muted);
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ----------------------------------------------------------
   SECTION SCAFFOLD
   ---------------------------------------------------------- */

.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(72px, 12vh, 140px) clamp(16px, 4vw, 48px) 0;
}

/* anchored jumps must clear the 56px fixed running header */
.section,
.work-row {
  scroll-margin-top: 72px;
}

.kicker {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
}

.kicker span:first-child {
  color: var(--ink);
}

.headline {
  font-weight: 800;
  font-size: clamp(2.3rem, 6.5vw, 4.8rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: clamp(20px, 4vh, 44px) 0 clamp(32px, 6vh, 64px);
  overflow: hidden;
}

.headline em {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-style: italic;
  font-weight: 480;
  color: var(--accent-text);
  letter-spacing: 0;
}

/* Scroll reveals (JS wraps .reveal content in .reveal-inner) */
html.js .reveal-inner {
  display: block;
  transform: translateY(115%);
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

html.js .in-view > .reveal-inner {
  transform: translateY(0);
}

html.js .rise {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

html.js .rise.in-view {
  opacity: 1;
  transform: translateY(0);
}

.section-note {
  color: var(--muted);
  margin: -20px 0 36px;
}

/* ----------------------------------------------------------
   001 — ABOUT
   ---------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: clamp(32px, 6vw, 96px);
}

.about-body p {
  max-width: 62ch;
  margin-bottom: 1.4em;
}

.about-body .dropcap::first-letter {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 3.3em;
  line-height: 0.82;
  float: left;
  padding: 0.08em 0.12em 0 0;
  color: var(--accent-text);
}

.about-margin {
  border-left: 1px solid var(--hairline);
  padding-left: clamp(20px, 2.5vw, 36px);
  align-self: start;
}

.margin-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0;
  border-bottom: 1px dotted var(--hairline);
}

.margin-key {
  color: var(--muted);
}

.pull-quote {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-style: italic;
  font-weight: 420;
  font-size: 1.35rem;
  line-height: 1.35;
  padding-top: 22px;
}

/* ----------------------------------------------------------
   002 — WORK INDEX
   ---------------------------------------------------------- */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 9px 14px 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.chip[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.chip-count {
  color: var(--accent-text);
}

.chip-stack {
  color: var(--ink);
  border-color: var(--accent);
}

.filter-count {
  color: var(--muted);
  white-space: nowrap;
}

.work-index {
  list-style: none;
  border-top: 1px solid var(--hairline);
}

.work-item {
  border-bottom: 1px solid var(--hairline);
}

/* --- Row (summary) --- */

.work-row summary {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, auto) 1fr auto auto;
  align-items: baseline;
  gap: clamp(12px, 2vw, 24px);
  padding: clamp(18px, 3vh, 28px) 8px;
  cursor: pointer;
  list-style: none;
  z-index: 0;
}

.work-row summary::-webkit-details-marker {
  display: none;
}

.work-row summary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
}

@media (hover: hover) {
  .work-row summary:hover::before {
    transform: scaleY(1);
  }

  .work-row summary:hover,
  .work-row summary:hover .row-num,
  .work-row summary:hover .row-meta {
    color: var(--bg);
  }

  .work-row summary:hover .row-flag {
    color: var(--bg);
    border-color: var(--bg);
  }

  .work-row summary:hover .row-glyph {
    color: var(--accent);
  }

  .work-row summary:hover .row-leader {
    border-color: color-mix(in srgb, var(--bg) 40%, transparent);
  }
}

.row-num {
  color: var(--muted);
  font-size: 0.85rem;
}

.row-title {
  font-weight: 700;
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.row-flag {
  display: inline-block;
  vertical-align: 0.25em;
  margin-left: 10px;
  padding: 2px 7px 1px;
  font-size: 0.6rem;
  color: var(--accent-text);
  border: 1px solid var(--accent-text);
  border-radius: 999px;
}

.row-leader {
  border-bottom: 1px dotted var(--hairline);
  transform: translateY(-0.35em);
  min-width: 24px;
}

.row-meta {
  color: var(--muted);
  white-space: nowrap;
}

.row-glyph {
  font-weight: 300;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent-text);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.work-row[open] .row-glyph {
  transform: rotate(45deg);
}

/* --- Spread (expanded) --- */

.spread {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 64px);
  padding: 8px 8px clamp(32px, 5vh, 56px);
}

html.js .work-row[open] .spread {
  animation: spread-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes spread-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spread-fig {
  align-self: start;
}

.plate {
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--muted);
  padding: clamp(14px, 2vw, 24px);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 3px;
  overflow: hidden;
  min-height: 120px;
}

.plate b {
  color: var(--accent-text);
  font-weight: 400;
}

.fig-caption {
  color: var(--muted);
  padding-top: 10px;
  font-size: 0.65rem;
}

.spread-dek {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-style: italic;
  font-weight: 420;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  line-height: 1.35;
  margin-bottom: 28px;
}

.case-file {
  border-top: 1px solid var(--hairline);
}

.case-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}

.case-row dt {
  color: var(--accent-text);
  padding-top: 3px;
}

.case-row dd {
  font-size: 0.98rem;
  line-height: 1.55;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 18px;
}

.metrics span {
  padding: 6px 11px 5px;
  border: 1px solid var(--hairline);
  color: var(--ink);
  white-space: nowrap;
}

.spread-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.spread-links a {
  color: var(--accent-text);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.spread-links a:hover {
  border-bottom-color: var(--accent-text);
}

.status-tag {
  color: var(--muted);
  border: 1px dotted var(--muted);
  padding: 5px 10px 4px;
}

/* FLIP filtering */
.work-item.flip-move {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.work-item[hidden] {
  display: none;
}

/* ----------------------------------------------------------
   003 — CAPABILITIES
   ---------------------------------------------------------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px);
}

.skill-group-title {
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 6px;
}

.skill-list {
  list-style: none;
}

.skill {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 2px 10px;
  border-bottom: 1px dotted var(--hairline);
  font-size: 0.8rem;
  transition: color 0.15s ease;
}

.skill .skill-count {
  color: var(--muted);
  font-size: 0.68rem;
}

button.skill:hover {
  color: var(--accent-text);
}

button.skill:hover .skill-count::after {
  content: " → INDEX";
}

.skill-plain {
  color: var(--muted);
}

/* ----------------------------------------------------------
   004 — EXPERIENCE LEDGER
   ---------------------------------------------------------- */

.ledger {
  list-style: none;
  border-top: 1px solid var(--hairline);
}

.ledger-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: clamp(16px, 3vw, 48px);
  padding: clamp(22px, 4vh, 34px) 8px;
  border-bottom: 1px solid var(--hairline);
}

.ledger-when {
  color: var(--muted);
  padding-top: 5px;
}

.ledger-what h3 {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.ledger-what p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 58ch;
}

.ledger-tag {
  align-self: start;
  color: var(--accent-text);
  border: 1px solid var(--accent-text);
  border-radius: 999px;
  padding: 4px 10px 3px;
  font-size: 0.62rem;
}

/* ----------------------------------------------------------
   005 — OFF HOURS
   ---------------------------------------------------------- */

.offhours-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: clamp(24px, 3vw, 48px);
}

.hobby-chess {
  grid-row: 1 / 3;
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}

.hobby {
  border-top: 1px solid var(--hairline);
  padding-top: 20px;
}

.hobby-chess.hobby {
  border-top: 1px solid var(--hairline);
}

.hobby h3 {
  font-size: 0.85rem;
  margin-bottom: 10px;
  letter-spacing: 0.08em;
}

.hobby p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 34ch;
}

.hobby-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent-text);
}

.hobby-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.chessboard {
  position: relative;
  aspect-ratio: 1;
  max-width: 240px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid var(--ink);
}

button.cb-sq {
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--bg);
  cursor: pointer;
}

.cb-sq.dark {
  background: var(--hairline);
}

button.cb-sq:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 2;
}

.cb-sq.cb-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cb-sq.cb-target {
  box-shadow: inset 0 0 0 1px var(--accent);
  opacity: 0.92;
}

.chessboard.cb-static .cb-sq {
  cursor: default;
}

.chess-status {
  color: var(--accent-text);
  padding-top: 12px;
  min-height: 2.2em;
  max-width: 240px;
}

.chess-moves {
  color: var(--muted);
  font-size: 0.65rem;
  max-width: 240px;
  overflow-wrap: anywhere;
  min-height: 1em;
}

.chess-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 14px;
}

.chess-links .hobby-link {
  margin-top: 0;
}

.chess-reset {
  padding: 6px 13px 5px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chess-reset:hover {
  background: var(--ink);
  color: var(--bg);
}

.cb-piece {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  display: grid;
  place-items: center;
  font-size: clamp(14px, 2.6vw, 21px);
  line-height: 1;
  transform: translate(calc(var(--f) * 100%), calc(var(--r) * 100%));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}

.cb-piece {
  color: var(--ink);
  pointer-events: none;
  z-index: 1;
}

/* ----------------------------------------------------------
   AVAILABILITY STRIP + CONTACT
   ---------------------------------------------------------- */

.avail-strip {
  margin-top: clamp(72px, 12vh, 140px);
  padding: 18px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.section-contact {
  padding-bottom: clamp(56px, 8vh, 96px);
}

.contact-lede {
  max-width: 46ch;
  font-size: 1.1rem;
  margin-bottom: clamp(32px, 5vh, 56px);
}

.contact-email {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin-bottom: clamp(32px, 5vh, 48px);
}

.email-big {
  font-weight: 700;
  font-size: clamp(1.5rem, 5.2vw, 3.6rem);
  letter-spacing: -0.02em;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 4px;
  overflow-wrap: anywhere;
}

.email-big:hover {
  color: var(--accent-text);
}

.copy-email {
  padding: 10px 18px 9px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.copy-email:hover {
  background: var(--ink);
  color: var(--bg);
}

.copy-email.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.contact-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(24px, 4vw, 56px);
}

.contact-links a {
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 3px;
}

.contact-links a:hover {
  color: var(--accent-text);
  border-bottom-color: var(--accent-text);
}

.contact-signoff {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 420;
  font-size: 1.3rem;
  color: var(--muted);
  margin-top: clamp(32px, 5vh, 48px);
}

/* ----------------------------------------------------------
   COLOPHON
   ---------------------------------------------------------- */

.colophon {
  border-top: 1px solid var(--ink);
  padding: 28px clamp(16px, 4vw, 48px) 40px;
}

.colophon-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px clamp(24px, 4vw, 64px);
  color: var(--muted);
  font-size: 0.68rem;
}

/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */

@media (max-width: 1024px) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .about-margin {
    border-left: none;
    border-top: 1px solid var(--hairline);
    padding-left: 0;
    padding-top: 20px;
  }

  .skills-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .rh-folio {
    display: none;
  }

  .spread {
    grid-template-columns: minmax(0, 1fr);
  }

  .spread-fig {
    max-width: 420px;
  }

  .work-row summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "num title glyph"
      "num meta  glyph";
    row-gap: 6px;
  }

  .row-num { grid-area: num; }
  .row-title { grid-area: title; }
  .row-meta { grid-area: meta; white-space: normal; }
  .row-glyph { grid-area: glyph; align-self: center; }
  .row-leader { display: none; }

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    padding-bottom: 6px;
    padding-right: 48px; /* keeps real content clear of the fade mask */
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
    mask-image: linear-gradient(90deg, #000 92%, transparent);
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .offhours-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hobby-chess {
    grid-row: auto;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .mast-topbar-right {
    display: none;
  }

  .mast-meta {
    flex-direction: column;
    gap: 10px;
  }

  .skills-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ledger-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .ledger-tag {
    justify-self: start;
  }

  .case-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .colophon-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ----------------------------------------------------------
   REDUCED MOTION
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }

  html.js .reveal-inner {
    transform: none;
  }

  html.js .rise {
    opacity: 1;
    transform: none;
  }
}
