/* Cavern Cat's site. One long page that goes down the mine: the camp at night on top,
   then each layer's rock in its own colours, with a depth gauge that follows the scroll. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Kalam";
  src: url("fonts/kalam-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Kalam";
  src: url("fonts/kalam-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* The game's own colours */
  --night: #131434;        /* the sky over the camp */
  --helmet: #f6a821;       /* her helmet: the one colour that means "press this" */
  --helmet-deep: #c9720f;
  --paper: #f3e7cc;        /* the log book's pages: all text */
  --paper-dim: #cdbfa3;
  --ink: #2a1c12;          /* text on helmet yellow and on paper */
  --firelight: #ffcf7a;    /* her handwriting */

  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --hand: "Kalam", "Comic Sans MS", "Segoe Print", cursive;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  --step-3: clamp(2.1rem, 1.3rem + 3.4vw, 3.4rem);

  --gutter: clamp(1.1rem, 4vw, 3rem);
  --measure: 34rem;
  --wide: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font-family: var(--display);
  font-size: var(--step-0);
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--firelight); text-underline-offset: 0.18em; }
a:hover { color: #fff; }
:focus-visible { outline: 3px solid var(--helmet); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -0.01em; }
p { margin: 0; max-width: var(--measure); text-wrap: pretty; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* --- Buttons ------------------------------------------------------------ */
.button {
  display: inline-flex; align-items: center; gap: 0.6em;
  font: inherit; font-weight: 800; text-decoration: none; line-height: 1.1;
  padding: 0.85em 1.3em; border-radius: 0.7em; border: 0; cursor: pointer;
}
.button-wishlist {
  background: var(--helmet); color: var(--ink);
  box-shadow: 0 0.28em 0 var(--helmet-deep);
  transition: transform 0.08s, box-shadow 0.08s;
}
.button-wishlist:hover { color: var(--ink); background: #ffbb3d; }
.button-wishlist:active { transform: translateY(0.2em); box-shadow: 0 0.08em 0 var(--helmet-deep); }
.button-wishlist svg { width: 1.35em; height: 1.35em; flex: none; }
.button-big { font-size: var(--step-1); }
.button-quiet {
  color: var(--paper); box-shadow: inset 0 0 0 2px rgb(243 231 204 / 0.45);
}
.button-quiet:hover { box-shadow: inset 0 0 0 2px var(--paper); }
.actions { display: flex; flex-wrap: wrap; gap: 0.9rem 1rem; align-items: center; }

/* --- Top bar ------------------------------------------------------------ */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem var(--gutter);
  background: linear-gradient(rgb(10 10 28 / 0.85), rgb(10 10 28 / 0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar-logo img { height: 1.9rem; width: auto; }
.topbar nav { display: flex; align-items: center; gap: 1.2rem; font-size: var(--step--1); font-weight: 700; }
.topbar nav a:not(.button) { color: var(--paper); text-decoration: none; }
.topbar nav a:not(.button):hover { text-decoration: underline; }
.topbar .button { padding: 0.6em 0.95em; white-space: nowrap; }
.topbar-logo { min-width: 0; }

/* --- The camp (top of the page) ---------------------------------------- */
.camp {
  position: relative;
  background: var(--night);
  padding-top: clamp(5rem, 9vw, 7.5rem);
  overflow: hidden;
}
.camp-stars {
  position: absolute; inset: 0 0 auto 0; height: 70%; pointer-events: none; opacity: 0.8;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 42%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 9%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 30%, #cfd6ff 50%, transparent 51%),
    radial-gradient(2px 2px at 71% 14%, #ffe9b8 50%, transparent 51%),
    radial-gradient(1px 1px at 83% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 93% 22%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 62%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 55%, #cfd6ff 50%, transparent 51%);
}
.camp-top {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 2rem var(--gutter); align-items: center;
}
.camp-words { display: flex; flex-direction: column; gap: 1.3rem; align-items: flex-start; }
.camp-words h1 img { width: min(100%, 38rem); filter: drop-shadow(0 6px 0 rgb(0 0 0 / 0.35)); }
.tagline { font-family: var(--hand); font-weight: 700; font-size: var(--step-2); color: var(--firelight); line-height: 1.1; }
.lede { font-size: var(--step-1); line-height: 1.4; max-width: 30rem; }
.status { font-size: var(--step--1); color: var(--paper-dim); }

/* The mascot, in the circle of her lantern's light. */
.lantern {
  justify-self: center; position: relative;
  width: min(100%, 26rem); aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #6b4a7d 0%, #3d2f63 45%, #1d1b47 72%, rgb(19 20 52 / 0) 100%);
}
.lantern::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 3.5rem 2rem var(--night);
}
.lantern img { position: absolute; left: 4%; top: 7%; width: 96%; max-width: none; }

.camp-ground {
  position: relative; z-index: 1;
  margin-top: clamp(-5rem, -6vw, -2rem);
  height: clamp(15rem, 30vw, 27rem);
  background: url("img/camp-night.webp") 38% bottom / auto 100% no-repeat;
}
.camp-ground::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 35%;
  background: linear-gradient(var(--night), rgb(19 20 52 / 0));
}

/* --- Layers ------------------------------------------------------------- */
.layer {
  --bg: #2b1c14;
  position: relative;
  background: var(--bg);
  padding-block: 0 clamp(4rem, 9vw, 7rem);
}
/* A strip of the layer's own rock along its top, fading into its colour. */
.layer-strip {
  height: clamp(7rem, 15vw, 13rem);
  background: var(--strip) center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(#000 35%, transparent);
  mask-image: linear-gradient(#000 35%, transparent);
  margin-bottom: clamp(1rem, 3vw, 2.5rem);
}
.layer-camp { --bg: #1a1420; padding-top: clamp(3rem, 7vw, 5rem); }
.layer-dirt { --bg: #33221a; --strip: url("img/strip-dirt.webp"); }
.layer-stone { --bg: #2b2734; --strip: url("img/strip-stone.webp"); }
.layer-aquifer { --bg: #13293a; --strip: url("img/strip-aquifer.webp"); }
.layer-glimmerdeep { --bg: #1e1436; --strip: url("img/strip-glimmerdeep.webp"); }
.layer-magma { --bg: #2a110b; --strip: url("img/strip-magma.webp"); }
.layer-underforge { --bg: #131a1f; --strip: url("img/strip-underforge.webp"); }

/* Her note on arriving in a layer, as in the game: "190 m. Stone, old and patient." */
.depth-note {
  font-family: var(--hand); font-weight: 700; font-size: var(--step-1);
  color: var(--firelight); line-height: 1.25; max-width: none;
}
.depth-note span { color: var(--paper-dim); font-weight: 400; }

.split {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2rem clamp(2rem, 5vw, 4rem); align-items: center;
}
.split.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.split.flip > .stack { order: 2; }

/* Screenshots are buttons that open the big picture. */
.shot {
  display: block; padding: 0; border: 0; background: none; cursor: zoom-in; width: 100%;
  border-radius: 0.9rem; overflow: hidden;
  box-shadow: 0 0 0 3px rgb(0 0 0 / 0.35), 0 1.2rem 2.5rem rgb(0 0 0 / 0.45);
}
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.shot-pair { display: grid; gap: 1rem; }
.shot-pair .shot:nth-child(2) { width: 62%; justify-self: end; margin-top: -18%; position: relative; }

/* --- The camp's folk ---------------------------------------------------- */
.folk { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem clamp(1rem, 3vw, 2.5rem); margin-top: 2.5rem; padding: 0; list-style: none; }
.folk li { display: flex; flex-direction: column; gap: 0.5rem; }
.folk-portrait {
  aspect-ratio: 1 / 1; border-radius: 1rem; overflow: hidden; margin-bottom: 0.4rem;
  background: radial-gradient(circle at 50% 35%, #5c4370, #2a2140 75%);
}
.folk-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.folk .kind { font-family: var(--hand); color: var(--firelight); font-size: var(--step-0); line-height: 1; }
.folk p { color: var(--paper-dim); font-size: 1rem; }

/* --- Plain facts -------------------------------------------------------- */
.facts { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; gap: 0.55rem; max-width: var(--measure); }
.facts li { padding-left: 1.6em; position: relative; }
.facts li::before {
  content: ""; position: absolute; left: 0.15em; top: 0.42em; width: 0.7em; height: 0.7em;
  background: var(--helmet); transform: rotate(45deg); border-radius: 2px;
}

/* --- Gallery ------------------------------------------------------------ */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-top: 2rem; }
.gallery .shot { border-radius: 0.6rem; box-shadow: 0 0 0 2px rgb(0 0 0 / 0.4); }

dialog.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(96vw, 1600px); max-height: 94vh;
}
dialog.lightbox::backdrop { background: rgb(5 5 15 / 0.9); }
dialog.lightbox img { max-height: 86vh; width: auto; margin-inline: auto; border-radius: 0.6rem; }
dialog.lightbox p { color: var(--paper-dim); font-size: var(--step--1); padding: 0.7rem 0.2rem 0; max-width: none; }
dialog.lightbox form { position: absolute; top: 0.6rem; right: 0.6rem; }
dialog.lightbox button {
  font: inherit; font-weight: 800; color: var(--ink); background: var(--paper);
  border: 0; border-radius: 0.5em; padding: 0.35em 0.7em; cursor: pointer;
}

/* --- The bottom --------------------------------------------------------- */
.bottom { display: flex; flex-direction: column; gap: 1.4rem; align-items: flex-start; }
.bottom h2 { max-width: 14em; }
.press-row {
  margin-top: clamp(3rem, 7vw, 5rem); padding-top: 2rem; border-top: 2px solid rgb(243 231 204 / 0.15);
  display: flex; flex-wrap: wrap; gap: 1.2rem 3rem; align-items: center; justify-content: space-between;
}
.signup { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.4rem; }
.signup input[type="email"] {
  font: inherit; color: var(--ink); background: var(--paper); border: 0; border-radius: 0.6em;
  padding: 0.75em 1em; min-width: min(100%, 17rem); flex: 1;
}
footer.site {
  background: #0b0f12; color: var(--paper-dim); font-size: var(--step--1);
  padding: 2rem 0 5.5rem;
}
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; justify-content: space-between; }
footer.site p { max-width: none; }

/* --- Depth gauge (the game's HUD reads "DEPTH 264 m" in this corner) ---- */
.gauge {
  position: fixed; left: var(--gutter); bottom: 1rem; z-index: 15;
  display: flex; align-items: baseline; gap: 0.6em;
  padding: 0.45em 0.8em; border-radius: 0.5em;
  background: rgb(8 8 20 / 0.72); color: #fff;
  font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2;
  pointer-events: none;
}
.gauge-label { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-dim); }
.gauge-where { font-family: var(--hand); font-weight: 700; color: var(--firelight); }
.no-js .gauge { display: none; }

/* --- Press kit page ----------------------------------------------------- */
.press-page { background: #1a1420; }
.press-head { padding: clamp(6rem, 12vw, 8rem) 0 2.5rem; }
.press-head .stack { gap: 1.2rem; align-items: flex-start; }
.press-section { padding-block: 2.5rem; border-top: 2px solid rgb(243 231 204 / 0.12); }
.press-section > .wrap { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1.2rem 2rem; }
.press-section h2 { font-size: var(--step-2); }
.sheet { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.5rem 1.5rem; }
.sheet dt { color: var(--paper-dim); }
.sheet dd { margin: 0; }
.downloads { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1.2rem; }
.downloads a { display: flex; flex-direction: column; gap: 0.5rem; text-decoration: none; font-size: var(--step--1); }
.downloads img { border-radius: 0.5rem; background: #2a2140; aspect-ratio: 16 / 9; object-fit: contain; width: 100%; }
.downloads .on-rock img { padding: 1rem; }
.downloads span { text-decoration: underline; }

/* --- Narrow screens ----------------------------------------------------- */
@media (max-width: 52rem) {
  .camp-top, .split, .split.flip { grid-template-columns: minmax(0, 1fr); }
  .split.flip > .stack { order: 0; }
  .lantern { width: min(70%, 18rem); grid-row: 1; }
  .folk { grid-template-columns: minmax(0, 1fr); }
  .folk li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); column-gap: 1rem; align-items: start; }
  .folk-portrait { grid-row: span 3; margin: 0; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .press-section > .wrap { grid-template-columns: minmax(0, 1fr); }
  .topbar nav a.hide-narrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button-wishlist { transition: none; }
}
