/* App Mania — theappmania.com
   Layout: the page behaves like a home screen. An icon dock picks the featured app
   and re-tints the whole site; the apps' own posters carry the colour, chrome stays quiet. */

@property --accent { syntax: '<color>'; inherits: true; initial-value: #35d6ff; }

:root {
  color-scheme: dark;
  --bg: #0d1017;
  --surface: #151923;
  --surface-2: #1d2230;
  --line: #2a3142;
  --fg: #eef1f7;
  --muted: #9ba5b8;
  --accent: #35d6ff;
  --accent-mix: 100%;      /* how much of the accent survives when used as text on --bg */
  --on-accent: #0a0d13;
  --glow: 15%;
  --shadow: 0 18px 50px rgb(0 0 0 / .45);

  --font-display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --radius: 20px;
  --radius-sm: 12px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  transition: --accent .6s ease;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f2f3f7; --surface: #ffffff; --surface-2: #e8eaf0; --line: #d3d8e2;
    --fg: #11141b; --muted: #566077; --accent-mix: 48%; --glow: 22%;
    --shadow: 0 18px 44px rgb(30 40 70 / .18);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f3f7; --surface: #ffffff; --surface-2: #e8eaf0; --line: #d3d8e2;
  --fg: #11141b; --muted: #566077; --accent-mix: 48%; --glow: 22%;
  --shadow: 0 18px 44px rgb(30 40 70 / .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 560px at 88% -120px, color-mix(in oklab, var(--accent) var(--glow), transparent), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--fg);
  font: 400 1.0625rem/1.6 var(--font-body);
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.accent { color: color-mix(in oklab, var(--accent) var(--accent-mix), #000); }
.mono { font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.eyebrow {
  font: 500 .75rem/1.4 var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in oklab, var(--accent) var(--accent-mix), #000);
}
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1rem/1 var(--font-display); letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand .mark-tile { fill: var(--fg); }
.brand .mark-hot { fill: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .9375rem; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: none; }
}
@media (max-width: 620px) {
  .nav .nav-wide { display: none; }
  .site-header .wrap { gap: 10px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 .9375rem/1 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, #fff); }
.btn-ghost { border-color: var(--line); background: color-mix(in oklab, var(--surface) 70%, transparent); color: var(--fg); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(36px, 6vw, 72px) clamp(28px, 4vw, 48px); overflow-x: clip; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.hero-copy { display: grid; gap: 22px; justify-items: start; }
.hero h1 {
  font: 600 clamp(1.9rem, 4.3vw, 3.35rem)/1.1 var(--font-display); letter-spacing: -.025em; text-wrap: balance;
}
.hero .lead { font-size: 1.1875rem; color: var(--muted); max-width: 34em; }
.hero-stats { color: var(--muted); }
.hero-stats b { color: var(--fg); font-weight: 500; }

.stage { display: grid; gap: 22px; justify-items: center; min-width: 0; }
.fan { --ph: clamp(330px, 40vw, 480px); display: grid; place-items: center; width: 100%; height: calc(var(--ph) + 16px); transition: opacity .22s ease, transform .22s ease; }
.fan.is-swapping { opacity: 0; transform: translateY(10px); }
.fan > * { grid-area: 1 / 1; }
.poster { height: var(--ph); width: auto; max-width: none; border-radius: 18px; box-shadow: var(--shadow); background: var(--surface-2); }
.poster-l { transform: translateX(-56%) rotate(-7deg) scale(.84); filter: brightness(.72); }
.poster-r { transform: translateX(56%) rotate(7deg) scale(.84); filter: brightness(.72); }
.poster-c { position: relative; outline: 1px solid color-mix(in oklab, var(--accent) 45%, transparent); outline-offset: -1px; }
.poster-link { position: relative; display: block; border-radius: 18px; }
.stage-caption { display: grid; gap: 4px; justify-items: center; text-align: center; }
.stage-name { font: 600 1.125rem/1.3 var(--font-display); letter-spacing: -.01em; }
.stage-name a { text-decoration: none; }
.stage-name a:hover { text-decoration: underline; text-underline-offset: 4px; }
.stage-tag { color: var(--muted); font-size: .9375rem; }

.dock-rail { margin-top: clamp(28px, 4vw, 44px); display: grid; gap: 10px; justify-items: center; }
.dock-hint { color: var(--muted); }
.dock {
  display: flex; gap: 10px; padding: 10px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in oklab, var(--surface) 78%, transparent); border: 1px solid var(--line); border-radius: 28px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.dock::-webkit-scrollbar { display: none; }
.dock-app {
  position: relative; flex: none; width: 58px; height: 58px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 16px; transition: transform .18s ease;
}
.dock-app img { width: 100%; height: 100%; border-radius: 16px; object-fit: cover; }
.dock-app:hover { transform: translateY(-3px); }
.dock-app[aria-pressed="true"] { transform: translateY(-5px); }
.dock-app[aria-pressed="true"] img { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.dock-app[aria-pressed="true"]::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.dock { padding-bottom: 14px; padding-top: 14px; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .fan { --ph: clamp(300px, 78vw, 420px); }
  .dock-app { width: 52px; height: 52px; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(48px, 7vw, 88px); }
.section-tight { padding-top: 0; }
.section-head { display: grid; gap: 12px; margin-bottom: clamp(24px, 3vw, 36px); max-width: 46rem; }
.section-head h2, .page-title { font: 600 clamp(1.45rem, 2.7vw, 2.15rem)/1.15 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.section-head p { color: var(--muted); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer;
  font-size: .9375rem; color: var(--muted);
}
.chip span { font-family: var(--font-mono); font-size: .75rem; margin-left: 6px; opacity: .8; }
.chip:hover { color: var(--fg); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* App cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 18px; }
.card {
  display: grid; grid-template-rows: auto 1fr; text-decoration: none; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in oklab, var(--accent) 70%, var(--line)); }
.card-media { position: relative; aspect-ratio: 3 / 5; overflow: hidden; background: #0b0d12; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-media .fill { object-fit: cover; filter: blur(22px) brightness(.7); transform: scale(1.25); }
.card-media .shot { object-fit: contain; }
.card-body { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px; padding: 14px 14px 16px; align-content: start; }
.card-icon { width: 44px; height: 44px; border-radius: 12px; grid-row: span 2; }
.card-name { font: 600 .8125rem/1.3 var(--font-display); letter-spacing: -.01em; align-self: end; }
.card-meta { color: var(--muted); font-size: .75rem; }
.card-tag { grid-column: 1 / -1; color: var(--muted); font-size: .9375rem; line-height: 1.45; margin-top: 6px; }
@media (max-width: 480px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-body { grid-template-columns: 36px minmax(0, 1fr); padding: 12px; gap: 2px 10px; }
  .card-icon { width: 36px; height: 36px; border-radius: 10px; }
  .card-name { font-size: .75rem; }
  .card-tag { font-size: .875rem; }
}

/* What's inside */
.inside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); }
.inside h3 { font: 600 1.0625rem/1.3 var(--font-display); letter-spacing: -.01em; padding-bottom: 14px; border-bottom: 1px solid var(--fg); }
.cap { display: grid; gap: 4px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.cap-name { font-weight: 600; }
.cap-desc { color: var(--muted); font-size: .9375rem; }
.cap-apps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cap-apps a { display: block; border-radius: 8px; transition: transform .15s ease; }
.cap-apps a:hover { transform: translateY(-2px); }
.cap-apps img { width: 28px; height: 28px; border-radius: 8px; }
@media (max-width: 860px) { .inside { grid-template-columns: 1fr; } }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; counter-reset: step; }
.step { counter-increment: step; display: grid; gap: 8px; align-content: start; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.step::before { content: "0" counter(step); font: 500 .8125rem/1 var(--font-mono); letter-spacing: .1em; color: color-mix(in oklab, var(--accent) var(--accent-mix), #000); }
.step h3 { font: 600 1rem/1.3 var(--font-display); letter-spacing: -.01em; }
.step p { color: var(--muted); font-size: .9688rem; }
.note { margin-top: 20px; color: var(--muted); max-width: 46rem; }
.note b { color: var(--fg); font-weight: 600; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* Contact panel */
.panel {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(24px, 4vw, 48px); align-items: center;
  padding: clamp(24px, 4vw, 48px); border-radius: calc(var(--radius) + 8px);
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 14%, var(--surface)), var(--surface) 60%);
  border: 1px solid var(--line);
}
.panel h2 { font: 600 clamp(1.35rem, 2.4vw, 1.9rem)/1.15 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.panel-copy { display: grid; gap: 14px; }
.panel-copy p { color: var(--muted); max-width: 36em; }
.contact { display: grid; gap: 14px; justify-items: start; }
.email { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.email a { font: 500 1rem/1.4 var(--font-mono); word-break: break-all; text-underline-offset: 4px; }
.copy { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .875rem; }
.copy:hover { border-color: var(--muted); }
@media (max-width: 760px) { .panel { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { margin-top: clamp(32px, 5vw, 64px); border-top: 1px solid var(--line); padding-block: 36px 44px; color: var(--muted); font-size: .9375rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between; align-items: flex-start; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }
.fine { margin-top: 22px; font-size: .8125rem; max-width: 60rem; }

/* ---------- App page ---------- */
.crumb { padding-top: 26px; color: var(--muted); font-size: .9375rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--fg); }
.app-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px 28px; align-items: center; padding-block: 28px 36px; }
.app-icon { width: clamp(84px, 12vw, 128px); height: clamp(84px, 12vw, 128px); border-radius: 26%; box-shadow: var(--shadow); }
.app-title { display: grid; gap: 10px; }
.app-title h1 { font: 600 clamp(1.7rem, 4vw, 2.9rem)/1.1 var(--font-display); letter-spacing: -.025em; text-wrap: balance; }
.app-title .tagline { font-size: 1.1875rem; color: var(--muted); }
.app-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); }
.app-facts b { color: var(--fg); font-weight: 500; }
.app-actions { grid-column: 1 / -1; }
@media (max-width: 520px) { .app-hero { grid-template-columns: 1fr; } }

.gallery-wrap { position: relative; }
.gallery {
  --gh: clamp(340px, 62vh, 540px);
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x proximity; padding-block: 6px 18px;
  padding-inline: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
  scrollbar-color: var(--line) transparent;
}
.gallery button { flex: none; padding: 0; border: 0; background: none; cursor: zoom-in; scroll-snap-align: center; border-radius: 16px; }
.gallery img { height: var(--gh); width: auto; max-width: 86vw; object-fit: contain; border-radius: 16px; }
.gallery-nav { position: absolute; top: 50%; margin-top: -28px; z-index: 2; width: 48px; height: 48px; background: var(--surface); box-shadow: var(--shadow); }
.gallery-nav.prev { left: 14px; }
.gallery-nav.next { right: 14px; }
@media (hover: none), (max-width: 760px) { .gallery-nav { display: none; } }

.app-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.app-main { display: grid; gap: 28px; }
.app-intro { font-size: 1.1875rem; max-width: 38em; }
.app-main h2, .app-side h2 { font: 600 1.125rem/1.3 var(--font-display); letter-spacing: -.01em; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.features li { padding-block: 14px; border-top: 1px solid var(--line); }
.features b { display: block; font-weight: 600; }
.features span { color: var(--muted); font-size: .9688rem; }
.app-side { display: grid; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.facts { display: grid; gap: 12px; }
.facts div { display: grid; gap: 2px; }
.facts dt { font: 500 .6875rem/1.4 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.facts dd { overflow-wrap: anywhere; }
.facts dd.mono { font-size: .8125rem; }
.app-side .btn { width: 100%; }
@media (max-width: 860px) { .app-body { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.lightbox::backdrop { background: rgb(5 7 11 / .88); }
.lightbox img { max-height: 92vh; max-width: 94vw; width: auto; border-radius: 14px; }
.lightbox form { position: fixed; top: 14px; right: 14px; }
.lightbox .icon-btn { background: #151923; border-color: #2a3142; color: #eef1f7; }

/* ---------- Text pages ---------- */
.page-head { padding-block: clamp(32px, 5vw, 56px) 8px; display: grid; gap: 12px; }
.page-head p { color: var(--muted); }
.prose { max-width: 44rem; padding-block: 20px 24px; }
.prose h2 { font: 600 1.1875rem/1.3 var(--font-display); letter-spacing: -.01em; margin: 2.2em 0 .6em; }
.prose h3 { font-size: 1.0625rem; font-weight: 600; margin: 1.6em 0 .4em; }
.prose p { margin: 0 0 1em; }
.prose ul { list-style: disc; padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose a { color: color-mix(in oklab, var(--accent) var(--accent-mix), #000); text-underline-offset: 3px; }
.prose .summary { padding: 18px 20px 6px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.prose .summary p { margin-bottom: .5em; }
.prose .table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .9375rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 600; background: var(--surface); }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { font-weight: 600; white-space: nowrap; }

.faq { max-width: 46rem; display: grid; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding-block: 18px; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.4rem/1 var(--font-mono); color: var(--muted); flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq .answer { padding-bottom: 20px; color: var(--muted); display: grid; gap: 10px; max-width: 40rem; }
.faq .answer b { color: var(--fg); font-weight: 600; }

.notfound { min-height: 56vh; display: grid; align-content: center; gap: 18px; justify-items: start; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
