/*
   GeneralsRemastered web app — visual parity with the WinUI 3
   Discombobulator launcher (Launcher/GeneralsLauncher). Palette and
   typography are lifted from Themes/ZeroHour.xaml + Shared.xaml so
   the website reads as a sibling to the desktop app.

   Default theme = Zero Hour (sapphire blues). To switch to Classic
   amber, swap the values inside :root.
*/

/* ─── Embedded fonts (mirrors Shared.xaml HeadlineFontFamily etc.) ─── */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/InstrumentSerif-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/InstrumentSerif-Italic.ttf") format("truetype");
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/InstrumentSans-Variable.ttf") format("truetype-variations"),
       url("/assets/fonts/InstrumentSans-Variable.ttf") format("truetype");
}

@font-face {
  font-family: "Instrument Sans";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/InstrumentSans-Italic-Variable.ttf") format("truetype-variations"),
       url("/assets/fonts/InstrumentSans-Italic-Variable.ttf") format("truetype");
}

/* ─── Palette ──────────────────────────────────────────────────────── */
/*
   Two themes, both lifted verbatim from the WPF launcher:
     :root              → Themes/ZeroHour.xaml (sapphire, default)
     body.theme-classic → Themes/Classic.xaml  (gold "OG Generals")

   Theme is selected per-page by setting ViewData["BodyClass"] in the
   PageModel. The fade-nav script in site.js swaps body.className at
   the midpoint of a hero crossfade so the new colours resolve as the
   new hero element renders.
*/

:root {
  --generals-navy:        #000000;
  --generals-deep-blue:   #0d132d;
  --generals-border-blue: #2c3e78;
  --generals-accent-blue: #5b8def;
  --generals-light-blue:  #9fb8ff;
  --generals-gray:        #7a8290;
  --generals-dark-panel:  #0a0a0e;
  --generals-mid-panel:   #111116;
  --button-bg:            #0d0d12;
  --button-fg:            #f2f2f2;
  --button-secondary-hover-bg: #1a1a24;
  --button-primary-bg:    #ffffff;
  --button-primary-fg:    #0a0f22;
  --button-primary-hover-bg: #e8ecf8;
}

body.theme-classic {
  --generals-deep-blue:   #1a1000;
  --generals-border-blue: #6b5520;
  --generals-accent-blue: #c8a84b;
  --generals-light-blue:  #e8cb7a;
  --generals-gray:        #8a8070;
  --generals-dark-panel:  #0e0b04;
  --generals-mid-panel:   #100c02;
  --button-secondary-hover-bg: #1a1500;
  --button-primary-hover-bg: #f8f0e0;
}

/* ─── Reset / page chrome ──────────────────────────────────────────── */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: var(--generals-navy);
  color: #ffffff;
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ─── Layer 1: video backdrop ──────────────────────────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;       /* WPF Stretch="UniformToFill" */
  opacity: 0.75;           /* matches MediaElement Opacity="0.75" */
  pointer-events: none;
  z-index: 0;
}

/* ─── Layer 2: dark scrim ──────────────────────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  background: #000000;
  opacity: 0.8;            /* matches Rectangle Fill="#000000" Opacity="0.8" */
  pointer-events: none;
  z-index: 1;
}

/* ─── Layer 3: hero block ──────────────────────────────────────────── */

.hero {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px 120px;   /* bottom padding clears the legal footer */
  text-align: center;
  /*
     Default fade-in animation runs on every fresh render — both initial
     page load and the JS-driven hero swap (when site.js inserts a new
     .hero element it gets this animation automatically). For the
     fade-OUT half, .hero-fading-out below overrides this declaration.
  */
  animation: hero-fade-in 280ms ease both;
}

.hero-fading-out {
  animation: hero-fade-out 280ms ease forwards;
}

@keyframes hero-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

@keyframes hero-fade-out {
  from { opacity: 1; transform: translateY(0);    }
  to   { opacity: 0; transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero,
  .hero-fading-out {
    animation: none;
  }
}

.hero-emblem {
  width: 128px;
  height: 128px;
  margin-bottom: 8px;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.6));
}

/*
   Headline rhythm replicates MainMenuPage.xaml:
   – italic super-title at ~55px
   – hero "GENERALS" at ~130px, pulled up so it tucks into the line above
   – italic accent sub-title at ~55px, also pulled up
*/
.hero-supertitle {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 4.5vw, 55px);
  margin: 0;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.hero-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(72px, 12vw, 130px);
  line-height: 1;
  margin: -0.1em 0 0 0;
  color: #ffffff;
  letter-spacing: 0.005em;
}

.hero-subtitle {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 4.5vw, 55px);
  margin: -0.3em 0 0 0;
  color: var(--generals-accent-blue);
}

.hero-divider {
  display: block;
  width: 120px;
  height: 1px;
  background: var(--generals-border-blue);
  margin: 28px 0 24px;
}

.hero-tagline {
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  max-width: 560px;
  margin: 0 0 32px;
  line-height: 1.5;
}

/* ─── Horizontal button row ────────────────────────────────────────── */

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;                  /* matches StackPanel Margin="0,0,12,0" */
}

/*
   Button base — mirrors GeneralsButtonStyle / GeneralsPrimaryButtonStyle.
   Sharp corners (2px radius), Instrument Sans semibold, 240px min width
   to line up with the launcher's Width="240" buttons.
*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 240px;
  padding: 14px 24px;
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border-radius: 2px;
  border: 1px solid var(--generals-border-blue);
  background: var(--button-bg);
  color: var(--button-fg);
  transition: border-color 120ms ease,
              background-color 120ms ease,
              color 120ms ease,
              transform 120ms ease;
  user-select: none;
}

.btn:hover {
  background: var(--button-secondary-hover-bg);
  border-color: var(--generals-accent-blue);
}

.btn:focus-visible {
  outline: none;
  border-color: var(--generals-light-blue);
  box-shadow: 0 0 0 2px rgba(159, 184, 255, 0.25);
}

.btn:active {
  transform: translateY(1px);
}

/* Primary CTA — white surface, deep navy type. */
.btn-primary {
  background: var(--button-primary-bg);
  color: var(--button-primary-fg);
  border-color: var(--button-primary-bg);
  font-weight: 700;
  padding: 14px 28px;
}

.btn-primary:hover {
  background: var(--button-primary-hover-bg);
  border-color: var(--button-primary-hover-bg);
  color: var(--button-primary-fg);
}

.btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ─── Layer 4: legal footer ────────────────────────────────────────── */

.legal-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.66);   /* matches Grid Background="#AA000000" */
  padding: 16px 30px;
  pointer-events: none;              /* matches IsHitTestVisible="False" */
  text-align: center;
}

.legal-footer p {
  margin: 0;
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.5);   /* matches Foreground="#80FFFFFF" */
  letter-spacing: 0.02em;
}

/* ─── Responsive trims ─────────────────────────────────────────────── */

@media (max-width: 720px) {
  .hero {
    padding: 48px 20px 140px;
  }
  .hero-emblem {
    width: 96px;
    height: 96px;
  }
  .hero-divider {
    margin: 20px 0 18px;
  }
  .hero-tagline {
    font-size: 13px;
    margin-bottom: 24px;
  }
  .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }
  .btn {
    width: 100%;
    min-width: 0;
  }
}
