/* ==========================================================================
   Haunted Mana — shared styles
   The site is an illustrated book: a deep forest-green cover that opens
   onto warm parchment pages. Change the look from the tokens below.
   ========================================================================== */

:root {
  /* Cover (deep forest) */
  --forest-950: #0b1712;
  --forest-900: #0f1f18;
  --forest-800: #14281f;
  --forest-700: #1c3529;
  --forest-600: #27463a;

  /* Accents drawn from the dragon painting */
  --jade: #8fb5a4;          /* links on dark */
  --jade-deep: #355f50;     /* links on parchment */
  --blossom: #ecbcc3;
  --blossom-deep: #a85d6e;
  --plum: #6b4a63;
  --plum-deep: #4a3044;
  --gilt: #cdb07a;          /* fine gold lines, like cover tooling */
  --gilt-soft: rgba(205, 176, 122, 0.38);
  --gilt-faint: rgba(205, 176, 122, 0.16);

  /* Pages */
  --ivory: #f6f0e3;
  --ivory-muted: rgba(246, 240, 227, 0.74);
  --parchment: #f1e7d0;
  --parchment-edge: #dccaa4;
  --ink: #2c2529;
  --ink-muted: #5a4c52;

  --font-display: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --font-body: "EB Garamond", Garamond, Georgia, serif;

  --wrap: 74rem;
  --gutter: clamp(1rem, 4vw, 2.25rem);
  --radius: 4px;
  --shadow-deep: 0 2.2rem 4rem -1.5rem rgba(0, 0, 0, 0.75), 0 0.8rem 1.6rem -0.8rem rgba(0, 0, 0, 0.55);
  --shadow-paper: 0 1.2rem 2rem -1rem rgba(0, 0, 0, 0.6), 0 0.2rem 0.5rem rgba(0, 0, 0, 0.25);

  /* Fine paper grain, used on the cover and the pages */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --page-glow: radial-gradient(120% 80% at 50% 0%, var(--forest-700) 0%, var(--forest-900) 55%, var(--forest-950) 100%);
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* Botanical flourish (vine + blossom), drawn as a mask so it takes any colour */
  --flourish: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 28'%3E%3Cdefs%3E%3Cpath id='l' d='M0 0C2.5-3.2 7-3.6 9.5-.6 7 2.2 2.6 2.4 0 0Z'/%3E%3Cg id='h'%3E%3Cpath d='M109 14C96 14 88 10 76 11 62 12 54 18 40 16 30 14.6 24 12 16 13 10 13.6 9 18.6 12.6 18.8 15 18.9 15.3 16.2 13.4 15.8' fill='none' stroke='%23000' stroke-width='1.2' stroke-linecap='round'/%3E%3Cuse href='%23l' transform='translate(82 11.2) rotate(-145)'/%3E%3Cuse href='%23l' transform='translate(66 11.8) rotate(155)'/%3E%3Cuse href='%23l' transform='translate(46 16.8) rotate(-130)'/%3E%3Cuse href='%23l' transform='translate(31 14.4) rotate(140)'/%3E%3Ccircle cx='99' cy='10.5' r='1.1'/%3E%3Ccircle cx='93' cy='17.6' r='.9'/%3E%3C/g%3E%3C/defs%3E%3Cuse href='%23h'/%3E%3Cuse href='%23h' transform='matrix(-1 0 0 1 240 0)'/%3E%3Cg transform='translate(120 14)'%3E%3Cellipse cy='-5' rx='2.7' ry='4.2'/%3E%3Cellipse cy='-5' rx='2.7' ry='4.2' transform='rotate(72)'/%3E%3Cellipse cy='-5' rx='2.7' ry='4.2' transform='rotate(144)'/%3E%3Cellipse cy='-5' rx='2.7' ry='4.2' transform='rotate(216)'/%3E%3Cellipse cy='-5' rx='2.7' ry='4.2' transform='rotate(288)'/%3E%3Ccircle r='1.3'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--forest-900);
  background-image:
    var(--grain),
    var(--page-glow);
  background-attachment: scroll, fixed;
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: clamp(1.075rem, 0.35vw + 1rem, 1.2rem);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h2 { font-size: clamp(2.1rem, 3.5vw + 1rem, 3.1rem); }
h3 { font-size: clamp(1.6rem, 1.5vw + 1rem, 2.05rem); }
p { margin: 0 0 1em; text-wrap: pretty; }

a { color: var(--jade); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--blossom); }

