/* ==========================================================================
   Design tokens — strict monochromatic palette
   ========================================================================== */
:root {
  --bg:                  #000000;

  --glass-bg:            rgba(255, 255, 255, 0.02);
  --glass-bg-hover:      rgba(255, 255, 255, 0.045);
  --glass-border:        rgba(255, 255, 255, 0.12);
  --glass-border-hover:  rgba(255, 255, 255, 0.22);

  --text-1:              #f5f5f5;
  --text-2:              rgba(255, 255, 255, 0.68);
  --text-3:              rgba(255, 255, 255, 0.42);

  --border-dim:          rgba(255, 255, 255, 0.06);
  --border:              rgba(255, 255, 255, 0.12);
  --border-bright:       rgba(255, 255, 255, 0.22);

  --font-sans:  "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-mono:  "JetBrains Mono", ui-monospace, monospace;

  --max-w:   95rem;
  --nav-h:   4.5rem;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden; /* scroll-container owns all scrolling */
  background: var(--bg);
  /* Barely-visible depth gradient — makes glass cards read against pure black */
  background-image:
    radial-gradient(ellipse 70% 50% at 15%  8%, rgba(255,255,255,0.013) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 85% 92%, rgba(255,255,255,0.008) 0%, transparent 100%);
  color: var(--text-1);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

img    { max-width: 100%; display: block; }
button, a { font: inherit; }
.hidden { display: none !important; }

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon svg {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon[data-icon="x"] svg {
  fill: currentColor;
  stroke: none;
}

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Single-pass silver shimmer that sweeps across the glass surface on hover */
@keyframes shimmer-sweep {
  0%   { transform: translateX(-155%) skewX(-12deg); opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateX(245%)  skewX(-12deg); opacity: 0; }
}

/* ==========================================================================
   Staggered "Rise from Bottom" Scroll Animation Engine
   ========================================================================== */
.slide-content > *:not(.projects-grid),
.projects-grid > * {
  opacity: 0;
  transform: translateY(80px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--stagger, 1) * 150ms);
  will-change: opacity, transform;
}

.slide.is-in-view .slide-content > *:not(.projects-grid),
.slide.is-in-view .projects-grid > * {
  opacity: 1;
  transform: translateY(0);
}

/* Slow breathing pulse on project card borders — cycles opacity 0.12 → 0.055 */
@keyframes border-breathe {
  0%, 100% { border-color: rgba(255, 255, 255, 0.12); }
  50%       { border-color: rgba(255, 255, 255, 0.055); }
}

/* Modal content stagger — used on .modal-content.is-active > * children */
@keyframes modal-fade-up {
  from { opacity: 0; transform: translateY(0.625rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Layout — App Shell
   ========================================================================== */
.app {
  height: 100dvh;
  overflow: hidden;
}

/* ==========================================================================
   Full-Page Scroll Engine
   ========================================================================== */

/* The single scrollable surface */
.scroll-container {
  height: 100dvh;
  overflow-y: scroll;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  /* Hide the scrollbar for a clean presentation look */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scroll-container::-webkit-scrollbar { display: none; }

/* Each full-screen slide */
.slide {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Reserve top padding for the fixed nav */
  padding: calc(var(--nav-h) + 1rem) 1.5rem 2rem;
  box-sizing: border-box;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Inner content wrapper — constrains max-width and stacks children */
.slide-content {
  width: 100%;
  max-width: var(--max-w);
  display: flex;
  flex-direction: column;
}

/* ── Slide 1 : Hero ─────────────────────────────────────────────────────── */
.slide--hero {
  position: relative; /* contains the absolutely-positioned gravity canvas */
}

.slide--hero .slide-content {
  max-width: 85rem;
  gap: 1.5rem;
  position: relative; /* participates in z-index stacking above z-index:0 canvas */
  z-index: 1;
}

/* ── Slide 2 : About ────────────────────────────────────────────────────── */
.slide--about {
  border-top: 1px solid var(--border-dim);
}

.slide--about .slide-content {
  gap: clamp(1.25rem, 2.8vh, 2rem);
}

.about-intro {
  max-width: 64rem;
  margin: 0;
  color: var(--text-2);
  font-size: clamp(1.125rem, 2vw, 1.4rem);
  line-height: 1.75;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

.about-card {
  position: relative;
  min-width: 0;
  padding: 1.25rem 1.375rem;
  overflow: hidden;
  border: 1px solid var(--border-dim);
  background: rgba(255, 255, 255, 0.018);
  transition:
    transform    0.5s cubic-bezier(0.22, 1, 0.36, 1),
    background   0.4s ease,
    box-shadow   0.4s ease,
    border-color 0.4s ease;
}

.about-card::after {
  content: '';
  position: absolute;
  top: -10%;
  left: 0;
  width: 52%;
  height: 120%;
  background: linear-gradient(
    105deg,
    transparent              0%,
    rgba(255,255,255,0.012) 38%,
    rgba(255,255,255,0.032) 50%,
    rgba(255,255,255,0.012) 62%,
    transparent            100%
  );
  pointer-events: none;
  transform: translateX(-155%) skewX(-12deg);
  opacity: 0;
}

.about-card:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.032);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 16px 32px -12px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.about-card:hover::after {
  animation: shimmer-sweep 1.25s ease-out forwards;
}

.about-kicker {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.about-card h3 {
  margin: 0 0 0.5rem;
  color: var(--text-1);
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
}

.about-card p {
  margin: 0;
  color: var(--text-3);
  font-size: 0.95rem;
  line-height: 1.7;
  transition: color 0.4s ease;
}

.about-card:hover p {
  color: var(--text-2);
}

.about-process {
  max-width: 64rem;
  margin: 0;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.975rem;
  line-height: 1.7;
}

@media (min-width: 640px) {
  .about-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .about-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Slide 3 : Projects ─────────────────────────────────────────────────── */
.slide--projects {
  position: relative;
  /* Tall section: snap only at start/end sentinels, not every scroll tick */
  scroll-snap-align: none;
  scroll-snap-stop: normal;
}

.slide--projects .slide-content {
  gap: 2rem;
}

.snap-anchor {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  pointer-events: none;
}

.snap-anchor--start {
  top: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.snap-anchor--end {
  bottom: 0;
  scroll-snap-align: end;
  scroll-snap-stop: always;
}

/* ── Slide 4 : Contact ──────────────────────────────────────────────────── */
.slide--contact {
  border-top: 1px solid var(--border-dim);
}

.slide--contact .slide-content {
  max-width: 36rem;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

/* Contact heading */
.contact-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-style: italic;
  font-weight: 300;
  color: var(--text-1);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

/* Contact CTA links row */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.contact-copy {
  max-width: 30rem;
  margin: 0;
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.7;
}

@media (min-width: 768px) {
  .slide { padding-left: 4rem; padding-right: 4rem; }
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-dim);
}

.nav-inner {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.nav-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(0.75rem, 3.7vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.025em;
  color: var(--text-1);
  white-space: nowrap;
}

.nav-sep {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.1em;
}

.nav-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: none;
}

.nav-links {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}

.nav-workshop {
  display: none;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.25s ease;
}

.nav-workshop:link,
.nav-workshop:visited { color: var(--text-3); }
.nav-workshop:hover { color: var(--text-1); }

@media (min-width: 640px) {
  .nav-workshop { display: inline-flex; }
}

.nav-github {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-decoration: none;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-dim);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.nav-github:link,
.nav-github:visited { color: var(--text-3); }

.nav-github:hover {
  color: var(--text-1);
  border-color: var(--border);
}

@media (min-width: 560px) {
  .nav-role { display: block; }
  .nav-name {
    font-size: 1.125rem;
    letter-spacing: 0.04em;
  }
}

@media (min-width: 768px) {
  .nav-inner { padding: 0 4rem; }
  .main      { padding-left: 4rem; padding-right: 4rem; }
}

/* ==========================================================================
   Hero — child element styles
   ========================================================================== */
.hero-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  margin: 0;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 7rem);
  font-style: italic;
  font-weight: 300;
  line-height: 0.95;
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin: 0;
}

.hero-bio {
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  font-weight: 400;
  color: var(--text-2);
  max-width: 65rem;
  line-height: 1.75;
  margin: 0.5rem 0 0;
}

.blink-cursor {
  animation: blink 1.1s step-end infinite;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  margin-left: 0.2rem;
  color: var(--text-2);
  user-select: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.9375rem 1.875rem;
  background: var(--text-1);
  color: #000;
  border: 1px solid var(--text-1);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.25s ease;
}

.btn-primary:hover { background: rgba(255, 255, 255, 0.84); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.9375rem 1.875rem;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.btn-outline:hover {
  color: var(--text-1);
  border-color: var(--border-bright);
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   Section header
   ========================================================================== */
.section-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-dim);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-style: italic;
  font-weight: 300;
  color: var(--text-1);
  margin: 0;
  line-height: 1.15;
}

/* ==========================================================================
   Projects stage — simple semantic wrapper
   ========================================================================== */
.projects-stage {
  /* Modal overlay handles expanded view; no layout rules needed here */
}

/* ==========================================================================
   Projects grid — standard 2-column layout
   ========================================================================== */
.projects-grid {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

@media (min-width: 820px) {
  .projects-grid {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 3rem;
  }
}

/* ==========================================================================
   Project card — Liquid Glass
   ========================================================================== */
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 65vh;
  width: 100%;
  max-width: 600px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  transition:
    transform    0.55s cubic-bezier(0.22, 1, 0.36, 1),
    background   0.4s  ease,
    box-shadow   0.4s  ease,
    border-color 0.4s  ease;
  animation: border-breathe 6s ease-in-out infinite;
}

/* Background Image Layer */
.project-card .card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--cover-pos, center);
  z-index: 1;
  filter: grayscale(100%) brightness(0.3);
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.8s ease;
  pointer-events: none;
}

/* Silver shimmer pseudo-element — hidden by default, sweeps on hover */
.project-card::after {
  content: '';
  position: absolute;
  top: -10%;
  left: 0;
  width: 52%;
  height: 120%;
  background: linear-gradient(
    105deg,
    transparent              0%,
    rgba(255,255,255,0.022) 38%,
    rgba(255,255,255,0.058) 50%,
    rgba(255,255,255,0.022) 62%,
    transparent            100%
  );
  pointer-events: none;
  z-index: 5;
  transform: translateX(-155%) skewX(-12deg);
  opacity: 0;
}

.project-card:hover {
  animation-play-state: paused;
  border-color: var(--glass-border-hover);
  box-shadow:
    0 0   0 1px rgba(255,255,255,0.045),
    0 28px 56px -8px rgba(0,0,0,0.85),
    inset 0 1px 0   rgba(255,255,255,0.07);
}

.project-card:hover .card-bg {
  transform: scale(1.08);
  filter: grayscale(100%) brightness(0.45);
}

.project-card:hover::after {
  animation: shimmer-sweep 1.1s ease-out forwards;
}

/* ==========================================================================
   Card content (absolutely positioned at the bottom)
   ========================================================================== */
.card-content-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 65%, transparent 100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .card-content-wrapper {
  transform: translateY(-5px);
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-sys-id {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  user-select: none;
}

.card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  text-decoration: none;
  border: 1px solid var(--border-dim);
  padding: 0.3125rem 0.625rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.card-status-badge:hover {
  border-color: var(--border);
  color: var(--text-1);
}

.card-status-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  border: 1px solid var(--border-dim);
  padding: 0.3125rem 0.625rem;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 2.125rem);
  font-style: italic;
  font-weight: 400;
  color: var(--text-1);
  margin: 0;
  line-height: 1.15;
}

.card-tagline {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin: 0;
}

.card-desc {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.75;
  margin: 0;
}

/* Tech stack pills */
.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 9999px;
  white-space: nowrap;
  transition: border-color 0.25s ease, color 0.25s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.project-card:hover .chip {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
}

/* Links row */
.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-dim);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-dim);
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card-link:hover {
  color: var(--text-1);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.02);
}

/* Inspect / expand button */
.inspect-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.8125rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-dim);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  margin-top: 0.375rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.inspect-btn:hover {
  color: var(--text-1);
  border-color: var(--border-bright);
  background: rgba(255, 255, 255, 0.05);
}

