/* =============================================================================
   THEME538 — Layout (CSS Grid + Flexbox, mobile-first)
   EBF Boxing / FPI Delegazione Piemonte
   ============================================================================= */

/* --- Custom properties ---------------------------------------------------- */
:root {
  --color-primary:   #cc0000;
  --color-secondary: #c9a84c;
  --color-dark:      #1e1e1e;
  --color-mid:       #252525;
  --color-muted:     #aaa;
  --color-light:     #f4f4f4;
  --color-white:     #fff;

  --header-bg:       #1e1e1e;
  --header-top-bg:   #141414;
  --footer-bg:       #1a1a1a;
  --footer-bottom-bg: #0f0f0f;

  --max-width:       1200px;
  --sidebar-width:   260px;
  --gap:             1.5rem;
  --gap-sm:          0.75rem;

  --radius:          4px;
  --transition:      0.2s ease;
}

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

/* --- Page wrapper ---------------------------------------------------------- */
.layout-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.site-header {
  background: var(--header-bg);
  color: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* Top bar: account + search */
.site-header__top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap);
  padding: 0.4rem 0;
  background: var(--header-top-bg);
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* Main bar: branding + nav */
.site-header__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.75rem 0;
  flex-wrap: wrap;
}

.site-branding {
  flex-shrink: 0;
}

.primary-nav {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

/* =============================================================================
   HIGHLIGHTED
   ============================================================================= */

.layout-highlighted {
  background: var(--color-primary);
  color: var(--color-white);
}

.layout-highlighted__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem var(--gap);
}

/* =============================================================================
   MAIN CONTAINER (content + sidebars)
   CSS Grid — adapts based on sidebar presence
   ============================================================================= */

.layout-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--gap) var(--gap);
  width: 100%;
  flex: 1;

  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "main";
  gap: var(--gap);
  align-items: start;
}

/* Right sidebar only */
@media (min-width: 768px) {
  .layout-container.has-sidebar-second {
    grid-template-columns: 1fr var(--sidebar-width);
    grid-template-areas: "main sidebar-second";
  }

  /* Left sidebar only */
  .layout-container.has-sidebar-first {
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas: "sidebar-first main";
  }

  /* Both sidebars */
  .layout-container.has-sidebar-first.has-sidebar-second {
    grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
    grid-template-areas: "sidebar-first main sidebar-second";
  }
}

.layout-main {
  grid-area: main;
  min-width: 0; /* prevent overflow in grid */
}

.layout-sidebar--first  { grid-area: sidebar-first; }
.layout-sidebar--second { grid-area: sidebar-second; }

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

.site-footer {
  background: var(--footer-bg);
  color: #bbb;
  margin-top: auto;
}

.footer-main__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--gap) 2rem;

  /* Auto-grid: blocks flow into columns */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}

.footer-bottom {
  background: var(--footer-bottom-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-bottom__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem var(--gap);
  text-align: center;
  font-size: 0.82rem;
  color: #777;
}
