/* speleo-limestone-atlas-v1 — field journal layout system */
:root {
  --page: #ebe6dc;
  --surface: #f7f3eb;
  --surface-alt: #e2ddd2;
  --text: #1a2420;
  --muted: #5c665e;
  --accent: #c45f1a;
  --accent-alt: #2a7a72;
  --line: color-mix(in srgb, var(--text) 14%, transparent);
  --radius: 12px;
  --rail-w: 248px;
  --content-max: 1280px;
  --section-space: clamp(4rem, 7vw, 6.5rem);
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  line-height: 1.62;
  font-family: var(--font-body);
  background: var(--page);
  color: var(--text);
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent-alt) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent-alt) 7%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
}

body, button, input, select, textarea { font: inherit; }

a { color: inherit; text-decoration: none; }

img, svg, video, canvas, iframe {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.25rem, 4.8vw, 4.25rem);
  margin-bottom: 1.25rem;
}

h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  margin-bottom: 0.85rem;
}

h3 {
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.22;
}

p { color: var(--muted); }

/* Page shell: side rail + main canvas */
.atlas-page {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 2160px;
  margin: 0 auto;
}

.site-rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  z-index: 40;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, var(--page));
  backdrop-filter: blur(10px);
}

.site-header {
  position: static;
  height: 100%;
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.75rem;
  width: 100%;
  min-height: 100%;
  padding: 1.35rem 1.1rem 1.5rem;
  margin: 0;
  max-width: none;
}

.brand {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.15;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 52px;
  height: 52px;
  max-width: 64px;
  max-height: 64px;
  border-radius: 10px;
  object-fit: contain;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-logo svg { width: 100%; height: 100%; }

.brand small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font-mono);
}

.site-header nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  margin: 0;
  min-width: 0;
}

.site-header nav a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.65);
  background: var(--surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header nav a:hover {
  color: var(--text);
  border-color: var(--accent);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 0.78rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 0.82rem;
  background: var(--accent);
  color: var(--surface);
  white-space: nowrap;
  min-width: 0;
}

.page-main {
  min-width: 0;
  width: 100%;
}

.page-content {
  width: 100%;
}

.section-inner {
  width: min(var(--content-max), calc(100% - clamp(1.5rem, 4vw, 3rem)));
  margin: 0 auto;
}

/* Hero */
.atlas-hero {
  padding: clamp(2rem, 5vw, 4.5rem) 0 var(--section-space);
}

.atlas-hero .section-inner {
  width: min(var(--content-max), calc(100% - clamp(1.5rem, 4vw, 3rem)));
}

.atlas-hero .hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.95fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.hero-copy { min-width: 0; }

.eyebrow, .section-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--accent-alt);
  margin-bottom: 0.85rem;
}

.lead {
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  max-width: 52ch;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 1rem;
}

.button, .header-cta {
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 0.9rem;
}

.button-primary, .header-cta {
  background: var(--accent);
  color: var(--surface);
}

.button-primary:hover, .header-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.button-secondary:hover {
  border-color: var(--accent-alt);
  color: var(--accent-alt);
}

.geo-line {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-visual {
  overflow: hidden;
  width: 100%;
  min-height: clamp(260px, 38vw, 480px);
  aspect-ratio: 3 / 2;
  border-radius: var(--radius);
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--surface-alt) 80%, var(--accent-alt));
  box-shadow: 0 20px 48px color-mix(in srgb, var(--text) 12%, transparent);
}

.hero-visual svg { width: 100%; height: 100%; }

/* Sections */
.atlas-band {
  padding: 0.35rem 0;
}

.atlas-band--alt {
  background: color-mix(in srgb, var(--surface-alt) 55%, transparent);
  border-block: 1px solid var(--line);
}

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

.section-heading {
  max-width: 58ch;
  margin-bottom: 2rem;
}

.section-heading > p { font-size: 1.05rem; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  min-width: 0;
  padding: 1.35rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--text) 8%, transparent);
}

.card p { margin-bottom: 0; }

.card-icon, .step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.85rem;
  color: var(--accent-alt);
  border: 1px solid color-mix(in srgb, var(--accent-alt) 30%, transparent);
  background: color-mix(in srgb, var(--accent-alt) 8%, transparent);
  border-radius: 10px;
}

.card-icon svg, .step-icon svg { width: 26px; height: 26px; }

.card-label {
  display: block;
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.55rem;
}

.card-value {
  display: block;
  margin-top: 0.85rem;
  color: var(--accent-alt);
  font-size: 1.05rem;
  font-weight: 700;
}

.card small {
  display: block;
  color: var(--muted);
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

.process-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
  counter-reset: atlas-step;
}