.inspect-btn .inspect-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  user-select: none;
}

.inspect-btn .inspect-icon svg {
  display: block;
  flex-shrink: 0;
}

/* ==========================================================================
   Project Modal — Floating Liquid Glass Overlay
   ========================================================================== */

/* Full-screen fixed container */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: none;
  visibility: hidden;
  /* Delay visibility so child transitions fully complete on close */
  transition: visibility 0s linear 0.42s;
}

.modal-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
  transition-delay: 0s;
}

/* Blurred dark backdrop — click area for closing */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.modal-overlay.is-open .modal-backdrop {
  opacity: 1;
}

/* Premium glass card — scales up and fades in from slightly below */
.modal-card {
  position: relative;
  width: 90%;
  max-width: 1000px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0   rgba(255, 255, 255, 0.08),
    inset 1px 0 0   rgba(255, 255, 255, 0.04),
    inset -1px 0 0  rgba(255, 255, 255, 0.02),
    0 0 0 1px       rgba(255, 255, 255, 0.04),
    0 40px 80px -8px rgba(0, 0, 0, 0.92),
    0 8px 32px       rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity   0.42s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: 0.06s;
  overflow: hidden;
}

.modal-overlay.is-open .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Non-scrolling top region — contains image banner and close button */
.modal-top {
  position: relative;
  flex-shrink: 0;
}

