/* ============================================
   Layout & Grid — Track B
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
  background: var(--bg-white);
  overflow-x: hidden;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--full {
  max-width: 100%;
  padding: 0;
}

/* --- Grid --- */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--12 { grid-template-columns: repeat(12, 1fr); }

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

/* --- Sections --- */
.section {
  padding: var(--section-feature) 0;
}

.section--hero {
  padding: var(--section-hero) 0;
}

.section--compact {
  padding: var(--section-content) 0;
}

.section--dark {
  background: linear-gradient(135deg, #0a0040 0%, #060097 50%, #1a0a4e 100%);
  background-size: 200% 200%;
  animation: sectionGradient 15s ease infinite;
  color: var(--text-inverse);
  position: relative;
  overflow: hidden;
}

.section--dark::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,205,87,0.06) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes sectionGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .section--dark { animation: none; background-size: 100% 100%; }
  .section--dark::before { display: none; }
}

.section--light {
  background: var(--bg-light);
}

.section--subtle {
  background: var(--bg-subtle);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-8xl); margin-bottom: var(--space-6); }
h2 { font-size: var(--text-6xl); margin-bottom: var(--space-6); }
h3 { font-size: var(--text-3xl); margin-bottom: var(--space-4); }
h4 { font-size: var(--text-xl); margin-bottom: var(--space-3); }

p { margin-bottom: var(--space-4); max-width: 72ch; }
p:last-child { margin-bottom: 0; }

.text-center { text-align: center; }
.text-center p { margin-left: auto; margin-right: auto; }

.label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  display: block;
}

.section--dark .label { color: var(--color-accent); }
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 { color: var(--text-inverse); }

/* --- Links --- */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--duration-micro) var(--ease-out);
}

a:hover { color: var(--color-primary-dark); }

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* --- Responsive --- */
@media (max-width: 921px) {
  h1 { font-size: var(--text-6xl); }
  h2 { font-size: var(--text-5xl); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 544px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-2xl); }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .container { padding: 0 var(--space-4); }
}