:focus-visible { outline: 2px solid var(--blossom); outline-offset: 3px; border-radius: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ivory); color: var(--ink); padding: 0.6rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }

/* Small caps label above headings */
.eyebrow {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gilt);
  margin-bottom: 0.9rem;
}

.flourish {
  display: block;
  width: min(15rem, 70%);
  aspect-ratio: 240 / 28;
  margin: 1.1rem auto 1.4rem;
  color: var(--gilt);
  background: currentColor;
  -webkit-mask: var(--flourish) center / contain no-repeat;
          mask: var(--flourish) center / contain no-repeat;
}
.flourish--left { margin-left: 0; }

.section-head { text-align: center; max-width: 42rem; margin: 0 auto clamp(2.5rem, 5vw, 3.5rem); }
.section-head h2 { margin-bottom: 0; }
.section-head p { color: var(--ivory-muted); margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.7em 1.45em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--gilt);
  border-radius: 999px;
  color: var(--gilt);
  transition: background-color .25s ease, color .25s ease, box-shadow .25s ease;
}
.btn:hover { color: var(--forest-900); background: var(--gilt); box-shadow: 0 0 1.5rem -0.3rem rgba(236, 188, 195, 0.45); }
.btn--solid { background: var(--gilt); color: var(--forest-900); }
.btn--solid:hover { background: var(--blossom); border-color: var(--blossom); }

.text-link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.1em;
}
.text-link::after { content: " \2192"; }

/* ---------- Header & navigation ---------- */

.site-header { position: relative; z-index: 2; }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.25rem;
}
.site-header--rule { border-bottom: 1px solid var(--gilt-faint); }

/* Brand: swap images/brand/icon.png (or this whole block) when the new logo arrives */
.brand {
  display: inline-flex; align-items: center; gap: 0.8rem;
  color: var(--ivory); text-decoration: none;
}
.brand-mark {
  width: 3rem; height: 3rem;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--gilt-soft), 0 0 0 4px var(--forest-900), 0 0 0 5px var(--gilt-faint);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
}
.brand:hover { color: var(--blossom); }

.site-nav ul {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.25rem clamp(0.9rem, 2.5vw, 2rem);
  margin: 0; padding: 0; list-style: none;
}
.site-nav a {
  display: inline-block;
  padding: 0.35rem 0.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.site-nav a:hover { color: var(--blossom); }
.site-nav a[aria-current="page"] { color: var(--ivory); border-bottom-color: var(--gilt); }

/* Menu button: only shown on small screens when JavaScript is running */
.nav-toggle {
  display: none;
  place-items: center;
  width: 2.9rem; height: 2.9rem;
  padding: 0;
  color: var(--ivory);
  background: transparent;
  border: 1px solid var(--gilt-soft);
  border-radius: 50%;
  cursor: pointer;
}
.nav-toggle:hover { color: var(--blossom); border-color: var(--blossom); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 1.15rem; height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before,
.nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); background: currentColor; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); background: currentColor; }

@media (max-width: 40rem) {
  .site-header .wrap { position: relative; padding-block: 0.9rem; }
  .brand { gap: 0.65rem; }
  .brand-mark { width: 2.5rem; height: 2.5rem; }
  .brand-name { font-size: 1.3rem; }

  /* Without JavaScript the links simply wrap below the brand */
  html:not(.js) .site-header .wrap { justify-content: center; }
  html:not(.js) .site-nav { width: 100%; }
  html:not(.js) .site-nav a { font-size: 0.92rem; letter-spacing: 0.1em; }

  /* With JavaScript: compact bar + drop-down menu */
  html.js .site-header .wrap { flex-wrap: nowrap; }
  html.js .nav-toggle { display: grid; flex: none; }
  html.js .site-nav {
    display: none;
    position: absolute;
    top: calc(100% - 0.25rem);
    left: var(--gutter); right: var(--gutter);
    z-index: 20;
    padding: 0.4rem 0;
    background: var(--forest-900);
    border: 1px solid var(--gilt-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-deep);
  }
  html.js .site-nav.is-open { display: block; }
  html.js .site-nav ul { flex-direction: column; gap: 0; }
  html.js .site-nav a {
    display: block;
    padding: 0.8rem 1.25rem;
    border-bottom: 0;
    border-left: 2px solid transparent;
  }
  html.js .site-nav a[aria-current="page"] { border-left-color: var(--gilt); background: rgba(205, 176, 122, 0.06); }
}

