/* Pixelated Polymath: shared styles */
:root {
  --bg: #191d3a;
  --ink: #ece8f5;
  --muted: #b3aed0;
  --accent: #f0a878;
  --line: #34386a;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 21px;
  line-height: 1.6;
}

img { image-rendering: pixelated; max-width: 100%; }

a { color: var(--accent); }
a:hover { color: #ffd2b0; }

/* Logo next to the name */
/* The icon is 32px (exactly 1/4 of the 128px art, so pixels stay even).
   Its base sits on the text baseline and its top lines up with the tall letters. */
.brand { display: inline-flex; align-items: baseline; gap: 10px; font-size: 30px; line-height: 1.2; }
.brand img { display: block; width: 32px; height: 32px; image-rendering: pixelated; transform: translateY(2px); }

/* Front page */
.home {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: url("dusk.png") center bottom / cover no-repeat;
  image-rendering: pixelated;
  position: relative;
}
.home::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 48, 0.15);
}
.home > * { position: relative; }
.home .name {
  margin: 28px 0 0;
  color: #e8ecf8;
}
.home nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: clamp(48px, 9vw, 76px);
  line-height: 1.12;
  padding-bottom: 8vh;
}
.home nav a { color: #ffffff; text-decoration: none; }
.home nav a:hover { color: #ffe08a; }

/* Inner pages */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}
.page > header { text-align: center; margin-bottom: 56px; }
.page > header a.brand { color: var(--ink); text-decoration: none; }
.page > header nav { margin-top: 6px; font-size: 18px; display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; }
.page > header nav a { font-size: 18px; color: var(--muted); text-decoration: none; }
.page > header nav a[aria-current="page"] { color: var(--accent); }

h1 { font-weight: 400; font-size: clamp(44px, 8vw, 64px); line-height: 1.1; margin: 0 0 24px; text-align: center; }
h2 { font-weight: 400; font-size: 34px; line-height: 1.2; margin: 48px 0 12px; }
.lede { font-size: 24px; text-align: center; color: var(--muted); margin: 0 auto 48px; max-width: 600px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }

.project { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; text-decoration: none; color: var(--ink); padding: 24px 0; border-top: 1px solid var(--line); }
.project:last-child { border-bottom: 1px solid var(--line); }
.project img { width: 120px; flex: none; }
.project .text { flex: 1 1 300px; }
.project h2 { margin: 0 0 6px; }
.project p { margin: 0; color: var(--muted); }
.project:hover h2 { color: var(--accent); }
.meta { font-size: 17px; color: var(--accent); letter-spacing: 0.5px; }

.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 32px 0; }
.gallery img { width: 100%; display: block; border-radius: 6px; }
.gallery figure { margin: 0; }
.gallery figcaption { font-size: 16px; color: var(--muted); margin-top: 6px; text-align: center; }
.wide { width: 100%; display: block; border-radius: 6px; margin: 32px 0 8px; }

