/* ==========================================================================
   Portfolio — shared stylesheet
   Corporate-clean, minimal. Dark-on-light with a single teal accent.
   ========================================================================== */

:root {
  --accent:        #0d5c75;   /* single accent color (deep medtech teal) */
  --accent-dark:   #094859;
  --accent-tint:   #e8f1f4;
  --ink:           #1c2733;   /* primary text */
  --ink-soft:      #4a5764;   /* secondary text */
  --ink-faint:     #6b7885;   /* captions, meta */
  --bg:            #ffffff;
  --bg-alt:        #f5f7f9;   /* section / panel background */
  --line:          #e2e7ec;   /* hairlines & borders */
  --warn-bg:       #fff8e6;   /* disclaimer background */
  --warn-line:     #e6b800;   /* disclaimer accent */
  --warn-ink:      #6b5300;
  --maxw:          860px;     /* readable measure for document pages */
  --radius:        8px;
  --shadow:        0 1px 3px rgba(28,39,51,.08), 0 6px 24px rgba(28,39,51,.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Links ---------- */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Skip link (a11y) ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 200;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   Header / navigation (sticky, shared across pages)
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.25rem;
}
.brand {
  display: flex; align-items: baseline; gap: .55rem;
  font-weight: 700; font-size: 1.05rem; color: var(--ink);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand .brand-mark { color: var(--accent); }
.brand .brand-sub {
  font-weight: 500; font-size: .8rem; color: var(--ink-faint);
  letter-spacing: .02em;
}

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: .4rem .55rem; cursor: pointer; color: var(--ink);
  line-height: 0;
}
.nav-toggle svg { width: 22px; height: 22px; }

.nav-links {
  display: flex; align-items: center; gap: .35rem;
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  display: block; color: var(--ink-soft);
  padding: .4rem .7rem; border-radius: 6px;
  font-size: .93rem; font-weight: 500;
}
.nav-links a:hover { color: var(--accent); background: var(--accent-tint); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--accent-tint); }

/* ==========================================================================
   Layout containers
   ========================================================================== */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

main { display: block; }

footer.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem; padding: 2rem 1.25rem;
  color: var(--ink-faint); font-size: .88rem;
}
footer.site-footer .wrap-wide { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
footer.site-footer a { color: var(--ink-faint); text-decoration: underline; }

/* ==========================================================================
   Homepage
   ========================================================================== */
.hero {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--accent-tint) 0%, #fff 100%);
}
.hero .eyebrow {
  text-transform: uppercase; letter-spacing: .14em;
  font-size: .78rem; font-weight: 700; color: var(--accent);
  margin: 0 0 .8rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1;
  margin: 0 0 1rem; letter-spacing: -.02em;
}
.hero p.lead {
  font-size: 1.15rem; color: var(--ink-soft); max-width: 640px; margin: 0;
}
.placeholder-note {
  display: inline-block; margin-top: 1.5rem;
  font-size: .82rem; color: var(--ink-faint);
  background: #fff; border: 1px dashed var(--line);
  padding: .4rem .7rem; border-radius: 6px;
}

.toc { padding: 3rem 0 1rem; }
.toc h2 {
  font-size: 1.4rem; margin: 0 0 .35rem;
}
.toc .toc-intro { color: var(--ink-soft); margin: 0 0 2rem; }

.cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem;
}
.card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; background: #fff;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #cdd6dd; text-decoration: none; }
.card .card-tag {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin-bottom: .6rem;
}
.card h3 { margin: 0 0 .5rem; font-size: 1.2rem; color: var(--ink); line-height: 1.25; }
.card p { margin: 0 0 1rem; color: var(--ink-soft); font-size: .95rem; flex: 1; }
.card .card-cta { font-weight: 600; color: var(--accent); font-size: .92rem; }
.card .card-cta::after { content: " →"; }

