/* =========================================================================
   Psalm Thing Wicked - the look of the whole site ("dark + cute").
   Every page links this one file, so a colour changed here changes everywhere.

   Building a page? These shared pieces are ready to use:
     .wrap           centred column with the 16px phone gutter
     .page-head      top of a section page: .eyebrow + h1.page-title + p.lead
     .panel / .card  dark rounded boxes (16px corners, soft gold edge)
     .btn            red pill button   (.btn-ghost = outlined, .btn-big = huge)
     .chip           small filter pill; give it aria-pressed="true" when it is on
     .grid           responsive card grid (cards at least 240px wide)
     .muted .center .visually-hidden   helpers
   Form fields (input, select, textarea) are already styled dark.
   ========================================================================= */

/* The display font, served from this site (no Google Fonts call, so no
   visitor data goes to anyone else). Licence: /assets/fonts/OFL.txt */
@font-face {
  font-family: "Lilita One";
  src: url("/assets/fonts/LilitaOne-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap; /* show text in a fallback font at once, swap when loaded */
}

:root {
  /* The palette George picked: black / deep red, gold lettering. */
  --bg: #0c090a;
  --panel: #1a1113;
  --panel-2: #24171a;
  --red: #8e1b22;
  --red-hi: #b3262f;
  --gold: #e6b84f;
  --cream: #f7ecd6;
  --muted: #c9b8a0;
  /* Red for small TEXT (labels like "WHAT HAPPENS", the eyebrow above a page title).
     --red and --red-hi are too dark to read as small text on the black panels
     (under 3:1); this brighter red is over 5:1 on every panel colour, which meets
     the WCAG AA reading standard (4.5:1). Keep --red / --red-hi for backgrounds,
     borders and glows. tests/style.test.mjs measures it. */
  --red-text: #ea6068;

  --line: rgba(230, 184, 79, 0.16);        /* thin gold edge on boxes */
  --line-strong: rgba(230, 184, 79, 0.45);
  --glow: 0 0 28px rgba(179, 38, 47, 0.45); /* the soft red glow */
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-pill: 999px;

  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --gutter: 16px;
  --max: 1120px;
  /* The header row may be wider than the page's column: the logo and seven nav links
     need about 1280px (tests/style.test.mjs measures them), more than --max. Only on
     screens wide enough to show them all in one row (see the phone-menu rule below). */
  --header-max: 1400px;
  --header-h: 64px;

  color-scheme: dark;
}

/* ---- Basics ------------------------------------------------------------ */

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

html {
  font-size: 106.25%; /* 17px when the visitor keeps the browser default of 16px */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px); /* jump links land below the sticky header */
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--cream);
  background-color: var(--bg);
  /* Two faint red glows behind everything - "hellfire, but cosy". */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(142, 27, 34, 0.38), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(142, 27, 34, 0.18), transparent 70%);
  background-attachment: fixed;
  overflow-x: hidden; /* never a sideways scroll on phones */
}

main { flex: 1 0 auto; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400; /* Lilita One only has one weight; stop browsers faking bold */
  color: var(--gold);
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}
h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

a { color: var(--gold); text-underline-offset: 0.18em; }
a:hover { color: #f3cf74; }

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

::selection { background: var(--red-hi); color: var(--cream); }

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

.muted { color: var(--muted); }
.center { text-align: center; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* "Skip to content" link for keyboard users - hidden until focused. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--gold);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---- Header (identical on every page) ------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 9, 10, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--header-max); /* wider than .wrap's --max: seven links need the room */
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px; /* a thumb-sized tap target, even with the smaller phone logo */
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
}
.logo img {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 6px rgba(179, 38, 47, 0.7));
}
.logo:hover { color: #f3cf74; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-nav a {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--cream);
  text-decoration: none;
  white-space: nowrap; /* a link never breaks onto two lines */
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.site-nav a:hover { color: var(--gold); background: var(--panel-2); }
.site-nav a[aria-current="page"] {
  color: var(--gold);
  background: rgba(142, 27, 34, 0.45);
  border-color: var(--line-strong);
}

/* The phone menu button. Hidden on wide screens. */
.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px; /* big enough for a thumb */
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--cream);
  font: inherit;
  font-family: var(--font-display);
  font-size: 1rem;
  cursor: pointer;
}
.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  transition: transform 0.2s, opacity 0.2s;
}
.menu-toggle-bars { position: relative; }
.menu-toggle-bars::before,
.menu-toggle-bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle-bars::before { top: -6px; }
.menu-toggle-bars::after { top: 6px; }
/* Bars turn into an X while the menu is open. */
.menu-toggle[aria-expanded="true"] .menu-toggle-bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Up to 87.5em (1400px at the usual 16px browser font size) the links fold into the
   phone menu. WHY: the logo plus seven links need about 1280px of room (tests/style.test.mjs
   measures it with the real font; five links needed 960px, when this was 66.25em), a
   desktop window loses ~17px to its scroll bar, and the rest is spare room for the
   stand-in font shown before Lilita One has loaded.
   In em, not px, so a visitor who sets a bigger font size gets the menu sooner instead
   of links breaking onto two lines. Keep it in step with the matchMedia line in site.js. */
