/* Two themes, one set of tokens. Dark is the default, see the small inline
   script in each page's head for how a saved choice gets applied early. */
:root {
  --bg: #0b0c2a;
  --panel: #13153f;
  --bar: #262a66;
  --ink: #eef0fb;
  --muted: #a3a7d4;
  --line: #c9cbe8;
  --shadow: #c9cbe8;
  --accent: #33ff33;
  --title-shadow: #05061a;
  --cast: rgba(3, 4, 20, 0.5);
  --ex1: #6a6ec0;
  --ex2: #2a2d70;
  --star-off: rgba(255, 255, 255, 0.16);
  --stars: 'DotGothic16', 'Jersey 15', monospace;
  --font: 'Archivo', system-ui, sans-serif;
  --pixel: 'Jersey 15', monospace;
  --display: 'Jersey 10', monospace;
}

:root[data-theme="light"] {
  --bg: #f6f6fb;
  --panel: #ffffff;
  --bar: #c9cbe8;
  --ink: #0b0c2a;
  --muted: #4d5078;
  --line: #0b0c2a;
  --shadow: #0b0c2a;
  --accent: #b5007a;
  --title-shadow: #ffffff;
  --cast: rgba(11, 12, 42, 0.14);
  --ex1: #8b8fc9;
  --ex2: #c9cbe8;
  --star-off: rgba(11, 12, 42, 0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--font);
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--accent); }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

code { font-family: var(--pixel); font-size: 1.15em; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* The paint. See js/background.js */
#swirl {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 24px 32px; }

/* The one component everything is built from: a hard-edged window */
.box {
  background: var(--panel);
  border: 3px solid var(--line);
  --lift: 5px;
  box-shadow: var(--lift) var(--lift) 0 var(--shadow), calc(var(--lift) + 9px) calc(var(--lift) + 9px) 0 var(--cast);
}

.win-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: var(--bar);
  border-bottom: 3px solid var(--line);
  padding: 8px 18px 6px;
  font: 400 25px/1.2 var(--pixel);
}

.win-body { padding: 18px; }
.win-body > p { margin-bottom: 14px; }
.win-body > p:last-child { margin-bottom: 0; }

/* Buttons press down into their shadow, like the keys they're pretending to be */
.btn {
  display: inline-block;
  margin-top: 28px;
  padding: 8px 18px 6px;
  font: 400 26px/1.1 var(--pixel);
  text-decoration: none;
  transition: transform 0.07s, box-shadow 0.07s;
}
.btn:hover { transform: translate(-2px, -2px); --lift: 7px; }
.btn:active { transform: translate(4px, 4px); --lift: 1px; }

/* ===== Nav ===== */
.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 38px;
  padding: 10px 22px;
  font: 400 26px/1.2 var(--pixel);
  margin-bottom: 28px;
}

.nav a { text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }

.nav .home { display: flex; align-items: center; gap: 10px; }
.nav .home img { width: 30px; height: 30px; object-fit: cover; image-rendering: pixelated; border: 2px solid var(--line); }