/* ---------- Cover (homepage header + hero) ---------- */

/* Gilt double rule, like tooling on a clothbound cover. The header draws the
   top half and the hero draws the bottom half, so they read as one frame. */
.site-header--cover,
.hero { --cover-inset: clamp(0.5rem, 1.6vw, 1.1rem); }
.site-header--cover::before,
.site-header--cover::after,
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  left: var(--cover-inset);
  right: var(--cover-inset);
  border: 1px solid var(--gilt-soft);
}
.site-header--cover::after,
.hero::after {
  left: calc(var(--cover-inset) + 6px);
  right: calc(var(--cover-inset) + 6px);
  border-color: var(--gilt-faint);
}
.site-header--cover::before { top: var(--cover-inset); bottom: 0; border-bottom: 0; }
.site-header--cover::after { top: calc(var(--cover-inset) + 6px); bottom: 0; border-bottom: 0; }
.hero::before { top: 0; bottom: var(--cover-inset); border-top: 0; }
.hero::after { top: 0; bottom: calc(var(--cover-inset) + 6px); border-top: 0; }

/* Homepage: soft jade, plum and blossom glows behind the header and hero */
body.home {
  background-image:
    var(--grain),
    radial-gradient(42rem 34rem at 78% 22rem, rgba(111, 156, 137, 0.22), transparent 70%),
    radial-gradient(36rem 30rem at 10% 42rem, rgba(107, 74, 99, 0.35), transparent 70%),
    radial-gradient(30rem 16rem at 85% 0, rgba(236, 188, 195, 0.10), transparent 70%),
    var(--page-glow);
  background-attachment: scroll, scroll, scroll, scroll, fixed;
}

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3.5rem, 7vw, 5.5rem);
}
.hero-grid {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}
@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}

.hero-title {
  font-size: clamp(3.2rem, 7.5vw, 6rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin-bottom: 0.25em;
}
.tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.45rem, 1.6vw + 1rem, 2rem);
  line-height: 1.25;
  color: var(--blossom);
  margin: 0;
}
.hero-intro { max-width: 34rem; color: var(--ivory-muted); }
.hero-intro p:first-child::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.6em;
  line-height: 0.8;
  padding: 0.08em 0.1em 0 0;
  color: var(--gilt);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.75rem; }

/* Phones: tighter spacing so the painting appears sooner */
@media (max-width: 40rem) {
  .hero { padding-block: 0.75rem 3rem; }
  .hero-grid { gap: 2rem; }
  .hero .eyebrow { margin-bottom: 0.6rem; }
  .hero .flourish--left { margin-block: 0.8rem 1rem; }
  .hero-intro p { margin-bottom: 0.75em; }
  .hero-actions { gap: 0.6rem; margin-top: 1.25rem; }
  .hero-actions .btn { font-size: 0.92rem; padding: 0.65em 1.15em; }
}

/* The painting, mounted like a tipped-in plate. Never cropped. */
.plate {
  margin: 0 auto;
  /* fit the full 4:5 painting within the viewport height */
  width: min(100%, calc(min(80vh, 48rem) * 0.8 + 1.25rem));
}
.plate-link { display: block; text-decoration: none; }
.plate-frame {
  position: relative;
  padding: 0.6rem;
  background: rgba(11, 23, 18, 0.7);
  border: 1px solid var(--gilt-soft);
  box-shadow: var(--shadow-deep), 0 0 6rem -1rem rgba(236, 188, 195, 0.22);
  transition: box-shadow .4s ease;
}
.plate-frame img { width: 100%; outline: 1px solid var(--gilt-faint); outline-offset: -1px; }
.plate-link:hover .plate-frame { box-shadow: var(--shadow-deep), 0 0 7rem 0 rgba(236, 188, 195, 0.32); }
.plate figcaption {
  margin-top: 0.9rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ivory-muted);
}

/* ---------- Book spread (parchment pages) ---------- */

