/* ============================================================
   Tesamorelin Compound — css/style.css
   Aesthetic: Terracota Mediterraneo
   Palette: terracotta #C2452D, olive #6B7F3B, coastal teal #A8D8C8,
            deep plum #3A1438, cool olive-white #F3F5F2
   Typography: Petrona (heading) + Mukta (body) + Spline Sans Mono
   ============================================================ */

/* --- CUSTOM PROPERTIES --- */
:root {
  --primary:        #C2452D;
  --primary-50:     #FAEAE5;
  --primary-900:    #5E1E12;
  --secondary:      #6B7F3B;
  --accent:         #1565C0;
  --teal:           #A8D8C8;
  --plum:           #3A1438;
  --plum-2:         #4A1942;
  --tan:            #D4956B;
  --neutral-50:     #F3F5F2;
  --neutral-200:    #DCE0D6;
  --neutral-500:    #6E7468;
  --neutral-900:    #221E20;
  --bg:             #F3F5F2;
  --surface:        #FBFCFA;
  --text:           #221E20;
  --text-muted:     #5C5650;
  --text-on-ink:    #F1E9EE;
  --text-on-ink-muted: #C9B3C4;
  --max-width:      70rem;
  --container-px:   clamp(1rem, 4vw, 2.5rem);
  --font-heading:   'Petrona', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-body:      'Mukta', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:      'Spline Sans Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --radius-btn:     9999px;
  --radius-card:    0 0 0.9rem 0.9rem;
  --shadow-card:    0 8px 24px -16px rgba(94, 30, 18, 0.35);
  --shadow-arch:    0 12px 40px -12px rgba(58, 20, 56, 0.45);
  --transition:     200ms ease-out;
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--body-size, 1.0625rem);
  line-height: 1.68;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration-thickness: 1px; }
a:hover { color: var(--primary-900); }
ul, ol { padding-left: 1.4rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--neutral-200); }
th { background: rgba(107, 127, 59, 0.12); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
tr:hover td { background: rgba(194, 69, 45, 0.04); }

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.12;
  letter-spacing: -0.005em;
  color: var(--neutral-900);
}
h1 { font-size: clamp(2.05rem, 4.4vw, 3.35rem); font-weight: 700; }
h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); font-weight: 600; }
h3 { font-size: 1.4rem; font-weight: 600; }
h4 { font-size: 1.15rem; font-weight: 600; }
p { margin-bottom: 1.1rem; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
  margin-bottom: 0.75rem;
}

.eyebrow--dark {
  color: var(--neutral-500);
}

sup a {
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
sup a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: #EBEEE6;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* --- LAYOUT --- */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

.content-measure {
  max-width: 66ch;
}

main { flex: 1; }

/* --- HEADER --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--plum);
  border-bottom: 2px solid var(--primary);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  gap: 1rem;
}

.site-brand {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-on-ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-brand:hover { color: var(--teal); }

.site-nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-on-ink-muted);
  text-decoration: none;
  transition: color var(--transition);
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text-on-ink);
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-underline-offset: 3px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--text-on-ink-muted);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--text-on-ink);
  font-size: 1.1rem;
  line-height: 1;
}

/* --- HERO (index) --- */
.page-body { padding-top: 3.75rem; } /* offset for fixed header */

.hero {
  background: var(--plum);
  padding: 4rem var(--container-px) 3rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}

.hero-inner {
  max-width: var(--max-width);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr 360px;
    align-items: center;
  }
}

.hero-content { max-width: 56ch; }

.hero h1 {
  color: var(--text-on-ink);
  margin-bottom: 1rem;
  max-width: 46ch;
}

.hero-lede {
  color: var(--text-on-ink-muted);
  font-size: 1.05rem;
  max-width: 58ch;
  margin-bottom: 2rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
}

