/* =========================================================
   Crowsong — styles
   Colours and fonts are set once here at the top.
   ========================================================= */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #0b0d0d;          /* page background */
  --bg-raised: #111515;
  --ink: #efe9dc;         /* main text (moon cream) */
  --ink-soft: #c9c3b6;
  --muted: #8d8a82;
  --line: rgba(239, 233, 220, .2);
  --line-strong: rgba(239, 233, 220, .55);
  --tiko: #7fe0b8;        /* Tiko portal glow */

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Montserrat", "Segoe UI", system-ui, sans-serif;

  --wrap: 1180px;
  --gutter: clamp(20px, 4.5vw, 56px);
  --header-h: 88px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* subtle film grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

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

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 200;
  padding: 10px 16px; background: var(--ink); color: var(--bg);
}
.skip:focus { top: 16px; }

/* =================== HEADER =================== */
.site-header {
  position: fixed; inset: 0 0 auto 0;
  z-index: 50;
  transition: background .4s var(--ease), border-color .4s var(--ease), backdrop-filter .4s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(11, 13, 13, .72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  transition: height .4s var(--ease);
}
.is-scrolled .header-inner { height: 68px; }

.brand img { height: 34px; width: auto; }
.is-scrolled .brand img { height: 30px; }
.brand img { transition: height .4s var(--ease), opacity .2s; }
.brand:hover img { opacity: .85; }

.nav { display: flex; gap: clamp(28px, 4vw, 64px); }
.nav a, .footer-nav a {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 6px 0;
}
.nav a::after, .footer-nav a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform .35s var(--ease);
}
.nav a:hover::after, .footer-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

