/**
 * Dashboard Layout CSS
 * Structural styles for Dashboard (1.0) - Homepage
 *
 * Source: web-design/1.0-dashboard/dashboard-v2.css
 * Uses tokens from: dashboard-tokens.css, global-tokens.css
 */

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-system);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-background-page);
  min-height: 100vh;
}

/* ==========================================================================
   HEADER SECTION
   Symmetric 3-column layout: Logo | Banner & Perex (centered) | Nav Links
   Logo and Nav columns have equal width for banner centering
   ========================================================================== */
.site-header {
  padding: var(--margin-top) 0 0 0;
}

.header-container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--margin-horizontal);

  display: grid;
  grid-template-columns: var(--header-side-width) 1fr var(--header-side-width);
  grid-template-rows: auto;
  gap: var(--header-gap);
  align-items: center;
}

/* Logo - centered in its column */
.header-logo {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-image {
  max-width: 100%;
  max-height: var(--header-logo-max-height);
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Banner & Perex - centered column */
.header-banner {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  height: var(--header-banner-height);
  overflow: visible;
}

.banner-image {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: var(--header-banner-height);
  max-width: none;
  z-index: -1;
  /* Fade edges with gradient mask */
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 20%,
    black 80%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 20%,
    black 80%,
    transparent 100%
  );
}

/* Navigation Links - right column (same width as logo column), centered text */
.header-nav {
  grid-column: 3;
  grid-row: 1;

  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.nav-link {
  font-family: var(--font-family-system);
  font-size: 1rem;
  color: var(--color-ui-primary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-text-header);
}

/* ==========================================================================
   MAIN DASHBOARD CONTENT
   Two-column layout: Story Fragment (left) + Info Panels (right)
   ========================================================================== */
.dashboard-main {
  padding: var(--panel-gap) 0 var(--margin-top) 0;
}

.dashboard-container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--margin-horizontal);

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--panel-gap);
  align-items: start;
}

/* ==========================================================================
   LEFT PANEL - Story Fragment "News"
   Aspect ratio 3:4, with log-book-empty.png background
   ========================================================================== */
.panel-left {
  /* Takes up left column */
}

.story-fragment {
  position: relative;
  aspect-ratio: var(--story-fragment-ratio);
  width: 100%;
  overflow: hidden;
}

.story-fragment__background {
  position: absolute;
  inset: 0;
  background-image: url('/assets/graphics/dashboard/log-book-empty.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.story-fragment__content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--sf-padding-top);
  padding-bottom: var(--sf-padding-bottom);
  padding-left: var(--sf-padding-left);
  padding-right: var(--sf-padding-right);
  text-decoration: none;
  color: inherit;
}

.story-fragment__link {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
}

/* Terminal glow effect on hover */
.story-fragment__link::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 8px;

  /* Glow from edges inward */
  background:
    linear-gradient(to right, rgba(204, 204, 255, 0.12), transparent 20px),
    linear-gradient(to left, rgba(204, 204, 255, 0.12), transparent 20px),
    linear-gradient(to bottom, rgba(204, 204, 255, 0.08), transparent 6px),
    linear-gradient(to top, rgba(204, 204, 255, 0.08), transparent 6px);
}

.story-fragment__link:hover::before {
  opacity: 1;
}

/* Story Fragment - Logo section */
.story-fragment__logo {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 160px;
  margin-top: 2rem;
  flex-shrink: 0;
}

.story-fragment__logo-img {
  width: 180px;
  height: auto;
}

/* Story Fragment - Text section (Caveat font) */
.story-fragment__text {
  font-family: var(--font-family-handwritten);
  font-size: var(--story-fragment-font-size);
  line-height: var(--story-fragment-line-height);
  color: var(--color-text-primary);
  text-align: justify;
  flex: 1;
  margin-top: 0.75rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  overflow: hidden;
}

.story-fragment__text p {
  margin-bottom: 0.75rem;
}

.story-fragment__text p:last-child {
  margin-bottom: 0;
}

/* Story Fragment - Meta section (system font) */
.story-fragment__meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-family-system);
  font-size: 0.75rem;
  color: var(--color-text-primary);
  padding-bottom: 1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  flex-shrink: 0;
  margin-top: auto;
}

.story-fragment__entries {
  flex: 1;
  text-align: left;
  color: var(--color-peach);
}

.story-fragment__separator {
  color: var(--color-text-meta);
  flex-shrink: 0;
}

.story-fragment__date {
  flex: 1;
  text-align: right;
  color: var(--color-text-meta);
}

/* ==========================================================================
   RIGHT PANEL - Stacked Info Panels
   ========================================================================== */
.panel-right {
  display: flex;
  flex-direction: column;
  gap: var(--panel-gap);
  padding-top: 1.5rem;
}

.info-panel {
  width: 100%;
}

.panel-placeholder {
  width: 100%;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg,
    rgba(204, 204, 255, 0.05) 0%,
    rgba(166, 166, 166, 0.05) 100%);
  transition: all 0.3s ease;
}

