/* ============================================================
 * C4YOS LAND — shared design system
 *
 * "Printed card, glitched world": every structural device on the site
 * comes from the anatomy of the physical cards (true-black frame, flat
 * saturated fields, the chamfered name plate, circled numerals), and the
 * AI that runs C4YOS Land corrupts it now and then with the logo's own
 * RGB-split glitch. The painted world is the stage; cards are objects.
 *
 * This file holds the tokens and the chrome every page shares (header,
 * buttons, footer, language chooser, news carousel, title gate, trailer
 * lightbox). Homepage sections live in home.css; game.css, cards.css,
 * shop.css and demo.css style their own pages.
 * ============================================================ */

:root {
  /* colour — sampled from the printed cards, the logo and the paintings */
  --card-black: #000;
  --night: #0a1230;          /* page ground: the blue of the art, not brown */
  --night-2: #111c44;
  --gold: #ffc629;           /* primary action */
  --gold-deep: #e9a400;
  --purple: #5b36b0;         /* the logo's outline purple — secondary */
  --purple-light: #7a55d6;
  --purple-dark: #3f2384;
  --red: #f0402f;            /* chaos, danger, Hell */
  --card-sky: #12a5ee;       /* gadget card art field */
  --card-slate: #a9c0ca;     /* gadget card text panel */
  --card-rust: #8a4b2e;      /* adventure card text panel */
  --card-blush: #e9c3c3;
  --paper: #fff6e3;          /* text on dark */
  --paper-dim: #d9d2c3;
  --glitch-cyan: #35e3ff;
  --glitch-magenta: #ff3d9a;

  /* legacy aliases still used by game.css / cards.css / shop.css / demo.css */
  --ink: #0d0b09;
  --ink-text: #12100c;
  --ink-secondary: #2b2317;
  --dark-blue: #141b2b;
  --cream: #fdfaf2;
  --placeholder: #8b7f66;

  /* type */
  --font-display: 'Luckiest Guy', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --font-hand: 'Patrick Hand', 'Comic Neue', ui-rounded, system-ui, sans-serif;

  /* space — 4px base */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 144px;
  --gutter: clamp(16px, 4vw, 48px);
  --content: 1240px;
  --stage: 1440px;
  --section-y: clamp(88px, 11vw, 152px);

  /* the card name plate: top corners cut away */
  --cut: 12px;

  /* motion */
  --ease-deal: cubic-bezier(.2, .9, .25, 1.15);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-hover: 140ms;
  --t-press: 80ms;

  --header-h: 76px;
}

/* Luckiest Guy's lowercase glyphs are a mismatched small-cap set, so the
   display face is always set in capitals. The markup stays in sentence
   case, which is what screen readers and translations work from. */
.btn, .text-link, .nav, .logo-tag, .site-footer h2, .section-eyebrow,
.lang-popup-title, .lang-popup-btn, .trailer-caption, .footer-label,
.nav-toggle, .news-slide-title, .news-btn { text-transform: uppercase; }

* { box-sizing: border-box; }

/* long German compounds hyphenate instead of pushing past the screen edge */
:lang(de) h1, :lang(de) h2, :lang(de) h3, :lang(de) h4 { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }

html {
  /* clip, not hidden: it doesn't create a scroll container, so the sticky
     header keeps working, but full-bleed layers can't cause a sideways
     scrollbar */
  overflow-x: clip;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--night);
  font-family: var(--font-hand);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--paper); }
input::placeholder { color: #8a8272; }
img { max-width: 100%; }

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

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 300;
  padding: 10px 16px;
  background: var(--gold);
  color: #1d1300;
  font-family: var(--font-display);
  border: 3px solid var(--card-black);
}
.skip-link:focus { top: 12px; color: #1d1300; }

/* Fixed sky-island backdrop. A fixed layer is compositor-only, unlike
   `background-attachment: fixed`, which repaints on every scroll frame.
   A real element (not ::before), so its slow zoom stays on its own layer. */
body.index-body { background: transparent; }

.sky-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  /* a fixed frame that clips the (slightly oversized, breathing) painting,
     so it can never make the page scroll sideways */
  overflow: hidden;
  background-color: var(--night);
  pointer-events: none;
}
.sky-bg::before {
  content: "";
  position: absolute;
  inset: -2%;
  background-image:
    linear-gradient(180deg, rgba(10, 18, 48, .6) 0%, rgba(10, 18, 48, .78) 50%, rgba(10, 18, 48, .9) 100%),
    url('assets/backgrounds/sky-islands-bg.jpg');
  background-position: center;
  background-size: cover;
}

