:root {
  --grey-900: #1f1f1f;
  --grey-800: #2e2e2e;
  --grey-700: #444444;
  --grey-500: #777777;
  --grey-300: #bdbdbd;
  --grey-200: #dcdcdc;
  --grey-100: #f2f2f2;
  --white: #ffffff;
}

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

body {
  /* Retro fonts: VT323 (terminal) for text and the nav, Press Start 2P (8-bit game) for
     headings. Both from Google Fonts, linked in each page. */
  font-family: "VT323", "Courier New", monospace;
  font-size: 1.25rem;
  /*background: var(--grey-100);*/
  /*color: var(--grey-800);*/
  line-height: 1.6;
  height: 100vh;
  height: 100dvh; /* mobile: excludes the browser toolbar */
  overflow: hidden;
  display: flex;
  flex-direction: column;

    background-image: url("./background.png");
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #f5f7f4;
}

/* Home page: globe tucked into the bottom-right corner with only its
   top-left quarter showing. */
.hero {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Navigation */
.nav {
  background: var(--grey-800);
  border-bottom: 3px solid var(--grey-500);
}

.nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
}

/* Everything from this item on sits on the right */
.nav .nav-push {
  margin-left: auto;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  color: var(--grey-200);
  text-decoration: none;
  font-family: "VT323", "Courier New", monospace;
  font-size: 1.5rem;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

/* Pixel-art icon: crisp square edges, drawn in the link's colour */
.nav-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

.nav a:hover,
.nav a.active {
  background: var(--grey-700);
  color: var(--white);
}

/* Main content */
.content {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 24px auto;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  /* Fill the space left between nav and footer; the visualisation
     inside sizes itself to whatever that space is (cqw/cqh units). */
  min-height: 0;
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rotating globe — animated with a CSS transform so the browser's
   compositor (GPU) does the work instead of a JavaScript timer loop. */
.globe {
  position: relative;
  width: min(100cqw, 100cqh, 640px);
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  container-type: inline-size; /* lets the caption scale with the globe */
}

.globe-img {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(0.65) contrast(0.9) brightness(1.05); /* softer, muted colours */
  will-change: transform;
  animation: globe-spin 72s linear infinite; /* 0.25x the original 18s */
}

@keyframes globe-spin {
  to {
    transform: rotate(360deg);
  }
}

.globe-text {
  position: absolute;
  top: 18%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: "Press Start 2P", "Courier New", monospace;
  font-size: 3.6cqw;
  color: var(--white);
  text-shadow: 0 0 2px #000, 0 2px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

/* Planetary gears (about page) — built once by gears.js, spun by CSS */
/* Content area that runs edge to edge between nav and footer */
.content.content-full {
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent; /* let the body's background image show through */
  position: relative;
}

.gears {
  position: absolute;
  inset: 0;
}

#gears {
  display: block;
  width: 100%;
  height: 100%;
}

.gear {
  stroke: var(--grey-900);
  stroke-width: 1;
  fill-rule: evenodd;
}

/* One muted hue per level: rings pale, suns deeper, smallest gears between */
.gear-l0 { --hue: 15; }  /* terracotta */
.gear-l1 { --hue: 40; }  /* ochre */
.gear-l2 { --hue: 150; } /* sage */
.gear-l3 { --hue: 205; } /* dusty blue */
.gear-l4 { --hue: 280; } /* mauve */
.gear-l5 { --hue: 340; } /* dusty rose */
.gear-l6 { --hue: 95; }  /* olive */

.gear-ring {
  fill: hsl(var(--hue) 22% 82%);
}

.gear-sun {
  fill: hsl(var(--hue) 22% 58%);
}

.gear-planet {
  fill: hsl(var(--hue) 30% 68%);
}

.gear-spin {
  will-change: transform;
  animation: globe-spin linear infinite;
}

.gears-caption {
  position: absolute;
  right: 0;
  bottom: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 16px;
  border-radius: 4px;
  color: #7f3636;
  white-space: nowrap;
}

/* Home page globe: large and centred on the
   bottom-right corner so only the top-left quarter is on screen */
.hero .globe {
  --globe-size: calc(1.3 * min(45cqw, 100cqh, 640px));
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--globe-size);
  transform: translate(50%, 50%);
}

@container (orientation: portrait) {
  .hero .globe {
    --globe-size: calc(1.3 * min(100cqw, 55cqh, 640px));
  }
}

/* Keep the caption (dwarf above the text) on the visible quarter of the
   planet (its radius is about 32% of the image), along the bottom edge of
   the screen. Not inside the spinning image, so it stays upright. */
.hero .globe-label {
  position: absolute;
  bottom: 50%;
  right: 50%;
  padding: 0 1% 1% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.hero .globe-dwarf {
  width: 15cqw;
  height: auto;
  image-rendering: pixelated;
}

.hero .globe-text {
  position: static;
  font-size: 1.3cqw;
  line-height: 1.4;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .globe-img,
  .gear-spin {
    animation: none;
  }
}

/* Footer */
.footer {
  background: var(--grey-800);
  color: var(--grey-300);
  text-align: center;
  padding: 12px 16px;
  font-size: 1.1rem;
}

@media (max-width: 600px) {
  .content {
    margin: 12px;
    width: auto;
    padding: 16px;
  }

  .nav a {
    padding: 12px 14px;
  }
}