/* Close button — pinned to the gallery corner, optically centered × */
.modal-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  width: 2.125rem;
  height: 2.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.modal-close-btn svg {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* Gallery carousel — one slide at a time, horizontal scroll-snap */
.modal-image-gallery {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  padding: 0;
  background: #060606;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  scrollbar-width: none;
  padding-bottom: 2.75rem;
}

.modal-image-gallery::-webkit-scrollbar { display: none; }

.glass-image-wrapper {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  min-height: 240px;
}

.glass-image-wrapper::after {
  content: '';
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.glass-image-wrapper:hover::after {
  left: 150%;
}

.carousel-image {
  height: 280px;
  max-width: calc(100% - 2rem);
  width: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass-image-wrapper:hover .carousel-image {
  transform: scale(1.02);
}

/* Placeholder shown until a slide's image arrives */
.glass-image-wrapper.is-loading::before {
  content: '';
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  animation: gallery-loading 1.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes gallery-loading {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .glass-image-wrapper.is-loading::before { animation: none; }
}

@media (max-width: 600px) {
  .carousel-image { height: 200px; }
  .glass-image-wrapper { min-height: 200px; }
}

/* Carousel controls — prev / dots / next */
.carousel-controls {
  position: absolute;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.3rem 0.45rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.carousel-controls[hidden] {
  display: none;
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.carousel-dot.is-active {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(1.2);
}

.carousel-nav {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.carousel-nav:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.carousel-nav:disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}

/* Avoid pixelation on animated GIF slides */
.glass-image-wrapper:hover .carousel-image[src$=".gif"] {
  transform: none;
}

/* Desktop side-by-side: gallery column + scrollable description */
@media (min-width: 900px) {
  .modal-card.layout-side {
    display: grid;
    grid-template-columns: minmax(280px, 40%) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    max-width: 1100px;
    max-height: 85vh;
    align-items: stretch;
  }

  .modal-card.layout-side.gallery-right {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 40%);
  }

  .modal-card.layout-side .modal-top {
    grid-row: 1;
    grid-column: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  .modal-card.layout-side.gallery-right .modal-top {
    grid-column: 2;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
  }

  .modal-card.layout-side .modal-body {
    grid-row: 1;
    grid-column: 2;
    min-height: 0;
    max-height: 85vh;
  }

  .modal-card.layout-side.gallery-right .modal-body {
    grid-column: 1;
  }

  .modal-card.layout-side .modal-image-gallery {
    flex: 1;
    min-height: 0;
    height: 100%;
    border-bottom: none;
    padding-bottom: 3rem;
  }

  .modal-card.layout-side .glass-image-wrapper {
    min-height: 100%;
    height: 100%;
    align-self: stretch;
  }

  .modal-card.layout-side .carousel-image {
    height: auto;
    max-height: min(70vh, 560px);
    max-width: calc(100% - 2rem);
    width: auto;
  }
}

/* Desktop stacked: 16:9 gallery banner above the description */
.modal-card.layout-stack {
  max-width: 1100px;
}

.modal-card.layout-stack .modal-top {
  flex-shrink: 0;
}

.modal-card.layout-stack .modal-image-gallery {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-card.layout-stack .glass-image-wrapper {
  min-height: 0;
  height: min(48vh, 520px);
}

.modal-card.layout-stack .carousel-image {
  height: auto;
  width: auto;
  max-height: 100%;
  max-width: calc(100% - 2rem);
  object-fit: contain;
}

/* Scrollable body — grows to fill remaining card height */
.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem 1.875rem 1.875rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

@media (min-width: 768px) {
  .modal-body { padding: 2rem 2.25rem 2.25rem; }
}

.modal-body::-webkit-scrollbar       { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* Per-project content block — only one shown at a time */
.modal-content {
  display: none;
  flex-direction: column;
  gap: 1.375rem;
}

.modal-content.is-active { display: flex; }

/* Stagger entrance — each direct child slides up sequentially as the modal opens */
.modal-content.is-active > * {
  animation: modal-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.modal-content.is-active > *:nth-child(1) { animation-delay: 0.15s; }
.modal-content.is-active > *:nth-child(2) { animation-delay: 0.22s; }
.modal-content.is-active > *:nth-child(3) { animation-delay: 0.29s; }
.modal-content.is-active > *:nth-child(4) { animation-delay: 0.35s; }
.modal-content.is-active > *:nth-child(5) { animation-delay: 0.41s; }
.modal-content.is-active > *:nth-child(6) { animation-delay: 0.47s; }
.modal-content.is-active > *:nth-child(7) { animation-delay: 0.53s; }

/* Meta row: sys-id + status/link badge(s) */
.modal-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-meta-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.modal-sys-id {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  user-select: none;
}

/* Title group */
.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 2.125rem);
  font-style: italic;
  font-weight: 400;
  color: var(--text-1);
  margin: 0;
  line-height: 1.1;
}

.modal-tagline {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin: 0;
}

/* Links row inside modal */
.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-dim);
}

/* Shared content styles — reused for capabilities, spec, and tags */
.details-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  margin: 0;
}

.capabilities-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.capabilities-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.65;
}

.cap-idx {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 1px;
  user-select: none;
}

.details-spec-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.125rem;
}

@media (min-width: 480px) {
  .details-spec-row { grid-template-columns: 3fr 2fr; }
}

.details-spec-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.details-block-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin: 0;
}

.details-block-text {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.75;
  margin: 0;
  border-left: 1px solid var(--border-dim);
  padding-left: 0.875rem;
}

.details-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.625rem;
}