/* the painting breathes: one slow, compositor-only zoom (was GSAP) */
@media (prefers-reduced-motion: no-preference) {
  @keyframes sky-breathe { from { transform: none; } to { transform: scale(1.07) translate(-1.5%, -1%); } }
  .sky-bg::before { animation: sky-breathe 32s ease-in-out infinite alternate; }
}

/* ============================================================
 * BUTTONS — the name plate as a physical key
 *
 * A black base cut to the card's name-plate shape; the coloured face sits
 * inside it, 3px in, with the base showing underneath as depth. Hover
 * lifts the face, press sinks it into the base.
 *   <a class="btn btn--primary btn--lg"><span class="btn__face">Play</span></a>
 * ============================================================ */

.btn {
  --face: var(--gold);
  --face-ink: #1d1300;
  --depth: 6px;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  padding: 0 0 var(--depth);
  background: var(--card-black);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%, 0 var(--cut));
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  letter-spacing: .03em;
  color: var(--face-ink);
  text-decoration: none;
  cursor: pointer;
  border: 0;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-hover);
}

.btn__face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  margin: 3px 3px 0;
  padding: .72em 1.25em .58em;
  background: var(--face);
  color: var(--face-ink);
  white-space: nowrap;
  clip-path: polygon(calc(var(--cut) - 1.5px) 0, calc(100% - var(--cut) + 1.5px) 0, 100% calc(var(--cut) - 1.5px), 100% 100%, 0 100%, 0 calc(var(--cut) - 1.5px));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .38), inset 0 -4px 0 rgba(0, 0, 0, .16);
  transform: translateY(0);
  transition: transform var(--t-hover) var(--ease-out), filter var(--t-hover);
}

.btn:hover { color: var(--face-ink); }
@media (hover: hover) {
  .btn:hover .btn__face { transform: translateY(-2px); filter: brightness(1.06); }
}
.btn:active .btn__face { transform: translateY(3px); transition-duration: var(--t-press); }

/* clip-path would swallow a normal outline, so focus recolours the base
   into a bright rim instead */
.btn:focus-visible { outline: none; background: var(--paper); }
.btn:focus-visible .btn__face { box-shadow: inset 0 0 0 2px var(--card-black), inset 0 3px 0 rgba(255, 255, 255, .38); }

.btn--primary { --face: var(--gold); --face-ink: #1d1300; }
.btn--secondary { --face: var(--purple); --face-ink: var(--paper); }
.btn--paper { --face: var(--paper); --face-ink: #16110a; }
.btn--red { --face: var(--red); --face-ink: var(--paper); }

.btn--sm { font-size: 16px; --depth: 5px; --cut: 9px; }
.btn--md { font-size: 20px; }
.btn--lg { font-size: clamp(22px, 2vw, 28px); --depth: 7px; --cut: 14px; }
.btn--block { display: flex; width: 100%; }

/* the primary action glitches for a beat when it's aimed at — the AI
   noticing you're about to play */
@media (prefers-reduced-motion: no-preference) {
  .btn--primary:hover .btn__label,
  .btn--primary:focus-visible .btn__label {
    animation: rgb-split 280ms steps(3, end) 1;
  }
}

@keyframes rgb-split {
  0%   { text-shadow: 3px 0 var(--glitch-magenta), -3px 0 var(--glitch-cyan); transform: translateX(1px); }
  40%  { text-shadow: -2px 0 var(--glitch-magenta), 2px 0 var(--glitch-cyan); transform: translateX(-1px); }
  100% { text-shadow: none; transform: none; }
}

.btn-icon-play {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  display: block;
}

/* quiet third tier: a text link with the gold underline bar */
.text-link {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: .03em;
  color: var(--paper);
  padding: 4px 0;
  background: linear-gradient(var(--gold), var(--gold)) left bottom / 100% 3px no-repeat;
  transition: background-size var(--t-hover) var(--ease-out), color var(--t-hover);
}
.text-link:hover { color: var(--gold); background-size: 40% 3px; }
.text-link:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

/* Legacy chunky buttons, still used on cards.html — restyled onto the
   tokens so they read as the same family. */
.wishlist-btn,
.watch-trailer-btn,
.play-demo-btn,
.kickstarter-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 3px solid var(--card-black);
  border-radius: 4px;
  box-shadow: 0 6px 0 var(--card-black);
  padding: 13px 24px 11px;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: .03em;
  line-height: 1;
  transition: transform var(--t-hover) var(--ease-out), box-shadow var(--t-hover);
}
.wishlist-btn, .play-demo-btn, .kickstarter-cta { background: var(--gold); color: #1d1300; }
.watch-trailer-btn { background: var(--purple); color: var(--paper); }
.wishlist-btn:hover, .play-demo-btn:hover, .kickstarter-cta:hover { color: #1d1300; transform: translateY(-2px); box-shadow: 0 8px 0 var(--card-black); }
.watch-trailer-btn:hover { color: var(--paper); transform: translateY(-2px); box-shadow: 0 8px 0 var(--card-black); }
.wishlist-btn:active, .watch-trailer-btn:active, .play-demo-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--card-black); }
.wishlist-btn:focus-visible, .watch-trailer-btn:focus-visible, .play-demo-btn:focus-visible, .kickstarter-cta:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.cards-cta-btn { width: auto; }

/* Legacy section type, used by cards.html */
.section-eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--red);
}
.section-heading {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1;
  color: var(--paper);
  text-shadow: 0 3px 0 var(--card-black);
}
.section-body {
  margin: 18px 0 0;
  max-width: 52ch;
  font-size: 20px;
  line-height: 1.45;
  color: var(--paper-dim);
}

