/* ─── Theme variables ────────────────────────────────────────────────────── */
:root {
  --bg:            #ffffff;
  --bg-alt:        #f4f4f4;
  --surface:       #ebebeb;
  --border:        #d0d0d0;
  --border-strong: #999999;
  --text:          #111111;
  --text-sec:      #3d3d3d;
  --muted:         #777777;
  --accent:        #b07d0a;
  --accent-dim:    rgba(176,125,10,0.10);
  --accent-dim-strong: rgba(176,125,10,0.16);
  --nav-h:         52px;
  --bg-rgb:        255, 255, 255;
}

[data-theme="dark"] {
  --bg:            #0f0f0f;
  --bg-alt:        #181818;
  --surface:       #222222;
  --border:        #2e2e2e;
  --border-strong: #484848;
  --text:          #efefef;
  --text-sec:      #c0c0c0;
  --muted:         #6e6e6e;
  --accent:        #d4a017;
  --accent-dim:    rgba(212,160,23,0.12);
  --accent-dim-strong: rgba(212,160,23,0.20);
  --bg-rgb:        15, 15, 15;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.nav--scrolled {
  background: rgba(var(--bg-rgb), 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.nav-logo {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
  transition: opacity 0.15s;
}
.nav-logo:hover { opacity: 0.75; }
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-links a {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
  transition: color 0.15s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--text); }
.nav-links a.nav-github { color: var(--text); font-weight: 500; }
.nav-links a.nav-github:hover { color: var(--accent); }
.nav-links a.nav-github::after { display: none; }

/* ─── Nav dropdown ───────────────────────────────────────────────────────── */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.nav-dropdown-trigger:hover,
.nav-dropdown.open .nav-dropdown-trigger { color: var(--text); }
.dropdown-chevron {
  width: 9px;
  height: 6px;
  transition: transform 0.2s ease;
}
.nav-dropdown.open .dropdown-chevron { transform: rotate(180deg); }

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  min-width: 190px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  /* closed state */
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
.nav-dropdown.open .nav-dropdown-menu {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}
.nav-dropdown-menu a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  transition: background 0.12s;
}
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover { background: var(--bg-alt); }
.dropdown-item-name {
  font-weight: 500;
  color: var(--text);
}
.dropdown-item-desc {
  font-size: 0.6875rem;
  color: var(--muted);
  font-weight: 400;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.theme-toggle svg { width: 14px; height: 14px; display: block; }

[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none; }

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.nav-hamburger span {
  display: block;
  width: 20px; height: 1.5px;
  background: var(--text);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 3px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-primary:hover {
  opacity: 0.88;
  box-shadow: 0 2px 8px rgba(176,125,10,0.25);
}
[data-theme="dark"] .btn-primary:hover {
  box-shadow: 0 2px 8px rgba(212,160,23,0.25);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.03em;
}
.badge-teal {
  color: var(--accent);
  border-color: var(--accent-dim-strong);
  background: var(--accent-dim);
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
#hero {
  padding-top: var(--nav-h);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 64px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 48px;
}
.hero-content { }
.hero-eyebrow {
  font-size: 0.6875rem;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.07em;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  text-transform: uppercase;
}
.hero-title {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.0;
  margin-bottom: 16px;
  color: var(--text);
}
.hero-desc {
  font-size: 0.9375rem;
  color: var(--text-sec);
  line-height: 1.7;
  margin-bottom: 10px;
  max-width: 460px;
}
.hero-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 24px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}
.hero-cta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hero-screenshot figure {
  border: 1px solid var(--border);
}
.hero-screenshot figcaption {
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  letter-spacing: 0.01em;
}
.hero-screenshot img {
  width: 100%;
  display: block;
}

/* ─── Screenshot wheel carousel ──────────────────────────────────────────── */
.ss-wheel {
  position: relative;
  border: 1px solid var(--border);
}
.ss-wheel-track {
  position: relative;
}
.ss-slide {
  display: none;
  width: 100%;
}
.ss-slide--active {
  display: block;
  animation: ss-fade-in 0.45s ease;
}
@keyframes ss-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.ss-slide img {
  width: 100%;
  display: block;
}
.ss-slide figcaption {
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  letter-spacing: 0.01em;
}
.ss-wheel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}
.ss-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: none;
  background: var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.ss-dot--active {
  background: var(--accent);
  transform: scale(1.25);
}

/* ─── Library overview screenshot ────────────────────────────────────────── */
.lib-screenshot {
  display: block;
  border: 1px solid var(--border);
  margin: 28px 0 32px;
  border-radius: 4px;
  overflow: hidden;
}
.lib-screenshot img {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: cover;
  object-position: top left;
}
.lib-screenshot figcaption {
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  letter-spacing: 0.01em;
}

/* ─── Page transitions ───────────────────────────────────────────────────── */
/* opacity-only: transform on body breaks position:fixed children (scroll bar) */
@keyframes page-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes page-leave {
  to { opacity: 0; }
}

body {
  animation: page-enter 0.35s ease both;
}
html.page-leaving body {
  animation: page-leave 0.22s ease forwards;
  pointer-events: none;
}

/* Smooth theme switching — enabled after initial animation settles */
body.transitions-ready,
body.transitions-ready .nav,
body.transitions-ready figure,
body.transitions-ready figcaption,
body.transitions-ready .problem-section,
body.transitions-ready .cta-section,
body.transitions-ready .pylay-specs > div,
body.transitions-ready .feature-list li,
body.transitions-ready footer {
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.2s ease;
}

/* ─── Scroll progress bar ────────────────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, transparent));
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 101;
  transition: transform 0.06s linear;
}

/* ─── Scroll-reveal ──────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity  0.55s cubic-bezier(0.16,1,0.3,1),
    transform 0.55s cubic-bezier(0.16,1,0.3,1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }

/* ─── Section helpers ────────────────────────────────────────────────────── */
.ch-num {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* ─── Story sections ─────────────────────────────────────────────────────── */
.story-section {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 48px;
  border-bottom: 1px solid var(--border);
}
.story-section--reverse {
  direction: rtl;
  grid-template-columns: 1fr 1.2fr;
}
.story-section--reverse > * { direction: ltr; }

.story-text h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text);
}
.story-text p {
  color: var(--text-sec);
  font-size: 0.9375rem;
  line-height: 1.75;
  margin-bottom: 12px;
}
.story-text p strong { color: var(--text); font-weight: 600; }
.story-text p em { font-style: italic; }

