/* style.css — Dermatology Scan Guide */

/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* Color palette */
  --color-warm-white: #F7F4EF;
  --color-soft-clay: #E8DED2;
  --color-charcoal: #1E1E1E;
  --color-steel: #8A9299;
  --color-accent: #C68C85;

  /* Typography families */
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Type scale (desktop baseline 16px) */
  --text-h1: clamp(2.25rem, 1.5rem + 2.5vw, 3.5rem);      /* ~36px → 56px */
  --text-h2: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);      /* ~24px → 36px */
  --text-h3: clamp(1.25rem, 1.1rem + 0.5vw, 1.375rem);     /* ~20px → 22px */
  --text-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);     /* 16px → 18px */
  --text-small: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem); /* ~13px → 14px */
  --text-citation: 0.8125rem;                                 /* 13px fixed */
  --text-subhead: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);  /* ~18px → 22px */

  /* Line heights */
  --lh-h1: 1.07;     /* 60/56 */
  --lh-h2: 1.22;     /* 44/36 */
  --lh-h3: 1.36;     /* 30/22 */
  --lh-body: 1.667;  /* 30/18 */
  --lh-small: 1.57;  /* 22/14 */
  --lh-citation: 1.538; /* 20/13 */

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

  /* Layout */
  --max-width: 1180px;
  --prose-width: 720px;
  --gutter: 32px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 768px) {
  :root {
    --gutter: 20px;
  }
}

@media (max-width: 480px) {
  :root {
    --gutter: 16px;
  }
}

/* ========================================
   LAYOUT
   ======================================== */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.prose {
  max-width: var(--prose-width);
  margin-left: auto;
  margin-right: auto;
}

.prose-centered {
  max-width: var(--prose-width);
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   SKIP LINK
   ======================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  background: var(--color-charcoal);
  color: var(--color-warm-white);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-small);
  text-decoration: none;
  z-index: 999;
  border-radius: 2px;
}

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

/* ========================================
   HEADER / NAV
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(30, 30, 30, 0.06);
  transition: box-shadow 220ms var(--ease);
}

.site-header.scrolled {
  box-shadow: 0 1px 4px rgba(30, 30, 30, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--gutter);
}

/* Wordmark */
.wordmark {
  font-family: var(--font-serif);
  font-size: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-charcoal);
  text-decoration: none;
  line-height: 1.2;
  display: inline-flex;
  flex-direction: column;
  gap: 0;
}

.wordmark-hairline {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--color-accent);
  margin-top: 2px;
}

/* Desktop nav */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.nav-desktop a {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-charcoal);
  text-decoration: none;
  letter-spacing: 0.02em;
  padding: var(--space-1) 0;
  position: relative;
}

.nav-desktop a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width 220ms var(--ease);
}

.nav-desktop a:hover::after,
.nav-desktop a[aria-current="page"]::after {
  width: 100%;
}

.nav-desktop a[aria-current="page"] {
  color: var(--color-charcoal);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 200;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--color-charcoal);
  transition: transform 220ms var(--ease), opacity 220ms var(--ease);
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile overlay */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-warm-white);
  z-index: 150;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-10);
}

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

.nav-mobile-overlay a {
  font-family: var(--font-serif);
  font-size: var(--text-h2);
  line-height: var(--lh-h2);
  color: var(--color-charcoal);
  text-decoration: none;
}

.nav-mobile-overlay a:hover {
  color: var(--color-accent);
}

@media (max-width: 768px) {
  .nav-desktop {
    display: none;
  }
  .hamburger {
    display: flex;
  }
}

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
  background: var(--color-warm-white);
  border-top: 1px solid rgba(30, 30, 30, 0.06);
  padding: var(--space-12) 0 var(--space-8);
  margin-top: var(--space-16);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.footer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-disclaimer {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--lh-small);
  color: var(--color-steel);
  max-width: 680px;
}

.footer-disclaimer strong {
  color: var(--color-charcoal);
  font-weight: 600;
}

