/* ============================================================
   Paul Withers — portfolio
   "Hardware datasheet / debugger" visual system.
   Palette grounded in the Atari Lynx + GearLynx emulator world.
   ============================================================ */

/* ---- Tokens ---------------------------------------------- */
:root {
  /* warm-biased neutrals (chosen, not pure grey) */
  --ground:      #0e0f13;
  --panel:       #16181e;
  --panel-2:     #1d2028;
  --line:        #2b2f3a;
  --ink:         #e9e4d9;
  --ink-dim:     #b4b0a6;
  --mono-grey:   #8c8a82;
  /* Lynx orange — the GearLynx output-bar accent */
  --accent:      #ff6b1a;
  --accent-soft: #ff8a4d;
  --accent-ghost: rgba(255, 107, 26, 0.12);
  /* phosphor cyan, used only for the CRT hero glow */
  --phosphor:    #38b6a6;

  --maxw: 1120px;
  --readw: 68ch;
  --radius: 4px;

  --f-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 4.75rem);
}

@media (prefers-color-scheme: light) {
  :root {
    --ground:      #f4f0e8;
    --panel:       #fffdf8;
    --panel-2:     #efe9dd;
    --line:        #ddd5c6;
    --ink:         #201d18;
    --ink-dim:     #55514a;
    --mono-grey:   #6f6a60;
    --accent:      #d1560c;
    --accent-soft: #b8480a;
    --accent-ghost: rgba(209, 86, 12, 0.1);
    --phosphor:    #0f8f7f;
  }
}
/* explicit toggle overrides the media query in both directions */
:root[data-theme="dark"] {
  --ground:#0e0f13; --panel:#16181e; --panel-2:#1d2028; --line:#2b2f3a;
  --ink:#e9e4d9; --ink-dim:#b4b0a6; --mono-grey:#8c8a82;
  --accent:#ff6b1a; --accent-soft:#ff8a4d; --accent-ghost:rgba(255,107,26,.12); --phosphor:#38b6a6;
}
:root[data-theme="light"] {
  --ground:#f4f0e8; --panel:#fffdf8; --panel-2:#efe9dd; --line:#ddd5c6;
  --ink:#201d18; --ink-dim:#55514a; --mono-grey:#6f6a60;
  --accent:#d1560c; --accent-soft:#b8480a; --accent-ghost:rgba(209,86,12,.1); --phosphor:#0f8f7f;
}

/* ---- Reset-ish ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---- Shared layout --------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.5rem); }
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--step--1);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mono-grey);
  margin: 0 0 1rem;
  display: flex; align-items: center; gap: .7rem;
}
.eyebrow::before {
  content: ""; width: 1.6rem; height: 1px; background: var(--accent); flex: none;
}
h1, h2, h3 { font-family: var(--f-sans); font-weight: 600; line-height: 1.1; text-wrap: balance; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -0.01em; }
.lede { font-size: var(--step-1); color: var(--ink-dim); max-width: var(--readw); line-height: 1.5; }
p { max-width: var(--readw); }

/* ---- Top nav --------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--f-mono); font-weight: 500; letter-spacing: .04em; color: var(--ink); text-decoration: none; }
.brand__mark {
  width: 26px; height: 26px; flex: none; border-radius: 3px;
  background: var(--accent); color: #0e0f13;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.nav__links { display: flex; align-items: center; gap: clamp(.9rem, 2vw, 1.8rem); }
.nav__links a { font-family: var(--f-mono); font-size: var(--step--1); color: var(--ink-dim); text-decoration: none; letter-spacing: .02em; }
.nav__links a:hover { color: var(--accent); }
.nav__links .nav-hide { }
.theme-btn {
  font-family: var(--f-mono); font-size: var(--step--1);
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
  padding: .35rem .6rem; border-radius: var(--radius); cursor: pointer; line-height: 1;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 620px) { .nav-hide { display: none; } }

/* ---- Hero ------------------------------------------------ */
.hero { position: relative; overflow: hidden; }
.hero__grid {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1.35fr 1fr; align-items: center;
  padding-block: clamp(3.5rem, 9vw, 7rem);
}
@media (max-width: 860px) { .hero__grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: var(--step-4); font-weight: 600; }
.hero h1 .accent { color: var(--accent); }
.hero__role {
  font-family: var(--f-mono); color: var(--ink-dim);
  font-size: var(--step-0); letter-spacing: .02em; margin: 1.4rem 0 0;
}
.hero__role b { color: var(--ink); font-weight: 500; }
.hero__lede { margin-top: 1.5rem; }
.hero__meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.tag {
  font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .03em;
  color: var(--ink-dim); border: 1px solid var(--line); border-radius: 999px;
  padding: .3rem .75rem; background: var(--panel);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }

/* CRT / handheld hero frame */
.handheld {
  position: relative; background: #0a0b0d; border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 14px 40px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.7);
  max-width: 320px; margin-inline: auto;
}
.handheld__screen {
  position: relative; border-radius: 3px; overflow: hidden; background: #000;
  aspect-ratio: 102 / 160; /* Lynx TATE portrait */
  border: 1px solid #33261a;
}
.handheld__screen img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.handheld__scan {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.22) 2px 3px);
  mix-blend-mode: multiply;
}
.handheld__glow { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 40px rgba(56,182,166,.14); }
.handheld__label {
  position: absolute; left: 0; right: 0; bottom: 12px; text-align: center;
  font-family: var(--f-mono); font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; color: var(--accent);
}
.handheld__led { position: absolute; top: 20px; right: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ---- Buttons --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .03em;
  padding: .7rem 1.1rem; border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--line); color: var(--ink); background: var(--panel);
  transition: border-color .15s, transform .15s, background .15s;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: #0e0f13; border-color: var(--accent); font-weight: 600; }
.btn--primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* ---- Stat strip ------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--panel); padding: 1.4rem 1.2rem; }
.stat__n { font-family: var(--f-mono); font-size: var(--step-2); color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.stat__l { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); margin-top: .5rem; letter-spacing: .02em; }

/* ---- Featured project ------------------------------------ */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } }
.feature__media {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #000; aspect-ratio: 102/160; max-width: 300px;
}
.feature__media img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.feature__media .handheld__scan { }
.feature ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .7rem; }
.feature li { position: relative; padding-left: 1.4rem; max-width: var(--readw); }
.feature li::before { content: "▸"; position: absolute; left: 0; top: 0; color: var(--accent); font-family: var(--f-mono); }

/* ---- Project grid ---------------------------------------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; margin-top: 2.5rem; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-3px); }
.card__shot { aspect-ratio: 160/102; background: #000; overflow: hidden; border-bottom: 1px solid var(--line); }
.card__shot img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.card__body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card__title { font-weight: 600; font-size: var(--step-0); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card__plat { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); letter-spacing: .02em; }
.card__desc { color: var(--ink-dim); font-size: var(--step--1); line-height: 1.5; }
.status {
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .12rem .5rem; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.status--done { color: var(--phosphor); border-color: color-mix(in srgb, var(--phosphor) 45%, transparent); }
.status--wip { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---- Credits (commercial) -------------------------------- */
.credits { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 2.5rem; }
.credit-row {
  display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 1rem; align-items: baseline;
  padding: 1.1rem clamp(1rem, 3vw, 1.6rem); background: var(--panel);
}
.credit-row + .credit-row { border-top: 1px solid var(--line); }
.credit-row__title { font-weight: 600; font-size: var(--step-1); letter-spacing: -.01em; }
.credit-row__meta { font-family: var(--f-mono); font-size: var(--step--1); color: var(--ink-dim); }
.credit-row__year { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 640px) {
  .credit-row { grid-template-columns: 1fr auto; }
  .credit-row__meta { grid-column: 1 / -1; }
}
.placeholder { color: var(--accent); font-family: var(--f-mono); font-size: .9em; }

/* ---- Games grid (commercial titles with cover art) ------- */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.2rem; margin-top: 2.5rem; }
.game {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.game:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-3px); }
.game__art {
  aspect-ratio: 1 / 1; background: var(--panel-2); border-bottom: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.game__art img { width: 100%; height: 100%; object-fit: contain; }
/* designed tile for titles with no available cover art */
.game__art--type { padding: 1.2rem; text-align: center; background:
  radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--accent) 16%, var(--panel-2)) 0%, var(--panel-2) 70%); }
.game__art--type .gt { font-weight: 600; font-size: var(--step-0); line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
.game__art--type .gt small { display: block; font-family: var(--f-mono); font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--mono-grey); margin-top: .6rem; }
.game__body { padding: .95rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.game__top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.game__name { font-weight: 600; font-size: var(--step-0); line-height: 1.2; text-wrap: balance; }
.game__year { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); font-variant-numeric: tabular-nums; flex: none; }
.game__badges { display: flex; flex-wrap: wrap; gap: .3rem; }
.badge { font-family: var(--f-mono); font-size: .62rem; letter-spacing: .04em; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 3px; padding: .12rem .4rem; }
.game__role { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); margin-top: auto; }
.game__role .hi { color: var(--phosphor); }

/* ---- Experiments list ------------------------------------ */
.repos { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 2rem; overflow: hidden; }
.repo { background: var(--panel); padding: 1.1rem 1.3rem; display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; align-items: center; text-decoration: none; color: var(--ink); }
.repo:hover { background: var(--panel-2); }
.repo__name { font-family: var(--f-mono); font-weight: 500; }
.repo__name .slash { color: var(--mono-grey); }
.repo__desc { color: var(--ink-dim); font-size: var(--step--1); grid-column: 1 / -1; max-width: 60ch; }
.repo__arrow { font-family: var(--f-mono); color: var(--mono-grey); }
.repo:hover .repo__arrow { color: var(--accent); }