.detail-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-3);
  transition: color 0.2s ease;
  cursor: default;
}

.detail-tag:hover { color: var(--text-2); }

/* ==========================================================================
   Footer / Contact — shared typographic atoms
   ========================================================================== */
.footer-copy {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: center;
  margin: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.footer-link {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--text-3);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.footer-link:hover { color: var(--text-1); }

/* ==========================================================================
   Gravity Canvas — Passive N-body orbital mechanics background (hero only)
   position: absolute within .slide--hero (which is position: relative).
   z-index: 0 keeps it below .slide--hero .slide-content (z-index: 1).
   pointer-events: none — all interactions pass through to content above.
   ========================================================================== */
#gravity-canvas {
  position: absolute;
  inset: 0;
  width: 100%;   /* explicit CSS override — prevents default 300px intrinsic width */
  height: 100%;  /* from interfering with the inset:0 stretch                      */
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* Hide on very small phones where canvas adds visual noise */
@media (max-width: 479px) {
  #gravity-canvas { display: none; }
}

/* ==========================================================================
   Orrery — Orbital scroll progress indicator
   Fixed to the right edge; hidden below 1024 px (not enough horizontal room).
   The active orbit eases into a brighter, slightly thicker highlight.
   ========================================================================== */
.orrery {
  position: fixed;
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 160px;
  height: 160px;
  display: none;
}

@media (min-width: 1024px) {
  .orrery { display: block; }
}

/* Tablet / large phone — show in bottom-right corner, smaller */
@media (min-width: 480px) and (max-width: 1023px) {
  .orrery {
    display: block;
    right: 1rem;
    top: auto;
    bottom: 1.75rem;
    transform: none;
    width: 100px;
    height: 100px;
  }
}

.orrery svg {
  overflow: visible;
  display: block;
  width: 100%;
  height: 100%;
}

.orrery-ring {
  stroke-opacity: 0.25;
  stroke-width: 1.2;
  transition:
    stroke-opacity 650ms cubic-bezier(0.22, 1, 0.36, 1),
    stroke-width 650ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 650ms ease;
}

.orrery-ring.is-active {
  stroke-opacity: 0.85;
  stroke-width: 1.7;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.28));
}

