/* ═══ Game Boy portfolio — tokens, base and console shell ═══ */

:root {
  /* LCD palette (4 shades of the DMG screen) */
  --lcd-0: #0f380f;
  --lcd-1: #306230;
  --lcd-2: #8bac0f;
  --lcd-3: #9bbc0f;
  --lcd-4: #b4cf3c;           /* highlight, hover */
  --ink: #0f380f;             /* primary text on LCD */
  --ink-2: #1f4a1f;           /* secondary text on LCD (≥4.5:1 on --lcd-3) */

  /* Plastic shell */
  --shell-hi: #dedad2;
  --shell: #c8c8be;
  --shell-lo: #aeaea0;
  --shell-shadow: #909088;
  --bezel: #7a7a72;
  --purple: #6a5acd;
  --blue: #3355aa;
  --btn-red: #a22;
  --gold: #ffd700;

  --px: 3px;                  /* pixel unit for borders */
  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  --font-body: 'VT323', 'Courier New', monospace;
  --page-bg: #0d1a05;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 21px;
  line-height: 1.3;
  color: var(--ink);
  background-color: var(--page-bg);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(155, 188, 15, .12) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(155, 188, 15, .08) 0%, transparent 40%),
    repeating-linear-gradient(0deg, transparent 0 40px, rgba(155, 188, 15, .02) 40px 41px),
    repeating-linear-gradient(90deg, transparent 0 40px, rgba(155, 188, 15, .02) 40px 41px);
  background-attachment: fixed;
}
body.no-scroll { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Accessible focus: strong, pixel-styled ring that works on LCD and on plastic */
:focus-visible {
  outline: var(--px) solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 calc(var(--px) + 3px) var(--lcd-4);
}
.shell :focus-visible { outline-color: var(--blue); box-shadow: none; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 1000;
  background: var(--lcd-0); color: var(--lcd-3); padding: 10px 14px;
  font-family: var(--font-pixel); font-size: 10px; text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ── Console shell ─────────────────────────────────────────────────────── */
.console {
  position: relative;
  width: min(1120px, 100% - 32px);
  margin: 28px auto 40px;
  padding: 44px 30px 34px;
  background: linear-gradient(155deg, var(--shell-hi) 0%, var(--shell) 45%, var(--shell-lo) 100%);
  border-radius: 18px 18px 90px 18px;
  box-shadow:
    inset 3px 4px 8px rgba(255, 255, 255, .7),
    inset -3px -3px 6px rgba(0, 0, 0, .2),
    6px 6px 0 var(--shell-shadow),
    12px 12px 0 rgba(0, 0, 0, .15),
    0 40px 100px rgba(0, 0, 0, .9);
}

.console-stripe {
  position: absolute; top: 18px; left: 0; right: 0; height: 8px;
  background: linear-gradient(90deg, var(--purple) 0%, #9090cc 35%, #7088bb 65%, var(--purple) 100%);
  border-top: 1px solid rgba(255, 255, 255, .3);
  border-bottom: 1px solid rgba(0, 0, 0, .2);
}

.console-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 14px; min-height: 34px;
}
.console-label {
  font: bold 9px/1 Arial, sans-serif; letter-spacing: 3px; color: #6060a0; text-align: center;
}
.led-group { display: flex; align-items: center; gap: 8px; font: 9px Arial, sans-serif; color: #66665c; }
.led {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff6666, #cc0000);
  box-shadow: 0 0 6px #f00, 0 0 12px rgba(255, 0, 0, .3);
  animation: led-blink 3s ease-in-out infinite;
}
@keyframes led-blink { 0%, 90%, 100% { opacity: 1; } 95% { opacity: .15; } }

/* Music widget */
.audio-widget { display: flex; align-items: center; gap: 8px; }
.audio-btn {
  font-family: var(--font-pixel); font-size: 9px; padding: 8px 10px; cursor: pointer;
  color: var(--lcd-3); background: var(--lcd-0); border: 0;
  box-shadow: 0 0 0 var(--px) var(--lcd-1), 3px 3px 0 var(--px) rgba(0, 0, 0, .25);
  transition: transform .1s steps(2);
}
.audio-btn:hover { background: var(--lcd-1); }
.audio-btn:active { transform: translate(2px, 2px); }
.audio-btn[aria-pressed="false"] { color: #7c8c5c; }
.audio-vol { width: 84px; accent-color: var(--lcd-0); cursor: pointer; }

/* Screen bezel + LCD */
.bezel {
  padding: 26px 26px 22px;
  background: linear-gradient(145deg, #8a8a82, var(--bezel) 50%, #888882);
  border-radius: 14px 14px 6px 6px;
  box-shadow: inset 4px 4px 10px rgba(0, 0, 0, .55), inset -1px -1px 4px rgba(255, 255, 255, .1);
}
.bezel-caption {
  display: flex; justify-content: space-between; gap: 12px; margin: -6px 2px 10px;
  font: bold 9px/1 Arial, sans-serif; letter-spacing: 2px; color: #c8c8be; text-transform: uppercase;
}
.screen-frame {
  padding: 6px; background: #1a1a18; border-radius: 6px;
  box-shadow: inset 0 0 0 3px #0a0a08;
}
.lcd {
  position: relative; background: var(--lcd-3); color: var(--ink);
  border-radius: 3px; min-height: 62vh;
  animation: lcd-on .45s steps(4) both;
}
@keyframes lcd-on { from { filter: brightness(.35) contrast(.7); } to { filter: none; } }
/* scanlines; sits above content but never intercepts clicks */
.lcd::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(15, 56, 15, .06) 3px 4px);
}

/* LCD top nav (sticky while scrolling long pages) */
.lcd-nav {
  position: sticky; top: 0; z-index: 4;
  display: flex; flex-wrap: wrap; align-items: stretch;
  background: var(--lcd-0); border-bottom: var(--px) solid var(--lcd-1);
}
.lcd-nav a {
  flex: 1 1 auto; min-width: 0; padding: 12px 10px; text-align: center; text-decoration: none;
  font-family: var(--font-pixel); font-size: 10px; line-height: 1.6; color: var(--lcd-3);
  border-right: 2px solid var(--lcd-1);
  transition: background .1s steps(2), color .1s steps(2);
}
.lcd-nav a:last-child { border-right: 0; }
.lcd-nav a:hover { background: var(--lcd-1); color: var(--gold); }
.lcd-nav a[aria-current="page"] { background: var(--lcd-2); color: var(--lcd-0); }
.lcd-nav a[aria-current="page"]::before { content: '▶ '; }
.lcd-nav :focus-visible { outline-color: var(--gold); outline-offset: -5px; box-shadow: none; }

.lcd-view { padding: 22px 22px 30px; outline: none; }
.lcd-view.enter { animation: view-in .25s steps(5) both; }
@keyframes view-in { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Console bottom: controls ──────────────────────────────────────────── */
.console-bottom {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  margin-top: 26px;
}
.brand { grid-column: 2; text-align: center; line-height: 1.4; }
.brand-sub { display: block; font: italic bold 12px Arial, sans-serif; color: var(--blue); letter-spacing: 1px; }
.brand-main { display: block; font: 900 20px Arial, sans-serif; color: var(--blue); letter-spacing: 1px; }

.dpad { position: relative; width: 120px; height: 120px; justify-self: start; }
.dpad button {
  position: absolute; background: #2b2b2b; border: 1px solid #1a1a1a; cursor: pointer; padding: 0;
  box-shadow: inset 1px 1px 1px rgba(255, 255, 255, .15), 3px 3px 6px rgba(0, 0, 0, .4);
}
.dpad button:active { background: #111; box-shadow: inset 2px 2px 4px rgba(0, 0, 0, .6); }
.dpad .up { top: 0; left: 40px; width: 40px; height: 46px; border-radius: 5px 5px 0 0; }
.dpad .down { bottom: 0; left: 40px; width: 40px; height: 46px; border-radius: 0 0 5px 5px; }
.dpad .left { top: 40px; left: 0; width: 46px; height: 40px; border-radius: 5px 0 0 5px; }
.dpad .right { top: 40px; right: 0; width: 46px; height: 40px; border-radius: 0 5px 5px 0; }
.dpad::after { content: ''; position: absolute; top: 40px; left: 40px; width: 40px; height: 40px; background: #2b2b2b; pointer-events: none; }
.dpad button::before { content: attr(data-glyph); color: #777; font-size: 12px; }

.ab-buttons {
  justify-self: end; display: flex; gap: 20px; padding: 6px 12px; border-radius: 35px;
  transform: rotate(-24deg); background: rgba(0, 0, 0, .06); border: 1px solid rgba(0, 0, 0, .05);
}
.ab { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ab button {
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: var(--btn-red); border: 1px solid #500;
  box-shadow: 3px 4px 6px rgba(0, 0, 0, .35), inset 1px 1px 2px rgba(255, 255, 255, .25);
}
.ab button:active { background: #700; transform: translate(1px, 1px); }
.ab span, .ss span { font: bold 10px Arial, sans-serif; color: var(--blue); }

.select-start { grid-column: 2; display: flex; justify-content: center; gap: 26px; margin-top: 4px; }
.ss { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ss button {
  width: 56px; height: 13px; border-radius: 7px; cursor: pointer; transform: rotate(-24deg);
  background: #8b8b83; border: 1px solid #6b6b63;
  box-shadow: 2px 3px 4px rgba(0, 0, 0, .3), inset 1px 1px 1px rgba(255, 255, 255, .2);
}
.ss button:active { background: #6b6b63; }
.ss span { font-size: 8px; letter-spacing: .5px; }
.ss button:focus-visible, .ab button:focus-visible, .dpad button:focus-visible, .audio-btn:focus-visible { outline: var(--px) solid var(--blue); outline-offset: 4px; }

.console-footer {
  margin-top: 22px; text-align: center; font: bold 11px Arial, sans-serif; letter-spacing: 1px; color: #6b6b5f;
}
.console-footer a { color: inherit; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .console-label { display: none; }
  .console-top { justify-content: space-between; }
}
@media (max-width: 640px) {
  body { font-size: 20px; }
  .console { width: calc(100% - 12px); margin: 6px auto 20px; padding: 36px 10px 24px; border-radius: 12px 12px 56px 12px; }
  .console-stripe { top: 14px; height: 6px; }
  .bezel { padding: 14px 10px 12px; }
  .bezel-caption { display: none; }
  .lcd-nav a { padding: 10px 6px; font-size: 8px; flex-basis: 30%; }
  .lcd-view { padding: 14px 12px 22px; }
  .console-bottom { grid-template-columns: 1fr 1fr; }
  .brand { grid-column: 1 / -1; grid-row: 1; }
  .select-start { grid-column: 1 / -1; grid-row: 3; margin-top: 14px; }
  .dpad { transform: scale(.9); transform-origin: left center; }
  .audio-vol { width: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
