/* ── Dune Awakening — Page-Specific Styles ── */

/* ── Mini-hero ── */
.mini-hero {
  position: relative;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: url('/assets/dune-hero-poster.webp') center/cover no-repeat,
              linear-gradient(135deg, #0a0a0f 0%, #1a1510 40%, #2a1f0a 70%, #0a0a0f 100%);
}

.mini-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.mini-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 15, 0.4) 0%,
    rgba(10, 10, 15, 0.6) 60%,
    rgba(10, 10, 15, 0.95) 100%
  );
}

.mini-hero-content {
  position: relative;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .mini-hero-video { display: none; }
}

.mini-hero-title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.mini-hero-subtitle {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.mini-hero-status {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

/* ── Mod header (terminal-style section header) ── */
.mod-header {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--green);
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

/* ── Server cards ── */
.dune-server-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; align-items: stretch;
  gap: 1.5rem;
}

.dune-server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.dune-server-card:hover {
  box-shadow: 0 0 20px rgba(212, 137, 28, 0.15);
  transform: translateY(-2px);
}

.dune-server-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.dune-server-badge.tease {
  color: var(--crimson, #c1542b);
  position: relative;
}
.dune-server-badge.tease::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 0.4rem;
  vertical-align: middle;
  animation: tease-pulse 1.8s ease-in-out infinite;
}
.dune-server-badge.live {
  color: #67d97a;
  position: relative;
}
.dune-server-badge.live::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-left: 0.4rem;
  vertical-align: middle;
  box-shadow: 0 0 6px currentColor;
  animation: live-pulse 1.8s ease-in-out infinite;
}
@keyframes tease-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.dune-server-title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

.dune-server-subtitle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-top: -0.6rem;
  margin-bottom: 0.75rem;
}

/* ── Nav dropdown: Live Status / Server Map grouped under "Dune" ── */
.nav-has-dropdown {
  position: relative;
}
.nav-has-dropdown > a::after {
  content: " \25BE";
  font-size: 0.7em;
  opacity: 0.6;
}
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.35rem 0;
  min-width: 150px;
  list-style: none;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 101;
}
/* Transparent bridge across the nav's bottom padding so moving the
   cursor down into the dropdown doesn't drop the :hover. */
.nav-dropdown::before {
  content: "";
  position: absolute;
  top: -0.75rem;
  left: 0;
  right: 0;
  height: 0.75rem;
}
.nav-has-dropdown:hover .nav-dropdown,
.nav-has-dropdown:focus-within .nav-dropdown {
  display: block;
}
.nav-dropdown li {
  display: block;
}
.nav-links .nav-dropdown a {
  display: block;
  padding: 0.45rem 1.1rem;
  white-space: nowrap;
  border-bottom: none;
}
.nav-links .nav-dropdown a:hover {
  color: var(--accent);
  background: rgba(212, 137, 28, 0.1);
}

.dune-server-detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.dune-server-name {
  display: none;
}

.dune-server-pop {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
}

.dune-locked {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--crimson);
}