.orrery-dot {
  fill-opacity: 0.45;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    fill-opacity 500ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.orrery-dot.is-active {
  fill-opacity: 1;
  transform: scale(1.45);
}

.orrery-hit  { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .scroll-container {
    scroll-snap-type: none;
    scroll-behavior: auto;
  }

  .about-card:hover {
    transform: none;
  }

  .about-card:hover::after {
    animation: none;
  }

  .orrery-ring,
  .orrery-dot {
    transition: none;
  }

  .hero-clue-arrow { animation: none; }
  .workshop-portal.is-dock,
  .workshop-portal.is-dock.is-open { transition: none; }
}

/* ==========================================================================
   Terminal Window — ScholiLink Firebase boot sequence
   Lives as first child of #mcontent-sl inside the scrollable modal body.
   letter-spacing: 0 on all output lines for authentic raw CLI density.
   ========================================================================== */
.terminal-window {
  background: #040404;
  border: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  height: 230px;
  overflow: hidden;
  flex-shrink: 0;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}

.terminal-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-3);
  user-select: none;
}

.terminal-replay-btn {
  background: none;
  border: 1px solid var(--border-dim);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0;
  padding: 0.2rem 0.625rem;
  cursor: pointer;
  line-height: 1.5;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.terminal-replay-btn:hover {
  color: var(--text-1);
  border-color: var(--border);
}

.terminal-body {
  flex: 1;
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.75rem 1rem 0.75rem;
}

.terminal-body::-webkit-scrollbar { display: none; }

.t-line {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.55;
  letter-spacing: 0;
  white-space: pre;
}

.t-line--blank { height: 0.65em; }
.t-line--cmd   { color: var(--text-2); }
.t-line--ok    { color: #4ade80; }
.t-line--info  { color: var(--text-2); }
.t-line--meta  { color: var(--text-3); }
.t-line--fn    { color: rgba(165, 180, 252, 0.85); }

.terminal-cursor {
  display: inline-block;
  width: 6px;
  height: 1em;
  background: var(--text-2);
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}

/* ==========================================================================
   Category Dividers — Grouping Software & Hardware
   ========================================================================== */
.category-divider {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  margin-top: 3.5rem;
  margin-bottom: 1.5rem;
}

.category-divider::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background: var(--border-dim);
}

.category-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-2);
  user-select: none;
}

