/* nicholaswright.org — shared theme. Palette variables are set per page load by js/v2.js. */
:root {
  --bg: #0e1024; --bg2: #1c1f3f; --ink: #f2f2ff; --sub: #a9adde;
  --accent: #7c5cff; --accent2: #29d8ff; --card: #181b38; --cardline: #2b2f5c;
  --radius: 18px; --font-display: 'Avenir Next', 'Futura', sans-serif;
  --font-body: -apple-system, 'Helvetica Neue', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  min-height: 100%;
  background: radial-gradient(120% 120% at 50% 0%, var(--bg2) 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

nav.top {
  display: flex; justify-content: center; gap: .25rem; flex-wrap: wrap;
  padding: 1.1rem 1rem 0; position: relative; z-index: 3; font-size: .9rem;
}
nav.top a {
  color: var(--sub); padding: .35rem .85rem; border-radius: 999px;
  border: 1px solid transparent;
}
nav.top a:hover { text-decoration: none; border-color: var(--cardline); color: var(--ink); }
nav.top a[aria-current] { color: var(--ink); border-color: var(--cardline); background: var(--card); }

header { text-align: center; padding: 3rem 1rem 1.5rem; position: relative; z-index: 2; }
header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
header.small h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
header p.tag { margin-top: .8rem; color: var(--sub); font-size: clamp(1rem, 2.2vw, 1.25rem); }
header p.hint { margin-top: .6rem; color: var(--sub); opacity: .55; font-size: .85rem; }

/* main is deliberately not positioned: the 2007 games place absolute elements in page coordinates */
main { width: min(1160px, 94vw); margin: 1rem auto 4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--cardline);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.pill {
  display: inline-block; font-size: .8rem; color: var(--accent2);
  border: 1px solid var(--cardline); border-radius: 999px; padding: .28rem .8rem;
}
.pill:hover { background: var(--cardline); text-decoration: none; }
.pill.muted { color: var(--sub); }

/* projects page: one wide row per project, image and copy swapping sides */
.project {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; margin: 1.4rem 0;
}
.project:nth-child(even) .shot { order: 2; }
.project .shot {
  display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; object-position: top left;
  background: #000; border-bottom: 1px solid var(--cardline);
}
.project .copy { padding: 1.4rem 1.6rem; display: flex; flex-direction: column; gap: .7rem; }
.project h2 { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .01em; }
.project .when { color: var(--sub); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.project p { color: var(--sub); line-height: 1.55; font-size: .95rem; }
.project .links { margin-top: auto; padding-top: .6rem; display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 760px) {
  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .shot { order: 0; }
}

/* games gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.gallery a.card { display: block; color: inherit; transition: transform .18s ease, box-shadow .18s ease; }
.gallery a.card:hover { text-decoration: none; transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.gallery .shot { display: block; width: 100%; aspect-ratio: 285/135; object-fit: cover; background: #000; image-rendering: auto; }
.gallery .meta { padding: .85rem 1rem 1rem; }
.gallery h2 { font-family: var(--font-display); font-size: 1.05rem; }
.gallery p { margin-top: .3rem; color: var(--sub); font-size: .85rem; line-height: 1.4; }

/* a game page: the 2007 DOM games keep a white cabinet so their colours read on every theme */
.cabinet {
  background: #fff; color: #222; border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,.18);
  box-shadow: inset 0 0 0 6px #f3f3f3, inset 0 0 0 7px rgba(0,0,0,.08), 0 12px 40px rgba(0,0,0,.35);
  padding: 2.2rem 1rem; overflow-x: auto;
  font: 13px/1.4 Verdana, Geneva, sans-serif;
}
.cabinet.dark {
  background: #05060a; color: #ddd;
  box-shadow: inset 0 0 0 6px #0f1117, inset 0 0 0 7px rgba(255,255,255,.08), 0 12px 40px rgba(0,0,0,.35);
}
.cabinet.dark a { color: #8ab4ff; }
.cabinet a { color: #1d4ed8; }
/* pong reads the board's offset before it sizes it, so the size has to be there first */
#pong_board { width: 400px; height: 300px; margin: 0 auto; }
.cabinet h1, .cabinet h2, .cabinet h3 { font-size: 1em; font-weight: bold; }
#game-container { zoom: var(--game-zoom, 1); }
.instructions { margin-top: 1.2rem; padding: 1.2rem 1.5rem; color: var(--sub); font-size: .92rem; line-height: 1.5; }
@media (min-width: 760px) { .instructions { column-count: 2; column-gap: 2.4rem; } }
.instructions h3 { color: var(--ink); font-family: var(--font-display); font-size: 1rem; margin-top: 1rem; break-after: avoid; }
.instructions h3:first-child { margin-top: 0; }
.instructions p { margin: .5rem 0; break-inside: avoid; }
.instructions ol { padding-left: 1.2rem; }
.source { margin-top: 1.4rem; }
.source summary { cursor: pointer; padding: .9rem 1.2rem; color: var(--ink); font-family: var(--font-display); }
.source summary small { color: var(--sub); font-family: var(--font-body); margin-left: .6rem; }
.source pre {
  margin: 0; padding: 1rem 1.2rem; border-top: 1px solid var(--cardline);
  overflow: auto; max-height: 70vh; font: 12.5px/1.5 'SF Mono', Menlo, Consolas, monospace;
  color: var(--ink); tab-size: 4;
}
.source .bar { display: flex; gap: .5rem; flex-wrap: wrap; padding: .6rem 1.2rem .9rem; border-top: 1px solid var(--cardline); }

/* 404 */
.lost { text-align: center; color: var(--sub); }
.lost p { margin: .6rem 0; }
.lost .row { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1.8rem; }

footer { text-align: center; padding: 2.5rem 1rem 3.5rem; color: var(--sub); font-size: .9rem; position: relative; z-index: 2; }
footer .links { margin-top: .5rem; }
footer .links a { margin: 0 .6rem; }
footer .fine { margin-top: 1rem; opacity: .5; }

/* books */
.books h2.group { font-family: var(--font-display); font-size: 1.3rem; margin: 2rem 0 1rem; }
.books h2.group:first-child { margin-top: .5rem; }
.books .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; }
.book { display: flex; flex-direction: column; }
.book .cover { display: block; width: 100%; aspect-ratio: 2/3; object-fit: cover; background: #000; border-bottom: 1px solid var(--cardline); }
.book .meta { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.book h3 { font-family: var(--font-display); font-size: 1.02rem; line-height: 1.25; }
.book p { color: var(--sub); font-size: .84rem; line-height: 1.45; }
.book .links { margin-top: auto; padding-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.book .price { color: var(--sub); font-size: .8rem; margin-left: auto; }
.card canvas.shot { image-rendering: auto; }
.project-group { font-family: var(--font-display); font-size: 1.15rem; color: var(--sub); margin: 2.4rem 0 .2rem; letter-spacing: .04em; text-transform: uppercase; }
.project-group:first-child { margin-top: .4rem; }
.project-group small { display: block; font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: .9rem; margin-top: .3rem; }
.books .note { color: var(--sub); margin: -.4rem 0 1rem; font-size: .95rem; }
.book .cover.contain { object-fit: contain; background: transparent; }
.book.wide { grid-column: span 2; flex-direction: row; align-items: flex-start; }
.book.wide .cover { width: 42%; aspect-ratio: 453/640; border-bottom: 0; border-right: 1px solid var(--cardline); border-radius: 0 0 var(--radius) 0; }
.book.wide .meta { padding: 1.3rem 1.4rem; align-self: stretch; }
.book.wide h3 { font-size: 1.3rem; }
.book.wide p { font-size: .92rem; line-height: 1.5; }
@media (max-width: 560px) { .book.wide { grid-column: span 1; flex-direction: column; } .book.wide .cover { width: 100%; border-right: 0; border-bottom: 1px solid var(--cardline); } }
