/* fablegate.org styles. Tokens follow designs/design-plan.md. */

/* Self-hosted faces. The build copies each file named here from its @fontsource package. */
@font-face {
  font-family: "Albert Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/albert-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Albert Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/albert-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Albert Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/albert-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/literata-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/literata-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/literata-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-latin-600-normal.woff2") format("woff2");
}

:root {
  --lintel: #1B3654;
  --gate: #6093D4;
  --slate: #E8EDF3;
  --paper: #FFFFFF;
  --link: #2F5E9E;
  --muted: #4A5A70;
  --rule: #C9D3E0;

  --bg: var(--slate);
  --surface: var(--paper);
  --ink: var(--lintel);
  --logo-inner: var(--lintel);
  --focus: var(--lintel);
  --footer-bg: var(--lintel);
  --footer-ink: #E4EAF2;
  --footer-muted: #AEBBCD;

  --sans: "Albert Sans", system-ui, sans-serif;
  --serif: "Literata", Georgia, serif;

  --step-0: 1.0625rem;  /* 17px body */
  --step-1: 1.3125rem;  /* 21 */
  --step-2: 1.6875rem;  /* 27 */
  --step-3: 2.0625rem;  /* 33 */
  --step-4: 2.625rem;   /* 42 */
  --step-hero: clamp(2.75rem, 1.25rem + 4.8vw, 5.5rem);

  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 68ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1D30;
    --surface: #142540;
    --ink: #E4EAF2;
    --link: #8DB4E6;
    --muted: #9AA9BE;
    --rule: #2A3E5C;
    --logo-inner: #E4EAF2;
    --focus: var(--gate);
    --footer-bg: #0A1524;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1D30;
  --surface: #142540;
  --ink: #E4EAF2;
  --link: #8DB4E6;
  --muted: #9AA9BE;
  --rule: #2A3E5C;
  --logo-inner: #E4EAF2;
  --focus: var(--gate);
  --footer-bg: #0A1524;
  color-scheme: dark;
}

/* The home page sits at night in both schemes, so the story art carries the color. */
body:has(.hero) {
  --bg: #0C1829;
  --surface: #12223A;
  --ink: #E9EEF6;
  --muted: #A9B6C9;
  --link: #8DB4E6;
  --rule: #22344F;
  --logo-inner: #E9EEF6;
  --focus: var(--gate);
  --footer-bg: #081220;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* A <picture> only chooses the file; its <img> lays out as if it were the parent's own child. */
picture { display: contents; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}
.skip:focus { top: 0.5rem; }

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

/* Eyebrow: the wordmark's tracked capitals, used for section labels. */
.eyebrow {
  font: 600 0.8125rem/1.2 var(--sans);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

/* ---------- Header ---------- */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  text-decoration: none;
}
.brand svg { width: 2.25rem; height: auto; }
.brand-word {
  font: 600 0.9375rem/1 var(--sans);
  letter-spacing: 0.28em;
  /* Tracking adds trailing space after the last letter; pull it back so the word centers. */
  margin-right: -0.28em;
}

.site-nav ul {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { border-bottom-color: currentColor; }
.site-nav a[aria-current="page"] { border-bottom: 2px solid var(--gate); }

/* Logo colors, shared by the header mark and the hero gate. */
.arch-outer { stroke: var(--gate); }
.arch-inner { stroke: var(--logo-inner); }

/* ---------- Hero: the gate as a lens ---------- */

/* The nav floats over the art so the world runs to the top edge. */
body:has(.hero) .site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  text-align: center;
  padding-block: clamp(5.5rem, 4rem + 4vw, 7rem) clamp(3rem, 8vw, 5rem);
}

/* The world fills the hero, dimmed and softened to night; the gate shows it sharp. */
.sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
/* Each world's <picture> is a box of its own, so it carries the .world cross-fade. */
.sky picture {
  display: block;
  position: absolute;
  inset: 0;
}
.sky img {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  filter: blur(7px) brightness(0.42) saturate(0.85);
}
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgb(12 24 41 / 0.55), transparent 28% 50%, var(--bg) 82%),
    radial-gradient(70% 70% at 50% 42%, transparent 40%, var(--bg));
}

.gate {
  position: relative;
  width: min(100%, 46rem);
  margin-inline: auto;
}
.gate svg { display: block; width: 100%; height: auto; }
.gate .arch-inner { stroke: var(--lintel); }

/* On narrow screens the gate outgrows the gutters; its clipped corners are empty anyway. */
@media (max-width: 40rem) {
  .gate { width: 126%; margin-inline: -13%; }
}

.hero-copy {
  position: relative;
  max-width: 48rem;
  margin: clamp(1.5rem, 3vw, 2.75rem) auto 0;
}

.hero h1 {
  font: 500 var(--step-hero)/1.0 var(--sans);
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}

.hero .lede {
  font: 400 var(--step-1)/1.5 var(--serif);
  color: var(--muted);
  margin: 1.5rem auto 0;
  max-width: 34rem;
  text-wrap: pretty;
}