/* ============================================================
 * GLITCH TEXT — the AI corrupting one word. <span class="glitch"
 * data-text="word">word</span>; JS adds .is-glitching to fire it once.
 * ============================================================ */
.glitch {
  position: relative;
  display: inline-block;
  color: #ff5a3f;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  -webkit-text-stroke: 0;
  text-shadow: none;
  pointer-events: none;
}
.glitch::before { color: var(--glitch-cyan); }
.glitch::after { color: var(--glitch-magenta); }

.glitch.is-glitching { animation: glitch-jitter 380ms steps(1, end) 1; }
.glitch.is-glitching::before { animation: glitch-slice-a 380ms steps(1, end) 1; }
.glitch.is-glitching::after { animation: glitch-slice-b 380ms steps(1, end) 1; }

@keyframes glitch-jitter {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3px, 1px); }
  40%  { transform: translate(3px, -1px); }
  60%  { transform: translate(-1px, 0); }
  80%  { transform: translate(2px, 1px); }
  100% { transform: none; }
}
@keyframes glitch-slice-a {
  0%   { opacity: .9; clip-path: inset(8% 0 62% 0); transform: translate(-6px, 0); }
  25%  { clip-path: inset(58% 0 12% 0); transform: translate(5px, 0); }
  50%  { clip-path: inset(30% 0 44% 0); transform: translate(-3px, 0); }
  75%  { clip-path: inset(78% 0 4% 0); transform: translate(7px, 0); }
  100% { opacity: 0; }
}
@keyframes glitch-slice-b {
  0%   { opacity: .9; clip-path: inset(66% 0 6% 0); transform: translate(6px, 0); }
  25%  { clip-path: inset(14% 0 60% 0); transform: translate(-5px, 0); }
  50%  { clip-path: inset(46% 0 28% 0); transform: translate(4px, 0); }
  75%  { clip-path: inset(2% 0 80% 0); transform: translate(-7px, 0); }
  100% { opacity: 0; }
}


/* ============================================================
 * HEADER — sticky; the nav is a name plate hanging from the top edge
 * ============================================================ */

.hero-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-5);
  min-height: var(--header-h);
  padding: 10px 0;
  transition: padding 220ms var(--ease-out);
}

/* the black bar appears once the page moves under the header. Drawn as a
   full-viewport-width layer so it bleeds past whatever centred container
   the header happens to sit in on each page. */
.hero-header::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--card-black);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 10px 30px -10px rgba(0, 0, 0, .7);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}
.hero-header.is-scrolled::before { opacity: 1; }

.logo {
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 0;
  border-radius: 6px;
}
.logo:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

.logo-img {
  display: block;
  width: clamp(118px, 12vw, 164px);
  height: auto;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .55));
  transition: width 220ms var(--ease-out);
}
.hero-header.is-scrolled .logo-img { width: clamp(96px, 8.5vw, 116px); }