/* ==========================================================================
   Hardware Media Grid — Custom detail showcase
   ========================================================================== */
.hw-media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .hw-media-grid {
    grid-template-columns: 1.35fr 1fr; /* Optimized ratio: wider for the landscape GIF, narrower for the vertical install photo */
    height: 380px; /* Uniform height for both side-by-side columns */
  }
}

.hw-media-pane {
  position: relative;
  background: #020202;
  border: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4px;
}

.hw-media-pane.main-pane {
  height: 250px; /* Mobile fallback height */
}

@media (min-width: 768px) {
  .hw-media-pane.main-pane {
    height: 100%; /* Spans full height of the parent grid */
  }
}

.hw-media-label {
  font-family: var(--font-mono);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-3);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(255, 255, 255, 0.02);
  z-index: 2;
  user-select: none;
}

.hw-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hw-placeholder-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}

.hw-placeholder-text {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--text-3);
  text-align: center;
  padding: 0 1rem;
}

/* User-inserted image styling inside panes */
.hw-media-pane img {
  position: absolute;
  top: 30px; /* leaves space for the label */
  left: 0;
  width: 100%;
  height: calc(100% - 30px);
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Optimize the 3D cad animation layout so it centers and contains correctly, avoiding ugly stretches/crops */
.hw-media-pane.main-pane img[src$=".gif"] {
  object-fit: contain;
  background: #080808;
}

.hw-media-pane:hover img {
  transform: scale(1.03);
}

/* Prevent scaling and active zoom hover effects for GIFs to avoid rendering pixelation */
.hw-media-pane img[src$=".gif"] {
  transition: none !important;
}

.hw-media-pane:hover img[src$=".gif"] {
  transform: none !important;
}

/* ==========================================================================
   Workshop entrance — a quiet secondary CTA and a short transition.
   The workshop itself (Three.js) only loads on /workshop/.
   ========================================================================== */
.workshop-veil {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease 0.18s, visibility 0s linear 0.63s;
}

.workshop-veil-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease 0.32s, transform 0.3s ease 0.32s;
}

