:root {
  --bg-canvas: #0b0b0d;
  --bg-surface: #131317;
  --bg-surface-elevated: #19191d;
  --bg-surface-hover: #222228;
  --text-primary: #e4e4e7;
  --text-muted: #9e9ea7;
  --text-dim: #71717a;
  --accent-primary: #dc2626;
  --accent-hover: #b91c1c;
  --accent-subtle: rgba(220, 38, 38, 0.12);
  --border-subtle: #27272e;
  --border-frame: #3f3f46;
  --border-highlight: #c0c4cc;
  --font-stack: "Trebuchet MS", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --ease-kinetic: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-elevation: 0 16px 36px -8px rgba(0, 0, 0, 0.6);
  --glow-accent: 0 0 20px -3px rgba(220, 38, 38, 0.4);
}

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

html {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.65;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-canvas);
  min-height: 100vh;
  padding: 1.25rem;
  overflow-wrap: anywhere;
  hyphens: auto;
}

@media (min-width: 1024px) {
  body {
    padding: 2.5rem 3.5rem;
  }
}

.site-frame {
  max-width: 1240px;
  margin: 0 auto;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  position: relative;
  min-height: 90vh;
  box-shadow: 0 0 0 1px rgba(192, 196, 204, 0.08);
}

/* Header */
.site-header {
  position: relative;
  margin: 1.5rem 1.5rem 2.5rem 1.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-frame);
  border-radius: 9999px;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-mark {
  width: 14px;
  height: 14px;
  background: var(--accent-primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: var(--glow-accent);
}

.brand-title {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.site-nav {
  display: none;
}

@media (min-width: 769px) {
  .site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s var(--ease-kinetic);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
}

.nav-link.active {
  border-bottom: 2px solid var(--accent-primary);
  padding-bottom: 2px;
}

.nav-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

@media (min-width: 769px) {
  .nav-toggle-btn {
    display: none;
  }
}

.mobile-menu-drawer {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-frame);
  border-radius: 16px;
  padding: 1.25rem;
  z-index: 100;
  box-shadow: var(--shadow-elevation);
}

.mobile-menu-drawer.open {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu-drawer .nav-link {
  font-size: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* Page Components */
.page-container {
  padding: 0 1.5rem 3rem 1.5rem;
}

@media (min-width: 1024px) {
  .page-container {
    padding: 0 3rem 4rem 3rem;
  }
}

.section-label {
  display: inline-block;
  font-size: 0.725rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero-band {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 2.5rem;
  margin-bottom: 3rem;
}

h1.hero-headline {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  max-width: 22ch;
  margin-bottom: 1.25rem;
}

.hero-dek {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 65ch;
  line-height: 1.6;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-primary);
  color: #ffffff;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  transition: background 0.2s var(--ease-kinetic), transform 0.2s var(--ease-kinetic);
}

.btn-pill:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Bento Unboxed Grid */
.bento-unboxed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-bottom: 4rem;
}

@media (min-width: 880px) {
  .bento-unboxed {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.bento-region {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.region-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

/* Divider-separated list rows */
.divided-list {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: start;
}

.list-row:first-child {
  padding-top: 0.5rem;
}

.row-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid var(--border-frame);
  background: var(--bg-surface-elevated);
}

.row-content h2, .row-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.row-content p {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.scientific-tag {
  display: inline-block;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--border-highlight);
  background: var(--bg-surface-elevated);
  padding: 0.15rem 0.5rem;
  margin-top: 0.4rem;
  border: 1px solid var(--border-subtle);
}

/* Imagery */
.panel-figure {
  margin: 1.5rem 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.panel-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  filter: contrast(108%) brightness(92%);
}

.panel-figure figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-figure figcaption span.source {
  color: var(--border-highlight);
}

/* Interactive Cross-Section */
.canopy-strata {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  margin: 2rem 0;
}

.strata-tier {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
}

.strata-tier:last-child {
  border-bottom: none;
}

.strata-altitude {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.strata-info h4 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.strata-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0 2.5rem 0;
  border: 1px solid var(--border-subtle);
}

table.scientific-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

table.scientific-table th, table.scientific-table td {
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

table.scientific-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.scientific-table td {
  color: var(--text-muted);
}

table.scientific-table tr:hover td {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* Accordion Definitions */
.definition-accordion {
  border-top: 1px solid var(--border-subtle);
  margin-top: 1.5rem;
}

.definition-item {
  border-bottom: 1px solid var(--border-subtle);
}

.definition-trigger {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 1rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.definition-trigger::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent-primary);
}

.definition-item.active .definition-trigger::after {
  content: "−";
}

.definition-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-kinetic);
}

.definition-body p {
  padding-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.925rem;
}

/* Forms & Text Tools */
.form-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 2rem;
  margin-top: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-frame);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 0;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-frame);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-highlight);
}

.status-output {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--border-highlight);
  min-height: 1.4rem;
}

/* Long Form Copy Readability */
.prose-block {
  max-width: 72ch;
  margin: 0 auto;
}

.prose-block p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.prose-block h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.25rem 0 1rem 0;
}

.prose-block h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.75rem 0 0.75rem 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
  background: var(--bg-surface);
  font-size: 0.825rem;
  color: var(--text-dim);
}

@media (min-width: 1024px) {
  .site-footer {
    padding: 3rem;
  }
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.footer-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.footer-meta-block {
  line-height: 1.6;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
  }
}

.footer-domain-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
}

.footer-domain-link:hover {
  color: var(--accent-primary);
}

/* Scroll reveal helper */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease-kinetic), transform 0.6s var(--ease-kinetic);
}

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

@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
