/**
 * @file
 * CC Soccer Theme - Page layout styles.
 *
 * Controls the overall page structure: header, main content, footer.
 * Uses design tokens from tokens.css.
 */

/* ============================================
   GLOBAL RESET / BASE
   ============================================ */

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

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--text-lg);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-gray-50);
  overflow-x: hidden;
}

/* ============================================
   BANNER
   ============================================ */

.site-banner {
  text-align: center;
}

/* ============================================
   HEADER
   ============================================ */

.site-header {
  background: var(--color-gray-800);
  box-shadow: var(--shadow-md);
}

.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo__image {
  height: 90px;
  width: auto;
}

/* Right side: stacked rows */
.site-header__right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
  min-width: 0;
}

/* Top row: tagline + nav */
.site-header__top-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

.site-tagline {
  font-size: var(--text-lg);
  color: var(--color-gray-400);
  white-space: nowrap;
}

/* Header nav area (where blocks get placed) */
.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Bottom row: game status */
.site-header__status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.site-header__status--on {
  background: rgba(40, 167, 69, 0.15);
  color: #a8e6a1;
}

.site-header__status--cancelled {
  background: rgba(220, 53, 69, 0.15);
  color: #f5a0a8;
}

.site-header__status--pending {
  background: rgba(255, 193, 7, 0.12);
  color: #ffe08a;
}

.site-header__status--none {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-gray-400);
}

/* Personalized next-game banner for authenticated players */
.site-header__player-game {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  flex-wrap: wrap;
}

.site-header__player-game--on {
  background: rgba(40, 167, 69, 0.20);
  color: #c8f7c5;
}

.site-header__player-game--cancelled {
  background: rgba(220, 53, 69, 0.20);
  color: #f5a0a8;
}

.site-header__player-game .player-game-label {
  font-weight: var(--font-weight-bold);
}

/* Hide module's page_top game status banner */
.ccsoccer-game-status-banner {
  display: none !important;
}

/* ============================================
   NAVIGATION (separate region, if used)
   ============================================ */

.site-nav {
  background: var(--color-gray-100);
  border-bottom: 1px solid var(--border-color);
}

/* ============================================
   HOMEPAGE HERO
   ============================================ */

.welcome-section {
  background: var(--color-gray-800);
  color: var(--color-white);
  padding: var(--space-12) var(--space-4);
  margin-bottom: var(--space-8);
  text-align: center;
  width: 100%;
  border-radius: var(--radius-lg);
}

.welcome-section h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-4) 0;
  color: var(--color-white);
}

.welcome-section p {
  max-width: 700px;
  margin: 0 auto var(--space-3);
  font-size: var(--text-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-gray-300);
}

.welcome-section p:last-of-type {
  margin-bottom: 0;
}

/* Register CTA for anonymous users */
.welcome-section .welcome-cta.button {
  display: inline-block;
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-8);
  background: var(--color-primary);
  color: var(--color-white) !important;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-pill);
  text-decoration: none;
  border: none;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.welcome-section .welcome-cta.button:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-primary);
  color: var(--color-white) !important;
}

/* ============================================
   ERROR PAGES (403 / 404)
   ============================================ */

.error-section {
  background: var(--color-gray-800);
  color: var(--color-white);
  padding: var(--space-12) var(--space-4);
  margin-bottom: var(--space-8);
  text-align: center;
  width: 100%;
  border-radius: var(--radius-lg);
}

.error-section h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-4) 0;
  color: var(--color-white);
}

.error-section p {
  max-width: 700px;
  margin: 0 auto var(--space-3);
  font-size: var(--text-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-gray-300);
}

.error-section p:last-of-type {
  margin-bottom: var(--space-4);
}

/*
 * Buttons inside the error hero mirror the header main nav
 * (.site-header__nav / #block-ccsoccer-theme-main-menu). Plain text
 * links with translucent hover; the primary CTA — either the
 * Register link on the 404 or the action marked with
 * .error-section__actions__cta on the 403 — gets the red pill
 * treatment used by the header Register button.
 */