/* Visually-hidden (screen-reader only) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Home hero "hub" (signpost directing) ---------- */
.hero-hub {
  text-align: center; padding: 5rem 0;
  display: flex; align-items: center; justify-content: center;
  min-height: 46vh;
}
.hero-hub .eyebrow { color: var(--accent); }
.hero-hub h1 { margin: 0 auto .6rem; max-width: 14ch; }
.hub-intro {
  color: var(--ink-soft); font-size: 1.05rem; margin: 0 0 2.6rem;
  text-transform: uppercase; letter-spacing: .12em; font-size: .82rem; font-weight: 600;
}
.signposts {
  display: flex; gap: 1.4rem; justify-content: center; align-items: stretch;
  flex-wrap: wrap;
}
.signpost {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  width: min(280px, 100%); padding: 1.7rem 1.4rem 1.3rem;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.signpost:hover, .signpost:focus-visible {
  transform: translateY(-4px); box-shadow: var(--shadow);
  border-color: var(--accent); text-decoration: none; outline: none;
}
.signpost-label { font-weight: 700; font-size: 1.25rem; color: var(--ink); letter-spacing: -.01em; }
.signpost:hover .signpost-label, .signpost:focus-visible .signpost-label { color: var(--accent); }
.signpost-sub { font-size: .86rem; color: var(--ink-faint); }
.signpost-arrow { width: 46px; height: 60px; color: var(--accent); }
.signpost-down .signpost-arrow { margin-top: .5rem; }
.signpost-up .signpost-arrow { margin-bottom: .5rem; }
.signpost-down:hover .signpost-arrow, .signpost-down:focus-visible .signpost-arrow { animation: nudge-down .7s ease; }
.signpost-up:hover .signpost-arrow, .signpost-up:focus-visible .signpost-arrow { animation: nudge-up .7s ease; }
@keyframes nudge-down { 50% { transform: translateY(5px); } }
@keyframes nudge-up { 50% { transform: translateY(-5px); } }

/* Anchor targets clear the sticky header */
#bio { scroll-margin-top: 84px; }

/* ---------- Home "Brief Bio" section (bottom) ---------- */
.bio-section {
  border-top: 1px solid var(--line); background: var(--bg-alt);
  padding: 3rem 0 3.5rem; margin-top: 3.5rem;
}
.bio-section h2 { font-size: 1.4rem; margin: 0 0 1rem; }
.bio-section .bio-text { color: var(--ink-soft); font-size: 1.08rem; max-width: 700px; margin: 0; }

/* ==========================================================================
   Document pages
   ========================================================================== */
.doc-header {
  padding: 3rem 0 2rem; border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}
.doc-header .kicker {
  text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
  font-size: .76rem; color: var(--accent); margin: 0 0 .7rem;
}
.doc-header h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 .8rem; line-height: 1.15; letter-spacing: -.015em; }
.doc-header .demonstrates {
  font-size: 1.08rem; color: var(--ink-soft); margin: 0; max-width: 680px;
}
.doc-header .meta {
  margin: 1.3rem 0 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: .5rem .5rem; font-size: .82rem;
}
.doc-header .meta li {
  background: #fff; border: 1px solid var(--line); border-radius: 100px;
  padding: .28rem .8rem; color: var(--ink-soft);
}
.doc-header .meta strong { color: var(--ink); font-weight: 600; }

article.doc { padding: 2.5rem 0 1rem; }
article.doc h2 {
  font-size: 1.5rem; margin: 2.5rem 0 .9rem; padding-top: .5rem;
  letter-spacing: -.01em; color: var(--ink);
}
article.doc h2:first-child { margin-top: .5rem; }
article.doc h3 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; color: var(--ink); }
article.doc h4 { font-size: 1rem; margin: 1.4rem 0 .4rem; color: var(--accent-dark); text-transform: uppercase; letter-spacing: .04em; font-size: .82rem; }
article.doc p { margin: 0 0 1.1rem; }
article.doc ul, article.doc ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
article.doc li { margin-bottom: .45rem; }
article.doc ul ul, article.doc ol ol { margin: .45rem 0; }

.lead-in {
  font-size: 1.1rem; color: var(--ink-soft);
  border-left: 3px solid var(--accent); padding-left: 1.1rem; margin: 0 0 2rem;
}