body.is-entering-workshop .workshop-veil {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease 0.18s, visibility 0s;
}

body.is-entering-workshop .workshop-veil-label {
  opacity: 1;
  transform: none;
}

/* The hero orbits converge on their star before the page goes dark */
#gravity-canvas {
  transform-origin: 72% 50%;
  transition: transform 0.6s cubic-bezier(0.55, 0, 0.75, 0.2), opacity 0.5s ease 0.1s;
}

body.is-entering-workshop #gravity-canvas,
body.is-portal-jump #gravity-canvas {
  transform: scale(0.06);
  opacity: 0;
}

/* ==========================================================================
   The portal — a wormhole / time-machine dial at the centre of the hero's
   orbits. script.js draws it on the canvas; without JS it is a CSS disc and
   the whole thing is still a plain link to /workshop/.
   ========================================================================== */
.workshop-portal {
  --portal: clamp(160px, 46vw, 240px);
  position: relative;
  z-index: 2;
  display: block;
  width: var(--portal);
  height: var(--portal);
  margin: 0.5rem auto 1.75rem;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text-1);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.7s;
}

.slide--hero.is-in-view .workshop-portal { opacity: 1; }

/* Wide screens show the orrery as section nav. Keep the portal out of the
   hero flow even before JS docks it, or when hover/pointer media fails. */