.error-section__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.error-section__actions a {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  color: var(--color-gray-200);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  border-radius: var(--radius-md);
  background: transparent;
  transition: color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.error-section__actions a:hover {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.1);
}

/* Primary CTA: red pill — matches header Register button. */
.error-section__actions a[href="/register"],
.error-section__actions a.error-section__actions__cta {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-5);
  font-weight: var(--font-weight-semibold);
  margin-left: var(--space-2);
}

.error-section__actions a[href="/register"]:hover,
.error-section__actions a.error-section__actions__cta:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-primary);
  color: var(--color-text-inverse);
}

/* ============================================
   BREADCRUMBS
   ============================================ */

.site-main__inner ol {
  list-style: none;
  margin: 0 0 var(--space-2) 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.site-main__inner ol li {
  display: flex;
  align-items: center;
}

.site-main__inner ol li + li::before {
  content: '/';
  margin-right: var(--space-1);
  color: var(--color-gray-400);
}

.site-main__inner ol a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.site-main__inner ol a:hover {
  color: var(--color-primary);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.site-main {
  min-height: 60vh;
}

.site-main__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  background: var(--color-gray-800);
  color: var(--color-gray-300);
  margin-top: var(--space-12);
}

.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.site-footer a {
  color: var(--color-gray-200);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-white);
}

/* Top row: 3-column grid */
.site-footer__top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-gray-600);
}

/* Brand column */
.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.site-footer__logo img {
  height: 80px;
  width: auto;
}

.site-footer__tagline {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-gray-400);
  line-height: var(--line-height-relaxed);
}

/* Column headings */
.site-footer__heading {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-white);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-3) 0;
}

/* Footer link lists */
.site-footer__links ul,
.site-footer__contact ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.site-footer__links li a,
.site-footer__contact li a {
  font-size: var(--text-sm);
  color: var(--color-gray-300);
  transition: color var(--transition-fast);
}

.site-footer__links li a:hover,
.site-footer__contact li a:hover {
  color: var(--color-white);
}

/* Bottom row: copyright */
.site-footer__bottom {
  padding-top: var(--space-4);
  text-align: center;
}

.site-footer__bottom p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-gray-500);
}

/* Drupal block content in footer */
.site-footer__blocks {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-gray-600);
  margin-top: var(--space-4);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .site-header__inner {
    flex-wrap: wrap;
    padding: var(--space-2) var(--space-3);
  }

  .site-logo {
    flex: 1;
  }

  .site-logo__image {
    height: 50px;
  }

  /* Hide tagline on mobile — nav stays in DOM for overlay */
  .site-header__top-row .site-tagline {
    display: none;
  }

  /* Collapse top row since tagline hidden and nav is display:none */
  .site-header__top-row {
    gap: 0;
    min-height: 0;
  }

  /* Status bar goes full width below logo row */
  .site-header__right {
    flex: unset;
    width: 100%;
    order: 3;
    gap: 0;
  }

  .site-header__status {
    justify-content: center;
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
  }

  .site-header__player-game {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
  }

  .site-main__inner {
    padding: var(--space-4) var(--space-3);
  }

  /* Hero: adjust padding */
  .welcome-section,
  .error-section {
    padding: var(--space-8) var(--space-4);
    margin-bottom: var(--space-6);
  }

  .welcome-section h1,
  .error-section h1 {
    font-size: var(--text-2xl);
  }

  .welcome-section p,
  .error-section p {
    font-size: var(--text-base);
  }

  /* Error page buttons: keep wrap, tighten spacing on mobile.
     No fixed widths — short labels fit naturally across two rows. */
  .error-section__actions {
    gap: var(--space-1);
  }

  .error-section__actions a[href="/register"],
  .error-section__actions a.error-section__actions__cta {
    margin-left: 0;
  }

  /* Footer: stack columns */
  .site-footer__top {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    text-align: center;
  }

  .site-footer__brand {
    align-items: center;
  }

  .site-footer__logo img {
    height: 60px;
  }
}
