:root {
  color-scheme: dark;
  --ink: #fff9d8;
  --midnight: #09052b;
  --royal: #29117a;
  --purple: #6f2dba;
  --hot-pink: #ff3da2;
  --gold: #ffd83d;
  --orange: #ff8a26;
  --mint: #75ffb1;
  --teal: #05bbb7;
  --ruby: #bd2447;
  --panel-light: #eee8ff;
  --panel-mid: #9285b6;
  --panel-dark: #241b4d;
  --screen: #031d14;
  --screen-green: #78ff74;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  margin: 0;
  color: var(--ink);
  background-color: #071b35;
  background-image:
    radial-gradient(circle at 8px 8px, rgb(255 216 61 / 42%) 0 1px, transparent 1.5px),
    radial-gradient(circle at 32px 26px, rgb(117 255 177 / 28%) 0 1px, transparent 1.5px),
    linear-gradient(135deg, rgb(30 56 104 / 60%) 25%, transparent 25%),
    linear-gradient(315deg, rgb(24 38 85 / 60%) 25%, transparent 25%);
  background-position: 0 0, 0 0, 0 0, 20px 20px;
  background-size: 42px 42px, 64px 64px, 40px 40px, 40px 40px;
  font-family: "Trebuchet MS", Verdana, Arial, sans-serif;
  line-height: 1.55;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 0%, rgb(112 45 186 / 35%), transparent 55%);
  content: "";
  pointer-events: none;
}