.logo-tag {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1;
  letter-spacing: .06em;
  color: #ff6a55;
  text-shadow: 0 2px 0 var(--card-black);
  white-space: nowrap;
  transition: opacity 180ms, height 220ms;
}
.hero-header.is-scrolled .logo-tag { opacity: 0; height: 0; margin: 0; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.8vw, 30px);
  padding: 14px clamp(22px, 2.4vw, 36px) 12px;
  background: var(--card-black);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, var(--cut) 100%);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: .05em;
}

.nav a {
  position: relative;
  color: var(--paper);
  white-space: nowrap;
  padding: 6px 0 4px;
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-hover) var(--ease-out);
}
.nav a:hover { color: var(--gold); }
.nav a:hover::after,
.nav a.active::after,
.nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a.active,
.nav a[aria-current="page"] { color: var(--gold); }
.nav a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.cta-col {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* old circle glyph inside the wishlist button, still in older markup */
.wishlist-icon { display: none; }

.btn-icon-heart { width: .95em; height: .95em; flex: none; }

/* mobile menu toggle — injected by site.js */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  background: var(--card-black);
  border: 2px solid rgba(255, 246, 227, .28);
  border-radius: 4px;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .05em;
  cursor: pointer;
}
.nav-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.nav-toggle-bars {
  position: relative;
  width: 18px;
  height: 12px;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after,
.nav-toggle-bars span {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: currentColor;
  transition: transform 200ms var(--ease-out), opacity 150ms;
}
.nav-toggle-bars::before { top: 0; }
.nav-toggle-bars span { top: 50%; margin-top: -1.25px; }
.nav-toggle-bars::after { bottom: 0; }
.nav-open .nav-toggle-bars::before { transform: translateY(4.75px) rotate(45deg); }
.nav-open .nav-toggle-bars span { opacity: 0; }
.nav-open .nav-toggle-bars::after { transform: translateY(-4.75px) rotate(-45deg); }

@media (max-width: 1080px) {
  .hero-header { grid-template-columns: auto 1fr auto; }
  .nav { font-size: 15px; gap: 16px; padding-inline: 20px; }
}

@media (max-width: 960px) {
  :root { --header-h: 64px; }

  .hero-header {
    grid-template-columns: 1fr auto;
    gap: var(--s-3);
    padding: 8px 0;
  }
  .logo-img, .hero-header.is-scrolled .logo-img { width: 104px; }
  .logo-tag { display: none; }

  .nav-toggle { display: inline-flex; }

  /* the menu becomes a full-screen sheet */
  .nav {
    position: fixed;
    inset: 0;
    z-index: -1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: calc(var(--header-h) + 24px) var(--gutter) 48px;
    clip-path: none;
    background:
      linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(10, 18, 48, .97) 60%),
      url('assets/backgrounds/sky-islands-bg.jpg') center / cover;
    font-size: clamp(34px, 10vw, 48px);
    letter-spacing: .02em;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity 200ms ease, transform 260ms var(--ease-out), visibility 0s linear 260ms;
  }
  .nav-open .nav {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 200ms ease, transform 260ms var(--ease-out), visibility 0s;
  }
  .nav a { padding: 6px 0; }
  .nav a::after { height: 4px; bottom: 2px; }

  /* the header bar must be solid while the sheet is open */
  .nav-open.hero-header::before { opacity: 1; }

  .cta-col .btn--header .btn__label-long { display: none; }
}

@media (min-width: 961px) {
  .cta-col .btn--header .btn__label-short { display: none; }
}

html.nav-locked, html.nav-locked body { overflow: hidden; }

/* the smallest phones: the logo keeps its size; the header key and the
   menu button give up padding and the menu drops its word */
