:root {
  color-scheme: dark;
  --background: #171c22;
  --foreground: #f4f1eb;
  --gold: #d8bd90;
  --supporting: #b9bec4;
  --divider: #515253;
  --body-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; background: var(--background); }
body {
  min-height: 100vh;
  color: var(--foreground);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
[hidden],
html:not([data-theme="retro"]) .retro-only,
html[data-theme="retro"] .professional-only { display: none !important; }

.site-header {
  width: min(100% - 6rem, 84rem);
  min-height: 44px;
  margin: 2.25rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  margin: 0;
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brand span {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: normal;
  text-transform: none;
}
.theme-switch {
  display: flex;
  margin-left: auto;
  border: 1px solid #64676b;
  border-radius: 3px;
}
.theme-switch button {
  min-height: 44px;
  padding: 0.6rem 1.4rem;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--foreground);
  font: 600 0.9375rem/1.4 var(--body-font);
  cursor: pointer;
}
.theme-switch button[aria-pressed="true"] {
  color: #171c22;
  background: #eee4d4;
}
.theme-switch button:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.theme-switch button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}

html:not([data-theme="retro"]) .portfolio {
  width: min(100% - 5rem, 78.125rem);
  margin: 7.1rem auto 6rem;
}
html:not([data-theme="retro"]) h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6.12vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
html:not([data-theme="retro"]) .supporting-copy {
  margin: 1.6rem 0 3.8rem;
  color: var(--supporting);
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  line-height: 1.6;
}
html:not([data-theme="retro"]) .project-library {
  padding-top: 1.8rem;
  border-top: 1px solid #72706a;
}
.collection-title {
  margin: 0 0 1.3rem;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-transform: uppercase;
}
html:not([data-theme="retro"]) .project-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
html:not([data-theme="retro"]) .project-item {
  min-width: 0;
  padding: 0.6rem 2.5rem 0;
  border-left: 1px solid var(--divider);
}
html:not([data-theme="retro"]) .project-item:first-child {
  padding-left: 0;
  border-left: 0;
}
html:not([data-theme="retro"]) .project-item:last-child { padding-right: 0; }
html:not([data-theme="retro"]) .project-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--foreground);
  text-decoration: none;
  border-radius: 2px;
}
html:not([data-theme="retro"]) .project-link:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 8px;
}
.project-number {
  color: var(--gold);
  font: 1.0625rem/1.5 ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: 0.04em;
}
.project-icon { width: 56px; height: 56px; margin: 1.6rem 0 1.1rem; }
html:not([data-theme="retro"]) .project-title {
  font-size: clamp(1.5rem, 2.05vw, 1.875rem);
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -0.025em;
}
html:not([data-theme="retro"]) .project-description {
  margin-top: 0.9rem;
  color: var(--supporting);
  font-size: 1.0625rem;
  line-height: 1.6;
}
html:not([data-theme="retro"]) .project-domain {
  margin: 0.35rem 0 1.8rem;
  color: var(--gold);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.project-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  margin-top: auto;
  color: var(--gold);
  font-size: 1.0625rem;
  line-height: 1.5;
}
.project-action img { width: 24px; height: 24px; }
html:not([data-theme="retro"]) .project-link:hover .project-action {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
html:not([data-theme="retro"]) :is(.cartridge-art, .project-shelf, .project-focus-frame) { display: none; }

@media (max-width: 899px) {
  html:not([data-theme="retro"]) .portfolio { margin-top: 4rem; }
  html:not([data-theme="retro"]) h1 { line-height: 1.2; }
  .hero-break { display: none; }
  html:not([data-theme="retro"]) .project-list { grid-template-columns: minmax(0, 1fr); }
  html:not([data-theme="retro"]) .project-item,
  html:not([data-theme="retro"]) .project-item:first-child {
    padding: 1.6rem 0;
    border-left: 0;
    border-bottom: 1px solid var(--divider);
  }
  html:not([data-theme="retro"]) .project-item:last-child { border-bottom: 0; }
  .project-icon { margin-top: 1rem; }
}
@media (max-width: 600px) {
  .site-header { width: calc(100% - 40px); margin-top: 1.5rem; gap: 1.5rem; }
  .brand { gap: 1rem; font-size: 1.35rem; }
  .brand span { font-size: 1rem; }
  .theme-switch { margin-left: 0; }
  .theme-switch button { padding-inline: 1.15rem; }
  html:not([data-theme="retro"]) .portfolio { width: calc(100% - 40px); margin-bottom: 2rem; }
  html:not([data-theme="retro"]) .supporting-copy { margin-bottom: 2.5rem; }
}

/* Existing cartridge presentation: declarations preserved, selectors isolated. */
html[data-theme="retro"] {
  color-scheme: dark;
  --background: #000;
  --cream: #eee4cc;
  --muted-cream: #d8cfba;
  --olive: #a8bd38;
  --olive-dark: #66762b;
  --periwinkle: #8eacff;
  --orange: #ff861f;
  --focus: #fff8e6;
  --display-font: "Cascadia Mono", "Lucida Console", "Courier New", monospace;
  --body-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="retro"] *,
html[data-theme="retro"] *::before,
html[data-theme="retro"] *::after {
  box-sizing: border-box;
}

html[data-theme="retro"] {
  background: var(--background);
  scroll-behavior: smooth;
}

html[data-theme="retro"] body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--cream);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme="retro"] img {
  display: block;
  max-width: 100%;
}

