/* Michael V. Heinz, M.D. — michaelvheinz.com
 * Subtle, elegant. Editorial typography. No flash.
 */

:root {
  --bg: #fbfaf7;
  --bg-elev: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-mute: #767676;
  --rule: #e6e3dc;
  --accent: #6b1f1f; /* deep oxblood — subtle, scholarly */
  --accent-soft: #9a3a3a;
  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 38rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --bg-elev: #1c1b17;
    --ink: #ece9e2;
    --ink-soft: #c8c4ba;
    --ink-mute: #8e8a80;
    --rule: #2a2823;
    --accent: #c89191;
    --accent-soft: #b07474;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* ── Reading progress hairline ─────────────────────── */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 20;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ── Reveal on scroll ──────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.08s; }
.reveal.delay-2 { transition-delay: 0.16s; }
.reveal.delay-3 { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1; transform: none; transition: none; }
  .progress { display: none; }
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s ease, color 0.2s ease;
}
a:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0;
}

h1 { font-size: clamp(2rem, 7vw, 3.75rem); line-height: 1.05; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.15; margin-bottom: 1rem; }
h3 { font-size: 1.2rem; line-height: 1.3; font-weight: 600; }

p { margin: 0 0 1em; }

.container {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.narrow { max-width: 44rem; }

/* ── Nav ───────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem var(--gutter);
  max-width: 64rem;
  margin: 0 auto;
  flex-wrap: wrap;
}
.nav-brand {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  border: none;
}
.nav-brand:hover { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.nav-links a {
  border: none;
  color: var(--ink-soft);
}
.nav-links a:hover { color: var(--accent); }

@media (max-width: 720px) {
  .nav-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem var(--gutter);
  }
  .nav-brand { font-size: 1rem; }
  .nav-links {
    width: 100%;
    gap: 1.1rem;
    font-size: 0.85rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .nav-links::-webkit-scrollbar { display: none; }
}

/* ── Hero ──────────────────────────────────────────── */
.hero {
  padding: clamp(2.5rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 4rem);
  border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
@media (min-width: 720px) {
  .hero-grid { grid-template-columns: 1fr 200px; }
}
.hero-eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-bottom: 1rem;
}
.hero-name {
  margin-bottom: 0.5rem;
  word-break: break-word;
  hyphens: none;
}
.hero-title {
  font-family: var(--sans);
  font-size: 1.1rem;
  color: var(--ink-soft);
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.hero-title em {
  font-style: normal;
  color: var(--ink-mute);
}
.hero-cv {
  margin-top: 1.75rem;
  margin-bottom: 0;
}
.cv-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--bg-elev);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.cv-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-elev);
}
.cv-link-label {
  letter-spacing: 0.01em;
}
.cv-link-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.portrait {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
  justify-self: center;
  will-change: transform;
  transition: transform 0.3s ease;
}
.portrait:hover { transform: scale(1.02); }

/* ── Sections ──────────────────────────────────────── */
section {
  padding: clamp(3rem, 6vw, 5rem) 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: none; }

.section-label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--ink-mute);
  margin-bottom: 0.5rem;
  display: block;
}

/* ── Prose ─────────────────────────────────────────── */
.prose {
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}
.prose p:first-of-type::first-letter {
  /* subtle, no drop cap to stay restrained */
}

/* ── Featured (Therabot) ───────────────────────────── */
.featured {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  margin-top: 1.25rem;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.featured + .featured { margin-top: 1rem; }
.featured:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--rule));
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -16px rgba(107, 31, 31, 0.18);
}
@media (prefers-reduced-motion: reduce) {
  .featured, .featured:hover { transform: none; transition: none; box-shadow: none; }
}
.featured-eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.featured h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}
.featured-meta {
  font-size: 0.9rem;
  color: var(--ink-mute);
  margin-bottom: 1rem;
  font-style: italic;
}
.featured p { color: var(--ink-soft); }
.featured-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ── Lists / Experience / Education ────────────────── */
.entries {
  list-style: none;
  padding: 0;
  margin: 0;
}
.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem 2rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  transition: padding-left 0.3s ease;
}
.entry:hover {
  padding-left: 0.35rem;
}
.entry:hover .entry-title {
  color: var(--accent);
}
.entry-title {
  transition: color 0.3s ease;
}
@media (prefers-reduced-motion: reduce) {
  .entry, .entry:hover { padding-left: 0; transition: none; }
}
.entry:first-child { border-top: none; }
@media (min-width: 640px) {
  .entry { grid-template-columns: 9rem 1fr; }
}
.entry-date {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-mute);
  letter-spacing: 0.01em;
  padding-top: 0.2rem;
}
.entry-body { }
.entry-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.1rem;
  color: var(--ink);
}
.entry-org {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.entry-detail {
  font-size: 0.92rem;
  color: var(--ink-mute);
  line-height: 1.55;
}

/* ── Publications ──────────────────────────────────── */
.pub {
  position: relative;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  font-size: 0.97rem;
  line-height: 1.55;
}
.pub:first-child { border-top: none; }
.pub-authors { color: var(--ink-soft); }
.pub-authors .me { color: var(--ink); font-weight: 600; }
.pub-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.1rem;
  margin: 0.2rem 0 0.2rem;
  color: var(--ink);
  font-weight: 500;
}
.pub-venue {
  font-style: italic;
  color: var(--ink-soft);
}
.pub > .pub-year {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}
.pub-year { color: var(--ink-mute); }
.pub-links {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
}
.pub-links a {
  color: var(--ink-mute);
  border-bottom-color: var(--rule);
  margin-right: 1rem;
}
.pub-links a:hover { color: var(--accent); }

.see-more {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  color: var(--ink-mute);
}

/* ── Press ─────────────────────────────────────────── */
.press-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem 2rem;
  margin-top: 1rem;
}
.press-item {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.press-outlet {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-bottom: 0.35rem;
}
.press-headline {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--ink);
}
.press-headline a { border: none; }
.press-headline a:hover { color: var(--accent); }

/* ── Contact ───────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 1.02rem;
}
.contact-line {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}
.contact-label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--ink-mute);
  min-width: 5.5rem;
  padding-top: 0.15rem;
}

/* ── Footer ────────────────────────────────────────── */
footer {
  padding: 2.5rem 0 3rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
  text-align: center;
}
footer a { color: var(--ink-mute); border-bottom-color: var(--rule); }

/* ── Utility ───────────────────────────────────────── */
.dot { color: var(--ink-mute); margin: 0 0.5rem; }