.dune-server-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.dune-sietch {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
/* Drop the browser's default abbr underline on the sietch name. */
.dune-sietch abbr {
  text-decoration: none;
  cursor: help;
}

.dune-source {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Resource grid ── */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-decoration: none;
  transition: box-shadow 0.3s ease, transform 0.2s ease, border-color 0.2s ease;
  display: block;
}
.resource-card:hover {
  box-shadow: 0 0 15px rgba(212, 137, 28, 0.2);
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
}

.resource-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.resource-name {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.resource-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Live status ── */
.server-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.server-info-item {
  text-align: center;
}

.server-info-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.server-info-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.dune-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.dune-status-headline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dune-status-bg-title {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.dune-status-bg-region {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dune-status-count {
  text-align: center;
}
.dune-status-count .count-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.dune-status-count .count-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dune-map-indicator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
}
.dune-map-indicator.online { color: #67d97a; }
.dune-map-indicator.offline { color: var(--crimson); }
.dune-map-indicator.restricted { color: var(--accent); }

.dune-stale-note {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.dune-instance-line {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.dune-history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

.dune-win-btns {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.dune-win-btn {
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
}
.dune-win-btn.active {
  background: var(--accent);
  color: #000;
}

.dune-chart-svg {
  width: 100%;
  height: 180px;
  display: block;
}

.dune-chart-empty {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

.dune-chart-meta {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.dune-chart-meta strong {
  color: var(--accent);
  font-weight: 700;
}

/* ── Progression widgets ── */
.dune-prog-histogram-wrap {
  width: 100%;
  min-height: 220px;
  border: 1px solid #2a2a35;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.75rem;
  border-radius: 4px;
}
.dune-prog-histogram-wrap .dune-chart-svg {
  height: 220px;
}
.dune-prog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (max-width: 720px) {
  .dune-prog-grid { grid-template-columns: 1fr; }
}
.dune-prog-panel {
  border: 1px solid #2a2a35;
  background: rgba(0, 0, 0, 0.25);
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 4px;
  min-height: 220px;
}
.dune-prog-panel .dune-map-subtitle { margin: 0 0 0.25rem; font-size: 1rem; }
.dune-prog-caption-mini {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.dune-prog-topn {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  counter-reset: progrow;
}
.dune-prog-topn li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px dashed #20202a;
  counter-increment: progrow;
}
.dune-prog-topn li:last-child { border-bottom: 0; }
.dune-prog-topn li::before {
  content: counter(progrow, decimal-leading-zero) ".";
  color: var(--text-muted);
  margin-right: 0.5rem;
  font-size: 0.75rem;
}
.dune-prog-topn .dune-prog-name {
  flex: 1;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dune-prog-topn .dune-prog-name.dune-prog-online::after {
  content: " ●";
  color: #4dd964;
  font-size: 0.7rem;
}
.dune-prog-topn .dune-prog-lvl {
  color: var(--accent);
  font-weight: 700;
  margin-left: 0.5rem;
}
.dune-prog-topn .dune-prog-xp {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-left: 0.5rem;
}
.dune-prog-levelups {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  max-height: 280px;
  overflow-y: auto;
}
.dune-prog-levelups li {
  padding: 0.3rem 0;
  border-bottom: 1px dashed #20202a;
  color: var(--text-muted);
}
.dune-prog-levelups li:last-child { border-bottom: 0; }
.dune-prog-levelups .dune-prog-name { color: #fff; }
.dune-prog-levelups .dune-prog-lvl { color: var(--accent); font-weight: 700; }
.dune-prog-levelups .dune-prog-ago {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

/* ── Server map ── */
.dune-map-subtitle {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 1.5rem 0 0.25rem;
}
.dune-map-subtitle:first-of-type {
  margin-top: 0;
}

.dune-map-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.dune-map-widget {
  margin-bottom: 1.5rem;
}

.dune-map-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #07070b;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}
.dune-map-viewport.dragging {
  cursor: grabbing;
}

.dune-map-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#hagga-map-img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.dune-map-dots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dune-map-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: #67d97a;
  box-shadow: 0 0 8px #67d97a;
  /* Counter-scaled per-dot in JS (transform) so the dot stays a constant
     on-screen size regardless of map zoom; transform-origin centre keeps
     it anchored on the player's point. */
  transform-origin: center;
  animation: live-pulse 1.8s ease-in-out infinite;
}

.dune-map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: repeating-linear-gradient(
    45deg, #0a0a0f, #0a0a0f 12px, #101019 12px, #101019 24px);
  pointer-events: none;
}
.dune-map-placeholder-icon {
  font-size: 1.75rem;
}

.dune-map-zoom-ctrl {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.dune-map-zoom-ctrl button {
  width: 32px;
  height: 32px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}
.dune-map-zoom-ctrl button:hover {
  border-color: var(--accent);
}

.dune-map-calreadout {
  position: absolute;
  left: 0.6rem;
  top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
}

.dune-map-status {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

/* ── Hagga hazard overlay ── */
.dune-map-hazards {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.dune-map-hazards.hidden {
  display: none;
}

.dune-hazard {
  position: absolute;
  border-radius: 50%;
  border: 1px solid;
  box-sizing: border-box;
  /* Sized in stage (image-pixel) space — zooms with the map, no
     per-circle counter-scaling (unlike the player dots). */
}
.dune-hazard-quicksand {
  background: rgba(212, 137, 28, 0.16);
  border-color: rgba(212, 137, 28, 0.55);
}
.dune-hazard-drumsand {
  background: rgba(120, 150, 210, 0.14);
  border-color: rgba(120, 150, 210, 0.5);
}
.dune-hazard-radiationlow {
  background: rgba(103, 217, 122, 0.14);
  border-color: rgba(103, 217, 122, 0.5);
}
.dune-hazard-radiationhigh {
  background: rgba(224, 72, 72, 0.2);
  border-color: rgba(224, 72, 72, 0.65);
}

/* ── Hagga landmark icon layer ── */
.dune-map-landmarks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Layer ignores pointer events so map dragging passes through empty
     space; individual icons re-enable them for hover tooltips. */
  pointer-events: none;
}
.dune-map-landmarks.hidden {
  display: none;
}

.dune-landmark {
  position: absolute;
  width: 26px;
  height: 26px;
  /* Centred on the POI point and counter-scaled in JS (transform) so the
     icon holds a constant on-screen size at any map zoom. */
  transform-origin: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}
.dune-landmark:hover {
  filter: drop-shadow(0 0 4px var(--accent));
}

.dune-map-tooltip {
  position: absolute;
  z-index: 20;
  max-width: 220px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(10, 10, 15, 0.96);
  border: 1px solid var(--border);
  border-radius: 4px;
  pointer-events: none;
}
.dune-map-tooltip strong {
  display: block;
  color: var(--accent);
}
.dune-tooltip-desc {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
}

.dune-map-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.dune-map-toggle {
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
}
.dune-map-toggle.active {
  background: var(--accent);
  color: #000;
}

/* ── Deep Desert intel panel ── */
.dune-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.dune-field-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.dune-field-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.dune-field-flavor {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}
.dune-field-partid {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dune-field-grouptitle {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0.9rem 0 0.4rem;
}
.dune-field-grouptitle:first-of-type {
  margin-top: 0;
}

.dune-field-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.35rem 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.dune-field-row:first-of-type {
  border-top: none;
}

.dune-field-name {
  color: #fff;
  flex: 1 1 100%;
}
.dune-field-kindid {
  color: var(--text-muted);
  font-size: 0.7rem;
}
.dune-field-spawning {
  color: #67d97a;
  font-size: 0.7rem;
}
.dune-field-stat {
  color: var(--accent);
  font-weight: 700;
}

.dune-field-bar {
  flex: 1 1 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  overflow: hidden;
}
.dune-field-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.dune-field-empty {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.4rem 0;
}

/* ── Connection protocol ── */
#connect { background: var(--bg-alt); }

/* ── Responsive ── */
/* Wider breakpoint first so narrower max-width rules can override */
@media (max-width: 1024px) {
  .resource-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .dune-server-grid { grid-template-columns: 1fr; }
  .resource-grid { grid-template-columns: 1fr; }
  .mini-hero { min-height: 30vh; }
  .server-info-grid { grid-template-columns: repeat(2, 1fr); }
  .dune-status-banner { flex-direction: column; align-items: flex-start; }
  .dune-chart-meta { gap: 1rem; flex-wrap: wrap; }
  .dune-map-viewport { aspect-ratio: 4 / 3; }
  .dune-fields-grid { grid-template-columns: 1fr; }

  /* In the hamburger menu the dropdown is just indented inline items. */
  .nav-has-dropdown { position: static; }
  .nav-has-dropdown > a::after { content: none; }
  .nav-dropdown {
    display: block;
    position: static;
    transform: none;
    margin: 0.25rem 0 0;
    padding: 0 0 0 1rem;
    min-width: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nav-dropdown::before { content: none; }
  .nav-links .nav-dropdown a { padding: 0.4rem 0; }
}
