/* ===========================================================================
   Exiles of Nexus - public site
   ---------------------------------------------------------------------------
   Design follows the "stone gothic" mock: Cinzel headings, Rajdhani body, a
   sticky navbar, a lit hero, and a card grid of stone-framed plates.

   What differs from the mock, and why:

     * The card grid is BUILT FROM THE LIVE FEED, not hardcoded. Servers come
       and go; a hardcoded card outlives the server it describes and says
       "Online" about something that has been off for a month.

     * Status colour is driven by the real state. The mock's badge is green in
       every card, which is the one thing a status page must never do.

     * Card artwork is optional. None of assets/cards/*.jpg exists yet, so each
       frame paints a plate from the game's own accent colour and glyph, and the
       <img> sits on top. Drop a real image in and it simply appears - no markup
       or CSS change. See .card-frame.
   =========================================================================== */

:root {
  --bg-dark: #07090e;
  --bg-card: #0d121b;
  --bg-sunken: #060910;
  --stone-border: #232b38;
  --stone-bevel: #384556;
  --accent-cyan: #00d2ff;
  --accent-crimson: #ff2a4b;
  --accent-gold: #c69b52;
  --ok: #22c55e;
  --off: #64748b;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-heading: 'Cinzel', Georgia, serif;
  --font-body: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  /* Per-card accent, set inline from the game's colour; falls back to cyan. */
  --game: var(--accent-cyan);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  line-height: 1.5;
}

/* --- Navigation ---------------------------------------------------------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.8rem 2.5rem;
  background: rgba(8, 11, 16, 0.95);
  border-bottom: 2px solid var(--stone-bevel);
  box-shadow: 0 4px 20px rgba(0,0,0,.8), inset 0 -1px 0 rgba(0,210,255,.2);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 40px; filter: drop-shadow(0 0 8px var(--accent-cyan)); }
.brand-title {
  font-family: var(--font-heading); font-size: 1.25rem; letter-spacing: 2px;
  text-transform: uppercase; color: #fff; text-shadow: 0 0 10px rgba(255,255,255,.4);
}
.nav-links { display: flex; list-style: none; gap: 1.8rem; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--font-heading); text-decoration: none; color: var(--text-muted);
  font-size: .9rem; letter-spacing: 1.5px; text-transform: uppercase;
  transition: color .25s, text-shadow .25s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--accent-cyan); text-shadow: 0 0 8px rgba(0,210,255,.6);
}
/* Live tally in the navbar: the one number a visitor came for, always in view. */
.nav-live {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: .85rem; letter-spacing: 1px; color: var(--text-muted);
  border: 1px solid var(--stone-bevel); border-radius: 4px; padding: 5px 14px;
  background: linear-gradient(180deg, #1f2733 0%, #0d121a 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.nav-cta { display: flex; align-items: center; gap: .75rem; }
.btn-login {
  font-family: var(--font-heading); font-size: .85rem; letter-spacing: 1px;
  text-decoration: none; color: var(--text-main); padding: 6px 18px; border-radius: 4px;
  background: linear-gradient(180deg, #1f2733 0%, #0d121a 100%);
  border: 1px solid var(--stone-bevel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
  transition: border-color .2s, box-shadow .2s;
}
.btn-login:hover { border-color: var(--accent-cyan); box-shadow: 0 0 12px rgba(0,210,255,.4); }

/* --- Hero banner ---------------------------------------------------------- */
/* A FRAMED banner, not a full-bleed background. The mock shows the artwork as a
   picture you look at, inside a stone frame - so it is inset from the page edge and
   bordered like the cards below it, which also ties the two together. */
.hero { padding: 1.75rem 1.5rem 0; }

.hero-banner {
  position: relative;
  max-width: 1400px; margin: 0 auto;
  min-height: clamp(300px, 34vw, 460px);
  display: grid; place-items: center;
  border: 2px solid var(--stone-border);
  border-radius: 12px;
  overflow: hidden;
  /* ⚠ IMAGE FIRST. In `background: A, B` the layers paint front-to-back, so listing
     the gradient first put an OPAQUE #0b1220 sheet over the artwork and hid it
     completely. The gradient belongs underneath, where it is a fallback for a
     missing file rather than a lid on a present one. */
  background:
    url('../assets/backgrounds/hero-bg.jpg?v=11') center 42% / cover no-repeat,
    linear-gradient(160deg, #0b1220 0%, #07090e 60%);
  box-shadow: 0 14px 40px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,255,255,.04);
}

/* ⚠ Kept deliberately light. The first version dimmed the art to 95% opaque at the
   edges, which made a 164 KB painting into an expensive dark rectangle. Darkness only
   where the text sits - top and bottom - and the middle left alone to be looked at. */
.hero-banner::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(4,6,10,.78) 0%, rgba(4,6,10,.28) 42%, rgba(4,6,10,.86) 100%),
    radial-gradient(ellipse at center, transparent 35%, rgba(4,6,10,.55) 100%);
}

/* The small crest sitting on the bottom edge, as in the mock: a rotated square, so it
   is one element rather than an image to keep in step with the theme. */
.hero-banner::after {
  content: ''; position: absolute; z-index: 3;
  left: 50%; bottom: -9px; width: 18px; height: 18px;
  transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #1f2733, #0d121a);
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0,210,255,.55);
}

.hero-content { position: relative; z-index: 2; text-align: center; padding: 2.5rem 1.5rem; }

.hero h1 {
  font-family: var(--font-heading); font-size: clamp(1.75rem, 4.2vw, 3.25rem);
  text-transform: uppercase; letter-spacing: 4px; color: #fff;
  text-shadow: 0 4px 18px rgba(0,0,0,.95), 0 0 34px rgba(0,210,255,.45);
}
.hero p {
  font-size: clamp(.95rem, 1.5vw, 1.25rem); color: #cbd5e1; letter-spacing: 2px;
  margin: .6rem 0 1.9rem; text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,.9);
}
.btn-primary {
  display: inline-block; font-family: var(--font-heading); letter-spacing: 2px;
  text-transform: uppercase; font-size: .95rem; font-weight: 700;
  padding: 12px 36px; color: #fff; text-decoration: none; cursor: pointer;
  background: linear-gradient(180deg, rgba(25,39,56,.92) 0%, rgba(12,20,29,.92) 100%);
  border: 1px solid var(--accent-cyan); border-radius: 4px;
  box-shadow: 0 0 15px rgba(0,210,255,.3), inset 0 0 10px rgba(0,210,255,.2);
  transition: transform .25s, box-shadow .25s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0,210,255,.6), inset 0 0 15px rgba(0,210,255,.4);
}

