/* MelanomaMonday.com — shared styles
 * Single source of truth. Inlined or linked from every page.
 */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #525252;
  --border: #e5e5e5;
  --accent: #b45309;
  --accent-hover: #92400e;
  --link: #1d4ed8;
  --warn-bg: #fef3c7;
  --warn-border: #f59e0b;
  --danger-bg: #fee2e2;
  --danger-border: #dc2626;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --surface: #161616;
    --text: #f0f0f0;
    --muted: #a3a3a3;
    --border: #262626;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --link: #60a5fa;
    --warn-bg: #3b2a05;
    --warn-border: #f59e0b;
    --danger-bg: #3b0f0f;
    --danger-border: #f87171;
    --card-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 4px;
}
.skip:focus { left: 8px; top: 8px; z-index: 100; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* Header + brand */
header.site {
  padding: 20px 0 0;
  border-bottom: 1px solid var(--border);
}
header.site .brand {
  font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; text-decoration: none; color: var(--text);
}
header.site .brand .dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); margin-right: 8px;
}

/* === Header & nav ============================================
 * Mobile-first. Order: base → body.nav-open → @media (min-width: 720px).
 * Contrast notes (light/dark, on var(--bg)):
 *   --muted #525252 / #a3a3a3 → 7.48 / 7.75 (AAA)
 *   --link  #1d4ed8 / #60a5fa → 6.42 / 7.69 (AAA)
 *   --accent #b45309 / #f59e0b → 4.81 / 9.11 (AA / AAA)
 */

/* --- Base (mobile): hamburger visible, drawer hidden --------- */
.brand-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  font: inherit; font-size: 20px; line-height: 1;
  min-width: 44px; min-height: 44px;     /* 44×44 touch target */
  padding: 0 12px; cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

nav.subnav {
  display: none;
  flex-direction: column;
  padding-top: 4px;
  font-size: 15px;
}
nav.subnav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;                       /* 44px touch target inside drawer */
  display: flex; align-items: center;
  padding: 4px 0;
}
nav.subnav a:hover { color: var(--accent); text-decoration: underline; }
nav.subnav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.nav-cluster { display: block; padding: 4px 0 8px; }
.nav-cluster + .nav-cluster { border-top: 1px solid var(--border); margin-top: 4px; }

.nav-cluster-label {
  display: block;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 4px 4px;
}

/* Brand: hover/focus signal that the wordmark is a link */
header.site .brand:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}
header.site .brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --- Drawer open state (mobile) ------------------------------ */
body.nav-open nav.subnav { display: flex; }
body.nav-open { overflow: hidden; }

/* --- Desktop ≥720px ----------------------------------------- */
@media (min-width: 720px) {
  .nav-toggle { display: none; }
  body.nav-open { overflow: auto; }
  nav.subnav,
  body.nav-open nav.subnav {
    display: flex; flex-direction: row; flex-wrap: wrap;
    gap: 8px 18px; padding-top: 4px;
    font-size: 14px;
  }
  nav.subnav a {
    min-height: 0; padding: 0;
    display: inline;
  }
  .nav-cluster {
    display: inline-flex; align-items: baseline; gap: 6px 14px;
    padding: 0; border: 0; margin: 0;
    flex-wrap: wrap;
  }
  .nav-cluster + .nav-cluster { border: 0; margin-top: 0; }
  .nav-cluster-label {
    display: inline; padding: 0; margin-right: 8px;
    color: var(--muted);
  }
  /* Vertical separator between clusters */
  .nav-cluster + .nav-cluster::before {
    content: ""; display: inline-block;
    width: 1px; height: 14px;
    background: var(--border);
    margin-right: 14px;
    vertical-align: middle;
  }
}

/* Reduced-motion: no transitions on drawer */
@media (prefers-reduced-motion: reduce) {
  nav.subnav, body.nav-open nav.subnav, .nav-toggle { transition: none !important; }
}

/* Breadcrumb (Glossary, Sources) ----------------------------- */
.breadcrumb {
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 0 0;
}
.breadcrumb ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 0;
}
.breadcrumb li { text-transform: uppercase; }
.breadcrumb li + li::before { content: "›"; margin: 0 6px; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text); }
@media print { .breadcrumb { display: none; } }

/* Anchor jump target padding (so deep-links don't land mid-element) */
:target,
section[id],
[id^="abcde"],
[id^="dysplastic"],
.glossary-list dt[id] { scroll-margin-top: 24px; }

/* Footer links (P2.10) */
.footer-links {
  font-size: 13px; margin: 0 0 12px;
}
.footer-links a { color: var(--muted); text-decoration: none; margin-right: 12px; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }

