/* ═══════════════════════════════════════════════════════
   SHARED STYLES — coenthornton.com
   Linked by all pages. Page-specific overrides stay
   in each file's local <style> block.
   ═══════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  --color-bg:     #F3EFE6;
  --color-text:   #151E13;
  --color-accent: #2E5C38;
  --color-muted:  #4A5C44; /* darkened from #5C7055 — passes WCAG AA on all bg values */
  --color-border: #C7CEBF;

  /* Semantic surface aliases */
  --cream: #F3EFE6;
  --sand:  #EDE9E0;
  --warm:  #E8E4DB;
  --tan:   #DDD9D0;
  --black: #151E13;
  --forest:#2E5C38;
  --moss:  #4A5C44;
}

/* ── BASE RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; background: var(--color-bg); }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  cursor: crosshair;
}

/* Linen grain texture */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: 0.10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55 0.35' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 280px 280px;
}
/* Grid lines */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 99;
  background-image:
    repeating-linear-gradient(0deg,   rgba(21,30,19,0.022) 0px, rgba(21,30,19,0.022) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(90deg,  rgba(21,30,19,0.022) 0px, rgba(21,30,19,0.022) 1px, transparent 1px, transparent 5px);
}

/* ── TYPOGRAPHY ── */

/* All headings: Bricolage Grotesque */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-weight: inherit;
}

/* Display scale */
.display-xl {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: clamp(3rem, 5.86vw, 5.275rem);
  font-weight: 400; line-height: 1.0; letter-spacing: -0.03em;
}
.display-lg {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: clamp(2.25rem, 4.4vw, 3.96rem);
  font-weight: 400; line-height: 1.1; letter-spacing: -0.025em;
}
.display-md {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: clamp(1.75rem, 3.3vw, 2.97rem);
  font-weight: 400; line-height: 1.25; letter-spacing: -0.015em;
}
.display-sm {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: clamp(1.375rem, 2.48vw, 2.228rem);
  font-weight: 400; line-height: 1.3; letter-spacing: -0.01em;
}

/* Body text: Lora */
.body-lg { font-family: 'Lora', Georgia, serif; font-size: 1.25rem; line-height: 1.7; font-weight: 400; }
.body-sm { font-family: 'Lora', Georgia, serif; font-size: 1.0625rem; line-height: 1.65; font-weight: 400; }