html[data-theme="retro"] .portfolio {
  width: min(100% - 3rem, 88rem);
  margin-inline: auto;
  padding-block: clamp(2.5rem, 6vw, 5.5rem) 1.5rem;
}

html[data-theme="retro"] .intro {
  max-width: 35rem;
  margin-left: clamp(0rem, 3vw, 3rem);
}

html[data-theme="retro"] .identity,
html[data-theme="retro"] h1,
html[data-theme="retro"] .project-title,
html[data-theme="retro"] .project-domain,
html[data-theme="retro"] .keyboard-guidance {
  font-family: var(--display-font);
}

html[data-theme="retro"] .identity {
  margin: 0;
  color: var(--cream);
  font-size: clamp(2.9rem, 6.4vw, 5.1rem);
  font-weight: 900;
  letter-spacing: 0.055em;
  line-height: 0.95;
  text-transform: uppercase;
}

html[data-theme="retro"] .intro-rule {
  display: block;
  width: 4.5rem;
  height: 0.42rem;
  margin-block: clamp(1.15rem, 2vw, 1.5rem) clamp(1.1rem, 1.8vw, 1.25rem);
  background: var(--olive-dark);
}

html[data-theme="retro"] h1 {
  max-width: 27rem;
  margin: 0;
  color: var(--orange);
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.015em;
  line-height: 1.02;
  text-wrap: balance;
}

html[data-theme="retro"] .supporting-copy {
  max-width: 32rem;
  margin: 1rem 0 0;
  color: var(--muted-cream);
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  line-height: 1.45;
}

html[data-theme="retro"] .project-library {
  position: relative;
  margin-top: clamp(0.6rem, 1.2vw, 1rem);
}

html[data-theme="retro"] .project-shelf {
  position: absolute;
  z-index: 2;
  bottom: 0.5rem;
  left: 0;
  width: 100%;
  height: clamp(3.8rem, 5.6vw, 5.6rem);
  object-fit: cover;
  object-position: center 51%;
  image-rendering: pixelated;
  pointer-events: none;
  transition: transform 140ms steps(2, end);
}

html[data-theme="retro"] .project-list {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.45rem, 1.5vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

html[data-theme="retro"] .project-item {
  position: relative;
  min-width: 0;
  padding-bottom: 1.6rem;
}

html[data-theme="retro"] .project-item--olive {
  --accent: var(--olive);
}

html[data-theme="retro"] .project-item--periwinkle {
  --accent: var(--periwinkle);
}

html[data-theme="retro"] .project-item--orange {
  --accent: var(--orange);
}

html[data-theme="retro"] .project-link {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  color: var(--accent);
  text-decoration: none;
  outline: none;
  transition: transform 140ms steps(2, end), filter 140ms linear;
}

html[data-theme="retro"] .project-link:hover {
  transform: translateY(-0.42rem);
  filter: brightness(1.08);
}

html[data-theme="retro"] .project-link:active {
  transform: translateY(-0.15rem) scale(0.99);
  transition-duration: 50ms;
}

html[data-theme="retro"] .project-link:focus-visible {
  filter: drop-shadow(0 0 0.55rem var(--accent));
  transform: translateY(-0.42rem);
}

html[data-theme="retro"] .project-focus-frame {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 1;
  outline: 0.22rem solid transparent;
  outline-offset: 0.35rem;
  pointer-events: none;
  transition: transform 140ms steps(2, end), filter 140ms linear;
}

html[data-theme="retro"] .project-link:hover ~ .project-shelf,
html[data-theme="retro"] .project-link:focus-visible ~ .project-shelf,
html[data-theme="retro"] .project-link:focus-visible ~ .project-focus-frame {
  transform: translateY(-0.42rem);
}

html[data-theme="retro"] .project-link:active ~ .project-shelf {
  transform: translateY(-0.15rem);
  transition-duration: 50ms;
}

html[data-theme="retro"] .project-link:focus-visible ~ .project-focus-frame {
  outline-color: var(--focus);
  filter: drop-shadow(0 0 0.55rem var(--accent));
}

html[data-theme="retro"] .cartridge-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

html[data-theme="retro"] .project-title,
html[data-theme="retro"] .project-description,
html[data-theme="retro"] .project-domain {
  position: absolute;
  z-index: 1;
  left: 22%;
  width: 56%;
  text-align: center;
}

html[data-theme="retro"] .project-title {
  top: 17.4%;
  display: grid;
  min-height: 13.5%;
  place-items: center;
  color: var(--cream);
  font-size: clamp(0.9rem, 2.05vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1.02;
  text-transform: uppercase;
  text-wrap: balance;
}

html[data-theme="retro"] .project-description {
  top: 72.5%;
  color: var(--accent);
  font-size: clamp(0.72rem, 1.25vw, 1.06rem);
  font-weight: 650;
  line-height: 1.25;
  text-wrap: balance;
}

html[data-theme="retro"] .project-domain {
  top: 78.4%;
  color: var(--accent);
  font-size: clamp(0.58rem, 1.02vw, 0.92rem);
  letter-spacing: 0.015em;
  line-height: 1.2;
}

html[data-theme="retro"] .guidance {
  display: grid;
  justify-items: center;
  gap: 1.4rem;
  margin-top: clamp(0.4rem, 1.4vw, 1.2rem);
  text-align: center;
}

html[data-theme="retro"] .guidance p {
  margin: 0;
}

html[data-theme="retro"] .keyboard-guidance {
  padding: 0.52rem 1.25rem;
  border: 0.12rem solid var(--periwinkle);
  color: var(--periwinkle);
  font-size: clamp(0.76rem, 1.5vw, 1rem);
  letter-spacing: 0.075em;
  line-height: 1.2;
}

html[data-theme="retro"] .keyboard-guidance-narrow {
  display: none;
}

html[data-theme="retro"] .motion-guidance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--muted-cream);
  font-size: clamp(0.82rem, 1.3vw, 1rem);
  line-height: 1.45;
}