.story-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 22px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 2px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, gap 0.2s ease;
}
.story-link:hover {
  border-bottom-color: var(--accent);
  gap: 8px;
}

/* ─── Figure / screenshots ───────────────────────────────────────────────── */
figure {
  border: 1px solid var(--border);
}
figcaption {
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  letter-spacing: 0.01em;
}
.screenshot-frame,
.screenshot-glow-teal,
.screenshot-glow-purple,
.screenshot-glow-gold {
  display: block;
  width: 100%;
  height: auto;
}

/* ─── Problem section ────────────────────────────────────────────────────── */
.problem-section {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 72px 48px;
}
.problem-inner {
  max-width: 760px;
}
.problem-section h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  color: var(--text);
}
.problem-section p {
  font-size: 0.9375rem;
  color: var(--text-sec);
  line-height: 1.75;
  margin-bottom: 12px;
}
.problem-section p strong { color: var(--text); font-weight: 600; }
.problem-section p em { font-style: italic; }
blockquote {
  margin: 24px 0;
  padding: 14px 18px;
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  font-size: 0.9375rem;
  color: var(--text-sec);
  font-style: italic;
  line-height: 1.75;
}

/* ─── PyLay specs ────────────────────────────────────────────────────────── */
.features-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 48px;
  border-bottom: 1px solid var(--border);
}
.features-section h2 {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  color: var(--text);
}
.pylay-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
}
.pylay-specs > div {
  padding: 20px 22px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.pylay-specs > div:hover { background: var(--bg-alt); }
.pylay-specs > div:nth-child(3n)   { border-right: none; }
.pylay-specs > div:nth-child(n+4)  { border-bottom: none; }
.pylay-specs dt {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.pylay-specs dd {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

/* ─── Pianove section ────────────────────────────────────────────────────── */
.pianove-section {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 64px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 48px;
  border-bottom: 1px solid var(--border);
}
.pianove-section h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text);
}
.pianove-section p {
  color: var(--text-sec);
  font-size: 0.9375rem;
  line-height: 1.75;
  margin-bottom: 12px;
}
.pianove-section p strong { color: var(--text); font-weight: 600; }
.feature-list {
  list-style: none;
  margin: 20px 0 0;
  border: 1px solid var(--border);
}
.feature-list li {
  padding: 10px 14px;
  font-size: 0.8125rem;
  color: var(--text-sec);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background 0.12s, color 0.12s;
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li:hover { background: var(--bg-alt); color: var(--text); }
.feature-list li::before {
  content: '';
  width: 5px; height: 5px;
  background: var(--accent);
  flex-shrink: 0;
  opacity: 0.8;
}

/* ─── CTA section ────────────────────────────────────────────────────────── */
.cta-section {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 72px 48px;
}
.cta-inner {
  max-width: 680px;
}
.cta-section h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  color: var(--text);
}
.cta-section p {
  color: var(--text-sec);
  font-size: 0.9375rem;
  line-height: 1.75;
  margin-bottom: 12px;
}
.cta-section p strong { color: var(--text); font-weight: 600; }
.cta-section p em { font-style: italic; }
.cta-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 28px;
}

