/*
 * Krull Games — Midnight Arcade.
 * Shared tokens keep new catalog entries consistent with the selected mockup.
 * Layout is mobile-first in spirit, with focused breakpoints for the three-card
 * desktop gallery and a readable single-column phone layout.
 */
:root {
    color-scheme: dark;
    --page: #03111f;
    --surface: #091b2d;
    --text: #eef4ff;
    --muted: #97afcf;
    --cyan: #00dced;
    --cyan-hover: #68f5ff;
    --pink: #ff5ad4;
    --line: #33485f;
    --display: 'Barlow Condensed', Impact, sans-serif;
    --body: 'Inter', Arial, sans-serif;
    --gutter: clamp(24px, 4.3vw, 64px);
    --content: 1360px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body { margin: 0; background: var(--page); color: var(--text); font: 400 16px/1.6 var(--body); }
body.dialog-open { overflow: hidden; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { color: inherit; }
button, input { border-radius: 0; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--cyan-hover); outline-offset: 5px; }
[hidden] { display: none !important; }
.container { width: calc(100% - var(--gutter) * 2); max-width: var(--content); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 16px; z-index: 20; padding: 12px 18px; background: var(--cyan); color: var(--page); font-weight: 700; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

/* Compact masthead and navigation; no separate mobile drawer is necessary. */
.site-header { min-height: 58px; background: var(--page); }
.header-inner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; text-transform: uppercase; font-weight: 800; letter-spacing: 3px; font-size: 22px; line-height: 1; }
.brand-mark { width: 38px; height: 38px; object-fit: contain; }
.primary-nav { display: flex; gap: 38px; align-items: center; font-size: 16px; font-weight: 600; color: var(--muted); }
.primary-nav a { padding-block: 16px; transition: color 160ms ease; }
.primary-nav a:hover, .primary-nav .nav-current { color: var(--cyan); }

/* The backdrop is generated artwork. Headline and controls remain real HTML. */
.hero { min-height: 454px; position: relative; isolation: isolate; overflow: hidden; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 49%; z-index: -1; }
.hero-inner { min-height: 454px; display: flex; align-items: center; }
.hero-copy { width: 590px; max-width: 49%; padding-block: 48px 54px; }
.eyebrow { display: flex; align-items: center; gap: 16px; margin: 0; color: #c4b8ef; font-family: var(--display); text-transform: uppercase; font-size: 18px; font-weight: 600; letter-spacing: 4px; line-height: 1.4; }
.eyebrow > span { width: 42px; height: 2px; background: var(--pink); box-shadow: 0 0 8px #ff5ad45c; }
.hero h1 { margin: 10px 0 10px; font-family: var(--display); font-size: clamp(88px, 9.8vw, 146px); font-weight: 800; line-height: 0.99; letter-spacing: -2px; text-transform: uppercase; color: #9cf5ff; text-shadow: 0 0 18px #00dced33; white-space: nowrap; }
.hero h1 > span { color: var(--pink); text-shadow: 0 0 18px #ff5ad438; }
.hero-description { margin: 0 0 30px; color: #d3e2f5; font-size: clamp(17px, 1.5vw, 22px); line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 20px; border: 1px solid transparent; border-radius: 4px; font-weight: 700; line-height: 1.2; white-space: nowrap; transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.button-primary { background: var(--cyan); color: #02101b; box-shadow: 0 0 19px #00dced1c; }
.button-primary:hover { background: var(--cyan-hover); box-shadow: 0 0 24px #00dced38; transform: translateY(-2px); }
.button-primary:active { transform: translateY(0); }
.hero-button { min-height: 60px; min-width: 224px; font-size: 23px; padding: 15px 25px; gap: 12px; }
.icon { width: 22px; height: 22px; flex-shrink: 0; }
.hero-button .icon { width: 28px; height: 28px; }
.hero-note { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.icon-cyan { filter: invert(74%) sepia(78%) saturate(2332%) hue-rotate(132deg) brightness(105%) contrast(103%); }
.icon-light { filter: invert(98%) sepia(6%) saturate(595%) hue-rotate(175deg); }
.icon-muted { filter: invert(72%) sepia(13%) saturate(728%) hue-rotate(174deg); }

/* Home shows the three supporting games; All games adds the featured entry. */
.library { padding-top: 26px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: var(--display); font-size: 42px; line-height: 1.2; font-weight: 700; letter-spacing: -0.4px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 5px 0 5px 12px; border: 0; background: transparent; color: var(--cyan); font-weight: 600; font-size: 16px; }
.text-button:hover { color: var(--cyan-hover); }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 24px; }
.game-card { min-width: 0; }
.featured-card { display: none; }
.catalog-expanded .featured-card { display: block; }
.game-image-link { display: block; overflow: hidden; border: 1px solid #33485f80; border-radius: 4px; background: var(--surface); }
.game-image { width: 100%; height: auto; aspect-ratio: 1.73; object-fit: cover; transition: transform 250ms ease, filter 250ms ease; }
.game-image-link:hover .game-image { transform: scale(1.035); filter: brightness(1.08); }
.game-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px 0; }
.game-heading { min-width: 0; }
.game-heading h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(27px, 2.5vw, 36px); line-height: 1.1; text-transform: uppercase; letter-spacing: -0.25px; overflow-wrap: anywhere; }
.game-genre { margin: 5px 0 0; color: var(--muted); font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; line-height: 1.5; }
.availability { font-weight: 400; font-size: 11px; color: #8498b6; border-left: 1px solid #33485f; padding-left: 10px; }
.button-small { min-height: 44px; padding: 10px 14px; font-size: 16px; gap: 6px; }
.button-small .icon { width: 18px; height: 18px; }
.catalog-tools { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 0 24px; }
.search-field { min-height: 48px; display: flex; align-items: center; gap: 12px; width: min(460px, 100%); padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.search-field:focus-within { border-color: var(--cyan); }
.search-field input { min-width: 0; width: 100%; min-height: 46px; border: 0; background: transparent; color: var(--text); outline: 0; font-size: 15px; }
.search-field input::placeholder { color: var(--muted); }
.search-field input:focus-visible { outline: none; }
.catalog-count { margin: 0; color: var(--muted); font-size: 14px; }
.empty-state { padding: 54px 20px; text-align: center; background: var(--surface); border-radius: 4px; }
.empty-state h3 { margin: 0; font-family: var(--display); font-size: 38px; }
.empty-state p { color: var(--muted); margin: 8px 0 14px; }
.empty-state .text-button { padding-left: 0; }

.site-footer { margin-top: 58px; min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: #8fa7ca; font-size: 13px; padding-block: 20px; }
.site-footer a:hover { color: var(--cyan); }
.noscript-note { font-size: 13px; color: var(--muted); padding-bottom: 18px; }

/* Native dialogs handle focus trapping and Escape; JS restores trigger focus. */
dialog { color: var(--text); background: var(--surface); padding: 0; border: 1px solid #315270; border-radius: 8px; width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; box-shadow: 0 20px 90px #0009; }
dialog::backdrop { background: #01060dd9; backdrop-filter: blur(6px); }
.dialog-close { position: absolute; top: 14px; right: 14px; z-index: 1; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #617791; border-radius: 50%; background: #03111feb; }
.dialog-close:hover { background: #17344d; }
.dialog-art { width: 100%; height: auto; aspect-ratio: 1.9; object-fit: cover; }
.dialog-copy { padding: 30px 34px 34px; }
.dialog-copy .eyebrow { font-size: 15px; letter-spacing: 3px; color: var(--cyan); }
.dialog-copy h2 { margin: 9px 0 12px; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 46px; line-height: 1.05; }
.dialog-copy > p:not(.eyebrow) { margin: 12px 0 18px; color: #b6c8df; }
.release-note { display: flex; flex-direction: column; gap: 5px; margin: 22px 0; padding: 16px 18px; border-left: 2px solid var(--pink); background: #0d2338; }
.release-note strong { color: #ffc0ed; font-size: 15px; }
.release-note span { color: var(--muted); font-size: 14px; }
.about-dialog { width: min(580px, calc(100vw - 32px)); }
.about-dialog .dialog-copy { padding: 44px; }
.about-mark { width: 62px; height: 62px; margin-bottom: 25px; }
.about-dialog .button { margin-top: 8px; }

/* A :target fallback makes previews and About readable when JS is disabled. */
dialog:target:not([open]) { display: block; position: fixed; inset: 32px 0; z-index: 30; }

@media (min-width: 1680px) {
    .hero { min-height: 500px; }
    .hero-inner { min-height: 500px; }
    .hero-art { object-position: center 53%; }
}

@media (max-width: 1100px) {
    .hero-copy { max-width: 59%; }
    .hero-description { max-width: 400px; }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .game-caption { align-items: flex-start; }
    .game-caption .button-small { padding: 10px; font-size: 14px; }
    .game-caption .button-small .icon { display: none; }
    .availability { border-left: 0; padding-left: 0; }
    .game-genre { column-gap: 8px; }
}

@media (max-width: 900px) {
    .header-inner { gap: 14px; min-height: 74px; flex-wrap: wrap; padding-block: 12px; }
    .brand { font-size: 19px; letter-spacing: 2px; }
    .brand-mark { width: 34px; height: 34px; }
    .primary-nav { gap: 24px; font-size: 13px; }
    .primary-nav a { padding-block: 6px; }
    .hero { padding-top: 220px; min-height: auto; }
    .hero-art { height: 245px; object-position: 70% 45%; object-fit: cover; }
    .hero-inner { min-height: auto; }
    .hero-copy { width: 100%; max-width: 100%; padding: 26px 0 30px; }
    .hero h1 { margin: 9px 0 10px; font-size: clamp(82px, 14.3vw, 112px); line-height: 1; letter-spacing: -1.5px; }
    .hero-description { font-size: 18px; margin-bottom: 22px; max-width: none; }
    .hero-button { font-size: 19px; min-width: 200px; min-height: 54px; }
    .hero-note { font-size: 13px; }
    .eyebrow { font-size: 16px; letter-spacing: 3px; }
    .library { padding-top: 18px; }
    .section-heading h2 { font-size: 34px; }
    .section-heading { gap: 12px; margin-bottom: 20px; }
    .text-button { font-size: 14px; gap: 6px; }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
    .game-caption { flex-wrap: wrap; gap: 10px; }
    .game-heading h3 { font-size: 30px; }
    .game-caption .button-small { font-size: 15px; padding: 10px 14px; }
    .game-caption .button-small .icon { display: block; }
    .catalog-tools { align-items: stretch; flex-direction: column; gap: 10px; }
    .search-field { width: 100%; }
    .site-footer { margin-top: 38px; font-size: 12px; }
}

@media (max-width: 480px) {
    .header-inner { justify-content: center; gap: 8px; padding-block: 10px; }
    .brand { width: 100%; justify-content: center; font-size: 19px; }
    .primary-nav { justify-content: center; gap: 36px; width: 100%; }
    .hero { padding-top: 200px; }
    .hero-art { height: 210px; object-position: 72% center; }
    .hero-copy { padding-top: 26px; }
    .hero h1 { font-size: clamp(76px, 21vw, 100px); }
    .hero-description { font-size: 16px; }
    .hero-note { font-size: 12px; }
    .game-grid { grid-template-columns: 1fr; gap: 29px; }
    .game-caption { flex-wrap: nowrap; align-items: center; }
    .game-heading h3 { font-size: 32px; }
    .game-genre { font-size: 14px; }
    .availability { font-size: 10px; }
    .button-small { min-height: 44px; }
    .section-heading h2 { font-size: 32px; }
    .section-heading .text-button { font-size: 13px; }
    .site-footer { flex-direction: column; align-items: flex-start; gap: 9px; padding-block: 20px; }
    .dialog-copy, .about-dialog .dialog-copy { padding: 26px 24px; }
    .dialog-copy h2 { font-size: 39px; }
    .dialog-copy > p:not(.eyebrow) { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
