﻿/* ==================================================
   Layout Stylesheet
   Purpose: Defines structural layout systems for page
   scaffolding, headers, hero placement, selectors, and modals.
   Category: Layout styling
================================================== */

/* ==================================================
   Start Page Layout
   Purpose: Arranges the loading page with top branding,
   centered hero, loading status, and anchored footer.
   Category: Layout styling
================================================== */
.start-screen {
  position: relative;
  min-height: 100vh;
  padding: clamp(1rem, 2.2vw, 2rem);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: clamp(1rem, 2vw, 1.5rem);
  isolation: isolate;
}

.start-screen > * {
  position: relative;
  z-index: 2;
}

.brand-header {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  width: fit-content;
}

.brand-header--start {
  align-self: start;
  justify-self: start;
}

.brand-text {
  display: grid;
  gap: 0.08rem;
}

.hero-panel {
  justify-self: center;
  align-self: center;
  width: min(var(--hero-panel-max-width), 93vw);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--hero-logo-row-gap);
  padding: var(--hero-panel-padding-block) var(--hero-panel-padding-inline);
}

.hero-tech-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--tech-logo-gap);
  flex-wrap: wrap;
}

.loading-section {
  justify-self: center;
  width: min(560px, 92vw);
  display: grid;
  gap: 0.7rem;
}

.loading-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.start-footer {
  justify-self: center;
  text-align: center;
  padding-bottom: var(--space-sm);
}

/* ==================================================
   Page 1 Layout
   Purpose: Structures Page 1 with the top header and
   continent selector scene area.
   Category: Layout styling
================================================== */
.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.game-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: clamp(0.8rem, 2vw, 1.2rem) clamp(1rem, 3vw, 2.2rem);
}

.brand-header--page {
  flex-shrink: 0;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-main {
  padding: clamp(1rem, 2.4vw, 2.2rem);
  display: grid;
  align-content: start;
}

/* ==================================================
   Country Page Main Spacing
   Purpose: Reduces horizontal/vertical page padding on
   country view so the map stage can use more screen space.
   Category: Layout styling
================================================== */
.page-country .page-main {
  padding: clamp(0.45rem, 1.1vw, 0.9rem);
}

/* ==================================================
   Page 1 Scene Grid
   Purpose: Stacks selector and dashboard windows vertically
   so the selector keeps its original centered layout.
   Category: Layout styling
================================================== */
.page-one-content {
  width: min(1520px, 100%);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: clamp(0.95rem, 1.8vw, 1.55rem);
}

/* ==================================================
  Dashboard Panels Layout
  Purpose: Arranges left-to-right Top 10 World, Top 10
  Continents, World Stats, World Chat, and Landmarks.
  Category: Layout styling
================================================== */
.dashboard-panels {
  width: 100%;
  display: grid;
  grid-template-columns:
    minmax(205px, 1fr)
    minmax(205px, 1fr)
    minmax(286px, 1.34fr)
    minmax(205px, 1fr)
    minmax(205px, 1fr);
  grid-template-areas: "top10-world top10-region landmarks world-stats chat";
  gap: clamp(0.75rem, 1.6vw, 1.15rem);
  align-items: stretch;
}

.dashboard-panels > .info-panel--top10-world {
  grid-area: top10-world;
}

.dashboard-panels > .info-panel--top10-region {
  grid-area: top10-region;
}

.dashboard-panels > .info-panel--world-stats {
  grid-area: world-stats;
}

.dashboard-panels > .info-panel--chat {
  grid-area: chat;
}

.dashboard-panels > .info-panel--landmarks {
  grid-area: landmarks;
  min-width: 286px;
}

/* ==================================================
   Europe Countries Layout
   Purpose: Structures Europe country selector heading and
   responsive country button grid container.
   Category: Layout styling
================================================== */
.country-selector {
  width: min(1320px, 100%);
  margin-inline: auto;
  display: grid;
  gap: clamp(1rem, 2.1vw, 1.65rem);
}

.country-selector__intro {
  display: grid;
  gap: 0.4rem;
  text-align: center;
  justify-items: center;
}

.country-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: clamp(0.6rem, 1.3vw, 1rem);
  align-items: start;
  justify-items: center;
}

/* ==================================================
   Country View Layout
   Purpose: Structures selected country heading, map panel,
   and metadata zones on the dedicated country page.
   Category: Layout styling
================================================== */
.country-view {
  width: 100%;
  display: grid;
  gap: 0;
}

.country-map-stage {
  width: min(2160px, 100%);
  margin-inline: auto;
  position: relative;
}

.game-header--country {
  display: grid;
  grid-template-columns: max-content minmax(88px, 1fr) max-content minmax(88px, 1fr) max-content;
  grid-template-areas: "brand timer center coordinate actions";
  gap: clamp(0.4rem, 1.2vw, 1rem);
  align-items: center;
  justify-content: stretch;
  width: 100%;
}

.game-header--country .brand-header--page {
  grid-area: brand;
}

.country-header-timer {
  grid-area: timer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
}

.country-header-center {
  grid-area: center;
  min-width: 0;
  display: grid;
  justify-items: center;
  justify-self: center;
  gap: 0.2rem;
}

.country-header-coordinate {
  grid-area: coordinate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
}

.country-header-actions {
  grid-area: actions;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 0.36rem;
  flex-wrap: wrap;
}

/* ==================================================
   Menu Drawer Layout
   Purpose: Positions the overlay and right-side drawer,
   including navigation button list spacing.
   Category: Layout styling
================================================== */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(420px, 100%);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.menu-drawer__header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: 1rem 1rem 0.85rem;
}

.menu-drawer__content {
  overflow-y: auto;
  padding: 0.9rem 1rem 1.3rem;
  display: grid;
  align-content: start;
  gap: 1rem;
}

.menu-button-list {
  display: grid;
  gap: 0.6rem;
}

/* ==================================================
   Popup Modal Layout
   Purpose: Positions the popup overlay and modal shell,
   including scrollable content internals.
   Category: Layout styling
================================================== */
.section-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(0.9rem, 2vw, 1.5rem);
}

.section-modal-backdrop {
  position: absolute;
  inset: 0;
}

.section-modal {
  position: relative;
  width: var(--section-modal-width);
  max-height: var(--section-modal-height);
  display: grid;
  grid-template-rows: auto 1fr;
}

.section-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: 1rem;
}

.section-modal__body {
  overflow-y: auto;
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}

.modal-section-content {
  display: grid;
  gap: 0.8rem;
}

.legal-block {
  display: grid;
  gap: 0.45rem;
}