.process-list li {
  counter-increment: atlas-step;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
}

.process-list li::before {
  content: "0" counter(atlas-step);
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.75;
}

.step-icon { flex: 0 0 auto; margin-bottom: 0; }

.geo-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.geo-chip {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.geo-chip strong,
.geo-chip span { display: block; }

.geo-chip span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.45rem;
}

.guide-body {
  min-width: 0;
  display: grid;
  gap: 1rem;
}

.chapter {
  min-width: 0;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.chapter li {
  color: var(--muted);
  margin: 0.45rem 0;
}

.faq-list { max-width: 100%; }

.faq-list details {
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  background: transparent;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.faq-list p { padding-right: 1rem; }

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 0.85rem;
  background: var(--surface);
  padding: 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.contact-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--page);
  color: var(--text);
  padding: 0.82rem;
  border-radius: calc(var(--radius) * 0.65);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.form-message {
  color: var(--accent-alt);
  margin: 0;
  font-weight: 700;
}

.site-footer {
  padding: var(--section-space) 0 3rem;
  background: color-mix(in srgb, var(--surface-alt) 70%, var(--page));
  border-top: 1px solid var(--line);
}

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

.footer-brand { font-size: 1.35rem; }

.site-footer a {
  display: block;
  color: var(--muted);
  margin: 0.35rem 0;
}

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

/* Icon motion */
.icon-draw path { stroke-dasharray: 34 8; animation: iconDraw 12s linear infinite; }
.icon-pulse { transform-box: fill-box; transform-origin: center; animation: iconPulse 12s ease-in-out infinite; }
.icon-slide { animation: iconSlide 12s ease-in-out infinite; }
.icon-spin { transform-box: fill-box; transform-origin: center; animation: iconSpin 14s linear infinite; }

@keyframes iconDraw { to { stroke-dashoffset: -84; } }
@keyframes iconPulse { 50% { transform: scale(0.9); opacity: 0.75; } }
@keyframes iconSlide { 50% { transform: translateX(3px); } }
@keyframes iconSpin { to { transform: rotate(360deg); } }

/* Tablet: full-width main — fix narrow column QA failure */
@media (min-width: 768px) and (max-width: 1100px) {
  :root {
    --content-max: 100%;
  }

  .atlas-page {
    display: block;
    max-width: none;
  }

  .site-rail {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .header-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    min-height: auto;
    padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
    gap: 0.75rem 1rem;
  }

  .brand {
    flex: 0 1 auto;
    grid-template-columns: auto 1fr;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .site-header nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1 1 100%;
    order: 3;
    justify-content: flex-start;
  }

  .site-header nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .header-cta {
    margin-top: 0;
    margin-left: auto;
    order: 2;
  }

  .page-main {
    width: 100%;
    max-width: none;
  }

  .section-inner,
  .atlas-hero .section-inner {
    width: calc(100% - clamp(2rem, 5vw, 3rem));
    max-width: none;
  }

  .atlas-hero .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    width: 100%;
    max-width: none;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .geo-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Desktop wide balance */
@media (min-width: 1101px) {
  .page-main {
    display: flex;
    justify-content: center;
  }

  .page-content {
    width: min(100%, calc(2160px - var(--rail-w)));
  }

  .section-inner {
    width: min(var(--content-max), calc(100% - 3rem));
  }
}

@media (min-width: 1440px) {
  :root { --content-max: 1360px; }
}

@media (max-width: 767px) {
  .atlas-page { display: block; }

  .site-rail {
    position: relative;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .header-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    min-height: auto;
    padding: 0.75rem 1rem;
    gap: 0.65rem;
  }

  .brand-logo { width: 40px; height: 40px; }

  .site-header nav { display: none; }

  .header-cta {
    margin-top: 0;
    margin-left: auto;
    padding: 0.65rem 0.85rem;
  }

  .section-inner {
    width: calc(100% - 1.75rem);
  }

  .atlas-hero { padding-top: 1.5rem; }

  .atlas-hero .hero-grid { grid-template-columns: 1fr; }

  .hero-visual { min-height: 240px; }

  .cards-grid,
  .process-list,
  .geo-chips,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  h1 { font-size: clamp(2rem, 11vw, 3.2rem); }
  h2 { font-size: clamp(1.55rem, 8vw, 2.25rem); }

  .card { padding: 1.1rem; }

  .section { padding: 3.75rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .icon-draw path,
  .icon-pulse,
  .icon-slide,
  .icon-spin,
  .card,
  .button,
  .header-cta {
    animation: none !important;
    transition: none !important;
  }

  .card:hover { transform: none; }
}