/* --- Sections ------------------------------------------------------------ */
.section { max-width: 1400px; margin: 0 auto 4rem; padding: 0 1.5rem; position: relative; z-index: 10; }
.section.servers { margin-top: 2.5rem; }
.section-head {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--stone-border);
}
.section-head h2 {
  font-family: var(--font-heading); font-size: 1.4rem; text-transform: uppercase;
  letter-spacing: 3px; color: #fff;
}
.section-head .hint { margin-left: auto; color: var(--text-dim); font-size: .85rem; letter-spacing: 1px; }

/* minmax(0, 1fr), never plain 1fr. A `1fr` track refuses to shrink below its
   content's min-content width, so one card with a long name or a cluster note
   silently widens its column and the whole row goes uneven - which is exactly
   what the ARK cluster card did (392px against its neighbours' 246px). */
.grid-container { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; align-items: start; }
@media (max-width: 1100px) { .grid-container { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px)  { .grid-container { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .grid-container { grid-template-columns: minmax(0, 1fr); } }

/* --- Server card (stone frame) ------------------------------------------- */
.server-card {
  background: var(--bg-card); border: 2px solid var(--stone-border); border-radius: 8px;
  padding: 8px; display: flex; flex-direction: column; position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,.6), inset 0 0 8px rgba(255,255,255,.03);
  transition: border-color .3s, transform .3s, box-shadow .3s, opacity .3s, filter .3s;
}
.server-card:hover {
  border-color: var(--game); transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,.8), 0 0 15px color-mix(in srgb, var(--game) 30%, transparent);
}
/* A stopped server keeps its card - it is coming back, and its address is still
   worth having - but must not compete with the ones you can actually join. */
.server-card.offline { opacity: .5; filter: grayscale(.6); }
.server-card.offline:hover { opacity: .85; filter: grayscale(.25); transform: none; }

.card-frame {
  position: relative; border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  aspect-ratio: 3 / 4;
  /* The plate under the artwork. Visible whenever assets/cards/<game>.jpg is
     absent, which is every game today - so this is the DEFAULT look, not a
     fallback nobody sees. */
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--game) 45%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, #131a26 0%, #080b12 100%);
  display: grid; place-items: center;
}
.card-glyph {
  font-size: clamp(48px, 7vw, 76px); line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.8)); user-select: none;
}
.card-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; transition: transform .4s ease;
}
.server-card:hover .card-img { transform: scale(1.03); }