/* Share component (P3.12) */
.share {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 18px 0;
}
.share .share-label {
  font-size: 13px; color: var(--muted); margin-right: 4px;
}
.share button, .share a.share-btn {
  font: inherit; font-size: 14px;
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.share button:hover, .share a.share-btn:hover {
  border-color: var(--accent); color: var(--accent);
}
.share .copied { color: var(--accent); font-size: 12px; }

/* Reduced motion (P4.18) */
@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;
  }
}

main { padding: 0 0 64px; }
section { padding: 48px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: 0; }

h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: clamp(20px, 3.5vw, 28px); line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.01em; }
h3 { font-size: 19px; margin: 0 0 8px; }
h4 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 14px; }
.lead { font-size: 19px; color: var(--muted); }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px;
  color: var(--accent); font-weight: 700; margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-block; background: var(--accent); color: #fff !important;
  padding: 12px 22px; border-radius: 999px; font-weight: 600;
  text-decoration: none; border: 0; cursor: pointer; font-size: 16px;
  font-family: inherit;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: transparent; color: var(--text) !important;
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

/* Cards + grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}
.card a.card-link { display: block; color: inherit; text-decoration: none; }
.card a.card-link:hover h3 { color: var(--accent); }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 480px) and (max-width: 639px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

ul.clean { padding-left: 18px; }
ul.clean li { margin-bottom: 6px; }

/* Stat callout */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 18px 0;
}
.stat .num { font-size: 28px; font-weight: 700; }
.small { font-size: 14px; color: var(--muted); }

/* Callouts */
.callout {
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 14px 0;
  color: var(--text);
}
.callout-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

/* Footer */
footer.site {
  padding: 32px 0;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}
footer.site a { color: var(--muted); text-decoration: underline; }
footer.site a:hover { color: var(--text); }

/* ABCDE illustration rows (used on index + check-a-spot) */
.abcde-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
}
@media (max-width: 540px) {
  .abcde-row { grid-template-columns: 1fr; }
  .abcde-svg { margin: 0 auto; }
}
.abcde-svg { width: 120px; height: 120px; }