.footer-copyright {
  font-family: var(--font-body);
  font-size: var(--text-small);
  color: var(--color-steel);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer-copyright a {
  color: var(--color-steel);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.footer-wordmark {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-steel);
  line-height: 1.2;
}

@media (max-width: 768px) {
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================================
   HERO SECTIONS
   ======================================== */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  text-align: center;
}

.hero h1 {
  font-size: var(--text-h1);
  line-height: var(--lh-h1);
  letter-spacing: -0.015em;
  color: var(--color-charcoal);
  margin-bottom: var(--space-6);
}

.hero-subhead {
  font-family: var(--font-body);
  font-size: var(--text-subhead);
  line-height: 1.55;
  color: var(--color-steel);
  max-width: 680px;
  margin: 0 auto var(--space-8);
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.cta-text {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-charcoal);
  text-decoration: none;
  border-bottom: 1px solid var(--color-accent);
  padding-bottom: 2px;
  letter-spacing: 0.01em;
}

.cta-text:hover {
  color: var(--color-accent);
}

/* ========================================
   CONTENT SECTIONS
   ======================================== */
.content-section {
  padding: var(--space-12) 0;
}

.content-section h2 {
  font-size: var(--text-h2);
  line-height: var(--lh-h2);
  color: var(--color-charcoal);
  margin-bottom: var(--space-6);
}

.content-section h3 {
  font-size: var(--text-h3);
  line-height: var(--lh-h3);
  font-weight: 500;
  color: var(--color-charcoal);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.content-section p {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-charcoal);
  margin-bottom: var(--space-4);
  max-width: var(--prose-width);
}

.content-section p:last-child {
  margin-bottom: 0;
}

/* Bold within text */
.content-section strong {
  font-weight: 600;
}

/* Inline links in body copy */
.content-section a.body-link {
  color: var(--color-charcoal);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.content-section a.body-link:hover {
  color: var(--color-accent);
}

/* Citations */
.citation {
  font-family: var(--font-mono);
  font-size: var(--text-citation);
  color: var(--color-steel);
  text-decoration: none;
  cursor: pointer;
  vertical-align: super;
  line-height: 0;
  padding: 0 1px;
}

.citation:hover {
  color: var(--color-accent);
}

/* Numbered list for editorial takeaways */
.editorial-list {
  padding-left: var(--space-6);
  margin: var(--space-4) 0;
  max-width: var(--prose-width);
}

.editorial-list li {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-charcoal);
  margin-bottom: var(--space-3);
  padding-left: var(--space-2);
}

/* Bulleted list */
.bullet-list {
  list-style: disc;
  padding-left: var(--space-6);
  margin: var(--space-4) 0;
  max-width: var(--prose-width);
}

.bullet-list li {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-charcoal);
  margin-bottom: var(--space-3);
  padding-left: var(--space-2);
}

/* ========================================
   PRACTITIONER / QUESTIONS CARD
   ======================================== */
.callout-card {
  background: var(--color-soft-clay);
  border-top: 2px solid var(--color-accent);
  padding: var(--space-8);
  margin: var(--space-12) auto;
  max-width: var(--prose-width);
}

.callout-card h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.375rem, 1.2rem + 0.5vw, 1.75rem);
  line-height: 1.3;
  color: var(--color-charcoal);
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.callout-card p {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-charcoal);
  margin-bottom: var(--space-4);
}

.callout-card .card-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--color-charcoal);
  text-decoration: none;
  border-bottom: 1px solid var(--color-accent);
  padding-bottom: 2px;
  margin: var(--space-4) 0;
}

.callout-card .card-link:hover {
  color: var(--color-accent);
}

.callout-card .card-disclosure {
  font-family: var(--font-mono);
  font-size: var(--text-citation);
  line-height: var(--lh-citation);
  color: var(--color-steel);
  margin-top: var(--space-4);
  margin-bottom: 0;
}

/* ========================================
   SAFETY / ACCURACY BLOCK
   ======================================== */
.safety-block {
  background: var(--color-soft-clay);
  padding: var(--space-8);
  margin: var(--space-12) auto;
  max-width: var(--prose-width);
}

.safety-block p {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-charcoal);
  max-width: var(--prose-width);
}

.safety-block strong {
  font-weight: 600;
}

/* ========================================
   EDITORIAL INDEPENDENCE DISCLOSURE (Research)
   ======================================== */
.editorial-disclosure {
  background: var(--color-soft-clay);
  padding: var(--space-4) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--lh-small);
  color: var(--color-charcoal);
  margin: var(--space-8) auto;
  max-width: var(--prose-width);
}