/* UI label */
.label {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.6875rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 500;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

/* ── FOCUS ── */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  transform: translateZ(0); /* force GPU compositing layer — fixes iOS Safari z-order bug with fixed + scrolled content */
  padding: max(1.25rem, calc(env(safe-area-inset-top) + 0.5rem)) 2.5rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
@media (max-width: 640px) {
  nav {
    padding: max(1rem, calc(env(safe-area-inset-top) + 0.5rem)) 1.25rem 1rem;
    background: rgba(243,239,230,0.98);
    box-shadow: 0 1px 0 rgba(21,30,19,0.08);
  }
  /* backdrop-filter removed on mobile — iOS Safari has a known bug where
     backdrop-filter on position:fixed breaks compositing layer z-order */
  nav.scrolled {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

nav.scrolled {
  background: rgba(243,239,230,0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(21,30,19,0.08);
}

.nav-link {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.8125rem; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 600;
  color: rgba(21,30,19,0.82); text-decoration: none;
  transition: color 0.2s ease;
}
nav.scrolled .nav-link { color: rgba(21,30,19,0.88); }
.nav-link:hover, nav.scrolled .nav-link:hover { color: var(--color-accent); }

.back-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.8125rem; letter-spacing: 0.10em; text-transform: uppercase;
  font-weight: 500; color: rgba(21,30,19,0.55); text-decoration: none;
  transition: color 0.2s ease, gap 0.2s ease;
}
.back-link:hover { color: var(--color-accent); gap: 0.65rem; }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.875rem 2rem; border-radius: 99px;
  background: var(--black); color: var(--cream);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
  box-shadow: 0 2px 12px rgba(21,30,19,0.20);
}
.btn-primary:hover { background: var(--forest); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(21,30,19,0.25); }
.btn-primary:active { transform: translateY(0); }

.btn-rose {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.875rem 2rem; border-radius: 99px;
  background: var(--forest); color: var(--cream);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.04em;
  text-decoration: none; border: none; cursor: pointer;
  transition: background 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
  box-shadow: 0 2px 14px rgba(46,92,56,0.28);
}
.btn-rose:hover { background: #1B3A22; transform: translateY(-2px); box-shadow: 0 6px 24px rgba(46,92,56,0.35); }
.btn-rose:active { transform: translateY(0); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.75rem; border-radius: 99px;
  background: transparent; color: rgba(21,30,19,0.70);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.875rem; font-weight: 400; letter-spacing: 0.04em;
  text-decoration: none;
  border: 1px solid rgba(21,30,19,0.25);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.btn-ghost:hover { background: rgba(46,92,56,0.08); border-color: rgba(46,92,56,0.40); color: var(--forest); transform: translateY(-2px); }
.btn-ghost:active { transform: translateY(0); }

.btn-case-study {
  display: inline-flex; align-items: center; justify-content: center; align-self: center;
  padding: 0.875rem 2rem; border-radius: 99px;
  background: var(--forest); color: var(--cream);
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: 0 2px 14px rgba(46,92,56,0.28);
  transition: background 0.25s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
  position: relative; z-index: 1;
}
.btn-case-study:hover { background: #1B3A22; transform: translateY(-3px); box-shadow: 0 8px 24px rgba(46,92,56,0.38); }
.btn-case-study:active { transform: translateY(0); }

/* ── PILLS / TAGS ── */
.pill {
  display: inline-block; padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500;
  background: rgba(74,92,68,0.10);
  color: #4A5C44;   /* contrast-checked: 5.7:1 on #E8E4DB */
  border: 1px solid rgba(74,92,68,0.22);
}
.pill-moss {
  background: rgba(46,92,56,0.10);
  color: var(--forest);
  border: 1px solid rgba(46,92,56,0.22);
}
/* Legacy alias used on index.html */
.pill-rose { background: rgba(46,92,56,0.10); color: var(--forest); border: 1px solid rgba(46,92,56,0.22); }

/* ── SHADOW SYSTEM ── */
.shadow-card {
  box-shadow:
    0 0 0 1px rgba(21,30,19,0.06),
    0 4px 16px rgba(21,30,19,0.07),
    0 16px 48px rgba(21,30,19,0.05);
}
.shadow-elevated {
  box-shadow:
    0 0 0 1px rgba(21,30,19,0.08),
    0 8px 32px rgba(21,30,19,0.10),
    0 32px 80px rgba(21,30,19,0.07);
}

/* ── CARDS ── */
.method-card {
  background: var(--warm);
  border: 1px solid rgba(21,30,19,0.07);
  border-radius: 1.5rem; padding: 2rem 2rem 2.25rem;
  display: flex; flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.method-card:hover {
  transform: translateY(-5px);
  border-color: rgba(46,92,56,0.18);
  box-shadow: 0 0 0 1px rgba(46,92,56,0.10), 0 8px 24px rgba(21,30,19,0.10), 0 24px 64px rgba(21,30,19,0.08);
}

.stat-card {
  background: var(--warm);
  border: 1px solid rgba(21,30,19,0.07);
  border-radius: 1.25rem; padding: 1.75rem 1.75rem 2rem;
}

.case-card {
  border-radius: 1.75rem; overflow: hidden;
  background: var(--warm); border: 1px solid rgba(21,30,19,0.07);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.4s ease, border-color 0.4s ease;
  cursor: pointer; display: flex; flex-direction: column;
}
.case-card:hover {
  transform: translateY(-8px);
  border-color: rgba(46,92,56,0.18);
  box-shadow: 0 0 0 1px rgba(46,92,56,0.10), 0 8px 24px rgba(21,30,19,0.10), 0 24px 64px rgba(21,30,19,0.08);
}
.case-card-thumb { position: relative; overflow: hidden; height: 220px; }
.case-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.case-card:hover .case-card-thumb img { transform: scale(1.04); }
.case-card-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(21,30,19,0.50) 0%, rgba(21,30,19,0.05) 55%, transparent 100%);
}
.case-card-body { padding: 1.75rem 1.75rem 2rem; flex: 1; display: flex; flex-direction: column; position: relative; }
.card-body-link { position: absolute; inset: 0; z-index: 0; }

.next-case {
  display: flex; align-items: center; gap: 2rem;
  background: var(--warm); border: 1px solid rgba(21,30,19,0.07);
  border-radius: 1.75rem; padding: 2rem 2.75rem;
  text-decoration: none; color: inherit;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.4s ease, border-color 0.4s ease;
}
.next-case:hover {
  transform: translateY(-6px); border-color: rgba(46,92,56,0.18);
  box-shadow: 0 0 0 1px rgba(46,92,56,0.10), 0 8px 24px rgba(21,30,19,0.10), 0 24px 64px rgba(21,30,19,0.08);
}

/* ── SECTION DECORATORS ── */
.section-divider       { width: 3rem; height: 2px; background: linear-gradient(to right, var(--moss), transparent); margin-bottom: 1.25rem; }
.section-divider-moss  { width: 3rem; height: 2px; background: linear-gradient(to right, var(--forest), transparent); margin-bottom: 1.25rem; }
.section-divider-rose  { width: 3rem; height: 2px; background: linear-gradient(to right, var(--forest), transparent); margin-bottom: 1.25rem; }
.section-rule          { width: 2.5rem; height: 2px; background: linear-gradient(to right, var(--forest), transparent); margin-bottom: 1rem; }
.rose-rule             { width: 100%; height: 1px; background: linear-gradient(to right, transparent, rgba(46,92,56,0.25), transparent); }
.hr-light              { width: 100%; height: 1px; background: rgba(21,30,19,0.07); }

/* ── ANIMATIONS ── */
@keyframes slideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.hero-animate {
  animation: slideUp 0.9s cubic-bezier(0.34,1.2,0.64,1) both;
}
.fade-up {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.34,1.2,0.64,1);
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ── PROGRESS BAR ── */
.progress-bar {
  position: fixed; top: 0; left: 0; z-index: 200;
  height: 2px; background: var(--forest);
  transition: width 0.1s linear; width: 0%;
}

/* ── RESEARCH COMPONENTS ── */
.finding-row {
  display: grid; grid-template-columns: 4rem 1fr; gap: 2rem; align-items: start;
  padding: 2.25rem 0;
  border-bottom: 1px solid rgba(21,30,19,0.07);
}
.finding-row:first-child { border-top: 1px solid rgba(21,30,19,0.07); }

.pull-quote {
  border-left: 3px solid var(--forest);
  padding: 1.25rem 2rem;
  background: rgba(46,92,56,0.04);
  border-radius: 0 0.75rem 0.75rem 0;
}

/* ── LAYOUT HELPERS ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(3rem, 6vw, 7rem);
  align-items: center;
  max-width: 70rem; margin: 0 auto;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr !important; } }

.hero-btn-group {
  display: inline-flex; gap: 2.5rem; flex-wrap: wrap; justify-content: center;
}
@media (max-width: 480px) {
  .hero-btn-group { flex-direction: column; gap: 1rem; align-items: stretch; width: 100%; }
  .hero-btn-group a { text-align: center; }
}

/* ── SVG CHART CLASSES (shared: index + solid-state) ── */
.ss-grid line { stroke: var(--color-border); stroke-width: 1; }
.ss-axis-text  { font-size: 11.5px; fill: #4A5C44; font-feature-settings: "tnum" 1; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-axis-label { font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; fill: #4A5C44; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-day-label  { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--black); font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-bar-value  { font-size: 11px; font-weight: 600; fill: var(--warm); font-feature-settings: "tnum" 1; pointer-events: none; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-bar-value-dark { font-size: 11px; font-weight: 600; fill: var(--black); font-feature-settings: "tnum" 1; pointer-events: none; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-total-label     { font-size: 12px; font-weight: 700; fill: var(--black); font-feature-settings: "tnum" 1; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-value-label     { font-size: 11.5px; font-weight: 600; fill: var(--black); font-feature-settings: "tnum" 1; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }
.ss-value-label-avg { font-size: 11.5px; font-weight: 700; fill: var(--black); font-feature-settings: "tnum" 1; font-family: 'Bricolage Grotesque', system-ui, sans-serif; }

/* ── CAROUSEL (index.html) ── */
.carousel-track { display: flex; height: 100%; transition: transform 0.55s cubic-bezier(0.4,0,0.2,1); will-change: transform; }
.carousel-slide { flex: 0 0 100%; height: 100%; overflow: hidden; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.carousel-wrap:hover .carousel-slide img { transform: scale(1.03); }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  background: rgba(243,239,230,0.80); backdrop-filter: blur(8px);
  border: 1px solid rgba(21,30,19,0.15); color: var(--black);
  width: 2.25rem; height: 2.25rem; border-radius: 50%; font-size: 1.1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; padding: 0;
  transition: opacity 0.25s ease, background 0.2s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.carousel-wrap:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: rgba(243,239,230,0.98); transform: translateY(-50%) scale(1.08); }
.carousel-btn:active { transform: translateY(-50%) scale(0.96); }
.carousel-prev { left: 0.75rem; }
.carousel-next { right: 0.75rem; }
.carousel-dots { position: absolute; bottom: 0.75rem; right: 1.25rem; z-index: 4; display: flex; gap: 0.35rem; align-items: center; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(21,30,19,0.20); transition: background 0.25s ease, transform 0.25s ease; }
.dot.active { background: var(--forest); transform: scale(1.3); }

/* ── UTILITY ── */
.footer-link { color: rgba(21,30,19,0.75); font-weight: 600; text-decoration: none; transition: color 0.2s ease; }
.footer-link:hover { color: var(--forest); }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }

  @keyframes slideUp {
    from { opacity: 1; transform: none; }
    to   { opacity: 1; transform: none; }
  }
  .hero-animate { animation: none; opacity: 1; transform: none; }

  .fade-up, .fade-up.visible {
    opacity: 1; transform: none; transition: none;
  }

  .carousel-track { transition: none; will-change: auto; }
  .carousel-slide img { transition: none; }
  .carousel-wrap:hover .carousel-slide img { transform: none; }
  .carousel-btn { transition: none; }
  .dot { transition: none; }

  .method-card { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
  .method-card:hover { transform: none; }
  .case-card { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
  .case-card:hover { transform: none; }
  .case-card-thumb img { transition: none; }
  .case-card:hover .case-card-thumb img { transform: none; }
  .next-case { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
  .next-case:hover { transform: none; }

  .btn-primary:hover, .btn-rose:hover,
  .btn-ghost:hover, .btn-case-study:hover { transform: none; }

  nav { transition: background 0.2s ease, box-shadow 0.2s ease; }
}