.panel-placeholder:hover {
  background: linear-gradient(135deg,
    rgba(204, 204, 255, 0.08) 0%,
    rgba(166, 166, 166, 0.08) 100%);
}

.panel-placeholder::after {
  content: attr(data-label);
  font-family: var(--font-family-system);
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: rgba(166, 166, 166, 0.35);
  font-weight: 700;
}

/* ==========================================================================
   UPDATES PANEL (Bordered with Header)
   Container for Game Updates with visible border and header bar
   ========================================================================== */
.updates-panel {
  width: 100%;
  border: 1px solid var(--color-panel-border);
  border-radius: var(--update-panel-radius);
  overflow: hidden;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.updates-panel__header {
  background: var(--color-panel-header-bg);
  padding: 0.75rem 1.25rem;
}

.updates-panel__title {
  font-family: var(--font-family-system);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(166, 166, 166, 0.5);
  text-transform: uppercase;
}

.updates-panel__content {
  padding: 1.5rem;
}

/* WIP variant - centered placeholder text */
.updates-panel__content--wip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

.wip-label {
  font-family: var(--font-family-system);
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  color: rgba(166, 166, 166, 0.4);
  font-style: italic;
}

/* ==========================================================================
   GAME UPDATE COMPONENT (V2 Layout)
   Top section: Image left (50%) | Meta right (50%)
   Bottom section: Description (full width)
   ========================================================================== */
.game-update {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Top section: image + meta side by side */
.game-update__top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Image */
.game-update__image {
  width: 100%;
}

.game-update__image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: 4px;
}

/* Meta section: stacked rows */
.game-update__meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
  height: 100%;
}

.game-update__meta-row {
  display: flex;
  gap: 0.5rem;
  font-size: var(--update-font-size-meta);
  color: var(--color-text-meta);
  align-items: center;
}

.game-update__label {
  color: var(--color-text-meta);
}

.game-update__date,
.game-update__version {
  color: var(--color-text-primary);
}

.game-update__notes-text {
  color: var(--color-text-meta);
}

.game-update__link {
  font-family: var(--font-family-system);
  font-size: var(--update-font-size-meta);
  color: var(--color-ui-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.game-update__link:hover {
  color: var(--color-text-header);
}

/* Discord icon link */
.game-update__link--discord {
  display: flex;
  align-items: center;
}

.game-update__link--discord svg {
  width: 18px;
  height: 18px;
}

/* Description - full width below top section */
.game-update__description {
  font-size: var(--update-font-size-description);
  line-height: 1.6;
  color: var(--color-text-primary);
  text-align: justify;
}

.game-update__description p {
  margin-bottom: 0.75rem;
}

.game-update__description p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet (< 1024px) */
@media (max-width: 1024px) {
  .header-container {
    --header-side-width: 140px;
    grid-template-columns: var(--header-side-width) 1fr var(--header-side-width);
  }

  .logo-image {
    max-height: 140px;
  }

  .banner-placeholder {
    min-height: 160px;
  }

  .nav-link {
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
  }

  /* Game Update - adjust for smaller space */
  .game-update__top {
    gap: 1rem;
  }

  .game-update__meta-row {
    font-size: 0.8125rem;
    gap: 1rem;
  }

  .game-update__description {
    font-size: 0.8125rem;
  }

  .game-update__link {
    font-size: 0.75rem;
  }

  .game-update__link--discord svg {
    width: 16px;
    height: 16px;
  }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
  .header-container {
    padding: 0 var(--margin-horizontal-mobile);
    grid-template-columns: 1fr 100px;
    grid-template-rows: auto auto;
  }

  .header-logo {
    grid-column: 2;
    grid-row: 1;
  }

  .header-banner {
    grid-column: 1;
    grid-row: 1;
  }

  .header-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    padding-top: 1rem;
  }

  .logo-image {
    max-height: 100px;
  }

  .dashboard-container {
    padding: 0 var(--margin-horizontal-mobile);
    grid-template-columns: 1fr;
  }

  .story-fragment {
    max-width: 400px;
    margin: 0 auto;
  }

  .panel-placeholder {
    min-height: 120px;
  }

  .nav-link {
    font-size: 0.875rem;
  }

  /* Game Update - stack vertically on mobile */
  .game-update__top {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .game-update__image {
    max-width: 250px;
  }

  .updates-panel__content {
    padding: 1rem;
  }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
  .header-container {
    grid-template-columns: 1fr;
  }

  .header-logo {
    justify-content: center;
    margin-bottom: 1rem;
  }

  .logo-image {
    max-height: 80px;
  }

  .header-banner {
    grid-column: 1;
  }

  .header-nav {
    grid-column: 1;
    justify-content: center;
  }

  .story-fragment__label {
    font-size: 1rem;
  }

  .updates-panel__header {
    padding: 0.625rem 1rem;
  }

  .updates-panel__title {
    font-size: 0.75rem;
  }
}
