/* Jafle Games
   One stylesheet for the whole site.
   1. Fonts  2. Tokens  3. Base  4. Shared pieces  5. Home  6. Game page (Citywide Crisis)  7. Small pages */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/hanken-grotesk-400-700.woff2') format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-style: italic; font-weight: 400 700; font-display: swap; src: url('../fonts/hanken-grotesk-400-700-italic.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/dm-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/dm-mono-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/barlow-condensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/barlow-condensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 700; font-display: swap; src: url('../fonts/barlow-condensed-700-italic.woff2') format('woff2'); }

/* 2. Tokens --------------------------------------------------------------- */
:root {
  /* Citywide Crisis's colours, used across the whole site */
  --paper: #fff6e4;
  --city: #0c1230;
  --city-2: #121a3f;
  --city-line: #2a3566;
  --hud: #f6cf36;
  --police: #4f8dff;
  --fire: #ff6a4d;
  --medic: #3fd16a;
  --ink: #05081a;
  --mist: #aab3d6;

  --sans: 'Hanken Grotesk', 'Segoe UI', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --cond: 'Barlow Condensed', 'Arial Narrow', 'Segoe UI', sans-serif;

  /* Side margin. Past 92rem the page stops widening and the margin takes up the slack,
     so anything pulled out by a negative gutter still reaches the window edge. */
  --gutter: max(clamp(1.25rem, 5vw, 4.5rem), calc((100vw - 92rem) / 2));
  --measure: 34rem;
}

/* 3. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--city);
  color: var(--paper);
  font: 400 1.0625rem/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--hud); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--hud); color: var(--ink); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 20;
  padding: 0.5rem 0.9rem; background: var(--hud); color: var(--ink);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 0.75rem; }

/* 4. Shared pieces -------------------------------------------------------- */
.mono {
  font: 400 0.8125rem/1.5 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.masthead {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.4rem var(--gutter);
}
.masthead__home img { width: 4.25rem; }
.masthead nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; justify-content: flex-end; }
.masthead nav a {
  font: 400 0.8125rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none; padding: 0.4rem 0; border-bottom: 1px solid transparent;
}
.masthead nav a:hover, .masthead nav a[aria-current] { border-bottom-color: currentColor; }

.footer {
  background: var(--ink);
  padding: 3.5rem var(--gutter) 2.5rem;
  display: grid; gap: 2.5rem 3rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
.footer__mark img, .lost .logo-link img { width: 10.5rem; }
.logo-link { display: inline-block; }
.footer__mark p { margin-top: 1rem; max-width: 22rem; color: var(--mist); font-size: 0.9375rem; }
.footer h2 { font: 400 0.75rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mist); margin-bottom: 0.9rem; }
.footer li + li { margin-top: 0.45rem; }
.footer a { text-decoration: none; border-bottom: 1px solid rgb(255 255 255 / 0.25); }
.footer a:hover { border-bottom-color: var(--hud); color: var(--hud); }
.footer__legal { grid-column: 1 / -1; padding-top: 1.5rem; border-top: 1px solid rgb(255 255 255 / 0.1); color: var(--mist); }
.footer li { overflow-wrap: anywhere; }
@media (max-width: 46rem) {
  .footer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer__mark { grid-column: 1 / -1; }
}
@media (max-width: 30rem) {
  .footer { grid-template-columns: minmax(0, 1fr); }
}

/* 5. Home: the same night city as the game -------------------------------- */

.hello {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: min(94svh, 54rem);
  padding: clamp(7rem, 18vh, 10rem) var(--gutter) clamp(12rem, 25vw, 18rem);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  background: linear-gradient(to bottom, var(--ink) 0%, var(--city) 34%, #14235a 74%, #1c3784 100%);
}
/* A tilted street grid, seen from about where the game's camera sits */
.hello::before {
  content: ""; position: absolute; inset: -45% -25% -10%; z-index: -1;
  background:
    repeating-linear-gradient(90deg, rgb(132 160 255 / 0.2) 0 2px, transparent 2px 11rem),
    repeating-linear-gradient(0deg, rgb(132 160 255 / 0.2) 0 2px, transparent 2px 6.5rem),
    repeating-linear-gradient(90deg, rgb(132 160 255 / 0.09) 0 1px, transparent 1px 2.75rem),
    repeating-linear-gradient(0deg, rgb(132 160 255 / 0.09) 0 1px, transparent 1px 3.25rem);
  transform: perspective(70rem) rotateX(60deg) rotateZ(-24deg);
  transform-origin: 62% 58%;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 64% 52%, #000 15%, transparent 78%);
  mask-image: radial-gradient(ellipse 60% 55% at 64% 52%, #000 15%, transparent 78%);
}
/* Calls coming in */
.blip {
  position: absolute; left: var(--x); top: var(--y); z-index: -1;
  width: 0.8rem; height: 0.8rem; border-radius: 50%;
  background: var(--tone); box-shadow: 0 0 1.4rem 0.2rem var(--tone);
}
.blip::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--tone);
  animation: call 3.2s ease-out infinite; animation-delay: var(--wait, 0s);
}
@keyframes call { from { transform: scale(1); opacity: 0.9; } 70%, to { transform: scale(5.5); opacity: 0; } }
@media (max-width: 52rem) { .blip { opacity: 0.55; } }