/* Section divider */
.rule { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.4rem 0 1.8rem; border: 1px solid var(--line); border-radius: var(--radius); }
table.data {
  width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 480px;
}
table.data caption {
  text-align: left; font-weight: 600; color: var(--ink); padding: .9rem 1rem .2rem;
  caption-side: top; font-size: .95rem;
}
table.data th, table.data td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th {
  background: var(--accent); color: #fff; font-weight: 600; font-size: .85rem;
  border-bottom: none; position: sticky; top: 0;
}
table.data tbody tr:nth-child(even) { background: var(--bg-alt); }
table.data tbody th { background: var(--accent-tint); font-weight: 600; color: var(--ink); white-space: nowrap; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-note { font-size: .82rem; color: var(--ink-faint); margin: -.8rem 0 1.8rem; }

/* Two-column framework grid (SWOT / PESTLE) */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.4rem 0 1.8rem; }
.grid-2 .panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: #fff; }
.grid-2 .panel h4 { margin: 0 0 .6rem; color: #fff; display: inline-block; padding: .2rem .6rem; border-radius: 4px; font-size: .78rem; letter-spacing: .04em; }
.panel.pos h4 { background: var(--accent); }
.panel.neg h4 { background: #9b5d3a; }
.grid-2 .panel ul { margin: 0; padding-left: 1.2rem; font-size: .92rem; }

/* Definition-style framework list (PESTLE) */
dl.framework { margin: 1.4rem 0 1.8rem; border-top: 1px solid var(--line); }
dl.framework > div { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
dl.framework dt { font-weight: 700; color: var(--accent-dark); }
dl.framework dd { margin: 0; }
dl.framework dd ul { margin: 0; padding-left: 1.1rem; font-size: .95rem; }

/* ---------- Figures / images ---------- */
figure.doc-figure { margin: 1.8rem 0; }
figure.doc-figure img {
  width: 100%; height: auto; display: block; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-alt);
}
figure.doc-figure.contain img { object-fit: contain; max-height: 460px; }
figure.doc-figure figcaption { font-size: .84rem; color: var(--ink-faint); margin-top: .6rem; }
figure.doc-figure figcaption strong { color: var(--ink-soft); }

/* ---------- Figure comparison grids (X23D Tables 1 & 2) ---------- */
table.figtable { width: 100%; border-collapse: collapse; min-width: 560px; }
table.figtable caption {
  text-align: left; font-weight: 600; color: var(--ink);
  padding: .9rem 1rem .2rem; caption-side: top; font-size: .95rem;
}
table.figtable th.colhead {
  background: var(--accent); color: #fff; font-weight: 600; font-size: .82rem;
  padding: .5rem 1rem; text-align: center; letter-spacing: .06em;
}
table.figtable th.rowhead {
  background: var(--accent-tint); color: var(--ink); font-weight: 600;
  font-size: .8rem; padding: .8rem .6rem; text-align: center;
  writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap;
  width: 2.4rem; border: 1px solid var(--line);
}
table.figtable td { border: 1px solid var(--line); padding: .85rem; vertical-align: top; width: 44%; }
table.figtable figure { margin: 0; }
table.figtable img {
  width: 100%; height: auto; display: block; border-radius: 6px;
  background: #0e0e12; border: 1px solid var(--line);
}
.fig-label { font-weight: 700; font-size: .85rem; margin: .55rem 0 .15rem; color: var(--ink); }
.fig-cap { font-size: .82rem; color: var(--ink-soft); margin: 0 0 .35rem; }
.fig-src { font-size: .74rem; color: var(--ink-faint); }
.fig-src a { color: var(--ink-faint); }
.empty-cell { color: var(--ink-faint); font-style: italic; text-align: center; vertical-align: middle; font-size: .85rem; }

/* Side-by-side figure pair (breach illustrations, ad mockups) */
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 1.6rem 0; }
.figure-pair figure { margin: 0; }
.figure-pair img {
  width: 100%; height: auto; display: block; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-alt);
}
.figure-pair figcaption { font-size: .84rem; color: var(--ink-faint); margin-top: .55rem; }
.figure-pair figcaption strong { color: var(--ink-soft); }

/* Placeholder for figures we describe rather than reproduce */
.figure-ref {
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--bg-alt); padding: 1rem 1.2rem; margin: 1.4rem 0 1.8rem;
  font-size: .9rem; color: var(--ink-soft);
}
.figure-ref .figure-ref-label { font-weight: 700; color: var(--ink); display: block; margin-bottom: .3rem; }

