/* Michael Descharles — portfolio */
:root {
  color-scheme: dark;
  --bg: #101010;
  --bg-rgb: 16, 16, 16;
  --text: #f1f0ec;
  --text-rgb: 241, 240, 236;
  --text-strong: #ffffff;
  --on-text: #111111;           /* text on a --text coloured button */
  --ink-rgb: 255, 255, 255;     /* hairlines, glass tints */
  --muted: #a5a5a0;
  --body: #bdbdbd; /* paragraph gray, same as the Framer site */
  --surface: #1a1a1a;
  --surface-rgb: 26, 26, 26;
  --menu-bg: rgba(30, 30, 30, 0.82);
  --error: #ff8a80;
  --line: rgba(var(--ink-rgb), 0.08);
  --card: linear-gradient(160deg, rgba(var(--ink-rgb), 0.07), rgba(var(--ink-rgb), 0.02));
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --max: 1160px;
  --font: "Instrument Sans", system-ui, sans-serif;
  /* critically damped spring, response ≈ 0.4 s */
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* entering, exiting, feedback */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* moving on screen */
  --press: transform 160ms var(--ease-out);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f4f0;
  --bg-rgb: 245, 244, 240;
  --text: #141414;
  --text-rgb: 20, 20, 20;
  --text-strong: #000000;
  --on-text: #ffffff;
  --ink-rgb: 0, 0, 0;
  --muted: #6e6d68;
  --body: #4a4a47;
  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --menu-bg: rgba(255, 255, 255, 0.82);
  --error: #c62828;
  --line: rgba(0, 0, 0, 0.09);
  --card: linear-gradient(160deg, #ffffff, rgba(255, 255, 255, 0.6));
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.wrap { width: min(var(--max), 100% - 48px); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  background: transparent;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled {
  background: rgba(var(--bg-rgb), 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 1px 0 rgba(var(--ink-rgb), 0.05);
}
.brand-name { font-size: 22px; font-weight: 500; line-height: 1.1; }
.brand-tag { font-size: 13px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 28px; font-size: 13px; font-weight: 500; }
.nav a:not(.btn) { opacity: 0.85; transition: opacity 0.2s; }
.nav a[aria-current="page"] { opacity: 1; }
.nav svg { width: 16px; height: 16px; fill: currentColor; }
.menu-toggle { display: none; position: relative; width: 40px; height: 40px; background: none; border: 0; color: var(--text); cursor: pointer; border-radius: 50%; transition: background 0.2s, var(--press); }
.menu-toggle:active { transform: scale(0.95); background: rgba(var(--ink-rgb), 0.08); }
.menu-toggle i { position: absolute; left: 10px; width: 20px; height: 1.6px; border-radius: 2px; background: currentColor; transition: transform 280ms var(--ease-in-out); }
.menu-toggle i:first-child { top: 15px; }
.menu-toggle i:last-child { top: 23px; }
.menu-toggle.open i:first-child { transform: translateY(4px) rotate(45deg); }
.menu-toggle.open i:last-child { transform: translateY(-4px) rotate(-45deg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 999px;
  background: var(--text); color: var(--on-text); font-size: 13px; font-weight: 600;
  transition: var(--press), background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid rgba(var(--ink-rgb), 0.5); }
.btn-ghost:active { background: rgba(var(--ink-rgb), 0.12); }

@media (max-width: 860px) {
  .site-header { padding: 16px 20px; }
  .menu-toggle { display: block; }
  .nav {
    position: fixed; inset: 72px 16px auto 16px;
    flex-direction: column; align-items: flex-start; gap: 18px;
    padding: 24px; border-radius: var(--radius);
    background: var(--menu-bg);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(var(--ink-rgb), 0.1);
    box-shadow: var(--shadow);
    font-size: 17px;
    transform-origin: top right;
    opacity: 0; pointer-events: none; transform: scale(0.94) translateY(-6px);
    transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out), visibility 0s linear 160ms;
    visibility: hidden;
  }
  .nav.open { opacity: 1; pointer-events: auto; transform: none; visibility: visible; transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out), visibility 0s; }
}

/* Generic */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.eyebrow { font-size: 13px; color: var(--muted); }
.section { padding: 96px 0; }
.section-title { font-size: clamp(28px, 3vw, 36px); font-weight: 500; text-align: center; margin-bottom: 40px; letter-spacing: -0.01em; }

/* Home carousel */
.home { min-height: calc(100vh - 90px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding-bottom: 32px; }
.carousel { position: relative; height: min(62vh, 560px); perspective: 1400px; }
.slide {
  position: absolute; top: 0; left: 50%;
  width: min(640px, 82vw); height: 100%;
  display: flex; flex-direction: column;
  border-radius: 22px; overflow: hidden;
  /* frosted glass: the neighbouring cards show through, softly */
  background: rgba(var(--surface-rgb), 0.12);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid rgba(var(--ink-rgb), 0.16);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--shadow);
  transform: translateX(-50%);
  will-change: transform, opacity;
  user-select: none; -webkit-user-select: none;
}
.carousel { touch-action: pan-y; cursor: grab; }
.carousel.dragging, .carousel.dragging * { cursor: grabbing; }
.carousel:not(.ready) .slide:not(:first-child) { opacity: 0; }
.slide img { -webkit-user-drag: none; pointer-events: none; }
.slide .shot { flex: 1; min-height: 0; padding: 16px 16px 0; }
.slide .shot img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.slide .meta { display: flex; justify-content: space-between; padding: 14px 20px 0; font-size: 13px; color: var(--muted); }
.slide .title-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 20px 22px; }
.slide h2 { font-size: clamp(24px, 3vw, 38px); font-weight: 500; letter-spacing: -0.02em; }
.slide .view { font-size: 13px; color: var(--muted); }
.tabs { display: flex; justify-content: center; gap: 28px; margin-top: 36px; font-size: 13px; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 8px 4px; transition: color 0.25s ease, var(--press); }
.tabs button:active { transform: scale(0.95); }
.tabs button[aria-selected="true"] { color: var(--text); }

/* About */
.about-hero { display: grid; grid-template-columns: 1.1fr 1.4fr 0.8fr; gap: 12px; padding-top: 40px; }
.about-hero .photo { grid-row: span 2; border-radius: var(--radius); overflow: hidden; filter: grayscale(1); }
.about-hero .photo img { width: 100%; height: 100%; object-fit: cover; }
.intro { padding: 28px; }
.intro h1 { font-size: 22px; font-weight: 500; margin: 10px 0 14px; line-height: 1.35; }
.intro p { color: var(--muted); font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; grid-column: 2 / 4; }
.side-stats { display: grid; gap: 12px; }
.stat { padding: 20px 14px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.stat strong { font-size: 22px; font-weight: 500; line-height: 1.15; }
.stat span { font-size: 12px; color: var(--muted); margin-top: 6px; }

.traits { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.traits h2 { font-size: 36px; font-weight: 500; margin-bottom: 20px; }
.trait-list { display: grid; gap: 10px; }
.accordion { border-radius: var(--radius); background: linear-gradient(160deg, rgba(var(--ink-rgb), 0.06), rgba(var(--ink-rgb), 0.02)); border: 1px solid var(--line); transition: border-color 200ms ease, background-color 200ms ease; overflow: hidden; }
.accordion.is-open { border-color: rgba(var(--ink-rgb), 0.16); background: linear-gradient(160deg, rgba(var(--ink-rgb), 0.09), rgba(var(--ink-rgb), 0.03)); }
:root[data-theme="light"] .accordion.is-open { background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06); }
.accordion summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 26px; font-size: 16px; font-weight: 500; cursor: pointer; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary { transition: var(--press); -webkit-tap-highlight-color: transparent; }
.accordion summary:active { transform: scale(0.99); }
.accordion summary:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; border-radius: var(--radius); }
.accordion .icon { position: relative; width: 18px; height: 18px; flex: none; transition: transform 240ms var(--ease-in-out); }
.accordion .icon::before, .accordion .icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 1.5px; background: var(--muted); transform: translate(-50%, -50%); }
.accordion .icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.accordion.is-open .icon { transform: rotate(45deg); }
.accordion.is-open .icon::before, .accordion.is-open .icon::after { background: var(--text); }
.accordion-body { will-change: opacity, transform; margin: 0 26px; padding: 22px 0 26px; border-top: 1px solid var(--line); }
.accordion-body p { font-size: 18px; line-height: 1.6; color: var(--body); }

.community { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; padding: 16px; align-items: center; }
.community .pics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.community .pics img { border-radius: 12px; aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.community .pics img:first-child { grid-column: span 2; aspect-ratio: 16/8; }
.community h2 { font-size: 32px; font-weight: 500; line-height: 1.2; margin-bottom: 16px; }
.community p { color: var(--muted); margin-bottom: 24px; }
.community p b { color: var(--text); font-weight: 600; }

.timeline { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.timeline h2 { font-size: 36px; font-weight: 500; }
.timeline ol { list-style: none; }
.timeline li { padding: 22px 0; border-bottom: 1px solid var(--line); }
.timeline time { font-size: 12px; color: var(--muted); }
.timeline h3 { font-size: 24px; font-weight: 500; margin: 4px 0; }
.timeline p { font-size: 14px; color: var(--muted); }

/* Testimonials */
.scroller { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.quote { padding: 28px; }
@media (max-width: 760px) { .scroller { grid-template-columns: 1fr; } }
.who { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.who img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.who strong { display: block; font-size: 17px; font-weight: 500; }
.who span { font-size: 12px; color: var(--muted); }
.quote p { font-size: 15px; color: var(--body); white-space: pre-line; }

/* Mentoring */
.mentor-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; padding-top: 40px; }
.mentor-hero h1 { font-size: clamp(40px, 5vw, 60px); font-weight: 500; line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 20px; }
.mentor-hero p { color: var(--muted); margin-bottom: 24px; max-width: 460px; }
.mentor-hero img { width: 100%; height: auto; }
.mentor-hero img.mentor-photo { border-radius: 0; } /* corners are part of the image */
.sessions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.session { padding: 10px; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); }
.session img { border-radius: 12px; aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.session h3 { font-size: 26px; font-weight: 700; line-height: 1.15; margin: 16px 10px 8px; }
.session p { font-size: 14px; color: var(--body); margin: 0 10px 20px; flex: 1; white-space: pre-line; }
.session .btn { margin: 0 10px 10px; }

/* Playground */
.play-hero { text-align: center; padding: 60px 0 64px; }
.play-hero h1 { font-size: clamp(32px, 4.4vw, 56px); font-weight: 500; line-height: 1.1; letter-spacing: -0.03em; max-width: 900px; margin: 12px auto 0; }
.masonry { columns: 4 260px; column-gap: 12px; padding: 0 12px 80px; }
.masonry img { width: 100%; margin-bottom: 12px; border-radius: 6px; break-inside: avoid; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.92); display: none; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 92vh; border-radius: 8px; transform-origin: 0 0; will-change: transform; }
.masonry img { transition: var(--press), opacity 0.2s; }
.masonry img:active { transform: scale(0.98); }

/* Locked case study */
.lock { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.lock h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 500; letter-spacing: -0.02em; margin-bottom: 12px; }
.lock p { color: var(--muted); margin-bottom: 24px; }
.lock form { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lock input { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; min-width: 240px; }
.lock .error { color: var(--error); font-size: 14px; margin-top: 14px; }

/* Footer */
.site-footer { padding: 48px 32px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 40px; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .about-hero, .traits, .timeline, .community, .mentor-hero { grid-template-columns: 1fr; }
  .about-hero .photo { grid-row: auto; aspect-ratio: 4/3; }
  .stats { grid-column: auto; grid-template-columns: repeat(2, 1fr); }
  .sessions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .sessions { grid-template-columns: 1fr; } }
@media (prefers-reduced-transparency: reduce) {
  .site-header.scrolled { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav { background: var(--surface) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .reveal { transform: none; transition: opacity 300ms ease; }
  .nav, .nav.open, .cs-toc, .cs-toc.shown { transform: none !important; }
  .menu-toggle i, .accordion .icon, .theme-toggle svg, .cs-pill, .cs-toc-marker { transition-duration: 0ms !important; }
  .btn:active, .menu-toggle:active, .theme-toggle:active, .tabs button:active, .masonry img:active, .cs-more-grid a:active, .accordion summary:active, .cs-toggle button:active, .cs-toc li a:active { transform: none !important; }
}

/* Case studies */
.cs-hero { padding: 56px 0 24px; max-width: 760px; }
.cs-hero h1 { font-size: clamp(42px, 6vw, 84px); font-weight: 500; line-height: 0.98; letter-spacing: -0.045em; margin-bottom: 24px; }
.cs-hero .lede { font-size: 18px; line-height: 1.45; color: var(--body); margin-bottom: 32px; max-width: 34em; }
@media (min-width: 960px) {
  .case .cs-hero { display: grid; grid-template-columns: 1fr 1fr; column-gap: 64px; align-items: start; max-width: none; width: min(var(--max), 100% - 64px); margin-inline: auto; padding-top: 72px; padding-bottom: 56px; }
  .cs-hero .lede { margin-bottom: 0; font-size: 19px; }
  .cs-hero .cs-meta div { padding: 22px 0; font-size: 22px; }
  .cs-hero .cs-meta div:first-child { padding-top: 6px; }
  .cs-hero .cs-stats { grid-column: 1 / -1; margin-top: 56px; }
}
.cs-meta div { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.cs-meta dt { color: var(--muted); }
.cs-meta dd { font-weight: 500; text-align: right; }
.cs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 32px 0 8px; }
.cs-stats .card { padding: 28px 18px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; container-type: inline-size; min-height: 140px; }
.cs-stats strong { display: block; white-space: nowrap; font-size: clamp(22px, 12cqi, 44px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cs-content .cs-stats { grid-template-columns: repeat(2, 1fr); }
.cs-stats span { font-size: 13px; color: var(--muted); }
.cs-content { width: min(760px, 100% - 48px); margin-inline: auto; }
.cs-toggle { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 4px; margin: 24px 0 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.cs-toggle button { position: relative; z-index: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; padding: 10px 22px; border-radius: 999px; cursor: pointer; transition: color 0.25s ease, var(--press); }
.cs-toggle button:active { transform: scale(0.96); }
.cs-toggle button[aria-selected="true"] { color: var(--on-text); }
.cs-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 999px; background: var(--text); transition: transform 280ms var(--ease-in-out), width 280ms var(--ease-in-out); }
.cs-toggle:not(.ready) .cs-pill { transition: none; }
.cs-toggle .eyebrow { padding: 0 14px 0 8px; }
.cs-body h2 { font-size: clamp(26px, 3vw, 34px); font-weight: 500; letter-spacing: -0.02em; margin: 56px 0 16px; }
.cs-body h3 { font-size: 21px; font-weight: 600; margin: 36px 0 10px; }
.cs-body p, .cs-body li { font-size: 17px; line-height: 1.65; color: var(--body); }
.cs-body p + p { margin-top: 14px; }
.cs-body ul, .cs-body ol { padding-left: 20px; display: grid; gap: 12px; margin: 12px 0; }
.cs-body b { color: var(--text); font-weight: 600; }
.cs-body .btn { margin-top: 24px; }
.media { margin: 28px 0; }
.media video, .media img { width: 100%; border-radius: 14px; background: var(--surface); }
.media figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; }
.media.portrait { margin: 0; }
blockquote { margin: 28px 0; padding: 24px 28px; border-left: 2px solid var(--text); background: var(--card); border-radius: 0 var(--radius) var(--radius) 0; }
blockquote p { font-size: 20px !important; color: var(--text) !important; line-height: 1.45 !important; }
blockquote cite { display: block; margin-top: 10px; font-style: normal; font-size: 14px; color: var(--muted); }
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; vertical-align: top; color: var(--body); border-bottom: 1px solid var(--line); line-height: 1.5; }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--text); font-weight: 500; min-width: 160px; }
.cs-cta { margin: 56px 0 16px; text-align: center; }
.cs-note { font-size: 13px; color: var(--muted); text-align: center; }
.cs-gallery { display: grid; gap: 12px; padding: 56px 12px 0; max-width: 1400px; margin: 0 auto; }
.cs-gallery img { width: 100%; border-radius: 12px; }
.cs-more { padding-top: 96px; }
.cs-more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cs-more-grid a { padding: 28px; transition: var(--press), border-color 0.2s; }
.cs-more-grid a:active { transform: scale(0.98); }
.cs-more-grid strong { display: block; font-size: 24px; font-weight: 500; margin-top: 6px; }
@media (max-width: 700px) { .split, .cs-more-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cs-content .cs-stats { grid-template-columns: 1fr; } }

/* Case study table of contents (desktop) */
.cs-toc { display: none; }
.cs-body h2, .cs-body h3 { scroll-margin-top: 110px; }
@media (min-width: 1180px) {
  .cs-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 760px) minmax(0, 1fr); column-gap: 48px; padding-inline: 32px; }
  .cs-layout .cs-hero { grid-column: 1 / -1; grid-row: 1; }
  .cs-layout .cs-content { grid-column: 2; grid-row: 2; width: auto; margin: 0; }
  .cs-layout.no-toc { display: block; }
  .cs-layout.no-toc .cs-content { width: min(760px, 100% - 48px); margin-inline: auto; }
  .cs-layout.no-toc .cs-toc { display: none; }
  .cs-toc { display: block; grid-column: 1; grid-row: 2; justify-self: end; width: min(300px, 100%); align-self: start; position: sticky; top: 112px; max-height: calc(100vh - 140px); overflow-y: auto; padding: 8px 0; }
  .cs-toc ol { list-style: none; position: relative; }
  .cs-toc li a { display: block; padding: 6px 0 6px 18px; font-size: 15px; line-height: 1.35; color: rgba(var(--text-rgb), 0.45); transition: color 0.25s ease, var(--press); }
  .cs-toc li.sub a { padding-left: 32px; font-size: 14px; }
  .cs-toc li a:active { transform: scale(0.98); }
  .cs-toc li a[aria-current="true"] { color: var(--text); }
  .cs-toc-marker { position: absolute; left: 2px; top: 0; width: 6px; height: 6px; border-radius: 1.5px; background: var(--text); transition: transform 280ms var(--ease-in-out), opacity 200ms ease; opacity: 0; }
  .cs-toc.ready .cs-toc-marker { opacity: 1; }
  /* hidden until the visitor starts scrolling, then eases in */
  .cs-toc { opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out); }
  .cs-toc.shown { opacity: 1; transform: none; pointer-events: auto; }
}

/* Theme switch */
.theme-toggle { position: relative; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; transition: background 0.2s, var(--press); -webkit-tap-highlight-color: transparent; }
.theme-toggle:active { transform: scale(0.95); }
.theme-toggle:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.theme-toggle svg { position: absolute; inset: 10px; width: 20px; height: 20px; transition: transform 280ms var(--ease-out), opacity 200ms ease; }
.theme-toggle .sun { opacity: 0; transform: rotate(-60deg) scale(0.9); }
:root[data-theme="light"] .theme-toggle .sun { opacity: 1; transform: none; }
:root[data-theme="light"] .theme-toggle .moon { opacity: 0; transform: rotate(60deg) scale(0.9); }
.header-actions { display: flex; align-items: center; gap: 6px; }
@media (min-width: 861px) { .header-actions { margin-left: 12px; } .site-header .nav { margin-left: auto; } }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Custom cursor (mouse and trackpad only) */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }
  html.has-cursor input, html.has-cursor textarea { cursor: text !important; }
  .cursor { display: block; position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; transition: opacity 150ms ease; will-change: transform; }
  .cursor.hidden { opacity: 0; }
  .cursor-shape {
    position: absolute; left: -38px; top: -38px; width: 76px; height: 76px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--text); color: var(--on-text);
    transform: scale(0.158); /* 12px dot */
    transition: transform 220ms var(--ease-out), background-color 180ms ease, box-shadow 180ms ease;
  }
  .cursor.is-link .cursor-shape { transform: scale(0.526); background: rgba(var(--text-rgb), 0.08); box-shadow: inset 0 0 0 2.8px rgba(var(--text-rgb), 0.5); } /* 40px ring */
  .cursor.has-label .cursor-shape { transform: scale(1); background: var(--text); box-shadow: none; }
  .cursor.pressed .cursor-shape { transform: scale(0.14); }
  .cursor.is-link.pressed .cursor-shape { transform: scale(0.48); }
  .cursor.has-label.pressed .cursor-shape { transform: scale(0.92); }
  .cursor-label { font-size: 13px; font-weight: 600; opacity: 0; transform: scale(0.9); transition: opacity 150ms ease, transform 220ms var(--ease-out); white-space: nowrap; }
  .cursor.has-label .cursor-label { opacity: 1; transform: none; }
  .lightbox .cursor-target { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cursor-shape, .cursor-label { transition: opacity 150ms ease; } }

/* Hover states only on devices that really hover */
@media (hover: hover) and (pointer: fine) {
  .nav a:not(.btn):hover { opacity: 1; }
  .btn:hover { background: var(--text-strong); }
  .btn-ghost:hover { background: rgba(var(--ink-rgb), 0.08); }
  .tabs button:hover { color: var(--text); }
  .site-footer a:hover { color: var(--text); }
  .cs-more-grid a:hover { border-color: rgba(var(--ink-rgb), 0.18); }
  .theme-toggle:hover { background: rgba(var(--ink-rgb), 0.06); }
  .cs-toc li a:hover { color: rgba(var(--text-rgb), 0.8); }
}

@media (max-width: 759px) { .slide { width: 84vw; } .carousel { height: min(64vh, 560px); } }

@media (prefers-reduced-transparency: reduce) {
  .slide { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