@media (min-width: 1024px) {
  .slide--hero .workshop-portal:not(.is-dock) {
    position: absolute;
    width: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* No-JS look, and the surface under the canvas */
.workshop-portal::before {
  content: '';
  position: absolute;
  inset: 17%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3dd 0, rgba(255, 226, 184, 0.55) 16%, #050505 62%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 46px rgba(255, 226, 184, 0.22);
}

.portal-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.portal-caption {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.1rem);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  transition: color 0.3s ease, letter-spacing 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-caption-arrow { display: inline-block; transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }

.workshop-portal:hover .portal-caption,
.workshop-portal:focus-visible .portal-caption { color: var(--text-1); letter-spacing: 0.24em; }
.workshop-portal:hover .portal-caption-arrow,
.workshop-portal:focus-visible .portal-caption-arrow { transform: translateX(4px); }

.workshop-portal:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.9);
  outline-offset: 8px;
}

.workshop-portal.is-diving { visibility: hidden; transition: none; }

/* The jump: a full-screen canvas takes over from the small one */
.portal-fx {
  position: fixed;
  inset: 0;
  z-index: 299;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Hero copy leaves while the orbits fall into the portal */
body.is-portal-jump .slide--hero .slide-content > * {
  opacity: 0 !important;
  transition: opacity 0.45s ease !important;
  transition-delay: 0s !important;
}

/* Wide screens: the title breathes and the copy keeps to the left */
@media (min-width: 900px) {
  .slide--hero .slide-content > * { max-width: min(46rem, 56%); }
  .slide--hero .hero-title { font-size: clamp(3rem, 6.2vw, 5.75rem); }
}

/* Docked: with a mouse on a wide screen the portal is not in the hero at all. The
   orrery on the right edge becomes the portal when the cursor rests on it
   (script.js adds .portal-dock to <html> and moves the link to <body>). */
.workshop-portal.is-dock {
  --portal: clamp(230px, 30vmin, 310px);
  position: fixed;
  z-index: 21;
  top: 50%;
  right: 1rem;
  left: auto;
  margin: 0;
  transform: translateY(-50%) scale(0.35);
  transform-origin: 82% 50%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease, visibility 0s linear 0.55s;
}

.workshop-portal.is-dock.is-open {
  transform: translateY(-50%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease, visibility 0s;
}

.workshop-portal.is-dock.is-diving { visibility: hidden; transition: none; }

/* the orrery steps aside while the portal is out, and charges as the cursor rests on it */
.orrery { transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.portal-dock .orrery.is-hidden { opacity: 0; pointer-events: none; transform: translateY(-50%) scale(0.7); }

.orrery-charge {
  stroke-opacity: 0;
  stroke-dasharray: 396;
  stroke-dashoffset: 396;
  transform: rotate(-90deg);
  transition: stroke-opacity 0.25s ease, stroke-dashoffset 0s linear 0.25s;
}

.portal-dock .orrery.is-charging .orrery-charge {
  stroke-opacity: 0.7;
  stroke-dashoffset: 0;
  transition: stroke-opacity 0.2s ease, stroke-dashoffset var(--dwell, 600ms) linear;
}

/* The hero's clue to the portal */
.hero-clue {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.9375rem 0.5rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.5;
}

.hero-clue-dock { display: none; }
.hero-clue-flow { display: inline; }

@media (min-width: 1024px) {
  .hero-clue-dock { display: inline; }
  .hero-clue-flow { display: none; }
}

.hero-clue-arrow {
  display: inline-block;
  animation: clue-nudge 2.4s ease-in-out infinite;
}

.hero-clue-arrow--up { animation-name: clue-nudge-up; }

@keyframes clue-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
@keyframes clue-nudge-up { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .workshop-veil,
  .workshop-veil-label,
  #gravity-canvas,
  .workshop-portal,
  .portal-caption,
  .portal-caption-arrow {
    animation: none;
    transition: none;
  }
}