.card-details {
  padding: 1rem .5rem .5rem; text-align: center;
  display: flex; flex-direction: column; gap: .5rem;
}
.card-game {
  font-family: var(--font-heading); font-size: .72rem; letter-spacing: 2px;
  text-transform: uppercase; color: var(--game);
}
.card-title {
  font-family: var(--font-heading); font-size: 1.05rem; font-weight: 600;
  letter-spacing: 1px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: .75rem; letter-spacing: 1px; text-transform: uppercase; color: var(--off);
}
.status-badge.up { color: var(--ok); }
.status-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--off); }
.status-badge.up .status-indicator { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.45); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.btn-connect {
  margin-top: .25rem; width: 100%; padding: 7px 0; cursor: pointer;
  background: #090e15; border: 1px solid var(--stone-bevel); border-radius: 4px;
  color: var(--text-muted); font-family: var(--font-heading);
  font-size: .75rem; letter-spacing: 1.5px; text-transform: uppercase;
  transition: background .2s, color .2s, border-color .2s;
}
.btn-connect:hover:not(:disabled) { background: var(--stone-border); color: #fff; border-color: var(--game); }
.btn-connect:disabled { cursor: default; color: var(--text-dim); opacity: .7; }
.btn-connect.copied { color: var(--ok); border-color: var(--ok); }

/* --- Cluster card -------------------------------------------------------- */
/* Several servers that are ONE world. Collapsed it is the size of any other
   card; the maps and their addresses are one click behind it. */
.cluster-note { color: var(--text-muted); font-size: .8rem; text-align: left; padding: 0 .25rem; }
.cluster-maps { margin-top: .25rem; border-top: 1px solid var(--stone-border); text-align: left; }
.map-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px .25rem; border-bottom: 1px solid var(--stone-border);
}
.map-row:last-child { border-bottom: none; }
.map-row.off .map-name, .map-row.off .status-badge { color: var(--text-dim); }
.map-name { font-weight: 600; font-size: .9rem; }
.map-row .status-badge { margin-left: auto; font-size: .68rem; }
.map-row .btn-connect { margin-top: 2px; }
.card-toggle .caret { display: inline-block; transition: transform .15s; }
.card-toggle.open .caret { transform: rotate(90deg); }

/* --- Downloads ----------------------------------------------------------- */
.dl-group { margin-bottom: 1.5rem; transition: opacity .2s, filter .2s; }
.dl-group.offline { opacity: .5; filter: grayscale(.6); }
.dl-group.offline:hover { opacity: .85; }
.dl-group-head {
  font-family: var(--font-heading); font-size: .85rem; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: .6rem;
}
.dl-card {
  background: var(--bg-card); border: 1px solid var(--stone-border); border-radius: 8px;
  padding: .9rem 1.1rem; margin-bottom: .6rem;
  transition: border-color .2s, transform .2s;
}
.dl-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); }
.dl-card.info:hover { transform: none; border-color: var(--stone-border); }
a.dl { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.dl-row { display: flex; align-items: center; gap: 14px; }
.dl-ico {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  font-size: 20px; flex: 0 0 auto;
  background: rgba(0,210,255,.08); border: 1px solid var(--stone-border);
}
.dl-name { font-weight: 700; font-size: 1rem; }
.dl-desc { color: var(--text-muted); font-size: .85rem; margin-top: 2px; }
.dl-updated { color: var(--text-dim); font-size: .72rem; margin-top: 4px; }
.dl-right { margin-left: auto; text-align: right; flex: 0 0 auto; }
.dl-size { font-size: .75rem; color: var(--text-dim); }
.dl-btn {
  margin-top: 4px; display: inline-block; padding: 5px 12px; border-radius: 6px;
  font-size: .75rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent-cyan); border: 1px solid var(--stone-bevel);
}

/* --- Odds and ends ------------------------------------------------------- */
.empty, .skeleton {
  color: var(--text-muted); font-size: .9rem; padding: 18px; text-align: center;
  border: 1px dashed var(--stone-border); border-radius: 8px;
  grid-column: 1 / -1;
}
.site-footer {
  border-top: 2px solid var(--stone-bevel); background: #040609;
  padding: 2.5rem 1.5rem 1.5rem; text-align: center;
}
.footer-nav { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.footer-nav a {
  color: var(--text-muted); text-decoration: none; font-size: .85rem;
  letter-spacing: 1px; transition: color .2s;
}
.footer-nav a:hover { color: var(--accent-cyan); }
.footer-copy { color: #4b5563; font-size: .8rem; }
.footer-live { color: var(--text-dim); font-size: .78rem; margin-top: .5rem; }

@media (max-width: 720px) {
  .navbar { flex-wrap: wrap; padding: .8rem 1.1rem; gap: .6rem; }
  .nav-links { gap: 1.1rem; order: 3; width: 100%; justify-content: center; }
}

/* Respect a visitor who has asked the OS for less motion. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
