@import url("/towerdefense/assets/type/fonts.css");

:root {
  color-scheme: dark;
  --bg: #0b1013;
  --surface: #131b20;
  --ink: #f8f2e6;
  --muted: #c3c5be;
  --gold: #f5cd7d;
  --line: #ffffff24;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.6 var(--body); }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: .94; letter-spacing: .007em; }
img, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.wrap { width: min(100% - 5rem, 75rem); margin-inline: auto; }
.skip { position: fixed; top: .85rem; left: .85rem; transform: translateY(-180%); z-index: 8; padding: .5rem .9rem; background: #211c14; }
.skip:focus { transform: none; }
section[id] { scroll-margin-top: 1.2rem; }

.masthead { background: #0b1116; border-bottom: 1px solid #ffffff24; }
.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 4.65rem; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .62rem; width: fit-content; text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 23%; }
.brand span { font: 800 1.28rem/1 var(--display); text-transform: uppercase; letter-spacing: .045em; }
.nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(1rem, 3vw, 2.5rem); }
.nav-links a, .locale { color: #ebe9df; font-size: .9rem; font-weight: 630; text-decoration: none; text-underline-offset: .25em; }
.nav-links a:hover { color: var(--gold); text-decoration: underline; }
.locale { justify-self: end; border: 1px solid #bba9777a; min-width: 2.75rem; padding: .38rem .6rem; text-align: center; border-radius: .25rem; }
.locale:hover { background: #bba9772a; }

.hero { position: relative; isolation: isolate; overflow: hidden; min-height: clamp(29rem, 44vw, 40rem); display: grid; align-items: center; border-bottom: 1px solid #cda86b40; }
.hero-art { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; object-position: 55% 58%; z-index: -2; animation: intro-art 1.25s cubic-bezier(.2,.7,.3,1) both; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #0a1015f8 2%, #0a1015e9 24%, #0a10158c 47%, #0a101500 79%), linear-gradient(0deg, #090f14e8 0%, transparent 32%); }
.hero-layout {
  display: grid;
  grid-template-columns: minmax(220px, .48fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 58px);
  padding-block: clamp(34px, 4.2vw, 64px);
}
.hero-content { animation: entering .7s ease-out both; }
.eyebrow { color: var(--gold); font-size: .81rem; line-height: 1.4; text-transform: uppercase; letter-spacing: .15em; font-weight: 760; }
.hero h1 { max-width: 11ch; text-transform: uppercase; font-size: clamp(3.2rem, 5.1vw, 5.2rem); line-height: .84; margin: .9rem 0 1.05rem; color: #f8e8c9; text-shadow: 0 6px 28px #0a0a08; }
.hero-line { font: 700 clamp(2rem, 4vw, 3.2rem)/1 var(--display); color: var(--gold); margin-bottom: .5rem; }
.hero-intro { max-width: 31ch; color: #e0e1d7; font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.45; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-top: 1.55rem; }
.store-badge { display: inline-block; flex: none; width: 10.5rem; border-radius: .35rem; transition: transform .2s; }
.store-badge:hover { transform: translateY(-2px); }
.store-badge img { width: 100%; height: auto; clip-path: inset(3.2% 1.02% round 2.8% / 9.3%); }
.cta { display: inline-flex; align-items: center; justify-content: center; min-height: 2.85rem; gap: .5rem; padding: .6rem 1.05rem; border-radius: .26rem; border: 1px solid transparent; cursor: pointer; text-decoration: none; font-size: .925rem; line-height: 1.25; font-weight: 770; text-align: center; transition: background .2s, color .2s, transform .2s; }
.cta:hover { transform: translateY(-2px); }
.cta:disabled { opacity: .5; cursor: default; transform: none; }
.cta-gold { background: #efc66f; color: #17140d; border-color: #f8d58a; }
.cta-gold:hover:not(:disabled) { background: #ffe0a0; }
.cta-quiet { background: #10191ccd; border-color: #a9956db5; color: #f3e9d4; }
.cta-quiet:hover:not(:disabled) { background: #2e332c; border-color: var(--gold); }
@keyframes entering { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes intro-art { from { opacity: .55; transform: scale(1.035); } to { opacity: 1; transform: scale(1); } }
.game-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding-block: .9rem; border-bottom: 1px solid var(--line); }
.game-stats > div { display: flex; justify-content: center; align-items: baseline; gap: .55rem; }
.game-stats > div + div { border-left: 1px solid var(--line); }
.game-stats strong { color: var(--gold); font: 750 clamp(2.15rem, 4vw, 3rem)/1 var(--display); }
.game-stats span { color: var(--muted); }

.feature-content, .heroes { padding-block: clamp(3.6rem, 6vw, 6.2rem); }
.demo-section { min-width: 0; }
.demo-section .section-lead { margin-bottom: .7rem; }
.demo-section h2 { font-size: clamp(1.75rem, 3vw, 2.6rem); }
.section-lead { margin-bottom: 1.35rem; }
h2 { font-size: clamp(2.9rem, 6vw, 5rem); }
.section-lead h2 { margin: .42rem 0 .72rem; }
.section-lead > p:not(.eyebrow) { max-width: 57ch; color: var(--muted); }
.battlebox { border: 1px solid #b9954d8f; border-radius: .55rem; overflow: hidden; background: #121b1f; box-shadow: 0 14px 50px #00000056; }
.battle-hud { display: flex; align-items: center; gap: clamp(.6rem, 3vw, 2.4rem); padding: .7rem 1rem; min-height: 3.2rem; }
.resource { display: flex; gap: .42rem; align-items: center; white-space: nowrap; }
.resource > span { color: var(--muted); font-size: .84rem; }
.resource strong { color: var(--ink); font: 800 1.3rem/1 var(--display); font-variant-numeric: tabular-nums; }
.icon-gold { width: .78rem; height: .78rem; border: 1px solid #ffe3a0; border-radius: 50%; background: #d19c43; box-shadow: inset 0 0 0 2px #f3c66c; }
.icon-life { width: .7rem; height: .7rem; background: #e38374; transform: rotate(45deg) scale(.8); border: 1px solid #fdad9e; }
.battle-reset { margin-left: auto; min-height: 2.3rem; padding: .25rem .65rem; border: 1px solid #ffffff36; color: #efe6d1; background: transparent; border-radius: .25rem; font-size: .85rem; font-weight: 660; cursor: pointer; }
.battle-reset:hover { background: #ffffff16; }
.battlefield { position: relative; aspect-ratio: 2; background: #344b2e url("/towerdefense/assets/forest.webp") center / cover; border-block: 1px solid #987f51a8; }
.battlefield canvas { width: 100%; height: 100%; }
.slots { position: absolute; inset: 0; pointer-events: none; }
.build-spot { --badge: clamp(1.25rem, 4.3vw, 2.75rem); position: absolute; transform: translate(-50%, -50%); width: max(var(--badge), 2.35rem); height: max(var(--badge), 2.35rem); border: 0; border-radius: 50%; background: transparent; cursor: pointer; pointer-events: auto; display: grid; place-items: center; padding: 0; touch-action: manipulation; }
.build-spot::after { content: "+"; width: var(--badge); height: var(--badge); border: 2px dashed #fff0b6; border-radius: 50%; background: #162117bb; color: #f8e8ac; display: grid; place-items: center; font: 650 clamp(.9rem, 2.65vw, 1.8rem)/1 var(--body); text-shadow: 0 2px 4px #000; transition: background .2s, border-color .2s; }
.build-spot:hover::after { border-style: solid; background: #45351add; }
.build-spot.built::after { content: ""; border: 2px solid transparent; background: transparent; }
.build-spot.built:hover::after, .build-spot.selected::after { border-color: var(--gold); background: transparent; }
.outcome { position: absolute; inset: 0; background: #070b0dd4; display: grid; place-items: center; text-align: center; padding: 1rem; }
.outcome h3 { color: var(--gold); font-size: clamp(2rem, 5.8vw, 4.75rem); }
.outcome p { color: #f4ecd9; margin: .45rem 0 .8rem; }
.armory { display: flex; gap: .85rem; align-items: stretch; justify-content: space-between; padding: .65rem .75rem; }
.tower-options { display: flex; flex: 1; gap: .5rem; }
.tower-card { flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .45rem; text-align: left; background: #1d2629; border: 1px solid #ffffff25; border-radius: .32rem; padding: .28rem .55rem .28rem .38rem; min-width: 0; cursor: pointer; transition: border-color .2s, background .2s; }
.tower-card:hover { background: #29302d; }
.tower-card[aria-pressed="true"] { background: #363023; border-color: #dfb769; }
.tower-card img { width: 2.8rem; height: 2.8rem; object-fit: contain; }
.tower-card strong { display: block; line-height: 1.2; font-size: .97rem; }
.tower-card small { display: block; font-size: .78rem; line-height: 1.2; color: #d1d2c8; margin-top: .14rem; }
.tower-card .tower-cost { color: var(--gold); font: 800 1.13rem/1 var(--display); }
.tower-card.unaffordable .tower-cost { color: #ff9c8a; }
.battle-controls { display: grid; grid-template-columns: auto auto; align-items: center; gap: .42rem; }
.battle-controls #start-wave { grid-column: 2; min-width: 7.2rem; }
.battle-status { min-height: 2rem; padding: 0 .85rem .53rem; color: #d7d7c2; font-size: .88rem; line-height: 1.35; }
.tip { margin-top: .68rem; color: #c4c4ad; font-size: .87rem; }

.features { background: #131b21; border-block: 1px solid var(--line); }
.game-shot img { width: 100%; height: auto; border: 1px solid #ae91599c; border-radius: .48rem; }
.game-shot figcaption { color: #bebcae; font-size: .85rem; padding-top: .6rem; }
.biome-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 1.55rem; }
.biome-grid figure { position: relative; min-width: 0; overflow: hidden; isolation: isolate; border-radius: .35rem; border: 1px solid var(--line); }
.biome-grid figure::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 35%, #090c12ec); z-index: -1; pointer-events: none; }
.biome-grid img { width: 100%; height: auto; aspect-ratio: 1.65; object-fit: cover; position: relative; z-index: -2; transition: transform .55s ease; }
.biome-grid figure:hover img { transform: scale(1.05); }
.biome-grid figcaption { position: absolute; inset: auto .6rem .6rem; font: 700 clamp(1.12rem, 2.6vw, 2rem)/1.08 var(--display); text-shadow: 0 2px 8px #000; }
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-top: 1.3rem; }
.hero-grid figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; border: 1px solid var(--line); border-radius: .38rem; padding: .8rem .5rem .7rem; background: radial-gradient(ellipse at 50% 43%, #293432, #111819 70%); text-align: center; }
.hero-grid img { width: 86%; height: clamp(7rem, 16vw, 13rem); object-fit: contain; }
.hero-grid strong { display: block; font: 750 1.9rem/1 var(--display); color: var(--gold); }
.hero-grid span { display: block; font-size: .91rem; color: var(--muted); }
.closing { background: #1f241d; border-block: 1px solid #af91506e; }
.closing-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.3rem; padding-block: 2.75rem; }
.closing-inner p { margin-top: .5rem; color: #dcddcd; }
footer { border-top: 1px solid #ffffff17; background: #0a0f12; }
.footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .9rem 1.6rem; padding-block: 1.4rem; }
.footer small { color: var(--muted); font-size: .83rem; }

.document { max-width: 54rem; min-height: 65vh; padding-block: clamp(3.2rem, 8vw, 6rem); }
.doc-heading h1 { font-size: clamp(3.7rem, 8vw, 6.6rem); margin: .28rem 0 1rem; }
.doc-heading p:not(.eyebrow) { font-size: 1.11rem; color: var(--muted); max-width: 67ch; }
.doc-entries { margin-top: 2rem; }
.doc-entries section, .doc-entries details { border-top: 1px solid var(--line); }
.doc-entries section { padding-block: 1.25rem; }
.doc-entries h2, summary { font: 700 clamp(1.55rem, 3.25vw, 2.1rem)/1.1 var(--display); }
.doc-entries h2 { margin-bottom: .55rem; }
.document p { color: #deddd2; }
.document a { color: var(--gold); text-underline-offset: .25em; overflow-wrap: anywhere; }
summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .98rem .3rem .98rem 0; }
summary::after { content: "+"; color: var(--gold); }
summary::-webkit-details-marker { display: none; }
details[open] summary::after { content: "−"; }
details p { padding: 0 1.8rem 1.05rem 0; }

@media (max-width: 1020px) {
  .hero-layout { grid-template-columns: minmax(0, 1fr); }
  .hero-content .hero-intro { max-width: 52ch; }
}
@media (max-width: 850px) {
  .wrap { width: calc(100% - 3rem); }
}
@media (max-width: 1180px) {
  .armory { flex-wrap: wrap; }
  .tower-options { flex-basis: 100%; }
  .battle-controls { display: flex; width: 100%; justify-content: flex-end; }
  .battle-controls .cta { min-height: 2.65rem; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 2rem); }
  .nav { min-height: 3.9rem; grid-template-columns: 1fr auto auto; gap: .65rem; }
  .brand img { width: 2rem; height: 2rem; }
  .brand span { font-size: 1.08rem; }
  .nav .nav-links { gap: .65rem; }
  .nav .nav-links a[href*="#"] { display: none; }
  .locale { min-width: 2.4rem; padding: .32rem .48rem; }
  .hero { align-items: end; }
  .hero-art { object-position: 60% 46%; }
  .hero::after { background: linear-gradient(0deg, #0c1217 1%, #0c1217d6 37%, #0c121745 80%), linear-gradient(90deg, #0c121771, transparent 80%); }
  .hero-layout { padding-block: 22px 34px; }
  .hero h1 { max-width: none; font-size: clamp(2.8rem, 12vw, 4.6rem); }
  .hero .hero-line { font-size: 1.7rem; }
  .hero .actions { margin-top: .85rem; }
  .game-stats span { font-size: .88rem; }
  .battle-hud { gap: .58rem; padding: .45rem .52rem; flex-wrap: wrap; }
  .resource { gap: .24rem; }
  .resource > span { font-size: .77rem; }
  .resource strong { font-size: 1.13rem; }
  .battle-reset { padding-inline: .38rem; font-size: .76rem; }
  .armory { gap: .55rem; padding: .46rem; }
  .tower-options { gap: .28rem; }
  .tower-card { grid-template-columns: 1.33rem minmax(0, 1fr); gap: .12rem .23rem; padding: .32rem; }
  .tower-card img { width: 1.45rem; height: 1.45rem; }
  .tower-card strong { font-size: .85rem; }
  .tower-card small { display: none; }
  .tower-card .tower-cost { grid-column: 2; font-size: 1rem; }
  .battle-controls .cta { flex: 1; padding-inline: .42rem; }
  .battle-status { padding-inline: .52rem; }
  .outcome .cta { min-height: 2.25rem; }
  .biome-grid { gap: .4rem; }
  .biome-grid figcaption { inset: auto .32rem .36rem; font-size: 1.07rem; }
  .hero-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .closing-inner { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

.locales { display: flex; gap: .4rem; justify-self: end; align-items: center; }