.book {
  position: relative;
  display: grid;
  max-width: 68rem;
  margin-inline: auto;
  color: var(--ink);
  background-color: var(--parchment);
  background-image:
    var(--grain-light),
    radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(150, 115, 60, 0.22) 100%);
  border-radius: var(--radius);
  /* green cover board peeking out around the pages */
  box-shadow:
    0 0 0 0.55rem var(--forest-700),
    0 0 0 calc(0.55rem + 1px) var(--gilt-soft),
    var(--shadow-deep);
}
@media (min-width: 50rem) {
  .book { grid-template-columns: 1fr 1fr; }
  /* the gutter where the pages meet */
  .book::after {
    content: "";
    position: absolute; top: 0; bottom: 0; left: 50%;
    width: 5rem; transform: translateX(-50%);
    background: linear-gradient(90deg,
      transparent, rgba(95, 65, 30, 0.10) 35%, rgba(70, 45, 20, 0.30) 50%,
      rgba(95, 65, 30, 0.10) 65%, transparent);
    pointer-events: none;
  }
}

.book-page {
  position: relative;
  padding: clamp(2rem, 4.5vw, 3.5rem);
}
.book-page::before {
  content: "";
  position: absolute;
  inset: clamp(0.6rem, 1.2vw, 0.9rem);
  border: 1px solid rgba(107, 74, 99, 0.22);
  pointer-events: none;
}
@media (max-width: 49.99rem) {
  .book-page + .book-page { border-top: 1px solid var(--parchment-edge); }
}

.book a { color: var(--jade-deep); }
.book a:hover { color: var(--blossom-deep); }
.book .eyebrow { color: var(--plum); }
.book h3 { color: var(--plum-deep); margin-bottom: 0.4em; }
.book p { color: var(--ink-muted); }

.game-art {
  display: block;
  margin: 0 0 1.6rem;
  padding: 0.35rem;
  background: #fffaf0;
  border: 1px solid rgba(44, 37, 41, 0.18);
  box-shadow: 0 0.6rem 1.2rem -0.7rem rgba(60, 40, 20, 0.5);
}
.game-art img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
a.game-art { transition: transform .3s ease, box-shadow .3s ease; }
a.game-art:hover { transform: translateY(-3px); box-shadow: 0 1rem 1.6rem -0.8rem rgba(60, 40, 20, 0.6); }

/* ---------- Sketchbook preview ---------- */

.sketches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.25rem);
  margin: 0; padding: 0; list-style: none;
}
@media (min-width: 50rem) { .sketches { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.sketch a {
  display: block;
  padding: 0.6rem 0.6rem 0.2rem;
  background: #fbf8f1;
  color: var(--ink-muted);
  text-decoration: none;
  box-shadow: var(--shadow-paper);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .35s ease, box-shadow .35s ease;
}
.sketch:nth-child(4n+1) { --tilt: -2.2deg; }
.sketch:nth-child(4n+2) { --tilt: 1.6deg; }
.sketch:nth-child(4n+3) { --tilt: -1deg; }
.sketch:nth-child(4n+4) { --tilt: 2.4deg; }
.sketch a:hover { transform: rotate(0deg) translateY(-4px); box-shadow: var(--shadow-deep); }
.sketch img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.sketch span {
  display: block;
  padding: 0.45rem 0.2rem 0.35rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
}
.section-foot { text-align: center; margin-top: clamp(2.5rem, 5vw, 3.5rem); }

/* ---------- Keeper / socials band ---------- */

.keeper {
  display: grid;
  gap: 1.75rem 2.5rem;
  align-items: center;
  justify-items: center;
  text-align: center;
  max-width: 56rem;
  margin-inline: auto;
  padding: clamp(2rem, 5vw, 3.25rem);
  background: linear-gradient(135deg, rgba(74, 48, 68, 0.75), rgba(28, 53, 41, 0.75));
  border: 1px solid var(--gilt-faint);
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep);
}
@media (min-width: 44rem) {
  .keeper { grid-template-columns: auto 1fr; justify-items: start; text-align: left; }
}
.keeper-portrait {
  width: 8.5rem; height: 8.5rem;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--gilt), 0 0 0 7px rgba(11, 23, 18, 0.7), 0 0 0 8px var(--gilt-soft), var(--shadow-paper);
}
.keeper h2 { font-size: clamp(1.9rem, 2vw + 1rem, 2.5rem); margin-bottom: 0.3em; }
.keeper p { color: var(--ivory-muted); }

