@font-face {
  font-family: "Pixeloid Sans";
  src: url("../fonts/PixeloidSans.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #e9f6ef;
  --bg-deep: #d4efe4;
  --paper: #ffffff;
  --ink: #24302a;
  --muted: #5b7268;
  --line: #24302a;
  --mint: #7ddec4;
  --mint-2: #b7e4d4;
  --teal: #2a9d8f;
  --ok: #2d6a4f;
  --bad: #9b2c2c;
  --max: 1120px;
  --font-pixel: "Pixeloid Sans", "Segoe UI", sans-serif;
  --font-ui: Nunito, "Segoe UI", sans-serif;
  --pixel-shadow: 6px 6px 0 var(--mint-2);
  --pixel-btn: 4px 4px 0 var(--ink);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }

a { color: var(--teal); }

.btn, .card, .back, .top-nav a, .gym-banner {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
}
.skip:focus { left: 8px; z-index: 20; }

.topbar {
  border-bottom: 4px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 8;
}

.topbar-inner,
.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.mark {
  width: 36px;
  height: 36px;
  background: var(--mint);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-pixel);
  font-size: 14px;
  box-shadow: 3px 3px 0 var(--ink);
}

.brand strong {
  display: block;
  font-family: var(--font-pixel);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.crumb {
  color: var(--muted);
  font-size: 14px;
}

.crumb a { color: var(--teal); text-decoration: none; }

.hero {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 28px;
  align-items: center;
  padding: 36px 0 20px;
}

.hero-art {
  width: 100%;
  border: 4px solid var(--ink);
  background: #fff;
  box-shadow: var(--pixel-shadow);
}

.kicker {
  font-family: var(--font-pixel);
  color: var(--teal);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 10px;
}

h1, h2, h3 {
  font-family: var(--font-pixel);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  margin: 0;
}

h1 { font-size: clamp(22px, 3.4vw, 36px); max-width: 18ch; }
h2 { font-size: clamp(18px, 2.4vw, 24px); }
h3 { font-size: 18px; }

.lede {
  max-width: 58ch;
  color: var(--muted);
  font-size: 18px;
  margin: 14px 0 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.pill {
  background: var(--paper);
  border: 3px solid var(--ink);
  padding: 6px 12px;
  font-size: 14px;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--mint-2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 8px 0 56px;
}

.section-title {
  font-family: var(--font-pixel);
  font-size: 20px;
  margin: 8px 0 4px;
}

.card {
  background: var(--paper);
  border: 4px solid var(--ink);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  box-shadow: var(--pixel-shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover { color: inherit; }

.card-head {
  padding: 14px 14px 8px;
}

.num {
  font-family: var(--font-pixel);
  color: var(--teal);
  font-size: 13px;
}

.card h2, .card h3 {
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.35;
}

.card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card-foot {
  margin-top: auto;
  padding: 12px 14px 14px;
  color: var(--teal);
  font-weight: 800;
  font-size: 13px;
}

.thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg-deep);
  overflow: hidden;
  border-bottom: 4px solid var(--ink);
}

.thumb-pixel {
  aspect-ratio: 1 / 1;
  background: #e9f6ef;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-pixel img {
  object-fit: contain;
  padding: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pdf-thumb {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 18px;
}

.section-intro {
  padding: 28px 0 8px;
}

.section-intro h1 { max-width: 28ch; }

.section-intro .lede { margin-top: 12px; }

.section-banner {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  align-items: start;
}

.section-banner img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border: 4px solid var(--ink);
  box-shadow: var(--pixel-shadow);
  image-rendering: pixelated;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  margin-bottom: 18px;
}

.material {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  padding: 28px 0 64px;
  align-items: start;
}

.figure {
  background: var(--paper);
  border: 4px solid var(--ink);
  padding: 12px;
  position: sticky;
  top: 84px;
  box-shadow: var(--pixel-shadow);
}

.figure img,
.figure iframe {
  width: 100%;
  background: #fff;
}

.figure iframe {
  min-height: 70vh;
  border: 0;
}

.figure button,
.zoom-hint {
  margin-top: 10px;
  width: 100%;
}

.article p {
  margin: 0 0 14px;
  color: #2a322d;
}

.article p:first-of-type {
  font-size: 18px;
}

.quiz-box {
  margin-top: 28px;
  padding: 18px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: var(--pixel-shadow);
}

.quiz-box p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 15px;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 11px 18px;
}

.btn-primary {
  background: var(--mint);
  color: var(--ink);
  box-shadow: var(--pixel-btn);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 3px solid var(--ink);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 20, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 30;
}

.modal {
  width: min(640px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  padding: 24px;
  box-shadow: 8px 8px 0 var(--mint);
}

.modal h2 { margin-bottom: 6px; }

.q {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 3px solid var(--ink);
}

.q p { margin: 0 0 10px; font-weight: 800; }

label.opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  cursor: pointer;
}

label.opt.ok { background: #e5f3ea; }
label.opt.bad { background: #f8e6e4; }

.feedback {
  font-size: 15px;
  color: var(--muted);
  margin: 6px 0 0 28px;
}

.score {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg);
  border: 3px solid var(--ink);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 11, 0.92);
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  background: #fff;
}

.lightbox button {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #fff;
}

.note {
  font-size: 13px;
  color: var(--muted);
}

.site-footer {
  background: var(--ink);
  color: var(--bg);
  padding: 36px 0 48px;
  margin-top: 8px;
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
  gap: 28px;
}

.site-footer h3 {
  color: var(--mint);
  font-size: 16px;
  margin: 0 0 12px;
}

.site-footer p {
  margin: 0;
  color: #cfe6dc;
  font-size: 14px;
  line-height: 1.5;
}

.site-footer a {
  display: block;
  color: var(--bg);
  text-decoration: none;
  margin: 5px 0;
  font-size: 14px;
}

.footer-mini {
  width: 100%;
  max-width: 180px;
  height: 72px;
  object-fit: cover;
  border: 3px solid var(--mint);
  margin-top: 12px;
  image-rendering: pixelated;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.home-banners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0 28px;
}

.gym-banner {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  align-items: center;
  margin: 0;
  padding: 16px 18px;
  background: var(--paper);
  border: 4px solid var(--ink);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--pixel-shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.gym-banner:hover { color: inherit; }

.gym-banner h2 { margin-top: 4px; font-size: 22px; }

.gym-banner p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 62ch;
}

.gym-banner-art {
  height: 88px;
  background: #cda67a;
  border: 3px solid var(--ink);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 0 8px 8px;
  image-rendering: pixelated;
}

.px-fig {
  width: 16px;
  height: 28px;
  background:
    linear-gradient(#c9a45c 0 8px, #f3c7a4 8px 14px, #ef6b63 14px 22px, #3a4a6a 22px 28px);
  box-shadow: 4px 0 0 #5aa8e8;
}

.px-fig-b {
  background:
    linear-gradient(#8a5a30 0 6px, #f3c7a4 6px 12px, #3d7eea 12px 20px, #2f3d4a 20px 28px);
}

.px-fig-curator {
  width: 16px;
  height: 42px;
  background:
    linear-gradient(#2a1810 0 14px, #f3c7a4 14px 20px, #2a9d8f 20px 32px, #3a3348 32px 42px);
  box-shadow: 0 0 0 2px #7ddec4;
}

.gym-page { padding-bottom: 24px; }

.gym-page h1 { max-width: 16ch; }

.gym-stage {
  margin: 8px 0 12px;
  border: 4px solid var(--ink);
  background: #1e1812;
  box-shadow: var(--pixel-shadow);
  overflow: visible;
  line-height: 0;
  position: relative;
}

.gym-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
  touch-action: manipulation;
}

.gym-nametag {
  position: absolute;
  transform: translate(-50%, calc(-100% - 8px));
  background: #fffdf7;
  border: 3px solid var(--ink);
  padding: 6px 10px;
  font-family: var(--font-pixel);
  font-size: 13px;
  line-height: 1.25;
  color: var(--ink);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--mint);
  z-index: 2;
}

.gym-nametag b,
.gym-nametag span { display: block; font-weight: 400; }

.gym-nametag.is-curator {
  background: var(--mint);
  box-shadow: 3px 3px 0 var(--ink);
}

.gym-hint {
  margin: 0 0 40px;
  color: var(--muted);
  font-size: 14px;
}

.portrait-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #1a2e24;
  border: 4px solid var(--ink);
  box-shadow: var(--pixel-shadow);
}

.portrait-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.portrait-frame.is-photo {
  animation: portrait-a 20s ease-in-out infinite;
}

.portrait-frame.is-pixel {
  animation: portrait-b 20s ease-in-out infinite;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.portrait-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 8px;
  background: var(--mint);
  box-shadow: 0 -3px 0 var(--ink);
  animation: portrait-timer 10s linear infinite;
  z-index: 2;
}

@keyframes portrait-a {
  0%, 42% { opacity: 1; }
  50%, 92% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes portrait-b {
  0%, 42% { opacity: 0; }
  50%, 92% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes portrait-timer {
  from { width: 0; }
  to { width: 100%; }
}

.portrait-stage-mini {
  width: 88px;
  height: 110px;
  aspect-ratio: auto;
  margin: 0 auto;
  box-shadow: 3px 3px 0 var(--ink);
}

.portrait-stage-mini .portrait-timer { height: 5px; }

.portfolio {
  display: grid;
  grid-template-columns: minmax(240px, 0.82fr) 1.18fr;
  gap: 32px;
  padding: 8px 0 64px;
  align-items: start;
}

.portfolio-figure {
  margin: 0;
  position: sticky;
  top: 84px;
}

.portfolio-figure figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 13px;
  line-height: 1.45;
}

.portfolio-bio h1 {
  font-size: clamp(22px, 3.2vw, 32px);
  max-width: 16ch;
  margin-top: 2px;
}

.portfolio-meta { margin-top: 16px; }

.college-card {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: var(--pixel-shadow);
}

.college-card p {
  margin: 0;
  color: #2a322d;
  font-size: 17px;
}

.subjects-title {
  margin: 28px 0 12px;
  font-size: 16px;
  line-height: 1.45;
  max-width: 28ch;
}

.subject-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subject-list li {
  position: relative;
  padding: 10px 14px 10px 38px;
  background: var(--paper);
  border: 3px solid var(--ink);
  font-family: var(--font-pixel);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 3px 3px 0 var(--mint-2);
}

.subject-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  background: var(--mint);
  border: 2px solid var(--ink);
  transform: translateY(-50%);
}

@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--ink); }
  .card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0 var(--mint-2);
  }
  .gym-banner:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0 var(--mint-2);
  }
  .btn-primary:hover { filter: brightness(0.97); }
  .back:hover { color: var(--teal); }
  .site-footer a:hover { color: var(--mint); }
  label.opt:hover { background: var(--bg); }
}