.button { display: inline-block; background: var(--accent); color: #1a1430; text-decoration: none; padding: 12px 24px; border-radius: 999px; font-size: 21px; }
.button:hover { background: #ffd2b0; color: #1a1430; }
.note { font-size: 18px; color: var(--muted); }

footer.site { text-align: center; font-size: 16px; color: var(--muted); padding: 32px 24px 48px; }

@media (max-width: 600px) {
  body { font-size: 19px; }
  .gallery { gap: 10px; }
}

/* ---------- Pages on the starry sky (Projects board, project pages) ---------- */
body.sky { background: var(--bg) url("dusk.png") center bottom / cover no-repeat fixed; image-rendering: pixelated; }
body.sky .page { max-width: 1040px; }
body.sky .lede, body.sky .page > header nav a { color: #d6d2ec; }
.back { font-size: 18px; text-decoration: none; }

/* Projects board */
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; margin: 0 0 36px; font-size: 17px; color: #d6d2ec; }
.legend span, .tile-meta { display: inline-flex; gap: 8px; align-items: center; }
.legend img, .tile-meta img { width: 16px; height: 16px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 6px solid #2a2f5a; border-radius: 6px; overflow: hidden; }
.board > * { aspect-ratio: 1 / 1; }
/* Empty squares keep a chessboard pattern. 4 columns: squares 3, 6, 8 are dark. */
.board > .sq { background: #262b55; }
.board > .sq:nth-child(3), .board > .sq:nth-child(6), .board > .sq:nth-child(8) { background: #1e2246; }
.tile { display: flex; flex-direction: column; text-decoration: none; color: #fff; background: #10142e; }
.tile img.cover { flex: 1; min-height: 0; width: 100%; object-fit: cover; object-position: 78% 45%; display: block; }
.tile-label { display: block; padding: 10px 16px 12px; background: #10142e; }
.tile-meta { font-size: 15px; color: var(--accent); }
.tile-title { display: block; font-size: 24px; line-height: 1.15; }
.tile:hover .tile-title { color: var(--accent); }
.board-note { margin: 20px 0 0; text-align: center; font-size: 18px; color: #d6d2ec; }

/* Project page */
.project-head { text-align: center; margin: 24px 0 40px; }
.project-head .meta { display: inline-flex; gap: 8px; align-items: center; letter-spacing: 1px; font-size: 16px; }
.project-head h1 { margin: 6px 0 12px; font-size: clamp(44px, 7vw, 64px); }
.project-head .lede { margin-bottom: 24px; font-size: 23px; }
.project-head .note { margin: 10px 0 0; font-size: 17px; color: var(--muted); }

.shots { position: relative; background: #10142e; padding: 10px; border-radius: 8px; }
.shots-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.shots-track img { width: 100%; height: auto; aspect-ratio: 390 / 844; display: block; border-radius: 4px; image-rendering: auto; }
.shots-btn, .shots-dots { display: none; }

h2.center { text-align: center; font-size: 30px; margin: 48px 0 14px; }
.cast { overflow: hidden; }
.cast-track { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; text-align: center; font-size: 15px; color: #d6d2ec; }
.cast-track figure { margin: 0; }
.cast-track img { width: 84px; height: 84px; display: block; margin: 0 auto; }
.cast-track figcaption { line-height: 1.2; margin-top: 4px; }
.cast-track .dup { display: none; }
.cast-track .boss { color: var(--accent); }

@keyframes cast-roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (max-width: 600px) {
  body.sky .page { padding: 22px 18px 56px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); border-width: 5px; }
  /* 2 columns: squares 4, 5, 8 are dark. */
  .board > .sq:nth-child(n) { background: #262b55; }
  .board > .sq:nth-child(4), .board > .sq:nth-child(5), .board > .sq:nth-child(8) { background: #1e2246; }
  .tile-label { padding: 6px 10px 8px; }
  .tile-meta { font-size: 13px; }
  .tile-title { font-size: 17px; }
  .legend { gap: 18px; font-size: 16px; margin-bottom: 22px; }
  .board-note { font-size: 16px; }

  .project-head .lede { font-size: 20px; }
  .shots { padding: 12px; border-radius: 12px; }
  .shots-track { display: flex; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .shots-track::-webkit-scrollbar { display: none; }
  .shots-track img { flex: 0 0 100%; scroll-snap-align: center; border-radius: 6px; }
  .shots-btn { display: block; position: absolute; top: calc(50% - 22px); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(16,20,46,0.8); color: #fff; font-size: 22px; cursor: pointer; }
  .shots-btn.prev { left: 20px; }
  .shots-btn.next { right: 20px; }
  .shots-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
  .shots-dots button { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: #4a4f7a; cursor: pointer; }
  .shots-dots button[aria-current="true"] { background: var(--accent); }

  h2.center { font-size: 26px; margin-top: 36px; }
  .cast { margin: 0 -18px; padding: 6px 0; }
  .cast-track { display: flex; gap: 18px; width: max-content; animation: cast-roll 28s linear infinite; }
  .cast-track figure { width: 96px; flex: none; font-size: 14px; }
  .cast-track .dup { display: block; }
  .cast:hover .cast-track, .cast:active .cast-track { animation-play-state: paused; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .cast-track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; }
  .cast-track .dup { display: none; }
}
body.sky .project-head .note, body.sky .lede { text-shadow: 0 1px 3px rgba(14, 20, 48, 0.9); }
body.sky .project-head .note { color: #ece8f5; }

/* Game logo in place of the title on a project page */
.project-head h1.game-logo { margin: 14px 0 18px; line-height: 0; }
.game-logo img { display: block; width: min(560px, 100%); height: auto; margin: 0 auto; image-rendering: auto; }
@media (max-width: 600px) { .game-logo img { width: min(320px, 100%); } }

/* About page */
body.about .page > header { margin-bottom: 72px; }
.about { max-width: 600px; margin: 0 auto; font-size: 22px; }
.about h1 { text-align: left; margin-bottom: 28px; }
.about p { margin: 0 0 22px; }
.about .reserved { margin: 0; color: #d6d2ec; }
.about-knight { display: block; width: 128px; height: 128px; margin: 64px auto 0; }
footer.site .footer-links { margin: 0 0 6px; }
.footer-links a { color: var(--muted); }
body.about footer.site { padding-top: 80px; }
@media (max-width: 600px) {
  body.about .page > header { margin-bottom: 48px; }
  .about { font-size: 20px; }
  .about h1 { font-size: 48px; margin-bottom: 20px; }
  .about-knight { width: 96px; height: 96px; margin-top: 48px; }
  body.about footer.site { padding-top: 56px; }
}

/* Under construction (Writing) */
.construction { text-align: center; }
.construction .barricade { display: block; width: 360px; max-width: 100%; height: auto; margin: 24px auto 36px; }
.construction p { margin: 0; font-size: 24px; color: #d6d2ec; }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .25; } }
.barricade .lamp { animation: blink 1.2s steps(1) infinite; }
.barricade .lamp-b { animation-delay: .6s; }
@media (max-width: 600px) {
  .construction .barricade { width: 280px; margin: 16px auto 28px; }
  .construction p { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .barricade .lamp { animation: none; } }