@media (max-width: 87.5em) {
  /* With the menu folded, the logo lines up with the page's column again. */
  .header-inner { flex-wrap: wrap; max-width: var(--max); }
  .site-nav { flex-wrap: wrap; }
  /* With JavaScript: links fold into a drop-down under the header.
     Without JavaScript (.js missing): they wrap under the logo, onto as many lines as
     they need, still usable. */
  .js .menu-toggle { display: inline-flex; }
  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px var(--gutter) 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
  }
  .js .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 16px; font-size: 1.15rem; }
}

@media (max-width: 380px) {
  .logo { font-size: 1.15rem; gap: 6px; }
  .logo img { width: 28px; height: 28px; }
  .menu-toggle { padding: 0 12px; }
  .menu-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---- Footer (identical on every page) ------------------------------------ */

.site-footer {
  margin-top: 64px;
  padding-block: 24px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.site-footer p { margin: 0; }

/* ---- Buttons, chips, boxes ---------------------------------------------- */

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 0.7em 1.5em;
  border: 2px solid var(--gold);
  border-radius: var(--radius-pill);
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--glow);
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn:hover {
  background: var(--red-hi);
  color: var(--cream);
  transform: translateY(-2px);
  box-shadow: 0 0 36px rgba(179, 38, 47, 0.7);
}
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--gold);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--panel-2); color: var(--gold); }

.btn-big {
  min-width: min(100%, 280px);
  padding: 0.85em 1.8em;
  font-size: clamp(1.35rem, 4.5vw, 1.7rem);
  border-radius: 22px;
}
.btn-sub {
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--cream);
  opacity: 0.85;
  max-width: 30ch;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px; /* 44px = big enough to hit with a thumb (Apple's and WCAG's advice) */
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-2);
  color: var(--cream);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--gold);
  color: var(--cream);
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 20px; }
.card { padding: 16px; overflow: hidden; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

/* Section pages: the title block at the top. */
.page-head { padding-block: 40px 24px; text-align: center; } /* top/bottom only: keeps .wrap gutters */
.page-title { font-size: clamp(2.2rem, 8vw, 3.6rem); text-shadow: 0 0 24px rgba(179, 38, 47, 0.55); }
.eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-text);
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; margin-inline: auto; }

/* ---- Form fields ---------------------------------------------------------- */

input,
select,
textarea {
  font: inherit;
  color: var(--cream);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 44px;
  max-width: 100%;
}
input::placeholder,
textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:focus,
select:focus,
textarea:focus { border-color: var(--gold); }

/* ---- Home page ------------------------------------------------------------ */

.hero {
  padding-block: 36px 24px; /* top/bottom only, so .wrap keeps its side gutter */
  text-align: center;
}

.hero-title {
  margin: 0 0 4px;
  font-size: clamp(2.6rem, 11vw, 5.6rem);
  line-height: 1;
  color: var(--gold);
  text-shadow:
    0 3px 0 #7a1a20,
    0 0 34px rgba(179, 38, 47, 0.65);
}

.hero-art {
  display: block;
  width: min(78vw, 420px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: 12px auto 8px;
  filter: drop-shadow(0 0 30px rgba(179, 38, 47, 0.6));
  animation: hover-bob 6s ease-in-out infinite;
}

.tagline {
  margin: 8px auto 28px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.25;
  color: var(--cream);
}
/* Each sentence wraps as a whole: "Don't take our word for it." / "Take His." */
.tagline span { display: inline-block; }
.tagline span:last-child { color: var(--gold); }

/* The big buttons sit two by two (three in a row left the fourth on its own),
   and one under another on a narrow screen. Every second one is the dark one. */
.hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 340px));
  justify-content: center;
  gap: 16px;
}
@media (max-width: 700px) {
  .hero-actions { grid-template-columns: minmax(0, 420px); }
}
.hero-actions .btn:nth-child(even) { background: var(--panel-2); }
.hero-actions .btn:nth-child(even):hover { background: var(--red-hi); }
/* An odd one out at the end (the seventh, Merch) has no partner: it sits centred on
   its own row, the same width as the others. */
.hero-actions .btn:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc((100% - 16px) / 2);
}
@media (max-width: 700px) {
  .hero-actions .btn:last-child:nth-child(odd) { width: 100%; }
}

/* A row of chibi demons peeking up from the bottom of the hero. */
.legion-peek {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(4px, 2vw, 18px);
  margin: 40px auto 0;
  padding: 0;
  list-style: none;
}
.legion-peek a { display: block; border-radius: var(--radius); }
.legion-peek img {
  display: block;
  /* Same HEIGHT for all, so tall-and-thin and short-and-wide art line up.
     17vw is small enough that all five always fit side by side (at 22vw they
     ran out of room between ~480px and ~830px wide and got squashed thinner).
     tests/style.test.mjs checks the fit at every width from 481px up. */
  height: clamp(84px, 17vw, 170px);
  width: auto;
  object-fit: contain; /* never stretch or squash the art, whatever the space */
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s;
}
.legion-peek li:nth-child(odd) img { transform: translateY(8px); }
.legion-peek a:hover img { transform: translateY(-6px) rotate(-3deg); }

@media (max-width: 480px) {
  .hero-actions .btn { width: 100%; }
  .legion-peek li:nth-child(n + 5) { display: none; } /* four is plenty on a phone */
  .legion-peek img { height: clamp(84px, 22vw, 170px); } /* only four, so they can be a bit bigger */
}

@keyframes hover-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* People who ask their device for less motion get no bobbing or sliding. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
