/*
 * Space Tower Defense – shared styles (tokens, base, header, footer,
 * buttons, store badges, legal pages, reveal animation).
 * Page specific styles live in their own file (css/home.css).
 * All fonts are self-hosted – no external requests (privacy by design).
 */

@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-Regular.woff2") format("woff2"),
       url("../assets/fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-SemiBold.woff2") format("woff2"),
       url("../assets/fonts/Inter-SemiBold.ttf") format("truetype");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Orbitron";
  src: url("../assets/fonts/Orbitron.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Colors – deep space, tower-glow cyan, alien green, warning amber */
  --color-bg: #05070d;
  --color-bg-2: #0a0f1a;
  --color-surface: rgba(16, 24, 40, 0.72);
  --color-surface-solid: #101828;
  --color-border: rgba(120, 170, 255, 0.16);
  --color-border-strong: rgba(120, 190, 255, 0.38);
  --color-text: #e7eefb;
  --color-text-muted: #9aa8c2;
  --color-primary: #3fb8ff;
  --color-primary-strong: #0e8fe0;
  --color-primary-glow: rgba(63, 184, 255, 0.45);
  --color-alien: #7dff6b;
  --color-alien-glow: rgba(125, 255, 107, 0.35);
  --color-warn: #ffb547;
  --color-danger: #ff5a5f;

  /* Typography */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Orbitron", "Inter", system-ui, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  --fs-2xl: clamp(2.2rem, 1.4rem + 3.6vw, 4.4rem);

  /* Layout */
  --content-width: 1180px;
  --legal-width: 48rem;
  --gutter: clamp(16px, 4vw, 32px);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --header-h: 68px;

  --shadow-glow: 0 0 0 1px var(--color-border), 0 18px 50px -20px rgba(0, 0, 0, 0.8);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(63, 184, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(125, 255, 107, 0.05), transparent 60%);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: #8fd6ff;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 0 0 0.6em;
}

p {
  margin: 0 0 1em;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--color-primary);
  color: #001224;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: top 0.2s;
}
.skip-link:focus {
  top: 12px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 0.9rem;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 48px;
  padding: 0.8em 1.5em;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s, color 0.2s;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  color: #00111f;
  box-shadow: 0 0 24px -4px var(--color-primary-glow);
}
.btn--primary:hover {
  color: #00111f;
  box-shadow: 0 0 36px 0 var(--color-primary-glow);
}
.btn--ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--ghost:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
  background: rgba(63, 184, 255, 0.08);
}

/* ---------------------------------------------------------- store badges */

.store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 176px;
  min-height: 56px;
  padding: 8px 18px 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border-strong);
  background: #000;
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), border-color 0.2s;
}
.store-badge:hover {
  color: #fff;
  transform: translateY(-2px);
  border-color: var(--color-primary);
}
.store-badge svg {
  width: 28px;
  height: 28px;
  flex: none;
}
.store-badge__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.store-badge__small {
  font-size: 0.72rem;
  opacity: 0.85;
}
.store-badge__big {
  font-size: 1.15rem;
  font-weight: 600;
}
.store-badge__pending {
  display: none;
  position: absolute;
  top: -10px;
  right: -8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-warn);
  color: #1a1000;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.store-badge.is-pending {
  cursor: default;
  opacity: 0.85;
}
.store-badge.is-pending:hover {
  transform: none;
  border-color: var(--color-border-strong);
}
.store-badge.is-pending .store-badge__pending {
  display: block;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(5, 7, 13, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.site-header.is-scrolled {
  background: rgba(5, 7, 13, 0.88);
  border-bottom-color: var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-right: auto;
}
.brand:hover {
  color: var(--color-text);
}
.brand__logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 0 18px -4px var(--color-primary-glow);
}
.brand__accent {
  color: var(--color-primary);
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__list a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}
.site-nav__list a:hover,
.site-nav__list a[aria-current="page"] {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}
.site-nav__cta a {
  margin-left: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  color: #00111f;
}
.site-nav__list .site-nav__cta a:hover {
  color: #00111f;
  background: linear-gradient(135deg, #7ccfff, var(--color-primary));
}

.lang-switcher {
  display: flex;
  align-items: center;
}
.lang-switcher__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.lang-switcher__options {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.03);
}
.lang-switcher__option {
  min-width: 40px;
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font: 600 var(--fs-xs) / 1 var(--font-body);
  letter-spacing: 0.08em;
  cursor: pointer;
}
.lang-switcher__option.is-active {
  background: var(--color-primary);
  color: #00111f;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--color-text);
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle.is-open .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-open .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }
  .site-header__inner {
    gap: 12px;
  }
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    padding: 24px var(--gutter) 40px;
    background: rgba(5, 7, 13, 0.97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, transform 0.25s var(--ease-out), visibility 0.25s;
    overflow-y: auto;
  }
  .site-nav.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .site-nav__list a {
    padding: 14px 16px;
    font-size: var(--fs-lg);
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
  }
  .site-nav__cta a {
    margin: 16px 0 0;
    border-radius: 999px;
    text-align: center;
    border-bottom: 0;
  }
}