@media (prefers-reduced-motion: reduce) {
  .portrait-frame.is-photo,
  .portrait-frame.is-pixel,
  .portrait-timer { animation: none; }
  .portrait-frame.is-photo { opacity: 1; }
  .portrait-frame.is-pixel { opacity: 0; }
  .portrait-timer { width: 100%; }
}

@media (max-width: 900px) {
  .hero,
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
  .home-banners { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .material,
  .portfolio { grid-template-columns: 1fr; }
  .figure,
  .portfolio-figure { position: static; }
  .portfolio-figure { max-width: 380px; }
  .brand span { display: none; }
  body { font-size: 16px; }
}

@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  .topbar {
    padding-top: env(safe-area-inset-top);
  }

  .topbar-inner,
  .wrap {
    width: 100%;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand strong { font-size: 13px; }

  .top-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 8px;
  }

  .top-nav .btn {
    text-align: center;
    font-size: 14px;
    padding: 12px 8px;
    min-height: 44px;
  }

  .crumb { display: none; }

  .hero {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0 8px;
  }

  .hero-art { box-shadow: 4px 4px 0 var(--mint-2); }

  h1 { font-size: 22px; max-width: none; line-height: 1.45; }
  h2 { font-size: 18px; }
  .kicker { font-size: 13px; }
  .lede { font-size: 16px; margin-top: 10px; }
  .section-intro { padding: 18px 0 6px; }
  .section-intro h1,
  .portfolio-bio h1,
  .gym-page h1 { max-width: none; }

  .meta-row { margin-top: 14px; gap: 8px; }
  .pill { font-size: 13px; padding: 6px 10px; }

  .home-banners { gap: 12px; margin-bottom: 20px; }

  .gym-banner {
    grid-template-columns: 88px 1fr;
    gap: 12px;
    padding: 12px;
    box-shadow: 4px 4px 0 var(--mint-2);
  }

  .gym-banner h2 { font-size: 18px; }
  .gym-banner p { font-size: 14px; }
  .portrait-stage-mini {
    width: 88px;
    height: 110px;
  }

  .section-banner {
    grid-template-columns: 72px 1fr;
    gap: 12px;
  }

  .section-banner img {
    width: 72px;
    height: 72px;
    box-shadow: 4px 4px 0 var(--mint-2);
  }

  .back {
    min-height: 44px;
    font-size: 16px;
    margin-bottom: 12px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 8px 0 32px;
  }

  .grid .card {
    display: grid;
    grid-template-columns: 96px 1fr;
    grid-template-rows: 1fr auto;
    box-shadow: 4px 4px 0 var(--mint-2);
  }

  .grid .thumb,
  .grid .thumb-pixel {
    grid-row: 1 / -1;
    width: 96px;
    min-height: 96px;
    height: 100%;
    aspect-ratio: auto;
    border-bottom: 0;
    border-right: 4px solid var(--ink);
  }

  .grid .thumb-pixel img { padding: 4px; }

  .grid .card-head {
    grid-column: 2;
    padding: 10px 12px 4px;
  }

  .grid .card h2,
  .grid .card h3 {
    font-size: 16px;
    line-height: 1.35;
  }

  .grid .card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    font-size: 13px;
    margin-top: 4px;
  }

  .grid .card-foot {
    grid-column: 2;
    padding: 0 12px 10px;
    font-size: 12px;
  }

  .material,
  .portfolio { padding: 12px 0 40px; gap: 18px; }

  .figure {
    padding: 8px;
    box-shadow: 4px 4px 0 var(--mint-2);
  }

  .figure iframe { min-height: 55vh; }

  .figure img { cursor: zoom-in; }

  .btn {
    min-height: 44px;
    padding: 12px 16px;
  }

  .figure .btn,
  .quiz-box .btn { width: 100%; }

  .quiz-box {
    padding: 14px;
    box-shadow: 4px 4px 0 var(--mint-2);
  }

  .overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    width: 100%;
    max-height: none;
    min-height: 100%;
    padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    box-shadow: none;
    border-left: 0;
    border-right: 0;
  }

  .modal h2 { font-size: 18px; line-height: 1.4; }

  label.opt {
    min-height: 48px;
    align-items: center;
    padding: 12px 10px;
    border: 2px solid transparent;
  }

  .btn-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-row .btn { width: 100%; }

  .feedback { margin-left: 0; }

  .lightbox {
    padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
    overflow: auto;
    align-content: start;
    -webkit-overflow-scrolling: touch;
  }

  .lightbox img {
    max-width: 100%;
    max-height: none;
    width: 100%;
    touch-action: pinch-zoom;
  }

  .lightbox button {
    position: sticky;
    top: 0;
    right: auto;
    margin: 0 0 12px auto;
    color: var(--ink);
    background: #fff;
    min-height: 44px;
  }

  .site-footer {
    padding: 24px 0 max(28px, env(safe-area-inset-bottom));
  }

  .site-footer .wrap {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .site-footer a {
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .gym-nametag {
    white-space: normal;
    max-width: min(220px, 78vw);
  }

  .subject-list li {
    font-size: 13px;
    padding: 12px 12px 12px 38px;
    min-height: 44px;
  }
}