.socials {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin: 1.25rem 0 0; padding: 0; list-style: none;
}
@media (max-width: 43.99rem) { .keeper .socials { justify-content: center; } }
.socials a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--gilt-soft);
  border-radius: 999px;
  color: var(--ivory);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.socials a:hover { border-color: var(--blossom); color: var(--blossom); background: rgba(236, 188, 195, 0.06); }

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 2.5rem 3rem;
  background: rgba(7, 15, 11, 0.55);
  border-top: 1px solid var(--gilt-faint);
  text-align: center;
  color: var(--ivory-muted);
  font-size: 0.98rem;
}
.site-footer .flourish { width: 9rem; margin-top: 0; opacity: 0.8; }
.site-footer .socials { justify-content: center; margin: 0 0 1.25rem; }
.site-footer .socials a { font-size: 0.95rem; padding: 0.3rem 0.85rem; }
.site-footer p { margin: 0.2rem 0; }
.footer-tagline { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; }

/* ---------- Page header (inner pages) ---------- */

.page-head { text-align: center; padding-block: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 3vw, 2.5rem); }
.page-head h1 { font-size: clamp(2.6rem, 5vw + 1rem, 4.4rem); margin-bottom: 0; }
.page-head p { max-width: 40rem; margin-inline: auto; color: var(--ivory-muted); }

/* ---------- Gallery (masonry via CSS columns: no cropping) ---------- */

.gallery-group + .gallery-group { margin-top: clamp(3.5rem, 7vw, 5.5rem); }
.gallery-group h2 { text-align: center; font-size: clamp(1.9rem, 2.5vw + 1rem, 2.6rem); margin-bottom: 0; }
.gallery-group:last-child { padding-bottom: clamp(3rem, 6vw, 5rem); }
.gallery-note { text-align: center; max-width: 38rem; margin: 0 auto 2.25rem; color: var(--ivory-muted); font-style: italic; }

.masonry {
  columns: 3 19rem;
  column-gap: clamp(1.25rem, 2.5vw, 2rem);
  margin: 0; padding: 0; list-style: none;
}
/* for a short list, use two centered columns instead of three */
.masonry--few { columns: 2 17rem; max-width: 48rem; margin-inline: auto; }
.art {
  break-inside: avoid;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
}
.art figure { margin: 0; }
.art-link {
  display: block;
  padding: 0.5rem;
  background: rgba(11, 23, 18, 0.7);
  border: 1px solid var(--gilt-faint);
  box-shadow: var(--shadow-paper);
  transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}
.art-link img { width: 100%; }
.art-link:hover { border-color: var(--gilt-soft); transform: translateY(-3px); box-shadow: var(--shadow-deep), 0 0 3rem -0.5rem rgba(236, 188, 195, 0.28); }
.art figcaption { padding: 0.75rem 0.2rem 0; }
.art-title { display: block; font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; line-height: 1.2; color: var(--ivory); }
.art-meta { display: block; font-size: 0.95rem; color: var(--ivory-muted); font-style: italic; }
.tag {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.05rem 0.55rem;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  vertical-align: 0.1em;
  color: var(--forest-900);
  background: var(--blossom);
  border-radius: 999px;
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent;
  color: var(--ivory);
}
.lightbox::backdrop { background: rgba(6, 12, 9, 0.94); }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
  padding: clamp(3.5rem, 6vw, 4.5rem) clamp(0.75rem, 6vw, 5.5rem) 0.5rem;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  box-shadow: 0 0 0 1px var(--gilt-faint), var(--shadow-deep);
  opacity: 0;
  transition: opacity .3s ease;
}
.lightbox-stage img.is-loaded { opacity: 1; }
.lightbox-caption {
  padding: 0.75rem var(--gutter) 1.25rem;
  text-align: center;
}
.lightbox-caption .art-title { font-size: 1.35rem; }
.lightbox-count { font-size: 0.9rem; color: var(--ivory-muted); letter-spacing: 0.1em; }

.lightbox button {
  position: absolute;
  display: grid; place-items: center;
  width: 3rem; height: 3rem;
  padding: 0;
  color: var(--ivory);
  background: rgba(15, 31, 24, 0.75);
  border: 1px solid var(--gilt-soft);
  border-radius: 50%;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}
.lightbox button:hover { color: var(--blossom); border-color: var(--blossom); }
.lightbox button svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox.is-single .lightbox-prev,
.lightbox.is-single .lightbox-next { display: none; }
.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); }
.lightbox-prev { left: clamp(0.5rem, 1.5vw, 1.25rem); }
.lightbox-next { right: clamp(0.5rem, 1.5vw, 1.25rem); }
@media (max-width: 40rem) {
  /* on phones, move arrows below the image so they don't cover it */
  .lightbox-prev, .lightbox-next { top: auto; bottom: 1rem; transform: none; }
  .lightbox-caption { padding-inline: 4.5rem; }
}

