/* =========================================================
   layout.css — Layout, Grid, Header, Footer, Sections
   Depends on: main.css
   Used by: All pages
   ========================================================= */

/* -----------------------------
   1) Global Layout Helpers
------------------------------ */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

/* -----------------------------
   2) Header & Navigation
------------------------------ */
.site-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  color: var(--color-secondary);
  font-size: var(--fs-md);
}

.brand img {
  height: 32px;
  width: auto;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: var(--fs-lg);
  cursor: pointer;
}

.main-nav {
  display: flex;
  gap: var(--space-4);
}

.main-nav a {
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-1);
}

.main-nav a:hover {
  color: var(--color-primary);
}

/* -----------------------------
   3) Footer
------------------------------ */
.site-footer {
  background-color: var(--color-secondary);
  color: #ffffff;
  padding: var(--space-12) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
}

.site-footer h4 {
  color: #ffffff;
  margin-bottom: var(--space-3);
  font-size: var(--fs-md);
}

.site-footer p,
.site-footer a {
  color: #cbd5f5;
  font-size: var(--fs-sm);
}

.site-footer a:hover {
  color: #ffffff;
}

.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: var(--fs-xs);
  color: #cbd5f5;
}

/* -----------------------------
   4) Sections
------------------------------ */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-8) 0;
}

.section-header {
  max-width: 700px;
  margin-bottom: var(--space-8);
}

.section-header h2 {
  margin-bottom: var(--space-3);
}

.section-header p {
  font-size: var(--fs-md);
}

/* -----------------------------
   5) Grid System
------------------------------ */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* -----------------------------
   6) Hero Layout
------------------------------ */
.hero {
  padding: var(--space-16) 0;
  background-color: var(--color-bg-soft);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-8);
  align-items: center;
}

.hero h1 {
  margin-bottom: var(--space-4);
}

.hero p {
  font-size: var(--fs-md);
  margin-bottom: var(--space-6);
}

/* -----------------------------
   7) Content Layout
------------------------------ */
.content {
  max-width: 800px;
}

.sidebar-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: var(--space-8);
}

/* -----------------------------
   8) Simple Tables
------------------------------ */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

.table th,
.table td {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  text-align: left;
}

.table th {
  background-color: var(--color-bg-soft);
  font-weight: 600;
}

/* -----------------------------
   9) Responsive Layout
------------------------------ */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 70px;
    right: 0;
    background-color: #ffffff;
    flex-direction: column;
    width: 220px;
    padding: var(--space-4);
    box-shadow: var(--shadow-md);
  }

  .main-nav.is-open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .sidebar-layout {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}