html[data-theme="retro"] .status-light {
  flex: 0 0 auto;
  width: 0.82rem;
  height: 0.82rem;
  border: 0.18rem solid var(--olive);
  border-radius: 50%;
}

@media (max-width: 62rem) {
  html[data-theme="retro"] .portfolio {
    width: min(100% - 2.5rem, 58rem);
  }

  html[data-theme="retro"] .intro {
    margin-left: 0;
  }

  html[data-theme="retro"] .project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
  }

  html[data-theme="retro"] .project-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc((100% - 1.2rem) / 2);
    justify-self: center;
  }

  html[data-theme="retro"] .project-title {
    font-size: clamp(1rem, 3.2vw, 1.75rem);
  }

  html[data-theme="retro"] .project-description {
    font-size: clamp(0.75rem, 1.8vw, 1rem);
  }

  html[data-theme="retro"] .project-domain {
    font-size: clamp(0.64rem, 1.55vw, 0.88rem);
  }
}

@media (max-width: 38rem) {
  html[data-theme="retro"] .portfolio {
    width: min(100% - 1.5rem, 26rem);
  }

  html[data-theme="retro"] .portfolio {
    padding-top: 2.25rem;
  }

  html[data-theme="retro"] .identity {
    font-size: clamp(2.25rem, 13vw, 3.4rem);
  }

  html[data-theme="retro"] h1 {
    max-width: 21rem;
    font-size: clamp(2rem, 10vw, 2.75rem);
  }

  html[data-theme="retro"] .project-library {
    margin-top: 1.5rem;
  }

  html[data-theme="retro"] .project-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  html[data-theme="retro"] .project-item:last-child:nth-child(odd) {
    grid-column: auto;
    width: auto;
    justify-self: stretch;
  }

  html[data-theme="retro"] .project-shelf {
    bottom: 0.15rem;
    height: 4.6rem;
  }

  html[data-theme="retro"] .project-title {
    font-size: clamp(1rem, 6.1vw, 1.6rem);
  }

  html[data-theme="retro"] .project-description {
    top: 70%;
    left: 14%;
    width: 72%;
    font-size: clamp(0.75rem, 3.2vw, 0.86rem);
  }

  html[data-theme="retro"] .project-domain {
    top: 75.8%;
    left: 14%;
    width: 72%;
    font-size: clamp(0.75rem, 2.9vw, 0.78rem);
  }

  html[data-theme="retro"] .keyboard-guidance-wide {
    display: none;
  }

  html[data-theme="retro"] .keyboard-guidance-narrow {
    display: inline;
  }

  html[data-theme="retro"] .motion-guidance {
    align-items: flex-start;
    text-align: left;
  }

  html[data-theme="retro"] .status-light {
    margin-top: 0.22rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="retro"] {
    scroll-behavior: auto;
  }

  html[data-theme="retro"] .project-link,
html[data-theme="retro"] .project-shelf,
html[data-theme="retro"] .project-focus-frame,
html[data-theme="retro"] .project-link:hover,
html[data-theme="retro"] .project-link:active,
html[data-theme="retro"] .project-link:focus-visible,
html[data-theme="retro"] .project-link:hover ~ .project-shelf,
html[data-theme="retro"] .project-link:active ~ .project-shelf,
html[data-theme="retro"] .project-link:focus-visible ~ .project-shelf,
html[data-theme="retro"] .project-link:focus-visible ~ .project-focus-frame {
    transition: none;
    transform: none;
  }
}