/* ---------- Coming soon pages ---------- */

.book--single { margin-bottom: clamp(4rem, 8vw, 6rem); max-width: 44rem; grid-template-columns: 1fr; text-align: center; }
.book--single::after { display: none; }

/* Social links on a parchment page (About) */
.book .socials a { color: var(--plum-deep); border-color: rgba(107, 74, 99, 0.4); }
.book .socials a:hover { color: var(--blossom-deep); border-color: var(--blossom-deep); background: rgba(168, 93, 110, 0.06); }

/* Homepage game card with more than one link */
.card-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; margin: 0; }

/* ---------- Games page ---------- */

.game-feature + .game-feature { margin-top: clamp(4rem, 8vw, 6rem); }
.game-feature h2 { color: var(--plum-deep); font-size: clamp(2.1rem, 3vw + 1rem, 2.9rem); margin-bottom: 0.35em; }
.game-feature .game-art { margin-bottom: 1rem; }

.screens {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0; padding: 0; list-style: none;
}
.screens a {
  display: block;
  padding: 0.2rem;
  background: #fffaf0;
  border: 1px solid rgba(44, 37, 41, 0.18);
  transition: transform .25s ease, box-shadow .25s ease;
}
.screens a:hover { transform: translateY(-2px); box-shadow: 0 0.6rem 1rem -0.6rem rgba(60, 40, 20, 0.6); }
.screens img { width: 100%; }
.screens-label { margin: 0 0 0.5rem; font-size: 0.95rem; font-style: italic; }

.game-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  margin: 1.5rem 0;
  padding: 1rem 0;
  border-block: 1px solid rgba(107, 74, 99, 0.2);
}
.game-facts dt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--plum);
  padding-top: 0.2em;
}
.game-facts dd { margin: 0; color: var(--ink); }

.game-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0 0; padding: 0; list-style: none; }
.book .game-links a {
  display: inline-flex; padding: 0.55rem 1.4rem;
  background: var(--plum-deep); color: var(--ivory);
  border: 1px solid var(--plum-deep); border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.1rem;
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease;
}
.book .game-links a:hover { color: var(--ivory); background: var(--blossom-deep); border-color: var(--blossom-deep); }

.archive {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  max-width: 52rem;
  margin: 0 auto;
  padding: 0; list-style: none;
}
@media (min-width: 40rem) { .archive { grid-template-columns: 1fr 1fr; } }
.archive:has(> li:only-child) { grid-template-columns: minmax(0, 26rem); justify-content: center; }
.archive figure { margin: 0; }
.archive .art-link img { aspect-ratio: 2 / 1; object-fit: cover; }

/* ---------- Sketchbook page: loose paper pages ---------- */

.masonry--paper .art-link {
  padding: 0.55rem;
  background: #fbf8f1;
  border: 0;
  transform: rotate(var(--tilt, 0deg));
}
.masonry--paper .art:nth-child(3n+1) { --tilt: -0.8deg; }
.masonry--paper .art:nth-child(3n+2) { --tilt: 0.6deg; }
.masonry--paper .art:nth-child(3n+3) { --tilt: -0.3deg; }
.masonry--paper .art-link:hover { transform: rotate(0deg) translateY(-3px); }
.section-intro { text-align: center; max-width: 36rem; margin: -0.5rem auto 2rem; color: var(--ivory-muted); font-style: italic; }

/* ---------- About page ---------- */

.about { text-align: left; }
.about .keeper-portrait { width: 9.5rem; height: 9.5rem; margin: 0 auto 1.75rem; }
.about h2 { color: var(--plum-deep); text-align: center; font-size: clamp(2rem, 2.5vw + 1rem, 2.6rem); }
.about p { color: var(--ink); max-width: 34rem; margin-inline: auto; }
.about .about-sign { font-family: var(--font-display); font-style: italic; font-size: 1.35rem; color: var(--plum); }
.about-links { max-width: 34rem; margin: 2rem auto 0; padding-top: 1.5rem; border-top: 1px solid rgba(107, 74, 99, 0.2); }
.about-links h3 { font-size: 1.5rem; margin-bottom: 0.2em; }
.about-links .socials { margin-top: 0.75rem; }
.about .about-email { margin: 1.25rem auto 0; }
.about-email a { color: var(--plum-deep); font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; overflow-wrap: anywhere; }
.about-email a:hover { color: var(--blossom-deep); }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .sketch a { transform: none; }
}