@media (max-width: 380px) {
  .hero-header { grid-template-columns: auto 1fr; gap: 8px; }
  .logo { min-width: 76px; }
  .logo-img, .hero-header.is-scrolled .logo-img { width: 76px; }
  .cta-col { gap: 6px; min-width: 0; }
  .cta-col > .btn { font-size: 14px; --cut: 7px; }
  .cta-col > .btn .btn__face { padding: .72em .8em .58em; gap: .4em; }
  .nav-toggle { width: 44px; padding: 0; justify-content: center; }
  .nav-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* Touch screens: every link in the chrome gets a 44px target without
   changing how it looks. The text link's gold bar stays under the text. */
@media (pointer: coarse), (max-width: 960px) {
  .text-link {
    padding-block: 12px;
    background-origin: content-box;
    background-clip: content-box;
    background-position: left bottom;
  }
  .site-footer li a,
  .footer-social-item { display: inline-flex; align-items: center; min-height: 44px; padding-block: 0; }
  .site-footer ul { gap: 0; }
  .lang-switch .lang-switch-btn { min-height: 44px; min-width: 44px; padding-inline: 8px; }
  .news-dots .news-dot { width: 40px; height: 44px; }
  .logo { min-height: 44px; justify-content: center; }
}

/* ============================================================
 * FOOTER
 * ============================================================ */

.site-footer {
  position: relative;
  margin-top: var(--section-y);
  background: var(--card-black);
  color: var(--paper-dim);
  padding: var(--s-8) var(--gutter) var(--s-6);
}

/* the footer's top edge is a plate edge: a notch cut into the middle */
.site-footer::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -22px;
  width: min(420px, 60vw);
  height: 23px;
  transform: translateX(-50%);
  background: var(--card-black);
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 100%, 0 100%);
}

.site-footer-inner {
  max-width: var(--content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: var(--s-7) var(--s-6);
}

.site-footer-brand img { width: 150px; height: auto; display: block; }
.site-footer-brand p {
  margin: var(--s-4) 0 0;
  max-width: 30ch;
  font-size: 18px;
  line-height: 1.4;
}

.site-footer h2 {
  margin: 0 0 var(--s-3);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: .05em;
  color: var(--paper);
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.site-footer li a {
  display: inline-block;
  padding: 4px 0;
  font-size: 19px;
  color: var(--paper-dim);
}
.site-footer li a:hover { color: var(--gold); }

/* social profiles aren't live yet: names only, no dead links */
.footer-social-item {
  display: inline-block;
  padding: 4px 0;
  font-size: 19px;
  color: #8f897d;
}
.footer-social-note { margin: 6px 0 0; font-size: 15px; color: #8f897d; }
.site-footer a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* footer: imprint + privacy next to the copyright (added by tools/build-dist.js) */
.site-footer-legal { display: inline-flex; flex-wrap: wrap; gap: 4px 18px; }
.site-footer-legal a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.site-footer-legal a:hover { color: var(--gold); }

.site-footer-base {
  max-width: var(--content);
  margin: var(--s-7) auto 0;
  padding-top: var(--s-5);
  border-top: 1px solid rgba(255, 246, 227, .14);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  font-size: 16px;
  color: #a39c8e;
}

@media (max-width: 860px) {
  .site-footer-inner { grid-template-columns: 1fr 1fr; }
  .site-footer-brand { grid-column: 1 / -1; }
}

/* Legacy footer pieces still used on game/cards/shop pages */
.footer-label {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--paper);
}

.social-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 2px solid rgba(255, 246, 227, .4);
  border-radius: 4px;
  padding: 2px 10px;
  color: var(--paper-dim);
}
.chip:hover { color: var(--gold); border-color: var(--gold); }
.chip--soon, .chip--soon:hover { color: #8f897d; border-color: rgba(255, 246, 227, .2); }

/* ============================================================
 * NEWS CAROUSEL (newsfeed.js)
 * Slides are stacked and swapped by opacity, so the banner keeps one
 * fixed height however tall the uploaded photos are.
 * ============================================================ */

.news-carousel {
  position: relative;
  border: 5px solid var(--card-black);
  border-radius: 8px;
  box-shadow: 0 8px 0 var(--card-black), 0 30px 50px -20px rgba(0, 0, 0, .7);
  overflow: hidden;
  background: var(--card-black);
}

.news-track {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  aspect-ratio: 16 / 7;
}

.news-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
}
.news-slide.is-active { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .news-slide { transition: none; }
}

/* `contain`, not `cover`: uploads often carry their own title burned in */
.news-slide-img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.news-slide-link {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 2;
}
.news-slide-link:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -6px;
}

.news-slide-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(26px) brightness(.45) saturate(1.1);
  transform: scale(1.15);
}

.news-slide-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .82) 0%, rgba(0, 0, 0, .55) 38%, rgba(0, 0, 0, 0) 68%);
}