/* The arches draw once on load: each half rises from its foot to the apex, the outer arch first.
   Once the inner arch is drawn, the world inside the gate fades in; the backdrop shows from the
   start. Without motion, the arches and the window are simply there. */
.gate {
  --draw: 0.9s;
  --inner-delay: 0.35s;
}
.draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .draw { animation: draw var(--draw) cubic-bezier(0.55, 0, 0.25, 1) both; }
  .arch-inner.draw { animation-delay: var(--inner-delay); }
  .gate .window { animation: reveal 0.35s ease-out calc(var(--inner-delay) + var(--draw)) both; }
}
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes reveal { from { opacity: 0; } }

/* Story worlds, through the gate and behind it. The first stays underneath; the rest fade in
   turn, one every five seconds. Without motion, only the first shows. */
.world { opacity: 0; }
.world:first-child { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .world:not(:first-child) { animation: world 30s infinite; }
  .world:nth-child(2) { animation-delay: 4s; }
  .world:nth-child(3) { animation-delay: 9s; }
  .world:nth-child(4) { animation-delay: 14s; }
  .world:nth-child(5) { animation-delay: 19s; }
  .world:nth-child(6) { animation-delay: 24s; }
}
@keyframes world {
  0% { opacity: 0; }
  5%, 17% { opacity: 1; }
  22%, 100% { opacity: 0; }
}

/* ---------- Home sections ---------- */

.section {
  padding-block: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--rule);
}

.section-head h2 {
  font: 500 var(--step-3)/1.15 var(--sans);
  letter-spacing: -0.015em;
  margin: 0;
  max-width: 24ch;
}

/* Imprint bands: each sub-brand in its own palette and type, the way a publisher shows its imprints. */
.band {
  padding-block: clamp(3.5rem, 9vw, 7rem);
  color: var(--band-ink);
  background: var(--band-bg);
}
.band .status {
  font: 600 0.75rem/1.3 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--band-accent);
  margin: 0;
}
.band h2 { margin: 0.75rem 0 0; font-weight: 400; }
.band .tagline {
  font: 400 var(--step-1)/1.5 var(--serif);
  margin: 1rem 0 0;
  max-width: 30rem;
  text-wrap: pretty;
}
.band-link {
  display: inline-block;
  margin-top: 1.75rem;
  font: 600 0.9375rem/1 var(--sans);
  color: var(--band-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--band-accent);
  padding-bottom: 0.3rem;
}
.band-link:hover { border-bottom-width: 2px; }
.band :focus-visible { outline-color: var(--band-accent); }

.band-pss {
  --band-bg: #1a1412;
  --band-ink: #fff8e7;
  --band-accent: #c8956a;
}
.band-pss h2 { font: 600 clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem)/1.05 "Playfair Display", Georgia, serif; }

.band-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 60rem) {
  .band-grid { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 4rem; }
}

/* A frame from the game itself: location, characters, the line just spoken, and the
   free-text box where the player says anything. */
.scene {
  position: relative;
  margin: 0;
  aspect-ratio: 1376 / 768;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #4a3728;
}
.scene-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-char {
  position: absolute;
  bottom: -18%;
  height: 112%;
  width: auto;
}
.scene-left { left: 4%; }
.scene-right { right: 4%; }
.scene-ui {
  position: absolute;
  left: 50%;
  bottom: 5%;
  transform: translateX(-50%);
  width: min(30rem, 62%);
  display: grid;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: clamp(0.6875rem, 0.4rem + 0.8vw, 0.9375rem);
  line-height: 1.4;
}
.dialogue {
  position: relative;
  background: rgb(26 20 18 / 0.88);
  color: #fff8e7;
  border: 1px solid #c8956a;
  border-radius: 6px;
  padding: 1.1em 1em 0.8em;
  font-family: var(--serif);
}
.speaker {
  position: absolute;
  top: 0;
  left: 0.8em;
  transform: translateY(-55%);
  background: #c8956a;
  color: #1a1412;
  font: 600 0.75em/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.4em 0.6em;
  border-radius: 3px;
}
.say {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: rgb(255 248 231 / 0.94);
  color: #1a1412;
  border-radius: 999px;
  padding: 0.55em 1em;
}
.say-label {
  font-weight: 600;
  font-size: 0.75em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7a5230;
}
.caret {
  width: 1px;
  height: 1.1em;
  background: #1a1412;
  margin-left: -0.35em;
}
@media (prefers-reduced-motion: no-preference) {
  .caret { animation: blink 1.1s steps(1) infinite; }
}
@keyframes blink { 50% { opacity: 0; } }

.band-storyswept {
  --band-bg: #fbf3ea;
  --band-ink: #3a2730;
  --band-accent: #a83d5c;
}
.band-storyswept h2 { font: 500 italic clamp(2.75rem, 2rem + 2.8vw, 4.25rem)/1 "Cormorant Garamond", Georgia, serif; }
.band-head { max-width: 40rem; }