/* ARCH container */
.arch-frame {
  border: 3px solid var(--primary);
  border-radius: 50% 50% 0 0 / 60px 60px 0 0;
  overflow: hidden;
  background: rgba(74, 25, 66, 0.35);
  position: relative;
}

@media (min-width: 900px) {
  .arch-frame {
    border-radius: 50% 50% 0 0 / 120px 120px 0 0;
  }
}

.arch-frame img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- INNER PAGE HERO (non-index) --- */
.inner-hero {
  background: var(--plum);
  padding: 3rem var(--container-px) 2.5rem;
  position: relative;
  overflow: hidden;
}

.inner-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}

.inner-hero-content {
  max-width: var(--max-width);
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.inner-hero::after {
  content: '';
  display: block;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
  position: absolute;
  bottom: 0;
  left: 0;
  opacity: 0.5;
  border-radius: 2px 2px 0 0;
}

.inner-hero h1 {
  color: var(--text-on-ink);
  margin-bottom: 0.75rem;
  max-width: 56ch;
}

.inner-hero-lede {
  color: var(--text-on-ink-muted);
  font-size: 1rem;
  max-width: 60ch;
  margin-bottom: 1rem;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.breadcrumb a,
.breadcrumb span {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-on-ink-muted);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb-sep { color: var(--primary); opacity: 0.6; }

/* Arch accent over inner hero H1 */
.arch-accent {
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--primary);
  border-radius: 9999px;
  margin-bottom: 1.25rem;
  position: relative;
}

/* --- OLIVE-BRANCH DIVIDER --- */
.olive-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0;
}
.olive-divider::before,
.olive-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--secondary);
  opacity: 0.5;
}
.olive-divider-node {
  width: 8px;
  height: 8px;
  background: var(--primary);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.olive-divider--ink::before,
.olive-divider--ink::after {
  background: rgba(107, 127, 59, 0.4);
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.7rem;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-on-ink);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-900);
  border-color: var(--primary-900);
  color: var(--text-on-ink);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal);
}
.btn-secondary:hover {
  background: rgba(168, 216, 200, 0.12);
  color: var(--teal);
  border-color: var(--teal);
}

.btn-outline {
  background: transparent;
  color: var(--secondary);
  border-color: var(--secondary);
}
.btn-outline:hover {
  background: rgba(107, 127, 59, 0.1);
  color: var(--secondary);
}

/* --- CARDS --- */
.card {
  background: var(--surface);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  display: block;
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --- STAT TILES --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}
@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-tile {
  background: var(--plum);
  border-radius: 0.5rem;
  padding: 1.25rem 1rem;
  position: relative;
  overflow: hidden;
}
.stat-tile::after {
  content: '';
  position: absolute;
  top: 0.5rem; right: 0.6rem;
  width: 8px; height: 8px;
  background: var(--primary);
  transform: rotate(45deg);
}
.stat-tile-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.4rem;
}
.stat-tile-value {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--text-on-ink);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-tile-sub {
  font-size: 0.78rem;
  color: var(--text-on-ink-muted);
  line-height: 1.3;
}

/* --- CALLOUTS --- */
.callout {
  background: var(--primary-50);
  border-left: 3px solid var(--primary);
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
  position: relative;
}
.callout::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0 0.5rem 0 0;
  background: linear-gradient(90deg, var(--primary) 0%, transparent 60%);
}

.callout-research {
  background: rgba(107, 127, 59, 0.08);
  border-left-color: var(--secondary);
}
.callout-research::before {
  background: linear-gradient(90deg, var(--secondary) 0%, transparent 60%);
}

/* --- CONTENT SECTIONS --- */
.content-section {
  padding: 2.5rem 0;
}
.content-section + .content-section {
  border-top: 1px solid var(--neutral-200);
}

.section-heading {
  margin-bottom: 1.25rem;
}
.section-heading h2 {
  color: var(--neutral-900);
}

/* --- PAGE LAYOUT (article + rail) --- */
.page-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding: 3rem 0 4rem;
}
@media (min-width: 1024px) {
  .page-layout {
    grid-template-columns: 1fr 240px;
    align-items: start;
  }
}

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