.news-slide-copy {
  position: absolute;
  left: clamp(20px, 4vw, 56px);
  bottom: clamp(20px, 4vw, 52px);
  width: min(52%, 560px);
}

.news-slide-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 46px);
  line-height: 1.05;
  color: var(--paper);
  text-shadow: 0 3px 0 var(--card-black);
}

.news-slide-text {
  margin: 10px 0 0;
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.4;
  color: var(--paper-dim);
}

.news-slide-actions {
  margin-top: clamp(12px, 1.6vw, 20px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.news-btn {
  display: inline-block;
  border: 3px solid var(--card-black);
  border-radius: 4px;
  box-shadow: 0 5px 0 var(--card-black);
  padding: 10px 18px 8px;
  font-family: var(--font-display);
  font-size: clamp(15px, 1.4vw, 19px);
  letter-spacing: .03em;
  transition: transform var(--t-hover), box-shadow var(--t-hover);
}
.news-btn--primary { background: var(--gold); color: #1d1300; }
.news-btn--secondary { background: var(--purple); color: var(--paper); }
.news-btn:hover,
.news-btn:focus-visible { transform: translateY(3px); box-shadow: 0 2px 0 var(--card-black); }
.news-btn--primary:hover, .news-btn--primary:focus-visible { color: #1d1300; }
.news-btn--secondary:hover, .news-btn--secondary:focus-visible { color: var(--paper); }

.news-arrows {
  position: absolute;
  z-index: 3;
  right: clamp(12px, 2vw, 22px);
  bottom: clamp(12px, 2vw, 22px);
  display: flex;
  gap: 8px;
}

.news-arrow {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  cursor: pointer;
  background: var(--card-black);
  border: 2px solid rgba(255, 246, 227, .5);
  border-radius: 4px;
  font-size: 15px;
  line-height: 1;
  color: var(--paper);
  transition: background var(--t-hover), color var(--t-hover), transform var(--t-hover);
}
.news-arrow:hover { background: var(--gold); color: #1d1300; border-color: var(--card-black); transform: translateY(-2px); }
.news-arrow:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.news-dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: clamp(8px, 1.4vw, 14px);
  display: flex;
  align-items: center;
}

.news-dot {
  appearance: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.news-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 246, 227, .45);
  box-shadow: 0 0 0 2px var(--card-black);
  transition: background .15s, width .2s var(--ease-out);
}
.news-dot.is-active::before { background: var(--gold); width: 22px; border-radius: 5px; }
.news-dot:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }

@media (max-width: 900px) {
  .news-carousel { border-width: 4px; }
  .news-track { aspect-ratio: 4 / 3; }
  .news-slide-copy { width: auto; right: clamp(16px, 4vw, 30px); bottom: 46px; }
  .news-slide-scrim { background: linear-gradient(0deg, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .55) 45%, rgba(0, 0, 0, .1) 80%); }
  .news-arrows { display: none; }
  .news-dots { bottom: 8px; }
}

/* ============================================================
 * TRAILER LIGHTBOX
 * ============================================================ */

.trailer-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}
.trailer-lightbox[hidden] { display: none; }

.trailer-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .88);
}

.trailer-lightbox-panel {
  position: relative;
  width: min(960px, 100%);
  aspect-ratio: 16 / 9;
  background: var(--card-black);
  border: 5px solid var(--card-black);
  box-shadow: 0 0 0 2px rgba(255, 246, 227, .15), 0 40px 80px -20px rgba(0, 0, 0, .8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .trailer-lightbox:not([hidden]) .trailer-lightbox-panel { animation: deal-in 360ms var(--ease-deal) both; }
  .trailer-lightbox:not([hidden]) .trailer-lightbox-backdrop { animation: fade-in 200ms ease both; }
}

/* the gameplay recording, until a trailer exists */
.trailer-lightbox--video { flex-direction: column; gap: 14px; }
.trailer-lightbox--video .trailer-lightbox-panel { aspect-ratio: 1280 / 800; }
.trailer-lightbox-player { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.trailer-lightbox-note {
  position: relative;
  margin: 0;
  max-width: 60ch;
  font-size: 17px;
  line-height: 1.4;
  text-align: center;
  color: var(--paper-dim);
}

.trailer-lightbox-video {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, .75), rgba(0, 0, 0, .35)),
    url('assets/web/kickstarter-hero-1264.webp') center / cover;
  text-align: center;
  padding: 24px;
}

