:root {
  color-scheme: dark;
  --bg: #050908;
  --panel: rgba(7, 18, 16, 0.86);
  --panel-strong: rgba(4, 12, 11, 0.96);
  --ink: #e7fff2;
  --muted: #9bb8aa;
  --green: #00ff88;
  --green-soft: #62f7ae;
  --cyan: #6de5ff;
  --line: rgba(0, 255, 136, 0.23);
  --line-strong: rgba(0, 255, 136, 0.55);
  --shadow: 0 18px 80px rgba(0, 0, 0, 0.48);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  background-image: linear-gradient(rgba(0, 255, 136, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 255, 136, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
  opacity: 0.6;
  pointer-events: none;
  position: fixed;
  z-index: -2;
}

body::after {
  background: radial-gradient(circle at 50% 0%, rgba(0, 255, 136, 0.1), transparent 42%), radial-gradient(circle at 90% 60%, rgba(109, 229, 255, 0.05), transparent 28%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: -3;
}

a { color: var(--green-soft); }
a:hover { color: var(--ink); }

button, input { font: inherit; }

button {
  border: 0;
  cursor: pointer;
}

.skip-link {
  background: var(--green);
  color: #00140b;
  left: 1rem;
  padding: 0.5rem 0.8rem;
  position: fixed;
  top: -5rem;
  z-index: 20;
}

.skip-link:focus { top: 1rem; }

#matrix-canvas {
  height: 100vh;
  inset: 0;
  opacity: 0.42;
  pointer-events: none;
  position: fixed;
  width: 100vw;
  z-index: -1;
}

.site-shell { margin: 0 auto; max-width: 1240px; padding: 0 1.4rem; }

.site-header {
  align-items: center;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  padding: 1.25rem 0;
}

.brand {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand-mark { color: var(--green); }

.site-nav { align-items: center; display: flex; gap: 1rem; }
.site-nav a { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.07em; text-decoration: none; text-transform: uppercase; }

.motion-toggle,
.button-secondary,
.button-primary,
.gallery-control {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  display: inline-flex;
  gap: 0.55rem;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6rem 0.9rem;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.motion-toggle, .button-secondary, .gallery-control { background: rgba(0, 255, 136, 0.045); color: var(--green-soft); }
.button-primary { background: var(--green); color: #00140b; font-family: var(--mono); font-weight: 700; text-decoration: none; }
.motion-toggle:hover, .button-secondary:hover, .gallery-control:hover { background: rgba(0, 255, 136, 0.13); color: var(--ink); }
.button-primary:hover { background: var(--ink); color: #00140b; }
.motion-toggle:focus-visible, .button-secondary:focus-visible, .button-primary:focus-visible, .gallery-control:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.eyebrow, .terminal-label {
  color: var(--green-soft);
  font-family: var(--mono);
  font-size: 0.73rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero { min-height: 67vh; padding: 8rem 0 5rem; }
.hero-grid { align-items: end; display: grid; gap: 3rem; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr); }
.hero h1 { font-family: var(--mono); font-size: clamp(3.2rem, 11vw, 8.4rem); letter-spacing: -0.09em; line-height: 0.86; margin: 0.65rem 0 1.6rem; max-width: 9ch; text-shadow: 0 0 38px rgba(0, 255, 136, 0.24); }
.hero h1 span { color: var(--green); }
.hero-lede { color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.35rem); max-width: 42rem; }
.hero-console { border-left: 1px solid var(--line-strong); padding: 0 0 0 1.4rem; }
.hero-console p { color: var(--muted); font-family: var(--mono); font-size: 0.84rem; margin: 0.8rem 0; }
.hero-console strong { color: var(--ink); font-weight: 500; }
.cursor { animation: blink 1.1s steps(2, jump-none) infinite; color: var(--green); }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 1.8rem 0 0; padding: 0; }
.tag-list li { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: var(--mono); font-size: 0.72rem; padding: 0.3rem 0.6rem; }

.lab-entry {
  align-items: center;
  background: linear-gradient(110deg, rgba(0, 255, 136, 0.09), rgba(3, 14, 10, 0.85));
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  color: var(--ink);
  display: grid;
  font-family: var(--mono);
  gap: 1rem;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  margin-top: 2rem;
  max-width: 31rem;
  padding: 1rem 1.15rem;
  position: relative;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.lab-entry::before { background: var(--green); bottom: 1rem; content: ""; left: -1px; position: absolute; top: 1rem; width: 2px; }
.lab-entry-rabbit { color: #f1fff7; display: block; height: 42px; width: 42px; filter: drop-shadow(0 0 7px rgba(165, 255, 208, 0.3)); }
.lab-entry-copy { display: flex; flex-direction: column; gap: 0.35rem; }
.lab-entry-title { font-size: clamp(0.85rem, 2.3vw, 1.05rem); font-weight: 600; line-height: 1.5; }
.lab-entry-destination { color: var(--green-soft); font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; }
.lab-entry-arrow { color: var(--green); font-size: 1.2rem; transition: transform 160ms ease; }
.lab-entry:hover, .lab-entry:focus-visible { background: rgba(0, 255, 136, 0.13); border-color: var(--green); box-shadow: 0 0 30px rgba(0, 255, 136, 0.12); color: #fff; }
.lab-entry:hover .lab-entry-arrow { transform: translateX(3px); }
@media (max-width: 420px) {
  .lab-entry { gap: 0.7rem; grid-template-columns: 34px minmax(0, 1fr) 16px; padding: 0.9rem; }
  .lab-entry-rabbit { height: 34px; width: 34px; }
  .lab-entry-destination { font-size: 0.59rem; letter-spacing: 0.06em; }
}

.panel {
  background: linear-gradient(140deg, rgba(10, 31, 25, 0.78), var(--panel));
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
}

.panel::before { background: var(--green); content: ""; height: 2px; left: 1.25rem; position: absolute; top: -1px; width: 3rem; }
.panel-inner { padding: clamp(1.2rem, 4vw, 2.5rem); }
.panel h2, .gallery-heading h1 { font-family: var(--mono); font-size: clamp(1.35rem, 3vw, 2.1rem); letter-spacing: -0.04em; margin: 0 0 1.1rem; }
.panel h2::before, .gallery-heading h1::before { color: var(--green); content: "// "; }
.about-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) minmax(180px, 0.32fr); }
.about-copy { color: var(--muted); font-size: 1.03rem; margin: 0; max-width: 78ch; text-wrap: pretty; }
.about-copy p { margin: 0 0 1rem; text-wrap: pretty; }
.about-copy p:last-child { margin-bottom: 0; }
.about-copy.is-changing { opacity: 0.35; transition: opacity 140ms ease; }
.about-controls { align-items: end; display: flex; flex-direction: column; gap: 0.85rem; justify-content: end; }
.toggle-label { align-items: center; color: var(--muted); display: inline-flex; font-family: var(--mono); font-size: 0.75rem; gap: 0.55rem; }
.toggle-label input { accent-color: var(--green); height: 1.1rem; width: 1.1rem; }

.home-footer { color: var(--muted); display: flex; font-family: var(--mono); font-size: 0.72rem; justify-content: space-between; padding: 2rem 0; }
.home-footer a { text-decoration: none; }

.gallery-page .site-shell { max-width: 1320px; }
.gallery-heading { align-items: end; display: flex; gap: 2rem; justify-content: space-between; padding: 5rem 0 2rem; }
.gallery-heading p { color: var(--muted); margin: 0; max-width: 36rem; }
.gallery-tools { align-items: center; display: flex; gap: 0.7rem; justify-content: space-between; margin-bottom: 1.2rem; }
.album-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.album-nav a { border-bottom: 1px solid transparent; font-family: var(--mono); font-size: 0.78rem; padding: 0.3rem 0; text-decoration: none; }
.album-nav a[aria-current="page"] { border-color: var(--green); color: var(--ink); }
.gallery-note { color: var(--muted); font-family: var(--mono); font-size: 0.73rem; }

.photo-grid { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.photo-card { min-width: 0; }
.photo-link { background: #07100e; border: 1px solid var(--line); border-radius: 0.65rem; display: block; overflow: hidden; position: relative; text-decoration: none; }
.photo-link:hover { border-color: var(--green); box-shadow: 0 0 24px rgba(0, 255, 136, 0.16); transform: translateY(-2px); }
.photo-frame { aspect-ratio: 4 / 3; background: linear-gradient(135deg, #0b1c18, #020504); display: block; overflow: hidden; }
.photo-frame picture { display: block; height: 100%; }
.photo-frame img { display: block; height: 100%; object-fit: cover; transition: transform 300ms ease; width: 100%; }
.photo-link:hover img { transform: scale(1.035); }
.photo-caption { background: linear-gradient(transparent, rgba(0, 0, 0, 0.86)); bottom: 0; color: var(--ink); font-family: var(--mono); font-size: 0.72rem; left: 0; padding: 2.7rem 0.7rem 0.65rem; position: absolute; right: 0; }
.photo-number { color: var(--green-soft); font-size: 0.65rem; margin-right: 0.35rem; }

.pagination { align-items: center; display: flex; gap: 0.7rem; justify-content: center; padding: 2.2rem 0 3.5rem; }
.pagination a, .pagination span { align-items: center; border: 1px solid var(--line); border-radius: 0.4rem; display: inline-flex; font-family: var(--mono); font-size: 0.78rem; justify-content: center; min-height: 2.5rem; min-width: 2.5rem; padding: 0.35rem 0.7rem; text-decoration: none; }
.pagination span { background: rgba(0, 255, 136, 0.16); border-color: var(--green); color: var(--ink); }

.photo-dialog { background: var(--panel-strong); border: 1px solid var(--line-strong); border-radius: 0.7rem; color: var(--ink); height: min(92vh, 900px); max-height: 92vh; max-width: min(1100px, calc(100vw - 2rem)); padding: 0; width: min(1100px, calc(100vw - 2rem)); }
.photo-dialog::backdrop { background: rgba(0, 4, 3, 0.88); backdrop-filter: blur(10px); }
.dialog-layout { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.dialog-header, .dialog-footer { align-items: center; display: flex; justify-content: space-between; padding: 0.8rem 1rem; }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-title { font-family: var(--mono); font-size: 0.8rem; }
.dialog-close, .dialog-arrow { align-items: center; background: rgba(0, 255, 136, 0.08); border: 1px solid var(--line-strong); border-radius: 0.4rem; color: var(--green-soft); display: inline-flex; justify-content: center; min-height: 2.75rem; min-width: 2.75rem; }
.dialog-close:hover, .dialog-arrow:hover { background: var(--green); color: #00140b; }
.dialog-stage { align-items: center; display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem; min-height: 0; padding: 0.8rem; }
.dialog-image-wrap { align-items: center; display: flex; height: 100%; justify-content: center; min-height: 220px; overflow: hidden; position: relative; }
.dialog-image { display: block; max-height: 100%; max-width: 100%; object-fit: contain; }
.dialog-status { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; left: 50%; position: absolute; top: 50%; transform: translate(-50%, -50%); }
.dialog-status[hidden] { display: none; }
.dialog-footer { border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 0.73rem; gap: 1rem; }
.dialog-caption { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { color: var(--muted); padding: 3rem 0; text-align: center; }
.sr-only { clip: rect(0, 0, 0, 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }

@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 900px) {
  .hero { padding-top: 5rem; }
  .hero-grid, .about-layout { grid-template-columns: 1fr; }
  .hero-console { border-left: 0; border-top: 1px solid var(--line); padding: 1.2rem 0 0; }
  .about-controls { align-items: start; flex-direction: row; flex-wrap: wrap; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-shell { padding: 0 1rem; }
  .site-header { align-items: flex-start; flex-wrap: wrap; gap: 0.8rem; }
  .site-nav { width: 100%; }
  .site-nav .motion-toggle { margin-left: auto; }
  .hero { min-height: auto; padding: 4rem 0 3rem; }
  .hero h1 { font-size: clamp(3.1rem, 19vw, 5rem); }
  .hero-lede { font-size: 1rem; }
  .gallery-heading { align-items: start; flex-direction: column; gap: 0.6rem; padding-top: 3rem; }
  .gallery-tools { align-items: start; flex-direction: column; }
  .photo-grid { gap: 0.65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-caption { font-size: 0.65rem; padding-left: 0.45rem; }
  .dialog-stage { grid-template-columns: 2.8rem minmax(0, 1fr) 2.8rem; padding: 0.35rem; }
  .dialog-footer { align-items: start; flex-direction: column; gap: 0.3rem; }
  .dialog-caption { max-width: 100%; width: 100%; }
  .home-footer { align-items: start; flex-direction: column; gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}