.nav-btns { margin-left: auto; display: flex; gap: 22px; }
.nav-btns button { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.nav-btns button:hover { color: var(--accent); }

/* ===== Type. Anything sitting straight on the paint gets a hard shadow ===== */
h1, h2, h3 { font-weight: 400; line-height: 1; }

.hello, .page-title, .sec-title, .panel-title, .hello-sub {
  font-family: var(--display);
  text-shadow: 4px 4px 0 var(--title-shadow);
}

/* The big ones are extruded, block by block, like an arcade logo */
.hello {
  text-shadow:
    3px 3px 0 var(--ex1), 6px 6px 0 var(--ex1),
    9px 9px 0 var(--ex2), 12px 12px 0 var(--ex2),
    15px 15px 0 var(--title-shadow), 26px 26px 0 var(--cast);
}
.page-title, .sec-title {
  text-shadow:
    2px 2px 0 var(--ex1), 4px 4px 0 var(--ex2),
    7px 7px 0 var(--title-shadow), 13px 13px 0 var(--cast);
}

.hero { position: relative; margin-bottom: 30px; }

.hello {
  position: relative;
  font-size: clamp(76px, 19.5vw, 256px);
  line-height: 0.82;
  margin: 26px 0 8px;
}

.hello-sub { position: relative; font-size: clamp(30px, 4.6vw, 50px); line-height: 1; text-shadow: 3px 3px 0 var(--title-shadow); }

.sticker {
  position: absolute;
  z-index: 3;
  right: 6px;
  bottom: 40px;
  padding: 5px 14px 3px;
  font: 400 24px/1.2 var(--pixel);
  transform: rotate(-4deg);
  white-space: nowrap;
}

.page-title { font-size: clamp(66px, 12vw, 150px); line-height: 0.85; margin: 26px 0 16px; }

.lede {
  display: table;
  padding: 12px 18px;
  font-size: 19px;
  line-height: 1.4;
  margin-bottom: 28px;
}

.sec-title { position: relative; z-index: 2; font-size: clamp(44px, 7vw, 76px); line-height: 0.9; margin: 66px 0 -6px; }
.sec-title + * { position: relative; }

/* ===== Project page text ===== */
.prose { padding: 8px 28px 22px; }
.prose p { margin-bottom: 14px; }
.prose ul { margin: 0 0 14px 20px; list-style: square; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--muted); }
.prose h2 { font: 400 40px/1 var(--display); margin: 28px 0 10px; }

/* ===== Banner, like a photo pinned to the top of the page ===== */
.banner { overflow: hidden; margin-bottom: 8px; }
.banner img { width: 100%; height: clamp(170px, 26vw, 290px); object-fit: cover; }

/* The about banner: one seamless 360 degree strip, twice, sliding by exactly one strip */
.pano { height: clamp(170px, 26vw, 290px); }
.pano-track { display: flex; width: max-content; height: 100%; animation: pano 150s linear infinite; }
.banner .pano-track img { flex: none; width: auto; max-width: none; height: 100%; object-fit: fill; }
@keyframes pano { to { transform: translateX(-50%); } }
[data-motion="off"] .pano-track { animation: none; }

/* ===== Homepage and About: intro, picture, facts ===== */
.me {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  grid-template-areas: "intro pic" "facts facts";
  gap: 28px;
}
.me-intro { grid-area: intro; font-size: 18px; }
.me-intro .win-body { padding-right: 46px; }
.me-facts { grid-area: facts; }

/* The photo sits on top of the windows around it, slightly crooked */
.me-pic {
  grid-area: pic;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  transform: rotate(1.6deg);
  margin: -46px 0 -34px -52px;
}
.me-pic img {
  flex: 1 1 0;
  min-height: 240px;
  width: 100%;
  object-fit: cover;
  object-position: center 30%;
  image-rendering: pixelated;
  cursor: pointer;
}
.me-pic figcaption { border-top: 3px solid var(--line); padding: 8px 14px 6px; font: 400 23px/1.1 var(--pixel); }
.me-pic.bounce { animation: bounce 0.28s steps(5); }
@keyframes bounce {
  0% { transform: rotate(1.6deg) scale(1); }
  35% { transform: rotate(-3deg) scale(1.05); }
  70% { transform: rotate(3deg) scale(0.98); }
  100% { transform: rotate(1.6deg) scale(1); }
}

.facts { list-style: none; }
.facts li { padding: 4px 0; break-inside: avoid; }
.facts b { font-weight: 700; }
.facts.cols { columns: 2; column-gap: 34px; }