.editorial-disclosure strong {
  font-weight: 600;
}

/* ========================================
   READER'S NOTE
   ======================================== */
.readers-note {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-charcoal);
  max-width: var(--prose-width);
  margin-left: auto;
  margin-right: auto;
  padding: var(--space-6) 0;
  border-bottom: 1px solid rgba(30, 30, 30, 0.06);
  margin-bottom: var(--space-8);
}

/* ========================================
   PULL QUOTE (journal-style)
   ======================================== */
.pull-quote {
  font-family: var(--font-serif);
  font-size: var(--text-h3);
  line-height: var(--lh-h3);
  font-style: italic;
  color: var(--color-charcoal);
  border-left: 2px solid var(--color-accent);
  padding-left: var(--space-6);
  margin: var(--space-8) 0;
  max-width: 600px;
}

/* ========================================
   RESEARCH PAGE — TABLE OF CONTENTS
   ======================================== */
.research-toc {
  position: sticky;
  top: 5rem;
  align-self: flex-start;
  padding: var(--space-4) 0;
  min-width: 220px;
}

.research-toc-title {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-charcoal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
}

.research-toc-list {
  list-style: none;
  padding: 0;
}

.research-toc-list li {
  margin-bottom: var(--space-2);
}

.research-toc-list a {
  font-family: var(--font-body);
  font-size: var(--text-small);
  color: var(--color-steel);
  text-decoration: none;
  line-height: 1.5;
  display: block;
  padding: var(--space-1) 0;
  transition: color 180ms var(--ease);
}

.research-toc-list a:hover,
.research-toc-list a.active {
  color: var(--color-charcoal);
}

/* Research page layout: sidebar + content */
.research-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-12);
  align-items: start;
}

@media (max-width: 1024px) {
  .research-layout {
    grid-template-columns: 1fr;
  }
  .research-toc {
    position: relative;
    top: 0;
  }

  /* Mobile: collapsible TOC */
  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-soft-clay);
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--text-small);
    font-weight: 600;
    color: var(--color-charcoal);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .toc-toggle-icon {
    transition: transform 220ms var(--ease);
  }

  .toc-toggle[aria-expanded="true"] .toc-toggle-icon {
    transform: rotate(180deg);
  }

  .toc-collapsible {
    display: none;
    padding: var(--space-2) var(--space-4) var(--space-4);
    background: var(--color-soft-clay);
  }

  .toc-collapsible.open {
    display: block;
  }

  .research-toc-title {
    display: none;
  }
}

@media (min-width: 1025px) {
  .toc-toggle {
    display: none;
  }
  .toc-collapsible {
    display: block !important;
  }
}

/* ========================================
   REFERENCE LIST
   ======================================== */
.reference-list {
  border-top: 1px solid rgba(30, 30, 30, 0.06);
  padding-top: var(--space-8);
  margin-top: var(--space-12);
}

.reference-list h2 {
  margin-bottom: var(--space-6);
}

.reference-entry {
  font-family: var(--font-mono);
  font-size: var(--text-citation);
  line-height: var(--lh-citation);
  color: var(--color-steel);
  margin-bottom: var(--space-4);
  padding-left: var(--space-8);
  text-indent: calc(-1 * var(--space-8));
  max-width: var(--prose-width);
  scroll-margin-top: 5rem;
}

.reference-entry a {
  color: var(--color-steel);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.reference-entry a:hover {
  color: var(--color-accent);
}

/* ========================================
   PRIVACY PAGE
   ======================================== */
.privacy-page {
  padding: var(--space-16) 0;
}

.privacy-page h1 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-6);
}

.privacy-page p {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  max-width: var(--prose-width);
  margin-bottom: var(--space-4);
}

/* ========================================
   404 PAGE
   ======================================== */
.page-404 {
  padding: var(--space-20) 0;
  text-align: center;
}

.page-404 h1 {
  font-size: var(--text-h1);
  margin-bottom: var(--space-6);
}

.page-404 p {
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-steel);
  max-width: 480px;
  margin: 0 auto var(--space-6);
}

.page-404 a {
  color: var(--color-charcoal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-404 a:hover {
  color: var(--color-accent);
}

/* ========================================
   SCROLL FADE-UP (headings only)
   ======================================== */
.fade-up {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 220ms ease-out, transform 220ms ease-out;
}

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