/* ==========================================================================
   Fitos' Hero Defense: landing page styles
   ========================================================================== */

:root {
  --bg: #080605;
  --text: #d9ccb4;
  --muted: #8f8370;
  --gold: #c9a052;
  --gold-bright: #f2d48a;
  --gold-dim: #6e5428;
  --frame: #1b150f;

  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Marcellus", Georgia, serif;
  --font-ui: "Marcellus SC", "Marcellus", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Firelit sky, vignette and a dark base */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(170, 60, 18, 0.38), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 105%, rgba(110, 25, 10, 0.3), transparent 70%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.75) 100%),
    linear-gradient(180deg, #120d0a 0%, #080605 100%);
}

/* Fine grain so the gradients don't look flat */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(201, 160, 82, 0.35);
  color: #fff;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--gold-bright);
}

em {
  font-style: normal;
  color: var(--gold-bright);
}

.container {
  width: min(100% - 32px, 960px);
  margin-inline: auto;
}

.hero,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Embers
   -------------------------------------------------------------------------- */

.embers {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.embers span {
  position: absolute;
  bottom: -12px;
  left: var(--x);
  width: var(--s, 3px);
  height: var(--s, 3px);
  border-radius: 50%;
  background: #ffc46b;
  box-shadow: 0 0 6px 2px rgba(255, 120, 30, 0.55);
  opacity: 0;
  animation: rise var(--t, 12s) linear var(--delay, 0s) infinite;
}

@keyframes rise {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.9;
  }
  70% {
    opacity: 0.6;
  }
  100% {
    transform: translate3d(var(--drift, 20px), -105vh, 0);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(2.5rem, 8vh, 5rem) 0 3.5rem;
  text-align: center;
}

.hero__eyebrow {
  margin: 0 0 0.75rem;
  padding-left: 0.3em; /* balances the trailing letter-spacing */
  font-family: var(--font-ui);
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 8.5vw, 5.75rem);
  line-height: 1.08;
  letter-spacing: 0.03em;
  color: var(--gold-bright);
  background: linear-gradient(180deg, #fff3c9 0%, #f3cf78 38%, #c28a35 68%, #7d4b17 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.9)) drop-shadow(0 0 28px rgba(255, 130, 40, 0.28));
}

.hero__title span {
  display: block;
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(420px, 80%);
  margin: 1.5rem auto 2.5rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.divider::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.divider span {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
  background: #b5360f;
  box-shadow: 0 0 10px rgba(255, 120, 30, 0.6);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-width: 200px;
  padding: 0.85em 1.6em;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--gold-bright);
  background: linear-gradient(180deg, #2c241b 0%, #17120d 100%);
  border: 1px solid var(--gold-dim);
  box-shadow:
    0 0 0 1px #000,
    inset 0 1px 0 rgba(255, 225, 160, 0.12),
    inset 0 -8px 16px rgba(0, 0, 0, 0.4);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn:hover,
.btn:focus-visible {
  color: #fff4d6;
  border-color: var(--gold);
  box-shadow:
    0 0 0 1px #000,
    0 0 18px rgba(240, 180, 80, 0.35),
    inset 0 1px 0 rgba(255, 225, 160, 0.2),
    inset 0 -8px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.btn--primary {
  color: #ffe9b8;
  background: linear-gradient(180deg, #7a2a12 0%, #4a1608 55%, #2e0d04 100%);
  border-color: #b07a35;
}

.btn--primary:hover,
.btn--primary:focus-visible {
  box-shadow:
    0 0 0 1px #000,
    0 0 24px rgba(255, 110, 30, 0.45),
    inset 0 1px 0 rgba(255, 200, 140, 0.25),
    inset 0 -8px 16px rgba(0, 0, 0, 0.3);
}

.btn__icon {
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

main > section {
  margin-bottom: 4.5rem;
}

.section-title {
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--gold-bright);
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(255, 140, 40, 0.25);
}

/* Framed panel with a double gold border, like the in-game UI */
.panel {
  position: relative;
  padding: clamp(1.75rem, 5vw, 2.75rem) clamp(1.25rem, 5vw, 3rem);
  background: linear-gradient(180deg, rgba(32, 25, 18, 0.92), rgba(16, 12, 9, 0.94));
  border: 1px solid var(--gold-dim);
  box-shadow:
    0 0 0 1px #000,
    0 0 0 4px var(--frame),
    0 0 0 5px var(--gold-dim),
    0 20px 50px rgba(0, 0, 0, 0.6),
    inset 0 0 40px rgba(0, 0, 0, 0.6);
}

/* Ember gem on top of the frame */
.panel::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translateX(-50%) rotate(45deg);
  background: radial-gradient(circle at 35% 35%, #ffb36b, #b5360f 60%, #4a0f04);
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 2px #000, 0 0 12px rgba(255, 110, 30, 0.7);
}

.welcome p {
  max-width: 62ch;
  margin: 0 auto 1rem;
  text-align: center;
}

.welcome p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Screenshots
   -------------------------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.5rem;
}

.shot {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: zoom-in;
  background: #0f0c09;
  border: 1px solid var(--gold-dim);
  box-shadow:
    0 0 0 1px #000,
    0 0 0 3px var(--frame),
    0 0 0 4px rgba(110, 84, 40, 0.6),
    0 12px 30px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shot:hover,
.shot:focus-visible {
  border-color: var(--gold);
  box-shadow:
    0 0 0 1px #000,
    0 0 0 3px var(--frame),
    0 0 0 4px var(--gold-dim),
    0 0 22px rgba(240, 160, 60, 0.3),
    0 12px 30px rgba(0, 0, 0, 0.5);
}

.shot:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 5px;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.shot:hover img {
  transform: scale(1.04);
}

/* --------------------------------------------------------------------------
   Screenshot viewer
   -------------------------------------------------------------------------- */

html:has(.lightbox[open]) {
  overflow: hidden;
}

.lightbox {
  --pad: clamp(16px, 5vw, 72px);
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--pad);
  border: 0;
  background: transparent;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgba(5, 4, 3, 0.92);
}

.lightbox__img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 2 * var(--pad));
  border: 1px solid var(--gold-dim);
  box-shadow:
    0 0 0 1px #000,
    0 0 0 4px var(--frame),
    0 0 0 5px var(--gold-dim),
    0 30px 80px rgba(0, 0, 0, 0.8);
}

.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  cursor: pointer;
  color: var(--gold-bright);
  background: linear-gradient(180deg, #2c241b 0%, #17120d 100%);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 0 1px #000;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.lightbox__btn:hover,
.lightbox__btn:focus-visible {
  color: #fff4d6;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px #000, 0 0 14px rgba(240, 180, 80, 0.35);
}

.lightbox__btn:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.lightbox__btn svg {
  width: 22px;
  height: 22px;
}

.lightbox__close {
  top: 16px;
  right: 16px;
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox__prev {
  left: 16px;
}

.lightbox__next {
  right: 16px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  padding: 2rem 0 3rem;
  font-size: 0.875rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(201, 160, 82, 0.15);
}

.site-footer p {
  margin: 0.25rem 0;
}

/* --------------------------------------------------------------------------
   Small screens and reduced motion
   -------------------------------------------------------------------------- */

@media (max-width: 520px) {
  .hero {
    padding-top: 2.5rem;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .btn {
    min-width: 0;
  }
}

/* On narrow screens the arrows move below the image so they don't cover it */
@media (max-width: 640px) {
  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: 16px;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .embers {
    display: none;
  }

  .btn,
  .shot,
  .shot img,
  .lightbox__btn {
    transition: none;
  }
}