/* ===== The game shelf ===== */
.shelf {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.shelf a {
  display: block;
  --lift: 4px;
  transition: transform 0.08s;
  will-change: transform;
}
.shelf a:nth-child(3n) { rotate: -0.8deg; }
.shelf a:nth-child(4n + 1) { rotate: 0.7deg; }
.shelf a:hover { position: relative; z-index: 2; rotate: 0deg; }
.shelf img { width: 100%; aspect-ratio: 460 / 215; object-fit: cover; }

.shelf .osu { position: relative; aspect-ratio: 460 / 215; }
.shelf .osu img { position: absolute; inset: 9%; width: 82%; height: 82%; aspect-ratio: auto; object-fit: contain; }

/* ===== Gear-style cards ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform 0.08s, box-shadow 0.08s;
}
.card:hover { transform: translate(-3px, -3px); --lift: 8px; }

.card-img {
  aspect-ratio: 6 / 5;
  overflow: hidden;
  border-bottom: 3px solid var(--line);
  background: var(--bar);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.cards.small .card-img { aspect-ratio: 16 / 10; }
.card-img-link { display: block; }

/* Product shots sit on white so they read the same in both themes */
.card-img.product {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}
.card-img.product img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 14px 20px 18px; }
.card-kind { font: 400 22px/1 var(--pixel); color: var(--muted); margin-bottom: 4px; }
.card h3 { font: 400 40px/0.95 var(--display); margin-bottom: 10px; }
.card h3 a { text-decoration: none; }
.card p { margin-bottom: 14px; }

.card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.card-foot .tech { color: var(--muted); font-size: 15px; }
.card-foot .go { font: 400 23px/1 var(--pixel); white-space: nowrap; }

