/* ============================
   AFO — Actions in Fire Observation
   Design System & Component Styles
   ============================ */

/* --- Type Scale (Fluid) --- */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'Zodiak', 'Georgia', serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;
}

/* --- Color: Light Mode (Default) --- */
:root, [data-theme="light"] {
  /* Surfaces — warm ivory */
  --color-bg:             #faf8f4;
  --color-surface:        #ffffff;
  --color-surface-2:      #f5f2ec;
  --color-surface-offset: #eeebe5;
  --color-divider:        #ddd8cf;
  --color-border:         #ccc7bd;

  /* Text */
  --color-text:           #1a1814;
  --color-text-muted:     #6b6560;
  --color-text-faint:     #a39e96;
  --color-text-inverse:   #faf8f4;

  /* Primary Accent — burnt orange (fire) */
  --color-primary:        #c45a1c;
  --color-primary-hover:  #a84b17;
  --color-primary-active: #8c3d12;
  --color-primary-highlight: #fce8d8;

  /* Secondary — deep forest green */
  --color-secondary:      #2a6b4a;
  --color-secondary-hover:#1f5239;
  --color-secondary-active:#163c2a;

  /* Amber accent */
  --color-amber:          #d49a2a;
  --color-amber-hover:    #b88320;

  /* Status */
  --color-error:          #b33a3a;
  --color-success:        #3a7d3a;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.2 0.02 60 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.02 60 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.02 60 / 0.12);
}

/* --- Color: Dark Mode --- */
[data-theme="dark"] {
  --color-bg:             #141210;
  --color-surface:        #1c1a17;
  --color-surface-2:      #242119;
  --color-surface-offset: #1e1c18;
  --color-divider:        #2e2b26;
  --color-border:         #3a3630;

  --color-text:           #d8d4cc;
  --color-text-muted:     #8a857e;
  --color-text-faint:     #5a5650;
  --color-text-inverse:   #1a1814;

  --color-primary:        #e87a3e;
  --color-primary-hover:  #f09155;
  --color-primary-active: #c45a1c;
  --color-primary-highlight: #3a2818;

  --color-secondary:      #4aad70;
  --color-secondary-hover:#3d9460;
  --color-secondary-active:#2a6b4a;

  --color-amber:          #e8b44a;
  --color-amber-hover:    #f0c460;

  --color-error:          #e06060;
  --color-success:        #5cb85c;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #141210;
    --color-surface:        #1c1a17;
    --color-surface-2:      #242119;
    --color-surface-offset: #1e1c18;
    --color-divider:        #2e2b26;
    --color-border:         #3a3630;
    --color-text:           #d8d4cc;
    --color-text-muted:     #8a857e;
    --color-text-faint:     #5a5650;
    --color-text-inverse:   #1a1814;
    --color-primary:        #e87a3e;
    --color-primary-hover:  #f09155;
    --color-primary-active: #c45a1c;
    --color-primary-highlight: #3a2818;
    --color-secondary:      #4aad70;
    --color-secondary-hover:#3d9460;
    --color-secondary-active:#2a6b4a;
    --color-amber:          #e8b44a;
    --color-amber-hover:    #f0c460;
    --color-error:          #e06060;
    --color-success:        #5cb85c;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}

/* ===========================
   GLOBAL LAYOUT
   =========================== */

.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.08);
  transition: box-shadow 0.3s ease;
}

.site-header--scrolled {
  box-shadow: var(--shadow-md);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
  gap: var(--space-4);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
}

.logo svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo-text span {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}

.nav-links a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-text);
  background: oklch(from var(--color-text) l c h / 0.05);
}

.nav-links a.active {
  color: var(--color-primary);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.theme-toggle:hover {
  color: var(--color-text);
  background: oklch(from var(--color-text) l c h / 0.05);
}

.mobile-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: var(--color-bg);
  padding: var(--space-6) var(--space-4);
  flex-direction: column;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mobile-nav-links a {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-md);
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
  background: oklch(from var(--color-text) l c h / 0.05);
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .mobile-toggle {
    display: flex;
  }
}

/* ===========================
   HERO SECTION
   =========================== */

.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1008 0%, #3a1e08 40%, #1a2a18 100%);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    oklch(0.1 0.02 40 / 0.6) 0%,
    oklch(0.1 0.02 40 / 0.4) 50%,
    oklch(0.1 0.02 40 / 0.8) 100%
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-block: var(--space-16) var(--space-12);
  max-width: 700px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: #faf8f4;
  margin-bottom: var(--space-4);
  line-height: 1.1;
}