.menu-toggle {
  display: none;
  width: 44px; height: 44px;
  margin-right: -10px;
  background: none; border: 0; padding: 10px; cursor: pointer;
  flex-direction: column; justify-content: center; gap: 6px;
}
.menu-toggle span {
  display: block; height: 2px; width: 100%; background: var(--ink);
  transition: transform .35s var(--ease), opacity .2s;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 10, 10, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s var(--ease);
}
.mobile-menu.is-open { opacity: 1; }
.mobile-menu nav { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.mobile-menu a {
  font-family: var(--serif); font-weight: 600;
  font-size: 40px; line-height: 1.1;
}

/* =================== HERO =================== */
.hero {
  position: relative;
  min-height: clamp(560px, 92vh, 860px);
  display: flex; align-items: center;
  padding: calc(var(--header-h) + 24px) 0 96px;
  overflow: hidden;
  isolation: isolate;
}
.hero-art {
  position: absolute; inset: 0; z-index: -1;
}
.hero-art img {
  position: absolute; inset: -6% 0 0 0;
  width: 100%; height: 106%;
  object-fit: cover;
  object-position: 72% 30%;
  will-change: transform;
  animation: hero-in 2.6s var(--ease) both;
}
/* fade the art into the page on the left and at the bottom */
.hero-art::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(11,13,13,.92) 22%, rgba(11,13,13,.45) 48%, rgba(11,13,13,0) 68%),
    linear-gradient(180deg, rgba(11,13,13,.55) 0%, rgba(11,13,13,0) 22%, rgba(11,13,13,0) 70%, var(--bg) 100%);
}
.moon-glow {
  position: absolute;
  left: 76%; top: 42%;
  width: 46vw; height: 46vw;
  max-width: 720px; max-height: 720px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(239,233,220,.16) 0%, rgba(239,233,220,0) 60%);
  animation: glow 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hero-in {
  from { transform: scale(1.08); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes glow {
  0%, 100% { opacity: .6; }
  50%      { opacity: 1; }
}

.hero-content > * { max-width: 640px; }
.hero-content > .hero-title { max-width: none; }
.hero-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(42px, 6.4vw, 84px);
  line-height: 1.02;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.hero-lede {
  margin-top: 24px;
  max-width: 37ch;
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.55;
  color: var(--ink-soft);
}
.hero-actions {
  margin-top: 40px;
  display: flex; flex-wrap: wrap; gap: 20px;
}

/* entrance animation for hero text */
.js .hero-title, .js .hero-lede, .js .hero-actions {
  opacity: 0; transform: translateY(18px);
  animation: rise .9s var(--ease) forwards;
}
.js .hero-title   { animation-delay: .25s; }
.js .hero-lede    { animation-delay: .45s; }
.js .hero-actions { animation-delay: .6s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-width: 176px;
  padding: 15px 32px;
  font-family: var(--mono);
  font-size: 15px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  border: 1px solid var(--ink);
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #fffaf0; transform: translateY(-2px); }
.btn-ghost { background: rgba(11,13,13,.35); color: var(--ink); }
.btn-ghost:hover { background: rgba(239,233,220,.1); transform: translateY(-2px); }

/* =================== SECTIONS =================== */
.section { padding-top: clamp(56px, 8vw, 96px); }

.section-label {
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 32px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.section-label::after {
  content: "";
  flex: 1; height: 1px;
  background: var(--line-strong);
  transform-origin: left;
}
.js .section-label.reveal::after { transform: scaleX(0); transition: transform 1.2s var(--ease) .15s; }
.js .section-label.reveal.is-in::after { transform: scaleX(1); }

/* scroll-reveal */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .pillar.reveal:nth-child(2) { transition-delay: .1s; }
.js .pillar.reveal:nth-child(3) { transition-delay: .2s; }

/* =================== FEATURED =================== */
.featured {
  position: relative;
  min-height: 300px;
  display: flex; align-items: center;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  overflow: hidden;
  isolation: isolate;
}
.featured-media {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 66%;
  z-index: -1;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 30%);
}
.featured-media img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 60% 50%;
  transition: transform 1.4s var(--ease);
}
.featured:hover .featured-media img { transform: scale(1.04); }
.portal-glow {
  position: absolute;
  left: 64%; top: 50%;
  width: 34%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(127,224,184,.38) 0%, rgba(127,224,184,0) 62%);
  mix-blend-mode: screen;
  animation: portal 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes portal {
  0%, 100% { opacity: .35; transform: translate(-50%, -50%) scale(.92); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.06); }
}
.featured-body {
  padding: clamp(32px, 5vw, 56px);
  max-width: 460px;
}
.game-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(52px, 7vw, 84px);
  line-height: .95;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.game-kicker {
  margin-top: 14px;
  font-size: 13px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
}
.game-desc {
  margin-top: 22px;
  max-width: 30ch;
  font-size: 16px;
  color: var(--ink-soft);
}

/* =================== WHAT WE DO =================== */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.pillar {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 12px clamp(16px, 3vw, 40px) 8px;
}
.pillar + .pillar { border-left: 1px solid var(--line); }
.pillar-icon {
  width: 52px; height: 52px;
  fill: none; stroke: var(--ink); stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
  margin-bottom: 22px;
  transition: transform .5s var(--ease);
}
.pillar-icon circle { fill: var(--ink); stroke: none; }
.pillar:hover .pillar-icon { transform: translateY(-4px); }
.pillar h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.pillar p {
  margin-top: 10px;
  max-width: 26ch;
  margin-inline: auto;
  font-size: 15px;
  color: var(--ink-soft);
}

/* =================== OUR GAMES =================== */
.games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.game-card {
  position: relative;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--bg-raised);
  transition: border-color .4s var(--ease), transform .5s var(--ease);
}
.game-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease), filter .6s;
}
.game-card:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.game-card:hover img { transform: scale(1.05); }