/* ---------- Claim call-outs (SeedSpine) ---------- */
.claim-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 1.2rem 0; background: #fff; }
.claim-block h3 { margin-top: 0; }
.testimonial {
  border-left: 3px solid var(--accent); padding: .3rem 0 .3rem 1.1rem;
  margin: 1.1rem 0; font-style: italic; color: var(--ink-soft);
}
.testimonial cite { display: block; font-style: normal; font-weight: 600; color: var(--ink); margin-top: .4rem; font-size: .9rem; }

/* ---------- Disclaimer banner ---------- */
.disclaimer {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-left: 5px solid var(--warn-line); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; margin: 2rem 0; color: var(--warn-ink);
}
.disclaimer strong { color: #4d3c00; }
.disclaimer .disclaimer-head {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; margin-bottom: .4rem; font-size: 1rem;
}
.disclaimer p { margin: .3rem 0 0; font-size: .95rem; line-height: 1.55; }

/* ---------- References ---------- */
.references { margin: 1rem 0 2rem; }
.references h2 { margin-top: 2rem; }
ol.reflist { font-size: .88rem; color: var(--ink-soft); padding-left: 1.4rem; line-height: 1.5; }
ol.reflist li { margin-bottom: .7rem; word-break: break-word; }
ol.reflist a { word-break: break-all; }

/* Back-to-top / page nav */
.page-nav {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin: 2.5rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.page-nav a { font-weight: 600; }
.btn-back {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--accent); color: #fff; padding: .55rem 1rem;
  border-radius: 6px; font-size: .92rem; font-weight: 600;
}
.btn-back:hover { background: var(--accent-dark); text-decoration: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: .5rem 1rem 1rem; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .7rem .6rem; border-radius: 6px; font-size: 1rem; }
  .cards { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .figure-pair { grid-template-columns: 1fr; }
  .signposts { flex-direction: column; align-items: center; }
  .signpost { width: 100%; max-width: 340px; }
  dl.framework > div { grid-template-columns: 1fr; gap: .3rem; }
  dl.framework dt { margin-bottom: .2rem; }
}

/* ---------- Small screens: comparison tables become stacked cards ---------- */
@media (max-width: 640px) {
  table.figtable { display: block; min-width: 0; width: 100%; }
  table.figtable caption { padding: .9rem 0 .4rem; }
  table.figtable thead { display: none; }              /* hide 2D / 3D header row */
  table.figtable tbody,
  table.figtable tr { display: block; }
  table.figtable tr { border-bottom: 2px solid var(--line); padding-bottom: .4rem; margin-bottom: .4rem; }
  table.figtable th.rowhead {                            /* modality label becomes a normal heading */
    display: block; width: auto; writing-mode: horizontal-tb; transform: none;
    text-align: left; border: 0; border-radius: 6px;
    padding: .45rem .8rem; margin: .8rem 0 .2rem;
  }
  table.figtable td { display: block; width: auto; border: 0; padding: .6rem 0; }
  table.figtable td.empty-cell { display: none; }        /* drop lone "—" cells */
  /* The per-figure label (e.g. "Figure 1 — 2D X-ray…") preserves 2D/3D + modality context. */
}

/* ==========================================================================
   Lightbox (click-to-enlarge figures)
   ========================================================================== */
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(12, 18, 24, .88);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  padding: 3vh 4vw;
}
.lightbox.open { display: flex; }
.lightbox-content { margin: 0; max-width: 1040px; max-height: 94vh; display: flex; flex-direction: column; align-items: center; }
.lightbox-content img {
  max-width: 100%; max-height: 82vh; object-fit: contain;
  border-radius: 8px; background: #0e0e12; cursor: zoom-out;
  box-shadow: 0 12px 44px rgba(0, 0, 0, .55);
}
.lightbox-content figcaption {
  color: #e8eef2; font-size: .86rem; margin-top: .85rem;
  text-align: center; line-height: 1.55; max-width: 760px;
}
.lightbox-content figcaption strong { color: #fff; }
.lightbox-content figcaption a { color: #9ecbe0; }
.lightbox-close {
  position: absolute; top: .6rem; right: 1rem;
  background: none; border: 0; color: #fff; font-size: 2.3rem; line-height: 1;
  cursor: pointer; padding: .1rem .6rem; border-radius: 8px;
}
.lightbox-close:hover,
.lightbox-close:focus-visible { background: rgba(255, 255, 255, .16); outline: none; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; }
  .lightbox { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
