@font-face { font-family: Anton; src: url('assets/anton.ttf') format('truetype'); font-weight: 400; font-display: swap; }
:root {
  color-scheme: dark;
  --page: #002438;
  --ink: #ff422c;
  --line: #19809a;
  --panel: #001018;
  --accent: #116b8c;
  --muted: #b9ccd6;
  --duration: 300ms;
  --out-opacity: 0;
  --underline-opacity: 0;
}
:root[data-theme="lights-out"] {
  --page: #190927;
  --ink: #9cff00;
  --line: #96e641;
  --panel: #07040e;
  --accent: #8c29bd;
  --muted: #d0bddb;
  --out-opacity: 1;
  --underline-opacity: 1;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--page); color: var(--ink); font-family: Arial, sans-serif; transition: background-color var(--duration), color var(--duration); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button, a, dialog { transition: color var(--duration), background-color var(--duration), border-color var(--duration), box-shadow var(--duration); }
.homepage { width: 100%; height: 100svh; height: 100dvh; position: relative; overflow: hidden; isolation: isolate; }
/* The original composition fits inside the viewport. Only the surrounding
   tentacle crops fill surplus space; every image keeps its aspect ratio. */
.composition { position: relative; margin-inline: auto; width: min(100%, calc(100svh * 4 / 3)); width: min(100%, calc(100dvh * 4 / 3)); aspect-ratio: 1448 / 1086; container-type: inline-size; }
.surroundings, .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait-backdrop { display: none; }
.backdrop-out { opacity: var(--out-opacity); transition: opacity var(--duration) ease; }
.surroundings::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #0002, transparent 30%, transparent 70%, #0002); }
.texture { position: absolute; inset: 0; background: var(--page); transition: background-color var(--duration); }
.texture svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.texture .texture-out { opacity: var(--out-opacity); transition: opacity var(--duration); }
.artwork { position: absolute; inset: 20.626% 0 0; }
.art { position: absolute; width: 100%; height: 100%; inset: 0; }
.art-out { opacity: var(--out-opacity); transition: opacity var(--duration) ease; }
/* One grid and one set of links serve both color themes. */
.navigation { position: absolute; left: 4.49%; right: 4.35%; top: 4.14%; height: 16.39%; display: grid; grid-template-columns: .895fr 1fr 1.07fr; grid-template-rows: 1fr 1fr; border: 2px solid var(--line); background: var(--panel); }
.navigation a { min-width: 0; position: relative; display: flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; text-transform: uppercase; font-family: Anton, Impact, 'Arial Narrow', sans-serif; font-weight: 400; font-size: clamp(20px, 3.24cqw, 72px); line-height: 1; white-space: nowrap; text-shadow: 1px 2px 1px #000; }
.navigation a:nth-child(-n+3) { border-bottom: 2px solid var(--line); }
.navigation a:not(:nth-child(3n)) { border-right: 2px solid var(--line); }
.navigation .racing { font-size: clamp(16px, 2.85cqw, 65px); }
.navigation a::after { content: ''; position: absolute; bottom: 10%; left: 28%; right: 28%; height: 10%; background: var(--accent); opacity: var(--underline-opacity); clip-path: polygon(0 43%, 16% 29%, 12% 19%, 40% 29%, 49% 12%, 67% 26%, 84% 19%, 81% 37%, 100% 48%, 90% 65%, 94% 73%, 59% 86%, 27% 74%, 32% 62%); transition: opacity var(--duration), background-color var(--duration); }
.navigation a:hover { background-color: #ffffff0e; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: -6px; }
.theme-toggle { position: absolute; right: 3.7%; top: 0; height: 3.3cqw; max-height: 36px; min-height: 30px; width: 115px; z-index: 3; padding: 0; border: 0; background: #05070d99; border-radius: 0 0 6px 6px; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; }
.theme-label { display: inline-block; width: 66px; font-size: 11px; font-weight: 700; line-height: 1; text-align: right; }
.theme-toggle svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle svg circle { fill: currentColor; stroke: none; }
.theme-toggle:hover { background: var(--page); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.section-dialog { width: min(90vw, 480px); padding: 44px 32px 32px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); box-shadow: 0 20px 80px #000a; }
.section-dialog::backdrop { background: #000b; backdrop-filter: blur(5px); }
.close-dialog { position: absolute; top: 8px; right: 12px; width: 36px; height: 36px; border: 0; background: none; color: var(--ink); font-size: 28px; cursor: pointer; }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 3px; }
h2 { margin: 20px 0; font-family: Anton, Impact, 'Arial Narrow', sans-serif; font-weight: 400; font-size: 40px; text-transform: uppercase; }
.section-message { color: var(--muted); line-height: 1.7; }
.contact-links a { display: inline-block; max-width: 100%; padding-block: 12px; color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; text-underline-offset: 4px; }
.contact-links a:focus-visible { outline-offset: 4px; }
.social-links { display: flex; flex-wrap: wrap; gap: 0 24px; }
.back-button { margin-top: 20px; border: 1px solid var(--line); padding: 12px 18px; background: transparent; color: var(--ink); cursor: pointer; }

.texture, .artwork { mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent); }
.navigation a:nth-child(3n+1) span { transform: translateX(-3.04cqw); }
.navigation a:nth-child(3n+2) span { transform: translateX(-4.83cqw); }
.section-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
/* Portrait phones and tablets: touch-friendly menu, intact emblem, tentacles
   continuing to the bottom of the actual visible browser viewport. */
@media (max-aspect-ratio: 1/1) {
  .surroundings > .backdrop { display: none; }
  .surroundings > .portrait-backdrop { display: block; }
  .composition { width: 100%; height: 100%; aspect-ratio: auto; }
  .texture { display: none; }
  .navigation { top: max(54px, env(safe-area-inset-top)); left: 5%; right: 5%; height: 156px; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
  .navigation a { font-size: clamp(24px, 7cqw, 38px); border: 0; }
  .navigation a:nth-child(odd) { border-right: 1px solid var(--line); }
  .navigation a:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .navigation a:nth-child(3n+1) span, .navigation a:nth-child(3n+2) span { transform: none; }
  .navigation .racing { font-size: clamp(14px, 4.1cqw, 25px); }
  .navigation a::after { height: 5px; bottom: 5px; }
  .artwork { top: 216px; bottom: auto; left: -16.666%; right: auto; width: 133.333%; height: min(79.5cqw, calc(100dvh - 232px)); mask-image: linear-gradient(to bottom, #000 78%, transparent 100%); }
  .theme-toggle { top: max(3px, env(safe-area-inset-top)); right: 5%; height: 44px; max-height: none; width: 120px; }
  .theme-label { font-size: 12px; }
  .theme-toggle svg { width: 32px; height: 32px; }
}
/* Landscape phones: reserve space for usable controls, then fit the entire
   emblem beneath them. The background reaches both screen edges. */
@media (min-aspect-ratio: 1/1) and (max-height: 540px) {
  .composition { width: 100%; height: 100%; aspect-ratio: auto; }
  .texture { display: none; }
  .navigation { top: 46px; left: max(4%, env(safe-area-inset-left)); right: max(4%, env(safe-area-inset-right)); height: 88px; grid-template-columns: 1fr 1fr 1.25fr; }
  .navigation a { font-size: clamp(18px, 3cqw, 28px); }
  .navigation .racing { font-size: clamp(14px, 2.5cqw, 24px); }
  .navigation a:nth-child(3n+1) span, .navigation a:nth-child(3n+2) span { transform: none; }
  .artwork { top: 140px; bottom: 0; left: 50%; right: auto; width: min(100%, calc((100dvh - 140px) * 1448 / 862)); transform: translateX(-50%); mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); }
  .theme-toggle { top: 0; height: 44px; max-height: none; right: max(4%, env(safe-area-inset-right)); }
}
@media (prefers-reduced-motion: reduce) { :root { --duration: 0ms; } }

/* Single game-link icon inherits the existing theme text color. */
.navigation .racing::after { display: none; }
.navigation .racing-icon { display: block; width: 48px; height: 48px; max-width: 80%; max-height: 85%; flex-shrink: 0; }

/* Product gallery is scoped to the Merch panel; the homepage is unchanged. */
.section-dialog.merch-dialog { width: min(92vw, 960px); }
.merch-gallery { margin: 28px 0 0; padding: 0; list-style: none; }
.merch-gallery:not([hidden]) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.merch-gallery li { min-width: 0; }
.merch-card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.merch-card:hover { background-color: #ffffff0e; }
.merch-card:focus-visible { outline-offset: 4px; }
.merch-card img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; background: #fff; }
.merch-card h3 { margin: 18px 16px 14px; font-size: 17px; line-height: 1.4; font-weight: 700; }
.merch-shop-link { display: block; margin-top: auto; padding: 0 16px 18px; font-size: 14px; line-height: 1.5; text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 760px) {
  .merch-gallery:not([hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
@media (max-width: 480px) {
  .section-dialog.merch-dialog { padding-inline: 24px; }
  .merch-gallery:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
}