.trailer-caption {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 34px);
  color: var(--paper);
  text-shadow: 0 3px 0 var(--card-black);
}
.trailer-caption-sub {
  font-size: 19px;
  color: var(--paper-dim);
}

.trailer-lightbox-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--card-black);
  border: 2px solid rgba(255, 246, 227, .5);
  color: var(--paper);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.trailer-lightbox-close:hover { background: var(--gold); color: #1d1300; }
.trailer-lightbox-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes deal-in {
  from { opacity: 0; transform: translateY(24px) rotate(-1.5deg) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
 * LANGUAGE CHOOSER — first-visit popup + footer switcher (lang.js)
 * ============================================================ */

.lang-popup {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  z-index: 60;
  width: min(340px, calc(100vw - 24px));
  background: var(--paper);
  border: 4px solid var(--card-black);
  border-radius: 6px;
  box-shadow: 0 8px 0 var(--card-black), 0 24px 40px -12px rgba(0, 0, 0, .6);
  padding: 18px 20px 20px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .25s ease, transform .25s var(--ease-out);
}
.lang-popup.is-open { opacity: 1; transform: translateY(0); }

/* phones: a slim sheet along the bottom edge instead of a card that covers
   the first screen's buttons */
@media (max-width: 560px) {
  .lang-popup {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    padding: 12px 14px 14px;
    box-shadow: 0 6px 0 var(--card-black);
  }
  .lang-popup-title { font-size: 18px; }
  .lang-popup-title span { display: inline; margin-left: 6px; font-size: 14px; }
  .lang-popup-text { display: none; }
  .lang-popup-actions { margin-top: 10px; }
  .lang-popup-btn { min-height: 44px; padding: 10px 8px 8px; font-size: 16px; }
  .lang-popup-close { width: 44px; height: 44px; right: 2px; top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .lang-popup, .lang-popup.is-open { transform: none; }
}

.lang-popup-close {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #3a3226;
  border-radius: 4px;
}
.lang-popup-close:hover { color: var(--red); }
.lang-popup-close:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }

.lang-popup-title {
  margin: 0 30px 0 0;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: .02em;
  line-height: 1.15;
  color: #16110a;
}
.lang-popup-title span {
  display: block;
  font-size: 15px;
  color: #6d6047;
}

.lang-popup-text {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.35;
  color: #2b2317;
}
.lang-popup-text span { display: block; font-size: 16px; color: #6d6047; }

.lang-popup-actions { margin-top: 16px; display: flex; gap: 10px; }

.lang-popup-btn {
  flex: 1;
  appearance: none;
  cursor: pointer;
  background: #fff;
  border: 3px solid var(--card-black);
  border-radius: 4px;
  box-shadow: 0 4px 0 var(--card-black);
  padding: 11px 8px 9px;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: .03em;
  color: #16110a;
  transition: transform var(--t-hover), box-shadow var(--t-hover);
}
.lang-popup-btn--primary { background: var(--purple); color: var(--paper); }
.lang-popup-btn:hover,
.lang-popup-btn:focus-visible { transform: translateY(2px); box-shadow: 0 2px 0 var(--card-black); }
.lang-popup-btn:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
}

.lang-switch-btn {
  appearance: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 4px;
  min-height: 32px;
  font: inherit;
  color: #a39c8e;
}
.lang-switch-btn:hover { color: var(--paper); }
.lang-switch-btn.is-active {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.lang-switch-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.lang-switch-sep { color: rgba(255, 246, 227, .3); }

/* ============================================================
 * ENTER GATE — homepage title screen (enter-gate.js)
 * Shown once per browser session.
 * ============================================================ */

.gate-done .enter-gate { display: none; }

html.gate-active,
html.gate-active body { overflow: hidden; }

.enter-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--night);
}

.enter-gate-fill,
.enter-gate-art {
  position: absolute;
  inset: 0;
  background-image: url('assets/backgrounds/sky-islands-bg.jpg');
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
}

.enter-gate-fill {
  background-size: cover;
  filter: blur(28px) brightness(.55) saturate(1.1);
  transform: scale(1.15);
}

.enter-gate-art {
  background-size: contain;
  z-index: 0;
}

.enter-gate-inner {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 4.5vh, 40px);
  padding: 20px;
}

.enter-gate-logo,
.enter-gate-btn {
  position: relative;
  z-index: 1;
}

.enter-gate-logo {
  width: clamp(240px, 40vw, 460px);
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .45));
}