.hello__mark { width: clamp(17rem, 46vw, 38rem); margin-left: -0.5%; }
.hello__mark img { width: 100%; }
.hello__lede {
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 27ch;
  font: 500 clamp(1.2rem, 2vw, 1.6rem)/1.4 var(--sans);
  text-wrap: balance;
}
.hello__next {
  margin-top: clamp(2rem, 5vw, 3.25rem);
  display: inline-flex; align-items: center; gap: 0.75rem;
  color: var(--hud); text-decoration: none;
}
.hello__next::before {
  content: ""; width: 0.6rem; height: 0.6rem; border-radius: 50%;
  background: var(--hud); box-shadow: 0 0 0 0 rgb(246 207 54 / 0.6);
  animation: ping 2.4s ease-out infinite;
}
.hello__next span { border-bottom: 1px solid rgb(246 207 54 / 0.5); padding-bottom: 0.15rem; }
.hello__next:hover span { border-bottom-color: var(--hud); }
@keyframes ping { 70%, 100% { box-shadow: 0 0 0 0.9rem rgb(246 207 54 / 0); } }

.horizon { position: absolute; inset: auto 0 -1px 0; height: clamp(9rem, 20vw, 15rem); pointer-events: none; }
.horizon::before, .horizon::after {
  content: ""; position: absolute; inset: 0;
  background-repeat: repeat-x; background-position: left bottom; background-size: auto 100%;
}
.horizon::before { background-image: url('../img/brand/skyline-far.svg'); background-position: 22rem bottom; transform: translateY(-6%); }
.horizon::after { background-image: url('../img/brand/skyline-near.svg'); }

.studio {
  padding: 0 var(--gutter) clamp(4rem, 10vw, 8rem);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 1.5rem;
}
.studio__label { grid-column: 1 / span 4; padding-top: 0.5rem; color: var(--hud); }
.studio__body { grid-column: 6 / span 7; max-width: 38rem; }
.studio__body h2 { font: italic 700 clamp(2.1rem, 4.4vw, 3.4rem)/0.95 var(--cond); text-transform: uppercase; letter-spacing: 0.01em; text-wrap: balance; }
.studio__body p { margin-top: 1.3rem; font-size: 1.125rem; color: rgb(255 246 228 / 0.88); }
.studio__body p a { color: var(--hud); }
@media (max-width: 52rem) {
  .studio__label, .studio__body { grid-column: 1 / -1; }
  .studio__label { margin-bottom: 1.25rem; }
}

.city { background: var(--city); padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(4rem, 10vw, 8rem); }
.city__label { color: var(--hud); display: flex; align-items: center; gap: 1rem; margin-bottom: clamp(1.5rem, 4vw, 2.75rem); }
.city__label::after { content: ""; flex: 1; height: 1px; background: var(--city-line); }

.feature { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2rem 1.5rem; align-items: end; }
.feature__art {
  grid-column: 1 / span 8; margin-left: calc(var(--gutter) * -1);
  display: block; position: relative; overflow: hidden;
  border-top: 3px solid var(--hud);
}
.feature__art img { width: 100%; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.feature__art:hover img { transform: scale(1.025); }
.feature__body { grid-column: 9 / span 4; padding-bottom: 0.5rem; }
.feature__body h2 {
  font: italic 700 clamp(2.4rem, 4.4vw, 3.6rem)/0.92 var(--cond); text-transform: uppercase; letter-spacing: 0.005em;
}
.feature__body h2 a { text-decoration: none; }
.feature__body p { margin-top: 1rem; color: var(--mist); }
.feature__facts { margin-top: 1.4rem; border-top: 1px solid var(--city-line); }
.feature__facts li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--city-line); color: var(--mist); }
.feature__facts b { font-weight: 400; color: var(--paper); text-align: right; }
.feature__go { margin-top: 1.75rem; }
@media (max-width: 60rem) {
  .feature__art { grid-column: 1 / -1; margin-right: calc(var(--gutter) * -1); }
  .feature__body { grid-column: 1 / -1; max-width: 34rem; }
}