/* Forms */
.form-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0;
  align-items: end;
}
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form-row select, .form-row button, .form-row input, .form-row textarea {
  font: inherit; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.form-row .field { display: flex; flex-direction: column; min-width: 100px; }
.form-row .field-grow { flex: 1 1 180px; }
textarea { width: 100%; min-height: 80px; resize: vertical; }

/* Trial / generic results list */
.results { margin-top: 16px; }
.result {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}
.result:first-child { border-top: 0; }
.result h4 { margin: 0 0 6px; font-size: 16px; }
.result .meta { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; margin-right: 4px; margin-bottom: 4px;
  color: var(--muted);
}

/* Glossary popovers */
.term {
  border-bottom: 1px dotted var(--accent);
  cursor: help; background: none; border-left: 0; border-right: 0; border-top: 0;
  color: inherit; font: inherit; padding: 0;
}
.term:hover, .term:focus-visible { color: var(--accent); }
.term-popover {
  position: absolute; max-width: 280px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  box-shadow: var(--card-shadow);
  font-size: 14px; line-height: 1.5;
  z-index: 50;
}
.term-popover .source {
  display: block; margin-top: 6px; font-size: 12px; color: var(--muted);
}
.term-popover .full-entry {
  display: inline-block; margin-top: 8px; font-size: 13px;
  color: var(--accent); text-decoration: none;
}
.term-popover .full-entry:hover { text-decoration: underline; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0 0;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  background: transparent; border: 0; padding: 10px 14px;
  font: inherit; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.tab-btn[aria-selected="true"] {
  color: var(--accent); border-bottom-color: var(--accent);
}
.tab-panel { padding: 16px 0; }
.tab-panel[hidden] { display: none; }

/* Body map */
.bodymap {
  display: grid; gap: 8px;
  grid-template-columns: 1fr 1fr;
  max-width: 460px; margin: 0 auto;
}
.bodymap svg {
  width: 100%; height: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bodymap .region {
  fill: var(--surface); stroke: var(--muted); stroke-width: 1;
  cursor: pointer; transition: fill 0.15s;
}
.bodymap .region:hover, .bodymap .region:focus-visible {
  fill: var(--warn-bg); stroke: var(--accent);
}
.bodymap .region.has-entry {
  fill: var(--accent); fill-opacity: 0.45;
}
.bodymap .label { fill: var(--muted); font-size: 9px; pointer-events: none; }

/* Doorways (homepage) */
.doorways {
  display: grid; gap: 12px; margin: 20px 0;
}
@media (min-width: 600px) {
  .doorways { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .doorways { grid-template-columns: repeat(4, 1fr); }
}
.doorway {
  display: block; padding: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.doorway:hover {
  border-color: var(--accent); transform: translateY(-2px);
}
.doorway h3 { margin: 0 0 4px; font-size: 17px; }
.doorway p { margin: 0; font-size: 14px; color: var(--muted); }

/* Step indicator (check-a-spot) */
.steps {
  display: flex; gap: 6px; margin: 0 0 20px;
}
.steps .step {
  flex: 1; height: 6px; background: var(--border); border-radius: 999px;
}
.steps .step.active { background: var(--accent); }

/* Yes/No big buttons (check-a-spot) */
.yn-row { display: flex; gap: 12px; margin: 20px 0; }
.yn-btn {
  flex: 1; padding: 18px; font: inherit; font-weight: 600; font-size: 17px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.yn-btn:hover { border-color: var(--accent); background: var(--warn-bg); }

/* Print styles */
@media print {
  header.site, footer.site, nav.subnav, .btn, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; }
}

/* ---------------------------------------------------------------------- */
/* Sticky mobile share bar (homepage only) */
.share-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: none; /* default off */
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px -12px rgba(0,0,0,0.12);
  font-size: 14px;
}
.share-bar[hidden] { display: none !important; }
.share-bar-text {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}
.share-bar-actions { display: flex; align-items: center; gap: 6px; }
.share-bar .btn-share { padding: 8px 12px; font-size: 14px; min-height: 36px; }
.share-bar-close {
  background: transparent; border: 0; padding: 8px 10px;
  font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer;
  border-radius: 6px;
}
.share-bar-close:hover { background: var(--bg); color: var(--fg); }

@media (max-width: 720px) {
  .share-bar:not([hidden]) { display: flex; }
  /* ensure page content can scroll past the fixed bar */
  body:has(.share-bar:not([hidden])) main { padding-bottom: 80px; }
}

/* ---------------------------------------------------------------------- */
/* Print styles for the worksheet page */
@media print {
  header.site, footer.site, .nav-toggle, .share, .share-bar, .skip,
  .print-hide, [data-print="hide"] {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  a { color: inherit; text-decoration: none; }
  .worksheet { max-width: none; padding: 0; }
  .worksheet h1, .worksheet h2 { color: #000; }
  .worksheet svg .region { fill: #f4f4f5; stroke: #888; }
  .checkbox-row { page-break-inside: avoid; }
  @page { margin: 0.5in; }
}

.worksheet { font-size: 14px; line-height: 1.5; }
.worksheet .grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start;
}
@media (max-width: 720px) { .worksheet .grid { grid-template-columns: 1fr; } }
.worksheet .checklist { margin: 0; padding: 0; list-style: none; }
.worksheet .checklist li {
  margin: 8px 0; display: flex; gap: 10px; align-items: flex-start;
}
.worksheet .checkbox {
  display: inline-block; width: 14px; height: 14px;
  border: 1.5px solid #555; border-radius: 3px; flex-shrink: 0;
  margin-top: 4px;
}
.worksheet .notelines {
  border: 1px solid var(--border); border-radius: 8px;
  background-image: repeating-linear-gradient(transparent 0, transparent 28px, var(--border) 28px, var(--border) 29px);
  background-size: 100% 29px;
  background-position: 0 18px;
  padding: 14px;
  min-height: 240px;
}

/* ---------------------------------------------------------------------- */
/* Streak 12-month grid */
.streak-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin: 14px 0 6px;
}
.streak-grid-cell {
  position: relative;
  min-height: 36px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  font-size: 10px;
  color: var(--muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.streak-grid-cell.checked {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
  font-weight: 600;
}
.streak-grid-cell.current {
  outline: 2px solid var(--link);
  outline-offset: 1px;
}
.streak-grid-cell .month-abbr { font-size: 10px; line-height: 1; }
.streak-grid-cell .year-abbr { font-size: 8px; opacity: 0.7; line-height: 1; margin-top: 1px; }
@media (max-width: 540px) {
  .streak-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 1fr; }
}

/* ---------------------------------------------------------------------- */
/* Trial status badges */
.tag-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.tag-status.tag-recruiting {
  background: #dcfce7;
  color: #14532d;
  border-color: #86efac;
}
.tag-status.tag-soon {
  background: #fef3c7;
  color: #78350f;
  border-color: #fcd34d;
}
.tag-status.tag-invite {
  background: #e0e7ff;
  color: #312e81;
  border-color: #a5b4fc;
}
.tag-status.tag-closed {
  background: var(--bg);
  color: var(--muted);
  border-color: var(--border);
}
@media (prefers-color-scheme: dark) {
  .tag-status.tag-recruiting { background: #14532d; color: #bbf7d0; border-color: #166534; }
  .tag-status.tag-soon       { background: #78350f; color: #fef3c7; border-color: #92400e; }
  .tag-status.tag-invite     { background: #312e81; color: #e0e7ff; border-color: #3730a3; }
}

/* ---------------------------------------------------------------------- */
/* Trial result location list */
.loc-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.loc-list li {
  margin: 0 0 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