/* ---- Skills / spec table --------------------------------- */
.spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem 2.5rem; margin-top: 2.5rem; }
.spec__group h4 { font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 .8rem; font-weight: 500; }
.spec__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.spec__list li { font-size: var(--step--1); color: var(--ink-dim); display: flex; gap: .6rem; align-items: baseline; font-family: var(--f-mono); }
.spec__list li::before { content: ""; width: 5px; height: 5px; background: var(--mono-grey); flex: none; border-radius: 1px; transform: translateY(3px); }

/* ---- About / summary ------------------------------------- */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 820px) { .about { grid-template-columns: 1fr; } }
.about__body p { max-width: none; font-size: var(--step-1); line-height: 1.55; color: var(--ink); }
.about__body p + p { margin-top: 1.1rem; }
.about__aside { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 1.4rem 1.5rem; }
.about__aside dl { margin: 0; display: grid; gap: 1rem; }
.about__aside dt { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: .25rem; }
.about__aside dd { margin: 0; font-family: var(--f-mono); font-size: var(--step--1); color: var(--ink-dim); line-height: 1.5; }

/* ---- Experience timeline --------------------------------- */
.timeline { margin-top: 2.5rem; display: grid; gap: 0; }
.job {
  display: grid; grid-template-columns: 200px 1fr; gap: clamp(1rem, 4vw, 3rem);
  padding: 2rem 0; border-top: 1px solid var(--line);
}
.job:last-child { border-bottom: 1px solid var(--line); }
@media (max-width: 720px) { .job { grid-template-columns: 1fr; gap: .8rem; } }
.job__when { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.job__when .now { display: inline-block; margin-top: .5rem; color: var(--phosphor); border: 1px solid color-mix(in srgb, var(--phosphor) 45%, transparent); border-radius: 999px; padding: .1rem .55rem; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.job__role { font-size: var(--step-1); font-weight: 600; letter-spacing: -.01em; }
.job__co { font-family: var(--f-mono); font-size: var(--step--1); color: var(--accent); margin-top: .3rem; letter-spacing: .02em; }
.job__co .type { color: var(--mono-grey); }
.job__desc { color: var(--ink-dim); margin: .9rem 0 0; max-width: var(--readw); }
.job__pts { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .55rem; }
.job__pts li { position: relative; padding-left: 1.4rem; color: var(--ink-dim); font-size: var(--step--1); max-width: var(--readw); }
.job__pts li::before { content: "▸"; position: absolute; left: 0; top: 0; color: var(--accent); font-family: var(--f-mono); font-size: .8em; line-height: 1.6; }
.job__pts b { color: var(--ink); font-weight: 500; }

/* ---- Contact --------------------------------------------- */
.contact { text-align: center; }
.contact h2 { margin-inline: auto; }
.contact .lede { margin-inline: auto; margin-block: 1.2rem 2rem; }
.contact__links { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; }

/* ---- Footer ---------------------------------------------- */
.footer { border-top: 1px solid var(--line); padding-block: 2.5rem; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); }
.footer a { color: var(--ink-dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---- Case-study (wolfenstein.html) ----------------------- */
.reading { max-width: 760px; margin-inline: auto; }
.reading h2 { font-size: var(--step-2); margin-top: 3.5rem; }
.reading h2:first-of-type { margin-top: 0; }
.reading p, .reading li { font-size: var(--step-0); color: var(--ink); }
.reading p { max-width: none; margin-block: 1.1rem; }
.reading figure { margin: 2rem 0; }
.reading figure img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #000; }
.reading figure.portrait img { max-width: 300px; margin-inline: auto; }
.reading figcaption { font-family: var(--f-mono); font-size: var(--step--1); color: var(--mono-grey); margin-top: .7rem; text-align: center; letter-spacing: .02em; }
.reading blockquote { border-left: 2px solid var(--accent); margin: 2rem 0; padding: .3rem 0 .3rem 1.4rem; color: var(--ink-dim); font-size: var(--step-1); line-height: 1.5; }
.article-head { padding-block: clamp(2.5rem, 6vw, 4rem) 0; }
.back-link { font-family: var(--f-mono); font-size: var(--step--1); color: var(--ink-dim); text-decoration: none; display: inline-flex; gap: .5rem; }
.back-link:hover { color: var(--accent); }

/* data table (memory budget) */
.data-table { width: 100%; overflow-x: auto; margin: 2rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
.data-table table { border-collapse: collapse; width: 100%; font-family: var(--f-mono); font-size: var(--step--1); }
.data-table th, .data-table td { text-align: right; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { color: var(--accent); letter-spacing: .04em; text-transform: uppercase; font-size: .7rem; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tr.total td { color: var(--ink); font-weight: 700; border-top: 1px solid var(--line); background: var(--panel); }

/* callout */
.callout { background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 2rem 0; }
.callout p { margin: 0; max-width: none; }
.callout .k { font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: .4rem; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