/* The slanted plate from the game's logo, used for the main actions */
.plate {
  display: inline-block; position: relative; isolation: isolate;
  padding: 0.7rem 1.9rem 0.72rem;
  font: italic 700 1.3rem/1 var(--cond); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; border: 0; background: none; cursor: pointer;
}
.plate::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--hud);
  clip-path: polygon(0.9rem 0, 100% 0, calc(100% - 0.9rem) 100%, 0 100%);
  transition: background-color 0.15s;
}
.plate:hover::before { background: #ffe26a; }
.plate--ghost { color: var(--paper); }
.plate--ghost::before { background: rgb(255 255 255 / 0.12); }
.plate--ghost:hover::before { background: rgb(255 255 255 / 0.2); }

/* 6. Game page ------------------------------------------------------------ */
.game { background: var(--city); }
.game main h2 {
  font: italic 700 clamp(2rem, 4vw, 3rem)/0.95 var(--cond); text-transform: uppercase; letter-spacing: 0.01em;
}
.game .label { color: var(--hud); margin-bottom: 0.9rem; }
.band { padding: clamp(3.5rem, 8vw, 6.5rem) var(--gutter); }
.band + .band { padding-top: 0; }

.g-hero { position: relative; min-height: min(92svh, 50rem); display: flex; align-items: flex-end; padding: 8rem var(--gutter) clamp(2.5rem, 6vw, 4.5rem); isolation: isolate; }
.g-hero__bg { position: absolute; inset: 0; z-index: -1; }
.g-hero__bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.g-hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--city) 0%, rgb(12 18 48 / 0.72) 30%, rgb(12 18 48 / 0) 62%),
    linear-gradient(to right, rgb(12 18 48 / 0.55), rgb(12 18 48 / 0) 60%);
}
.g-hero__copy { max-width: 40rem; }
.g-hero__logo { width: clamp(15rem, 34vw, 27rem); margin-left: -0.4rem; }
.g-hero__copy p { margin-top: 1.5rem; font-size: 1.1875rem; max-width: 34rem; }
.g-hero__actions { margin-top: 1.9rem; display: flex; flex-wrap: wrap; gap: 0.9rem 0.6rem; }

.hazard { height: 0.7rem; background: repeating-linear-gradient(-55deg, var(--hud) 0 0.85rem, transparent 0.85rem 1.7rem); opacity: 0.9; }

.pitch { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2.5rem 1.5rem; }
.pitch__lead { grid-column: 1 / span 6; }
.game main .pitch__lead h2 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.pitch__lead p { margin-top: 1.5rem; font-size: 1.1875rem; max-width: var(--measure); color: rgb(255 246 228 / 0.9); }
.pitch__modes { grid-column: 8 / span 5; display: grid; gap: 2.25rem; align-content: start; }
.mode { border-top: 3px solid var(--hud); padding-top: 1rem; }
.mode:nth-child(2) { border-top-color: var(--police); }
.mode h3 { font: 700 1.6rem/1 var(--cond); text-transform: uppercase; letter-spacing: 0.03em; }
.mode p { margin-top: 0.7rem; color: var(--mist); }
.mode ul { margin-top: 0.9rem; }
.mode li { position: relative; padding: 0.3rem 0 0.3rem 1.15rem; color: var(--mist); }
.mode li::before { content: ""; position: absolute; left: 0; top: 0.95em; width: 0.5rem; height: 2px; background: var(--hud); }
@media (max-width: 58rem) {
  .pitch__lead, .pitch__modes { grid-column: 1 / -1; }
}

/* Screenshots: an uneven wall, not a uniform grid */
.shots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; margin: 0 calc(var(--gutter) * -0.5); }
.shots li:nth-child(1) { grid-column: span 4; grid-row: span 2; }
.shots li:nth-child(2), .shots li:nth-child(3) { grid-column: span 2; }
.shots li:nth-child(n + 4) { grid-column: span 2; }
.shots button { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: var(--city-2); cursor: zoom-in; position: relative; overflow: hidden; }
.shots img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16 / 9; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.shots button:hover img { transform: scale(1.03); }
.shots span {
  position: absolute; left: 0; bottom: 0; padding: 0.35rem 0.7rem;
  background: rgb(5 8 26 / 0.82); color: var(--paper);
  font: 400 0.75rem/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
}
@media (max-width: 44rem) {
  .shots { grid-template-columns: 1fr 1fr; margin: 0; }
  .shots li:nth-child(n) { grid-column: span 1; grid-row: auto; }
  .shots li:nth-child(1), .shots li:nth-child(6) { grid-column: span 2; }
}