.game-card--next img { position: absolute; inset: 0; filter: grayscale(.3); }
.next-text {
  position: absolute; inset: 0;
  padding: 22px 24px;
  background: linear-gradient(180deg, rgba(11,13,13,.55), rgba(11,13,13,.1));
}
.next-text h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(18px, 1.8vw, 22px);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.next-text p {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cursor { margin-left: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.games-dots { display: none; }

/* =================== FOOTER =================== */
.site-footer { margin-top: clamp(72px, 10vw, 120px); }
.footer-inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.2fr;
  align-items: start;
  gap: 40px;
  padding-top: 48px;
  padding-bottom: 40px;
  position: relative;
}
.footer-inner::before {
  content: "";
  position: absolute; top: 0; left: var(--gutter); right: var(--gutter);
  height: 1px; background: var(--line);
}
.footer-brand img { height: 34px; width: auto; margin-top: 8px; }
.footer-nav { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.footer-nav a { font-size: 13px; padding: 2px 0; }
.footer-about {
  border-left: 1px solid var(--line);
  padding-left: clamp(24px, 4vw, 72px);
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 340px;
}
.footer-place {
  margin-top: 20px;
  font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.copyright {
  padding-bottom: 32px;
  font-size: 12px;
  color: var(--muted);
}

/* =================== TABLET =================== */
@media (max-width: 900px) {
  .pillar h3 { font-size: 16px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; border-left: 0; padding-left: 0; }
}

/* =================== PHONE =================== */
@media (max-width: 720px) {
  :root { --header-h: 72px; }
  .nav { display: none; }
  .menu-toggle { display: flex; }
  .brand img { height: 28px; }
  .is-scrolled .header-inner { height: 60px; }
  .is-scrolled .brand img { height: 24px; }

  .hero {
    min-height: 0;
    align-items: flex-start;
    padding-top: calc(var(--header-h) + 40px);
    padding-bottom: 56px;
  }
  .hero-art img { object-position: 71% 0%; }
  .hero-lede { text-shadow: 0 1px 12px rgba(11,13,13,.9); }
  .hero-art::after {
    background:
      linear-gradient(90deg, rgba(11,13,13,.85) 0%, rgba(11,13,13,.35) 60%, rgba(11,13,13,.1) 100%),
      linear-gradient(180deg, rgba(11,13,13,.4) 0%, rgba(11,13,13,0) 30%, rgba(11,13,13,.2) 70%, var(--bg) 100%);
  }
  .moon-glow { left: 85%; top: 30%; width: 120vw; height: 120vw; }
  .hero-title { font-size: clamp(38px, 11vw, 52px); }
  .hero-lede { max-width: 26ch; }
  .hero-actions { flex-direction: column; gap: 14px; max-width: 320px; }
  .btn { width: 100%; }

  .section-label { font-size: 14px; margin-bottom: 24px; }

  .featured { min-height: 0; align-items: stretch; }
  .featured-media {
    width: 78%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.6) 35%, #000 70%);
            mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.6) 35%, #000 70%);
  }
  .featured-body { padding: 32px 24px; }
  .game-title { font-size: 52px; }
  .game-kicker { font-size: 12px; max-width: 16ch; }
  .game-desc { font-size: 15px; max-width: 22ch; }

  .pillars { grid-template-columns: 1fr; }
  .pillar {
    flex-direction: row; align-items: center; text-align: left; gap: 24px;
    padding: 20px 0;
  }
  .pillar + .pillar { border-left: 0; border-top: 1px solid var(--line); }
  .pillar-icon { width: 46px; height: 46px; margin: 0 8px 0 4px; flex: none; }
  .pillar h3 { font-size: 16px; }
  .pillar p { margin: 2px 0 0; max-width: none; font-size: 14px; }

  .games {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
    gap: 16px;
    scrollbar-width: none;
  }
  .games::-webkit-scrollbar { display: none; }
  .game-card { flex: 0 0 84%; scroll-snap-align: start; }
  .game-card:hover { transform: none; }

  .games-dots { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
  .games-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--line-strong); opacity: .5;
    transition: opacity .3s, background .3s;
  }
  .games-dots span.is-active { background: var(--ink); opacity: 1; }

  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 24px;
  }
  .footer-brand img { height: 30px; margin: 0; }
  .footer-nav { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px 28px; }
  .footer-about { max-width: none; }
  .copyright { text-align: center; }
}

/* =================== REDUCED MOTION =================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .hero-title, .js .hero-lede, .js .hero-actions { opacity: 1; transform: none; }
  .js .section-label.reveal::after { transform: none; }
}