::selection {
  color: var(--midnight);
  background: var(--gold);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  color: #07051c;
  background: var(--gold);
  border: 3px outset #fff1a1;
  font-weight: 900;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1060px, calc(100% - 24px));
  margin: 26px auto;
  overflow: hidden;
  background: var(--midnight);
  border: 5px outset var(--panel-light);
  box-shadow:
    0 0 0 4px #100937,
    0 18px 55px rgb(0 0 0 / 60%);
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 32px;
  padding: 0.25rem 0.55rem;
  color: white;
  background: linear-gradient(90deg, #10096d, #6940b5);
  border-bottom: 2px solid #b9a9eb;
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.browser-bar__gem {
  color: var(--gold);
}

.browser-bar__controls {
  margin-left: auto;
  padding: 0 0.3rem;
  color: #160c50;
  background: #d6cfe9;
  border: 2px outset white;
  letter-spacing: 0.25em;
}

.site-header {
  border-bottom: 3px ridge var(--gold);
}

.marquee {
  overflow: hidden;
  color: #241700;
  background: var(--gold);
  border-top: 2px solid #fff29d;
  border-bottom: 3px solid var(--orange);
  font-family: "Courier New", monospace;
  font-size: clamp(0.76rem, 2.3vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 22s linear infinite;
}

.marquee__track span {
  flex-shrink: 0;
  padding: 0.42rem 2.5rem;
}

@keyframes marquee-scroll {
  to {
    transform: translateX(-50%);
  }
}

.masthead {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  padding: 1.7rem 7rem;
  overflow: hidden;
  text-align: center;
  background:
    repeating-linear-gradient(90deg, transparent 0 39px, rgb(255 255 255 / 4%) 40px),
    repeating-linear-gradient(0deg, transparent 0 39px, rgb(255 255 255 / 4%) 40px),
    radial-gradient(ellipse at center, #6535ac 0, #2b126b 50%, #12093d 100%);
}

.masthead::before,
.masthead::after {
  position: absolute;
  color: var(--gold);
  font-size: 1.6rem;
  content: "✦  ·  ✧  ·  ✦";
  opacity: 0.72;
}

.masthead::before {
  top: 1.2rem;
  left: 1.5rem;
}

.masthead::after {
  right: 1.5rem;
  bottom: 1.2rem;
}

.masthead__eyebrow,
.kicker {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-family: "Courier New", monospace;
  font-size: 0.83rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0;
  color: var(--gold);
  font-family: Impact, Haettenschweiler, "Arial Black", sans-serif;
  font-size: clamp(3.2rem, 10vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 0.9;
  text-shadow:
    3px 3px 0 var(--orange),
    6px 6px 0 var(--ruby),
    9px 9px 0 #0d0733,
    0 0 18px rgb(255 216 61 / 45%);
  transform: scaleY(1.08);
}

.masthead__tagline {
  max-width: 650px;
  margin: 1rem auto 0;
  color: #f5eaff;
  font-family: Georgia, serif;
  font-size: clamp(0.95rem, 2vw, 1.18rem);
  font-style: italic;
}

.masthead__sparkle {
  position: absolute;
  left: 6%;
  color: var(--mint);
  font-size: 4rem;
  text-shadow: 0 0 14px var(--mint);
  animation: sparkle 1.8s steps(2, end) infinite;
}

.masthead__new {
  position: absolute;
  top: 1.35rem;
  right: 2.5rem;
  padding: 0.25rem 0.45rem;
  color: white;
  background: var(--hot-pink);
  border: 2px outset #ffc0e2;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  font-weight: 900;
  transform: rotate(7deg);
  animation: blink 1.15s steps(2, end) infinite;
}

@keyframes sparkle {
  50% {
    opacity: 0.35;
    transform: rotate(45deg) scale(0.82);
  }
}

@keyframes blink {
  50% {
    opacity: 0.45;
  }
}

main {
  background:
    linear-gradient(rgb(10 5 43 / 95%), rgb(10 5 43 / 95%)),
    repeating-linear-gradient(45deg, #2d1766 0 8px, #120b3f 8px 16px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.9fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1.3rem, 4vw, 3.2rem);
  border-bottom: 4px double var(--purple);
}

.bevel-panel {
  padding: clamp(1.15rem, 3vw, 2rem);
  color: #24183b;
  background: #f2ead6;
  border: 5px outset #fff9e9;
  box-shadow:
    8px 8px 0 #391c75,
    12px 12px 0 #080420;
}

.hero__copy h2 {
  margin: 0.1rem 0 0.8rem;
  color: #532080;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.05;
}

.hero__copy p:not(.kicker) {
  font-size: 1.02rem;
}

.hero__copy strong {
  color: #a51745;
}

.course-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.35rem;
  padding: 0.5rem;
  color: white;
  background: #35235d;
  border: 3px inset #b3a6cd;
  font-family: "Courier New", monospace;
  font-size: 0.68rem;
  font-weight: 900;
}

.course-progress__bar {
  height: 14px;
  padding: 2px;
  background: #050317;
  border: 2px inset #8e84aa;
}

.course-progress__bar span {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--mint) 0 7px, #159b68 7px 10px);
}

.hero__art {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
}

.hero__art img {
  display: block;
  width: min(100%, 440px);
  height: auto;
  filter: drop-shadow(8px 10px 0 rgb(0 0 0 / 35%));
  animation: dragon-bob 3.4s ease-in-out infinite;
}

@keyframes dragon-bob {
  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

.dragon-caption {
  margin: -0.8rem 0 0;
  padding: 0.28rem 0.6rem;
  color: #251604;
  background: var(--gold);
  border: 2px outset #fff09a;
  font-family: "Courier New", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  transform: rotate(-1deg);
}

.starburst {
  position: absolute;
  top: 4%;
  right: -2%;
  z-index: 2;
  display: grid;
  width: 106px;
  aspect-ratio: 1;
  place-content: center;
  color: white;
  background: var(--ruby);
  clip-path: polygon(50% 0, 61% 26%, 85% 15%, 74% 39%, 100% 50%, 74% 61%, 85% 85%, 61% 74%, 50% 100%, 39% 74%, 15% 85%, 26% 61%, 0 50%, 26% 39%, 15% 15%, 39% 26%);
  font-family: "Arial Black", sans-serif;
  font-size: 0.7rem;
  line-height: 1;
  text-align: center;
  text-shadow: 1px 1px 0 #3f0715;
  transform: rotate(10deg);
}

.starburst span {
  display: block;
  margin-bottom: 0.12rem;
  color: var(--gold);
  font-size: 1.25rem;
}

.fact-machine {
  margin: clamp(1.4rem, 4vw, 3rem);
  border: 5px outset #b8aace;
  box-shadow: 8px 8px 0 #000;
}

.fact-machine__titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  color: white;
  background: linear-gradient(90deg, #191274, #783dc7);
  border-bottom: 2px solid #cbbce1;
}

.fact-machine__titlebar h2 {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  letter-spacing: 0.04em;
}

.status-light {
  width: 13px;
  height: 13px;
  margin-left: auto;
  background: #59ff69;
  border: 2px inset #d7ffd9;
  box-shadow: 0 0 10px #59ff69;
  animation: blink 2s steps(2, end) infinite;
}

.fact-machine__body {
  padding: clamp(0.8rem, 2.5vw, 1.5rem);
  background: #777184;
  border: 4px inset #d1cad8;
}

.fact-screen {
  position: relative;
  min-height: 210px;
  padding: clamp(1rem, 3vw, 1.7rem);
  overflow: hidden;
  color: var(--screen-green);
  background:
    repeating-linear-gradient(0deg, rgb(0 0 0 / 13%) 0 1px, transparent 1px 3px),
    radial-gradient(circle at center, #073c2a, var(--screen));
  border: 6px inset #888;
  box-shadow: inset 0 0 36px #000;
  font-family: "Courier New", monospace;
  text-shadow: 0 0 7px rgb(117 255 177 / 60%);
}

.fact-screen__label {
  margin: 0 0 1rem;
  color: #38c576;
  font-size: 0.72rem;
  font-weight: 700;
}

.fact-screen__text {
  max-width: 850px;
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.55rem);
  font-weight: 700;
  line-height: 1.42;
}

.fact-screen__source {
  margin: 1rem 0 0;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
}

.terminal-cursor {
  color: var(--screen-green);
  animation: blink 1s steps(2, end) infinite;
}

.fact-screen.is-refreshing .fact-screen__text,
.fact-screen.is-refreshing .fact-screen__source {
  animation: terminal-refresh 180ms steps(2, end);
}

@keyframes terminal-refresh {
  50% {
    opacity: 0.15;
    transform: translateX(3px);
  }
}

.fact-machine__controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0.25rem 0.25rem;
}

.fact-machine__controls p {
  margin: 0;
  color: #17121c;
  font-size: 0.73rem;
  font-style: italic;
}

.retro-button {
  flex: 0 0 auto;
  padding: 0.7rem 1rem;
  color: #1f1200;
  background: var(--gold);
  border: 4px outset #fff0a1;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  box-shadow: 3px 3px 0 #2a183a;
  cursor: pointer;
}

.retro-button:hover {
  background: #ffe972;
}

.retro-button:active {
  border-style: inset;
  box-shadow: 1px 1px 0 #2a183a;
  transform: translate(2px, 2px);
}

.retro-button:focus-visible,
a:focus-visible {
  outline: 4px solid var(--mint);
  outline-offset: 4px;
}

.curriculum {
  padding: 0 clamp(1.4rem, 4vw, 3rem) clamp(2rem, 5vw, 3.5rem);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  color: var(--gold);
  text-align: center;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(1.25rem, 4vw, 1.8rem);
}

.section-heading span {
  color: var(--hot-pink);
  font-family: "Courier New", monospace;
}

.curriculum__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.lesson-card {
  position: relative;
  min-height: 220px;
  padding: 1.3rem;
  overflow: hidden;
  color: #21162d;
  background: #f1e9cf;
  border: 4px outset white;
  box-shadow: 5px 5px 0 #000;
}

.lesson-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--accent);
  content: "";
}

.lesson-card--ruby {
  --accent: var(--ruby);
}

.lesson-card--gold {
  --accent: #c88e00;
}

.lesson-card--teal {
  --accent: #008c87;
}

.lesson-card__number {
  position: absolute;
  right: 0.65rem;
  color: rgb(35 24 46 / 12%);
  font-family: Impact, sans-serif;
  font-size: 5rem;
  line-height: 1;
}

.lesson-card h3 {
  position: relative;
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 1.3rem;
}

.lesson-card p {
  position: relative;
}

.lesson-card__status {
  position: absolute;
  bottom: 0.8rem;
  left: 1rem;
  padding: 0.18rem 0.4rem;
  color: white;
  background: var(--accent);
  border: 2px outset white;
  font-family: "Courier New", monospace;
  font-size: 0.7rem;
  font-weight: 900;
  transform: rotate(-2deg);
}

.web-awards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 1.1rem;
  background: #050317;
  border-top: 3px ridge #5e4d8f;
}