/* The launch shelf: covers with each story's opening hook. Scrolls sideways on small screens. */
.shelf {
  list-style: none;
  margin: 3rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2.5rem 1.5rem;
}
.book img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 1px 0 #e9d8c8, 0 10px 24px -12px rgb(58 39 48 / 0.45);
}
.book h4 {
  font: 500 italic 1.3125rem/1.15 "Cormorant Garamond", Georgia, serif;
  margin: 0.9rem 0 0;
}
.book p {
  font: 400 0.875rem/1.45 var(--serif);
  color: #684a54;
  margin: 0.35rem 0 0;
}
@media (max-width: 64rem) {
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 44rem) {
  .shelf {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    gap: 1rem;
    margin-inline: calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 1rem;
    scrollbar-width: thin;
  }
  .book { flex: 0 0 62%; scroll-snap-align: start; }
}

/* Company: label column beside a reading column. */
.company {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}
@media (min-width: 56rem) {
  .company { grid-template-columns: 16rem minmax(0, 1fr); gap: 4rem; }
}

.prose {
  font: 400 var(--step-0)/1.7 var(--serif);
  max-width: var(--measure);
}
.prose p { margin: 0 0 1.1em; }
.prose h2 {
  font: 500 var(--step-2)/1.2 var(--sans);
  letter-spacing: -0.01em;
  margin: 2.5em 0 0.6em;
  scroll-margin-top: 1.5rem;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  font: 600 var(--step-0)/1.4 var(--sans);
  margin: 1.8em 0 0.5em;
}
.prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1.1em; }
.prose li { margin-bottom: 0.4em; }
.prose .big { font-size: var(--step-1); line-height: 1.55; }

/* Company beliefs: unordered commitments, lead word in the sans. */
.prose .beliefs {
  list-style: none;
  padding: 0;
  margin: 0 0 1.1em;
}
.prose .beliefs li { margin-bottom: 0.9em; }
.prose .beliefs strong { font: 600 var(--step-0)/1.4 var(--sans); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 1.5rem 2rem;
  margin: 2.5rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}
.facts dt {
  font: 600 0.75rem/1.3 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 0.4rem 0 0;
  font: 400 var(--step-0)/1.5 var(--sans);
}

/* ---------- Inner pages ---------- */

.page-head {
  padding-block: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
}
.page-head h1 {
  font: 500 var(--step-4)/1.1 var(--sans);
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 20ch;
}
.page-head .sub {
  font: 400 var(--step-1)/1.5 var(--serif);
  color: var(--muted);
  margin: 1rem 0 0;
  max-width: 40rem;
}
.page-head .meta {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 1rem 0 0;
}

.page-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding-bottom: clamp(3rem, 8vw, 6rem);
}
@media (min-width: 60rem) {
  .page-body.has-toc { grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; }
}

.toc {
  font-size: 0.9375rem;
  align-self: start;
}
@media (min-width: 60rem) {
  .toc { position: sticky; top: 1.5rem; }
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc li a {
  display: block;
  padding: 0.3rem 0 0.3rem 1rem;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}
.toc li a:hover { color: var(--ink); }
@media (max-width: 59.99rem) {
  .toc { border: 1px solid var(--rule); padding: 1rem 1.25rem; background: var(--surface); }
  .toc ol { border-left: 0; columns: 2 12rem; }
  .toc li a { padding-left: 0; }
}

.sheet {
  background: var(--surface);
  padding: clamp(1.5rem, 5vw, 3.5rem);
  border-radius: 2px;
}

/* Contact cards: one per way to reach the company, the address set as the record states it. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1.5rem;
  max-width: 56rem;
}
.card {
  background: var(--surface);
  padding: 2rem;
  border-top: 3px solid var(--gate);
}
.card h2 {
  font: 600 0.8125rem/1.2 var(--sans);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
.card address, .card p { font: 400 var(--step-1)/1.5 var(--sans); font-style: normal; margin: 0; }
.card .note { font: 400 0.9375rem/1.5 var(--serif); color: var(--muted); margin-top: 1rem; }

.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 2rem;
  height: 2rem;
  border-radius: 999px 999px 0 0;
  background: var(--lintel);
  color: #fff;
  font: 600 0.9375rem/2.1rem var(--sans);
  text-align: center;
}

.callout {
  border-left: 3px solid var(--gate);
  padding: 0.25rem 0 0.25rem 1.25rem;
  margin: 1.5rem 0;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.5rem 2.5rem;
}

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

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding-block: 3rem 2.5rem;
  font-size: 0.9375rem;
}
.site-footer a { color: var(--footer-ink); }
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 48rem) {
  .footer-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
}
.site-footer .entity {
  font: 600 1rem/1.4 var(--sans);
  margin: 0 0 0.35rem;
}
.site-footer address { font-style: normal; color: var(--footer-muted); line-height: 1.6; }
.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.copyright {
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid #2E4767;
  color: var(--footer-muted);
}