.viewer { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100dvh; color: var(--paper); }
.viewer::backdrop { background: rgb(5 8 26 / 0.94); }
.viewer__stage { width: 100%; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 1rem; gap: 0.75rem; }
.viewer__stage img { max-width: 100%; max-height: calc(100dvh - 5.5rem); object-fit: contain; cursor: zoom-out; }
.viewer__bar { display: flex; align-items: center; gap: 1.25rem; }
.viewer__bar button { background: none; border: 1px solid rgb(255 255 255 / 0.3); padding: 0.35rem 0.8rem; cursor: pointer; font: 400 0.8125rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; }
.viewer__bar button:hover { border-color: var(--hud); color: var(--hud); }

/* Feature list, set like the game's event log */
.log { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2rem 1.5rem; }
.log__head { grid-column: 1 / span 4; }
.log__head p { margin-top: 1rem; color: var(--mist); max-width: 22rem; }
.log__rows { grid-column: 5 / span 8; }
.log__rows li {
  display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 0.25rem 1.25rem; align-items: baseline;
  padding: 0.8rem 1rem; background: var(--city-2); border-left: 3px solid var(--tone, var(--hud));
}
.log__rows li + li { margin-top: 0.3rem; }
.log__rows b { font: 600 1.25rem/1.15 var(--cond); text-transform: uppercase; letter-spacing: 0.04em; color: var(--tone, var(--hud)); }
.log__rows span { color: rgb(255 246 228 / 0.86); }
@media (max-width: 58rem) {
  .log__head, .log__rows { grid-column: 1 / -1; }
  .log__rows li { grid-template-columns: 1fr; }
}

.trailer { margin: 0 calc(var(--gutter) * -1); background: var(--ink); }
.trailer video { width: 100%; max-height: 86svh; aspect-ratio: 16 / 9; background: var(--ink); }
.trailer__cap { padding: 0.8rem var(--gutter); color: var(--mist); }

/* Download: laid out like the game's top HUD bar */
.dl { background: var(--city-2); border-top: 3px solid var(--hud); }
.dl__head { padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 2rem; align-items: end; }
.dl__head p { margin-top: 0.9rem; color: var(--mist); max-width: 36rem; }
.dl__actions { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.dl__alt { color: var(--mist); }
.dl__alt a { color: var(--paper); }
.dl__cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--city-line); }
.dl__cells div { padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.15rem; border-left: 1px solid var(--city-line); min-width: 0; }
.dl__cells div:first-child { border-left: 0; }
.dl__cells dt { font: 400 0.75rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mist); }
.dl__cells dd { margin-top: 0.35rem; font: 700 clamp(1.35rem, 2.4vw, 1.9rem)/1.1 var(--cond); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.dl__cells dd.is-key { color: var(--hud); }
.dl__sum { padding: 0.85rem clamp(1.5rem, 4vw, 2.5rem); border-top: 1px solid var(--city-line); color: var(--mist); overflow-wrap: anywhere; text-transform: none; }
.dl__sum[hidden] { display: none; }
@media (max-width: 52rem) {
  .dl__head { grid-template-columns: 1fr; }
  .dl__cells { grid-template-columns: 1fr 1fr; }
  .dl__cells div:nth-child(3) { border-left: 0; }
  .dl__cells div:nth-child(n + 3) { border-top: 1px solid var(--city-line); }
}

.notes { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2.5rem 1.5rem; margin-top: clamp(2.5rem, 6vw, 4rem); }
.notes__steps { grid-column: 1 / span 5; }
.notes__reqs { grid-column: 7 / span 6; }
.notes h3 { font: 700 1.5rem/1 var(--cond); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 1rem; }
.steps { counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 1rem 2.6rem; color: rgb(255 246 228 / 0.88); }
.steps li::before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0.2rem; font: 500 0.8125rem/1.5 var(--mono); color: var(--hud); }
.steps kbd { font: 400 0.875em var(--mono); padding: 0.05rem 0.35rem; border: 1px solid var(--city-line); background: var(--city-2); }
.reqs { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.reqs th, .reqs td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--city-line); }
.reqs thead th { font: 400 0.75rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--mist); }
.reqs tbody th { font-weight: 400; color: var(--mist); white-space: nowrap; }
@media (max-width: 58rem) {
  .notes__steps, .notes__reqs { grid-column: 1 / -1; }
}

/* 7. Small pages ---------------------------------------------------------- */
.lost { min-height: 100svh; align-items: flex-start; }
.lost__code { color: var(--hud); margin-top: 2.5rem; }
.lost h1 { margin-top: 0.75rem; font: italic 700 clamp(2.4rem, 6vw, 4.2rem)/0.95 var(--cond); text-transform: uppercase; max-width: 14ch; }
.lost > a:last-of-type { display: inline-block; margin-top: 2rem; color: var(--hud); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