.web-badge {
  display: grid;
  width: 92px;
  min-height: 52px;
  place-content: center;
  padding: 0.3rem;
  border: 3px outset white;
  font-family: "Arial Black", sans-serif;
  line-height: 1;
  text-align: center;
}

.web-badge strong {
  font-size: 1.25rem;
}

.web-badge span {
  margin-top: 0.2rem;
  font-size: 0.52rem;
  letter-spacing: 0.07em;
}

.web-badge--y2k {
  color: #031a10;
  background: var(--mint);
}

.web-badge--cookies {
  color: #342000;
  background: var(--gold);
}

.web-badge--dragon {
  background: #8a1d40;
}

.web-badge--html {
  background: #075795;
}

.visitor-counter {
  display: grid;
  place-items: center;
  color: white;
  font-family: "Courier New", monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.visitor-counter strong {
  padding: 0.15rem 0.35rem;
  color: #ff4f4f;
  background: #060606;
  border: 3px inset #777;
  font-size: 1.15rem;
  letter-spacing: 0.18em;
  text-shadow: 0 0 5px #ff2020;
}

.visitor-counter small {
  color: #aaa;
  font-size: 0.5rem;
  text-transform: lowercase;
}

.site-footer {
  padding: 1rem;
  color: #c4b9dd;
  background: #080520;
  border-top: 3px ridge #4d3f75;
  font-family: "Courier New", monospace;
  font-size: 0.68rem;
  text-align: center;
}

.site-footer p {
  margin: 0.25rem;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 12px, 620px);
    margin-block: 6px;
  }

  .masthead {
    min-height: 170px;
    padding: 1.4rem 2.4rem;
  }

  .masthead__sparkle {
    display: none;
  }

  .masthead__new {
    top: 0.8rem;
    right: 0.9rem;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero__art {
    order: -1;
  }

  .hero__art img {
    width: min(78vw, 390px);
  }

  .starburst {
    right: 6%;
  }

  .curriculum__grid {
    grid-template-columns: 1fr;
  }

  .lesson-card {
    min-height: 185px;
  }
}

@media (max-width: 480px) {
  .page-shell {
    border-width: 3px;
  }

  .browser-bar__controls {
    display: none;
  }

  .masthead {
    padding-inline: 0.9rem;
  }

  .masthead h1 {
    font-size: clamp(3rem, 17vw, 4.6rem);
    text-shadow:
      2px 2px 0 var(--orange),
      4px 4px 0 var(--ruby),
      6px 6px 0 #0d0733;
  }

  .masthead::before,
  .masthead::after {
    font-size: 1rem;
  }

  .hero {
    padding-inline: 0.75rem;
  }

  .bevel-panel {
    box-shadow: 5px 5px 0 #391c75;
  }

  .course-progress {
    grid-template-columns: 1fr auto;
  }

  .course-progress__bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .fact-machine {
    margin-inline: 0.65rem;
    border-width: 3px;
  }

  .fact-screen {
    min-height: 245px;
  }

  .fact-machine__controls {
    align-items: stretch;
    flex-direction: column;
  }

  .curriculum {
    padding-inline: 0.65rem;
  }

  .section-heading span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .marquee__track {
    width: 100%;
    transform: none;
  }

  .marquee__track span {
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
  }

  .marquee__track span + span {
    display: none;
  }
}