@media (max-width: 420px) {
  .brand__text {
    display: none;
  }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  position: relative;
  margin-top: 96px;
  padding: 56px 0 28px;
  border-top: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(10, 15, 26, 0.6), var(--color-bg));
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  gap: 32px;
}
.site-footer h2 {
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: 1rem;
}
.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-footer li + li {
  margin-top: 8px;
}
.site-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--color-primary);
}
.site-footer__brand .brand {
  margin-bottom: 14px;
}
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-xs);
}

@media (max-width: 860px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}
@media (max-width: 480px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------------------------------------- legal pages */

.legal-main {
  padding: clamp(32px, 6vw, 72px) 0 0;
}
.legal {
  max-width: var(--legal-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.legal h1 {
  font-size: var(--fs-xl);
  margin-bottom: 0.4em;
}
.legal h2 {
  font-size: var(--fs-lg);
  margin-top: 2.4em;
  padding-top: 0.2em;
  color: var(--color-text);
}
.legal h3 {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 1.6em;
}
.legal p,
.legal li {
  color: #c9d4e8;
}
.legal ul,
.legal ol {
  padding-left: 1.3em;
}
.legal li + li {
  margin-top: 0.35em;
}
.legal__intro {
  font-size: var(--fs-lg);
  color: var(--color-text);
}
.legal__meta {
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.legal__card {
  margin: 1.5em 0;
  padding: 20px 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.legal__card p {
  margin-bottom: 0.4em;
}
.legal__card p:last-child {
  margin-bottom: 0;
}
.legal__toc {
  margin: 2em 0;
  padding: 18px 22px;
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--color-surface);
}
.legal__toc h2 {
  margin: 0 0 0.6em;
  font-size: var(--fs-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.legal__toc ol {
  margin: 0;
  columns: 2;
  column-gap: 32px;
  font-size: var(--fs-sm);
}
.legal__toc a {
  text-decoration: none;
}
@media (max-width: 600px) {
  .legal__toc ol {
    columns: 1;
  }
}
.legal__table-wrap {
  overflow-x: auto;
  margin: 1.2em 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.legal table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.legal th,
.legal td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}
.legal th {
  background: rgba(63, 184, 255, 0.08);
  color: var(--color-text);
  font-weight: 600;
}
.legal tr:last-child td {
  border-bottom: 0;
}
/* Narrow screens: each row becomes a card; column names come from
   data-label (set by main.js from the table head). */
@media (max-width: 640px) {
  .legal table.is-stacked {
    min-width: 0;
  }
  .legal table.is-stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .legal table.is-stacked tr {
    display: block;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
  }
  .legal table.is-stacked tbody tr:last-child {
    border-bottom: 0;
  }
  .legal table.is-stacked th,
  .legal table.is-stacked td {
    display: block;
    border-bottom: 0;
    padding: 6px 14px;
  }
  .legal table.is-stacked tbody th {
    background: none;
  }
  .legal table.is-stacked td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--color-text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}
.legal__back {
  display: inline-block;
  margin-top: 2.5em;
}

/* ------------------------------------------------- account deletion form */

.btn--danger {
  background: var(--color-danger);
  color: #1a0003;
  box-shadow: 0 0 24px -6px rgba(255, 90, 95, 0.55);
}
.btn--danger:hover {
  color: #1a0003;
  box-shadow: 0 0 32px -2px rgba(255, 90, 95, 0.6);
}
.btn:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}
/* The form needs JavaScript; without it the <noscript> note shows instead. */
html:not(.js) .delete-form {
  display: none;
}
.delete-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.delete-form legend {
  margin-bottom: 0.8em;
  font-weight: 600;
  color: var(--color-text);
}
.delete-form__field {
  display: block;
  margin-bottom: 1em;
}
.delete-form__field span {
  display: block;
  margin-bottom: 0.35em;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.delete-form__field input {
  width: 100%;
  min-height: 48px;
  padding: 0.6em 0.9em;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-bg-2);
  color: var(--color-text);
  font: inherit;
}
.delete-form__field input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.delete-form__check {
  display: flex;
  gap: 0.7em;
  align-items: flex-start;
  margin: 0.4em 0 1.4em;
  color: #c9d4e8;
  font-size: var(--fs-sm);
}
.delete-form__check input {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.2em;
  accent-color: var(--color-danger);
}
.delete-form__status {
  margin: 1em 0 0;
  font-size: var(--fs-sm);
}
.delete-form__status.is-busy {
  color: var(--color-text-muted);
}
.delete-form__status.is-error {
  color: var(--color-danger);
}
.delete-success {
  border-color: var(--color-alien);
}
.delete-success h3 {
  margin-top: 0;
  color: var(--color-alien);
}

/* --------------------------------------------------------------- reveal */

/* Hidden only when JS runs (html.js is set inline in <head>). */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
html.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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