@media (prefers-reduced-motion: no-preference) {
  .gate-active .enter-gate-logo { animation: deal-in 700ms var(--ease-deal) 120ms both; }
  .gate-active .enter-gate-btn { animation: deal-in 600ms var(--ease-deal) 380ms both; }
}

@media (max-aspect-ratio: 1 / 1) {
  .enter-gate-art { background-size: cover; }
}

/* ============================================================
 * LOGO GLITCH — the launch trailer's logo slam, in short bursts
 * site.js wraps each logo in .glitch-logo and adds three slices
 * (copies of the logo). A burst shifts the slices sideways,
 * swaps their colours and splits the logo into red and cyan.
 * ============================================================ */

.glitch-logo { position: relative; line-height: 0; }
.glitch-logo--block { display: block; width: fit-content; }
.glitch-logo--inline { display: inline-block; vertical-align: top; }
.glitch-logo-slice {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .glitch-logo.is-glitching { animation: logo-glitch-split 420ms steps(1, end); }
  .glitch-logo.is-glitching .glitch-logo-slice { animation: logo-glitch-a 420ms steps(1, end); }
  .glitch-logo.is-glitching .glitch-logo-slice:nth-of-type(3) { animation-name: logo-glitch-b; }
  .glitch-logo.is-glitching .glitch-logo-slice:nth-of-type(4) { animation-name: logo-glitch-c; }
}

@keyframes logo-glitch-split {
  0%   { translate: 3px 0;  filter: drop-shadow(-4px 0 rgba(255, 0, 110, .8)) drop-shadow(4px 0 rgba(0, 235, 255, .8)); }
  20%  { translate: -4px 0; filter: drop-shadow(5px 0 rgba(255, 0, 110, .8)) drop-shadow(-5px 0 rgba(0, 235, 255, .8)); }
  45%  { translate: 0 0;    filter: none; }
  60%  { translate: 2px 0;  filter: drop-shadow(-3px 0 rgba(255, 0, 110, .8)) drop-shadow(3px 0 rgba(0, 235, 255, .8)); }
  80%  { translate: -1px 0; filter: drop-shadow(2px 0 rgba(255, 0, 110, .7)) drop-shadow(-2px 0 rgba(0, 235, 255, .7)); }
  100% { translate: 0 0;    filter: none; }
}
@keyframes logo-glitch-a {
  0%   { opacity: 1; clip-path: inset(14% 0 68% 0); translate: -7% 0; filter: hue-rotate(110deg) saturate(1.5); }
  20%  { opacity: 1; clip-path: inset(52% 0 34% 0); translate: 6% 0;  filter: hue-rotate(220deg) saturate(1.5); }
  45%  { opacity: 0; }
  60%  { opacity: 1; clip-path: inset(30% 0 58% 0); translate: -4% 0; filter: hue-rotate(300deg) saturate(1.5); }
  80%  { opacity: 1; clip-path: inset(76% 0 10% 0); translate: 3% 0;  filter: hue-rotate(60deg) saturate(1.5); }
  100% { opacity: 0; }
}
@keyframes logo-glitch-b {
  0%   { opacity: 1; clip-path: inset(40% 0 44% 0); translate: 5% 0;  filter: hue-rotate(180deg) saturate(1.6); }
  20%  { opacity: 0; }
  60%  { opacity: 1; clip-path: inset(62% 0 22% 0); translate: -6% 0; filter: hue-rotate(90deg) saturate(1.6); }
  80%  { opacity: 1; clip-path: inset(8% 0 80% 0);  translate: 4% 0;  filter: hue-rotate(250deg) saturate(1.6); }
  100% { opacity: 0; }
}
@keyframes logo-glitch-c {
  0%   { opacity: 0; }
  20%  { opacity: 1; clip-path: inset(24% 0 64% 0); translate: 9% 0;  filter: hue-rotate(330deg) saturate(1.8); }
  45%  { opacity: 1; clip-path: inset(84% 0 4% 0);  translate: -5% 0; filter: hue-rotate(140deg) saturate(1.8); }
  60%  { opacity: 0; }
  80%  { opacity: 1; clip-path: inset(46% 0 42% 0); translate: -8% 0; filter: hue-rotate(40deg) saturate(1.8); }
  100% { opacity: 0; }
}
