/* Night Shift Servers - public homepage.
   Separate from style.css, which is shared by the member and admin pages.
   Mobile layout first; the desktop layout is defined from 900px up. */

@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/manrope-latin-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #05111a;
  --bg-panel: #0a1b29;
  --bg-panel-2: #0d2234;
  --teal: #5d9aaa;
  --teal-bright: #7fd8e8;
  --text: #f1eee8;
  --text-soft: #c3d2df;
  --text-dim: #8399ad;
  --line: rgba(127, 216, 232, 0.22);
  --line-soft: rgba(169, 191, 211, 0.14);
  --gutter: 16px;
  --radius: 14px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  background: linear-gradient(180deg, rgba(5, 17, 26, 0.92) 0%, rgba(5, 17, 26, 0.6) 100%);
  border-bottom: 1px solid var(--line-soft);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "brand login"
    "nav   nav";
  align-items: center;
  gap: 10px 12px;
  padding: 12px var(--gutter) 0;
}

.brand {
  grid-area: brand;
  display: inline-block;
}

.brand img {
  height: 44px;
  width: auto;
}

.main-nav {
  grid-area: nav;
  display: flex;
  justify-content: center;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 6px 2px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--teal-bright);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.nav-link.is-active::after,
.nav-link:hover::after {
  transform: scaleX(1);
}

.login-button {
  grid-area: login;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
  background: rgba(93, 154, 170, 0.16);
  border: 1px solid rgba(127, 216, 232, 0.55);
  border-radius: 10px;
  box-shadow: 0 0 18px rgba(127, 216, 232, 0.12);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.login-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.login-button:hover,
.login-button:focus-visible {
  background: rgba(93, 154, 170, 0.3);
  box-shadow: 0 0 26px rgba(127, 216, 232, 0.28);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 560px;
  padding: 140px var(--gutter) 40px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% 60%;
  animation: drift 40s ease-in-out infinite alternate;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 17, 26, 0.35) 0%, rgba(5, 17, 26, 0.15) 35%, rgba(5, 17, 26, 0.85) 75%, var(--bg) 100%);
}

.hero-content {
  position: relative;
  animation: rise 0.9s ease-out both;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 11vw, 3.2rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.hero-title span {
  display: block;
}

.hero-title .accent {
  color: var(--teal-bright);
  background: linear-gradient(90deg, #a6eef8 0%, var(--teal-bright) 45%, #5fc3d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-text {
  margin: 16px 0 0;
  max-width: 34ch;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-soft);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

/* ---------- Game cards ---------- */

.worlds {
  display: grid;
  gap: 20px;
  padding: 8px var(--gutter) 40px;
  scroll-margin-top: 20px;
}

.world {
  position: relative;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: rise 0.9s ease-out both;
}

.world-valheim {
  animation-delay: 0.12s;
}

.world-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.world-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s ease;
}

.world-se .world-media img {
  object-position: 45% 50%;
}

.world-valheim .world-media img {
  object-position: 42% 50%;
}

.world-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, var(--bg-panel) 100%);
}

.world-body {
  position: relative;
  padding: 0 18px 22px;
  margin-top: -36px;
}

.world-title {
  margin: 0;
  line-height: 0;
}

.world-logo {
  width: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.7));
}

.world-se .world-logo {
  height: 44px;
}

.world-valheim .world-logo {
  height: 62px;
}

.world-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal-bright);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fe3a0;
  box-shadow: 0 0 0 0 rgba(111, 227, 160, 0.6);
  animation: pulse 2.4s ease-out infinite;
}

.world-text {
  margin: 10px 0 0;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-soft);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg) 0%, #071827 100%);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px var(--gutter) 24px;
  font-size: 0.85rem;
}

.footer-inner p {
  margin: 0;
}

.invite {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
}

.invite svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
}

.est {
  padding-left: 26px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  :root {
    --gutter: clamp(32px, 4.5vw, 88px);
  }

  .header-inner,
  .hero-content,
  .worlds,
  .footer-inner {
    width: 100%;
    max-width: 1760px;
    margin-inline: auto;
  }

  .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav login";
    gap: clamp(32px, 4vw, 72px);
    padding: 16px var(--gutter);
  }

  .brand img {
    height: clamp(58px, 4.8vw, 78px);
  }

  .main-nav {
    justify-content: flex-start;
  }

  .nav-link {
    font-size: 1rem;
  }

  .login-button {
    gap: 10px;
    padding: 12px 22px;
    font-size: 0.95rem;
    border-radius: 12px;
  }

  .login-button svg {
    width: 18px;
    height: 18px;
  }

  .hero {
    align-items: center;
    min-height: clamp(620px, 78vh, 860px);
    padding: clamp(120px, 14vh, 150px) 0 clamp(170px, 22vh, 240px);
  }

  .hero-content {
    padding-inline: var(--gutter);
  }

  .hero-bg {
    object-position: 50% 55%;
  }

  .hero-shade {
    background:
      linear-gradient(90deg, rgba(5, 17, 26, 0.88) 0%, rgba(5, 17, 26, 0.62) 28%, rgba(5, 17, 26, 0.12) 58%, transparent 75%),
      linear-gradient(180deg, rgba(5, 17, 26, 0.2) 0%, transparent 30%, transparent 55%, rgba(5, 17, 26, 0.7) 82%, var(--bg) 100%);
  }

  .hero-title {
    font-size: clamp(3.6rem, 5.6vw, 6rem);
  }

  .hero-text {
    margin-top: clamp(18px, 2vw, 28px);
    max-width: none;
    font-size: clamp(1.15rem, 1.45vw, 1.5rem);
  }

  /* Cards overlap the bottom of the hero so the landscape runs behind them. */
  .worlds {
    position: relative;
    z-index: 2;
    grid-template-columns: 1fr 1fr;
    gap: clamp(20px, 2vw, 32px);
    margin-top: calc(-1 * clamp(130px, 17vh, 190px));
    padding-top: 0;
    padding-bottom: clamp(48px, 6vh, 72px);
    padding-inline: var(--gutter);
  }

  .world {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: clamp(440px, 33vw, 600px);
    background: var(--bg);
  }

  .world-media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
  }

  .world-media::after {
    background: linear-gradient(180deg, transparent 35%, rgba(5, 17, 26, 0.55) 60%, rgba(5, 17, 26, 0.94) 85%, rgba(5, 17, 26, 0.98) 100%);
  }

  .world:hover .world-media img {
    transform: scale(1.04);
  }

  .world-body {
    margin-top: 0;
    padding: 0 clamp(24px, 2.4vw, 40px) clamp(26px, 2.4vw, 38px);
  }

  .world-se .world-logo {
    height: clamp(50px, 4vw, 70px);
  }

  .world-valheim .world-logo {
    height: clamp(70px, 5.6vw, 98px);
  }

  .world-status {
    margin-top: 14px;
    font-size: 0.85rem;
    letter-spacing: 0.34em;
  }

  .world-text {
    max-width: 52ch;
    margin-top: 12px;
    font-size: clamp(1rem, 1.05vw, 1.12rem);
  }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 24px var(--gutter);
    font-size: 0.92rem;
  }

  .est {
    padding-left: 0;
  }
}

/* ---------- Motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drift {
  from {
    transform: scale(1.04) translateX(0);
  }
  to {
    transform: scale(1.08) translateX(-1.2%);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(111, 227, 160, 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 8px rgba(111, 227, 160, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}