/* ─── Story page header ──────────────────────────────────────────────────── */
.story-page-header {
  padding-top: var(--nav-h);
  border-bottom: 1px solid var(--border);
}
.story-page-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 48px 48px;
}
.story-page-title {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.0;
  margin-bottom: 12px;
  color: var(--text);
}
.story-page-desc {
  font-size: 1rem;
  color: var(--text-sec);
  line-height: 1.65;
  max-width: 480px;
}

/* ─── Landing highlights strip ───────────────────────────────────────────── */
.landing-highlights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.landing-highlight {
  padding: 28px 28px;
  border-right: 1px solid var(--border);
}
.landing-highlight:last-child { border-right: none; }
.landing-highlight-value {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 5px;
}
.landing-highlight-label {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ─── Landing projects ───────────────────────────────────────────────────── */
.landing-projects-section {
  border-bottom: 1px solid var(--border);
}
.landing-projects-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 48px;
}
.landing-projects-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 28px;
  opacity: 0.8;
}
.landing-projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
}
.landing-project {
  padding: 28px 28px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.landing-project:last-child { border-right: none; }
.landing-project-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.landing-project-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.landing-project-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.landing-project-desc {
  font-size: 0.875rem;
  color: var(--text-sec);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 18px;
}
.landing-project .story-link { margin-top: 0; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 18px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}
footer a { color: var(--muted); transition: color 0.15s; }
footer a:hover { color: var(--text); }

/* ─── Stub pages ─────────────────────────────────────────────────────────── */
.stub-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  gap: 20px;
}
.stub-page h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.stub-page p { color: var(--muted); font-size: 1rem; max-width: 480px; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 56px 32px;
  }
  .hero-desc { max-width: none; }
  .landing-projects { grid-template-columns: 1fr; }
  .landing-project { border-right: none; border-bottom: 1px solid var(--border); }
  .landing-project:last-child { border-bottom: none; }
  .landing-highlights { grid-template-columns: repeat(2, 1fr); }
  .landing-highlight:nth-child(2) { border-right: none; }
  .landing-highlight:nth-child(3) { border-top: 1px solid var(--border); }
  .landing-highlight:nth-child(4) { border-top: 1px solid var(--border); border-right: none; }
}
@media (max-width: 900px) {
  .story-page-header-inner { padding: 40px 24px 36px; }
  .landing-projects-inner { padding: 48px 24px; }
  .story-section,
  .pianove-section {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 56px 24px;
  }
  .story-section--reverse { direction: ltr; }
  .pylay-specs { grid-template-columns: 1fr 1fr; }
  .pylay-specs > div:nth-child(3n)  { border-right: 1px solid var(--border); }
  .pylay-specs > div:nth-child(2n)  { border-right: none; }
  .pylay-specs > div:nth-child(n+4) { border-bottom: 1px solid var(--border); }
  .pylay-specs > div:nth-child(n+5) { border-bottom: none; }
  .features-section { padding: 56px 24px; }
  .problem-section  { padding: 56px 24px; }
  .cta-section      { padding: 56px 24px; }
}
@media (max-width: 640px) {
  .nav { padding: 0 16px; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 20px; font-size: 0.9375rem; }
  .nav-hamburger { display: flex; }
  /* Mobile dropdown — inline, not absolute */
  .nav-dropdown { width: 100%; }
  .nav-dropdown-trigger { padding: 12px 20px; width: 100%; font-size: 0.9375rem; justify-content: space-between; color: var(--muted); }
  .nav-dropdown-menu {
    position: static;
    transform: none !important;
    left: auto;
    border: none;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    min-width: 0;
    box-shadow: none;
    /* mobile: hide with max-height instead of visibility */
    visibility: visible;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.22s ease;
  }
  .nav-dropdown-menu a { padding: 11px 32px; }
  .nav-dropdown.open .nav-dropdown-menu {
    visibility: visible;
    pointer-events: auto;
    max-height: 200px;
    opacity: 1;
    transform: none;
  }
  .hero-screenshot { display: none; }
  .hero-inner { padding: 36px 20px; }
  .hero-cta { flex-direction: column; }
  .landing-highlights { grid-template-columns: 1fr 1fr; }
  .landing-highlight:nth-child(2) { border-right: none; }
  .landing-highlight:nth-child(3) { border-top: 1px solid var(--border); }
  .landing-highlight:nth-child(4) { border-top: 1px solid var(--border); border-right: none; }
  .pylay-specs { grid-template-columns: 1fr; }
  .pylay-specs > div { border-right: none !important; border-bottom: 1px solid var(--border) !important; }
  .pylay-specs > div:last-child { border-bottom: none !important; }
  footer { flex-direction: column; text-align: center; padding: 16px 20px; }
}

/* ─── Focus states ───────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  body { animation: none; }
}