/* ===== Ratings: stars settle in once, then just catch the light now and then ===== */
.rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px 7px;
  background: var(--bar);
  border-top: 3px solid var(--line);
}
.stars { display: flex; gap: 3px; font: 400 34px/1 var(--stars); }
.star { display: block; color: var(--star-off); }
.star.on {
  color: #ffd23f;
  text-shadow: 2px 2px 0 #8a5200, 0 0 5px rgba(255, 210, 63, 0.22);
  animation: star-glint 7s calc(var(--i) * 0.14s) infinite;
}
.score { font: 400 34px/1 var(--display); color: #ffd23f; text-shadow: 2px 2px 0 #8a5200; }
.r0 .score { font: 400 23px/1 var(--pixel); color: var(--muted); text-shadow: none; }

.rating.dealt .star { animation: star-pop 0.2s calc(var(--i) * 0.04s) steps(3) backwards; }
.rating.dealt .star.on { animation: star-pop 0.2s calc(var(--i) * 0.04s) steps(3) backwards, star-glint 7s calc(1s + var(--i) * 0.14s) infinite; }

/* Five stars are a touch warmer, one star is red and twitches now and then */
.r5 .star.on { text-shadow: 2px 2px 0 #8a5200, 0 0 7px rgba(255, 225, 110, 0.35); }
.r1 .star.on { color: #ff4436; text-shadow: 2px 2px 0 #6e0f08, 0 0 5px rgba(255, 60, 40, 0.25); animation: star-rage 6s infinite; }
.rating.r1.dealt .star.on { animation: star-pop 0.2s steps(3) backwards, star-rage 6s 1s infinite; }
.r1 .score { color: #ff4436; text-shadow: 2px 2px 0 #6e0f08; }

@keyframes star-pop {
  from { transform: scale(0.6); }
  to { transform: none; }
}
@keyframes star-glint {
  0%, 94%, 100% { filter: none; }
  97% { filter: brightness(1.2); }
}
@keyframes star-rage {
  0%, 94%, 100% { transform: none; }
  95% { transform: translateX(-1px) rotate(-3deg); }
  96.5% { transform: translateX(1px) rotate(3deg); }
  98% { transform: translateX(-1px) rotate(-2deg); }
}

[data-motion="off"] .star, [data-motion="off"] .egg-mgr, [data-motion="off"] .me-pic.bounce { animation: none !important; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 6px 22px;
  background: var(--bar);
  padding: 12px 22px;
  margin-bottom: 34px;
  font: 400 26px/1.2 var(--pixel);
}
.tabs button:hover, .tabs button[aria-selected="true"] { color: var(--accent); }
.tabs button[aria-selected="true"] { text-decoration: underline; text-underline-offset: 4px; }

.panel-title { font-size: 56px; line-height: 0.9; margin: 0 0 20px; }
.panel + .panel { margin-top: 56px; }
[hidden] { display: none !important; }

/* ===== Project pages ===== */
.proj-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.proj-main { display: grid; gap: 28px; min-width: 0; }
.proj-side { position: sticky; top: 24px; }

.fig img { width: 100%; }
.fig figcaption { border-top: 3px solid var(--line); padding: 8px 14px 6px; font: 400 22px/1.15 var(--pixel); }
.fig.tall img { max-height: 620px; object-fit: cover; object-position: center; }
.prose .fig { margin: 22px 0 28px; }

.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
  margin: 22px 0;
}
.two .fig { margin: 0; }

/* ===== About ===== */
.skills { display: grid; gap: 14px; }
.skill summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 11px 18px;
  cursor: pointer;
  font-weight: 700;
}
.skill summary::-webkit-details-marker { display: none; }
.skill summary:hover { color: var(--accent); }
.skill summary .toggle { font: 400 24px/1 var(--pixel); color: var(--muted); }
.skill summary .toggle::after { content: "+"; }
.skill[open] summary .toggle::after { content: "-"; }
.skill[open] summary { background: var(--bar); border-bottom: 3px solid var(--line); }
.skill-body { padding: 14px 18px 4px; }
.skill-body p { margin-bottom: 10px; }

.goals { list-style: none; columns: 2; column-gap: 34px; }
.goals li { display: flex; gap: 12px; padding: 4px 0; break-inside: avoid; }
.goals .tick { font: 400 23px/1.15 var(--pixel); color: var(--muted); flex: none; }
.goals .done .tick { color: var(--accent); }
.goals .done span:last-child { color: var(--muted); text-decoration: line-through; }

.contact { max-width: 560px; margin: 0 auto; text-align: center; }
.contact .facts li { padding: 6px 0; }
.center-title { text-align: center; }

/* Spotify, stays hidden until js/spotify.js has something to show */
.music { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.music-now { grid-column: 1 / -1; }
.now-body { display: flex; align-items: center; gap: 18px; padding: 14px 18px; text-decoration: none; }
.now-body img { flex: none; border: 3px solid var(--line); }
.now-text { display: grid; gap: 2px; min-width: 0; }
.now-text b { font: 400 34px/1 var(--display); overflow-wrap: anywhere; }
#now-when { color: var(--muted); font-size: 15px; }
.music-list { list-style: none; padding: 8px 14px; }
.music-list a { display: flex; align-items: center; gap: 12px; padding: 6px 0; text-decoration: none; }
.music-list a[href]:hover b, .now-body[href]:hover b { color: var(--accent); }
.music-list img { flex: none; border: 2px solid var(--line); }
.music-text { display: grid; min-width: 0; line-height: 1.25; }
.music-text b { overflow-wrap: anywhere; }
.music-text span { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
#spotify .btn { margin-top: 22px; }

/* ===== Settings ===== */
.settings { max-width: 760px; }
.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 16px 4px;
}
.setting + .setting { border-top: 3px solid var(--bar); }
.setting h2 { font: 400 36px/1 var(--display); }
.setting p { color: var(--muted); margin-top: 4px; }

.choice { display: flex; gap: 10px; flex: none; }
.choice button {
  --lift: 3px;
  min-width: 74px;
  padding: 6px 12px 4px;
  font: 400 26px/1.1 var(--pixel);
  box-shadow: var(--lift) var(--lift) 0 var(--shadow);
  transition: transform 0.07s, box-shadow 0.07s;
}
.choice button:hover { color: var(--accent); }
.choice button:active, .choice button[aria-pressed="true"] { transform: translate(3px, 3px); --lift: 0px; }
.choice button[aria-pressed="true"] { background: var(--accent); color: var(--panel); border-color: var(--accent); }

/* ===== 404 ===== */
.lost { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.lost .hello { margin-top: 0; }
.lost .hello-sub { margin-bottom: 24px; }
.lost .btn { margin-top: 0; }

/* ===== Footer ===== */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 30px;
  padding: 12px 22px;
  margin-top: 72px;
}
.foot .who { font: 400 26px/1 var(--pixel); }
.foot .links { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.foot .mini {
  --lift: 2px;
  padding: 2px 9px 0;
  font: 400 20px/1.2 var(--pixel);
  text-decoration: none;
  box-shadow: var(--lift) var(--lift) 0 var(--shadow);
}
.foot .mini:active { transform: translate(2px, 2px); --lift: 0px; }
.foot .fine { flex-basis: 100%; color: var(--muted); font: 400 20px/1.2 var(--pixel); }

/* ===== Typed easter eggs ===== */
.egg-full {
  position: fixed;
  inset: 0;
  z-index: 1000;
  cursor: pointer;
}

.egg-matrix { background: #000; }
.egg-matrix canvas { display: block; width: 100%; height: 100%; }

.egg-mgr {
  background: #000;
  color: #ff2a1f;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 6vw;
  overflow: hidden;
  animation: egg-shake 0.09s steps(2) 12;
}
.egg-mgr .big {
  font: 400 min(15vw, 210px)/0.85 var(--display);
  text-transform: uppercase;
}
.egg-mgr .line { font-weight: 700; font-size: clamp(20px, 3vw, 38px); color: #fff; margin-top: 22px; letter-spacing: -0.02em; }
@keyframes egg-shake {
  from { transform: translate(-7px, 4px); }
  to { transform: translate(7px, -4px); }
}

.egg-layer { position: fixed; inset: 0; z-index: 1000; overflow: hidden; pointer-events: none; }
.egg-sticker {
  position: absolute;
  background: #3a0f63;
  color: #8dff4f;
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #8dff4f;
  padding: 6px 14px 4px;
  font: 400 clamp(22px, 3vw, 40px)/1 var(--display);
  white-space: nowrap;
}

.egg-term {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  width: min(460px, calc(100vw - 48px));
  cursor: pointer;
}
.egg-term .win-body { font: 400 22px/1.3 var(--pixel); min-height: 218px; }
.egg-term .win-body div:last-child::after { content: "_"; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .egg-mgr, .me-pic.bounce { animation: none; }
}

/* ===== Small screens ===== */
@media (max-width: 860px) {
  .wrap { padding: 16px 16px 24px; }
  .me, .proj-layout { grid-template-columns: minmax(0, 1fr); }
  .me { grid-template-areas: "intro" "pic" "facts"; }
  .proj-side { position: static; order: -1; }
  .me-pic { margin: 0; }
  .me-intro .win-body { padding-right: 18px; }
  .sticker { position: relative; right: auto; bottom: auto; display: table; margin: 12px 0; transform: rotate(-2deg); }
  .hello { text-shadow: 2px 2px 0 var(--ex1), 4px 4px 0 var(--ex2), 7px 7px 0 var(--title-shadow), 12px 12px 0 var(--cast); }
  .setting { flex-direction: column; align-items: flex-start; gap: 10px; }
  .me-pic img { flex: none; height: 280px; }
  .facts.cols, .goals { columns: 1; }
  .music { grid-template-columns: minmax(0, 1fr); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .cards, .two { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .nav { gap: 4px 20px; padding: 10px 14px; font-size: 24px; }
  .nav-btns { margin-left: 0; }
  .tabs { justify-content: flex-start; font-size: 24px; padding: 12px 14px; }
  .box { --lift: 4px; }
  .prose { padding: 4px 18px 16px; }
  .sticker { white-space: normal; }
  .foot .links { margin-left: 0; }
  .sec-title { margin-top: 48px; }
}