.hero h1 .accent {
  color: var(--color-amber);
}

.hero p {
  font-size: var(--text-base);
  color: oklch(0.85 0.01 60);
  margin-bottom: var(--space-6);
  max-width: 560px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ===========================
   BUTTONS
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: oklch(from var(--color-text-inverse) l c h / 0.12);
  color: #faf8f4;
  border: 1px solid oklch(1 0 0 / 0.15);
}
.btn-secondary:hover {
  background: oklch(1 0 0 / 0.18);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

/* ===========================
   SECTIONS
   =========================== */

.section {
  padding-block: clamp(var(--space-12), 6vw, var(--space-24));
}

.section-header {
  margin-bottom: var(--space-8);
}

.section-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  max-width: 60ch;
}

/* ===========================
   STATS BAR
   =========================== */

.stats-bar {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  padding-block: var(--space-8);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.stat-number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

/* ===========================
   ABOUT SECTION
   =========================== */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-10);
  align-items: center;
}

.about-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-text h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.about-text p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.7;
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* ===========================
   FEATURE CARDS (Protected Areas, Resources)
   =========================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--space-6);
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive),
              transform var(--transition-interactive);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-image img {
  transform: scale(1.03);
}

.card-body {
  padding: var(--space-5);
}

.card-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.card-title a {
  color: var(--color-text);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--color-primary);
}

.card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* ===========================
   BLOG LIST
   =========================== */

.blog-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.blog-entry {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-6);
  align-items: start;
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.blog-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.blog-entry-image {
  aspect-ratio: 16/10;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.blog-entry-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-entry-body h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.blog-entry-body h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.blog-entry-body h3 a:hover {
  color: var(--color-primary);
}

.blog-entry-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}

.blog-entry-excerpt {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .blog-entry {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   ACTIVE FIRES MAP
   =========================== */

.map-container {
  width: 100%;
  height: 600px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
}

.map-container iframe,
.map-container #map {
  width: 100%;
  height: 100%;
  border: none;
}

.fire-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.fire-info-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.fire-info-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.fire-info-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ===========================
   PROTECTED AREAS
   =========================== */

.pa-hero {
  background: var(--color-surface-2);
  padding-block: var(--space-12);
}

.pa-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
}

.pa-detail-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
}

.pa-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pa-meta-table {
  width: 100%;
  margin-top: var(--space-4);
}

.pa-meta-table tr {
  border-bottom: 1px solid var(--color-divider);
}

.pa-meta-table td {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.pa-meta-table td:first-child {
  font-weight: 600;
  color: var(--color-text);
  width: 40%;
}

.pa-meta-table td:last-child {
  color: var(--color-text-muted);
}

@media (max-width: 768px) {
  .pa-detail {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   RESOURCES
   =========================== */

.resource-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: box-shadow var(--transition-interactive);
}

.resource-card:hover {
  box-shadow: var(--shadow-md);
}

.resource-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.resource-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.resource-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
}

/* ===========================
   PARTNERS
   =========================== */

.partners-section {
  background: var(--color-surface-2);
}

.partners-logo-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  flex-wrap: wrap;
  padding-block: var(--space-4);
}

.partners-logo-strip img {
  max-height: 48px;
  width: auto;
  opacity: 0.7;
  transition: opacity 0.2s;
  filter: grayscale(30%);
}

.partners-logo-strip img:hover {
  opacity: 1;
  filter: grayscale(0%);
}

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

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-10) var(--space-6);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.footer-brand p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  line-height: 1.6;
  max-width: 32ch;
}

.footer-col h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-col a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-bottom a {
  color: var(--color-text-faint);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   PAGE HEADER (interior pages)
   =========================== */

.page-header {
  background: linear-gradient(135deg, #1a1008 0%, #2a1a08 60%, #1a2a18 100%);
  padding-block: var(--space-16) var(--space-12);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, oklch(0.3 0.1 40 / 0.3), transparent 60%);
}

.page-header-content {
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: #faf8f4;
  margin-bottom: var(--space-2);
}

.page-header p {
  font-size: var(--text-base);
  color: oklch(0.8 0.01 60);
  max-width: 55ch;
}

/* ===========================
   LEAFLET MAP OVERRIDES
   =========================== */

.leaflet-container {
  font-family: var(--font-body) !important;
}

/* ===========================
   SCROLL ANIMATIONS
   =========================== */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   SKIP LINK
   =========================== */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  z-index: 9999;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-2);
}