.page-rail {
  position: sticky;
  top: 5rem;
}

.toc-nav {
  background: var(--surface);
  border: 1px solid var(--neutral-200);
  border-radius: 0.5rem;
  padding: 1.25rem;
}
.toc-nav h3 {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--neutral-500);
  margin-bottom: 0.75rem;
}
.toc-nav ul {
  list-style: none;
  padding: 0;
}
.toc-nav li + li { margin-top: 0.35rem; }
.toc-nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.6rem;
  transition: color var(--transition), border-color var(--transition);
}
.toc-nav a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* --- REFERENCES LIST --- */
.references-list {
  padding-left: 0;
  list-style: none;
  counter-reset: ref-counter;
}
.references-list li {
  counter-increment: ref-counter;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.5rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--neutral-200);
  font-size: 0.9rem;
  line-height: 1.55;
}
.references-list li::before {
  content: "[" counter(ref-counter) "]";
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--primary);
  padding-top: 0.15rem;
  font-weight: 500;
}
.references-list a {
  color: var(--accent);
  word-break: break-all;
}

/* --- FAQ --- */
.faq-list {
  list-style: none;
  padding: 0;
}
.faq-item {
  border-bottom: 1px solid var(--neutral-200);
}
.faq-item:first-child {
  border-top: 1px solid var(--neutral-200);
}
.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 0;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--neutral-900);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  line-height: 1.35;
  transition: color var(--transition);
}
.faq-question:hover { color: var(--primary); }
.faq-chevron {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
  transition: transform var(--transition);
}
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  display: none;
  padding: 0 0 1.25rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 66ch;
}
.faq-item.open .faq-answer { display: block; }

/* --- IMAGES IN CONTENT --- */
.content-figure {
  margin: 2rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}
.content-figure img {
  width: 100%;
  height: auto;
  display: block;
}
.content-figure figcaption {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  letter-spacing: 0.02em;
}

/* --- CHART CONTAINER --- */
.chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--neutral-200);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 2rem 0;
}
.chart-wrapper canvas { max-height: 350px; }
.chart-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neutral-500);
  margin-bottom: 1rem;
}

/* --- CONTACT FORM --- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 36rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--neutral-200);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { min-height: 8rem; resize: vertical; }
.form-disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- FOOTER --- */
.site-footer {
  background: var(--plum);
  padding: 3rem var(--container-px) 1.75rem;
  margin-top: auto;
}

.footer-disclaimer {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--text-on-ink-muted);
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 1.5rem;
  max-width: 50rem;
  margin-inline: auto;
}

.footer-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) {
  .footer-columns { grid-template-columns: repeat(3, 1fr); }
}

.footer-col-heading {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.875rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.footer-links a {
  font-size: 0.875rem;
  color: var(--text-on-ink-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--text-on-ink); }

.footer-copyright {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(201, 179, 196, 0.5);
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(107, 127, 59, 0.25);
}

/* --- 404 PAGE --- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 4rem var(--container-px);
}
.error-code {
  font-family: var(--font-mono);
  font-size: 5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  opacity: 0.4;
  margin-bottom: 1rem;
}
.error-page h1 { color: var(--neutral-900); margin-bottom: 1rem; }

/* --- UTILITY CLASSES --- */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.pt-3 { padding-top: 1.5rem; }
.pb-3 { padding-bottom: 1.5rem; }
.section-pad { padding: 3.5rem 0; }

/* --- RESPONSIVE NAV --- */
@media (max-width: 768px) {
  .nav-toggle { display: flex; align-items: center; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--plum-2);
    padding: 1rem var(--container-px);
    border-bottom: 2px solid var(--primary);
  }
  .site-nav.open { display: block; }
  .site-nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }
  .site-nav a {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
  }
}

/* --- PREFERS REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
