/* ═══════════════════════════════════════════════════════════════
   TOKENS
══════════════════════════════════════════════════════════════ */
:root {
  --ink:        #111111;
  --paper:      #FCFCFA;
  --rule:       #E0DDD5;
  --muted:      #6B6B6B;
  --blue:       #1E4FD8;
  --blue-hover: #0A2FB0;
  --measure:    640px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Charter,
           'Georgia Pro', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; scroll-padding-top: 60px; }

/* Scroll progress bar (CSS-only) */
@supports (animation-timeline: scroll()) {
  html::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    height: 2.5px;
    background: var(--blue);
    z-index: 9999;
    width: 100%;
    transform-origin: left;
    transform: scaleX(0);
    animation: scroll-progress linear;
    animation-timeline: scroll();
  }
  @keyframes scroll-progress {
    to { transform: scaleX(1); }
  }
}

/* Page fade-out transition */
.page-fade-out {
  opacity: 0 !important;
  transition: opacity 100ms ease-in !important;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'onum' 1;
  opacity: 0;
  animation: fadein 150ms ease-out forwards;
}

@keyframes fadein { to { opacity: 1; } }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════════ */
.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 64px 48px 112px;
  position: relative;
}

section { margin-top: 52px; position: relative; }

.section-anchor {
  display: block;
  position: relative;
  top: -60px;
  height: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   NAV / MASTHEAD
══════════════════════════════════════════════════════════════ */
.nav {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 64px;
  flex-wrap: wrap;
  row-gap: 4px;
}

.nav-home {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: none;
  margin-right: 2px;
}

.nav-home:hover { color: var(--blue); border-bottom: none; }

.nav-sep {
  color: var(--rule);
  margin: 0 10px;
  user-select: none;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: none;
  position: relative;
  padding-bottom: 1px;
  transition: color 180ms ease;
}

/* Animated underline that grows from left */
.nav a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--blue);
  transition: width 220ms ease;
}

.nav a:hover { color: var(--blue); border-bottom: none; }
.nav a:hover::after { width: 100%; }

/* nav-home: no underline animation, just colour */
.nav-home::after { display: none; }

/* Current page — not a link */
.nav .nav-current {
  color: var(--ink);
  font-weight: 700;
  cursor: default;
}

/* Nav slides down on load */
.nav {
  animation: nav-drop 200ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes nav-drop {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger homepage sections after body fade */
.lede.reveal.visible   { transition-delay: 20ms;  }
.available.reveal.visible { transition-delay: 40ms; }
section.reveal.visible { transition-delay: 60ms; }

/* ═══════════════════════════════════════════════════════════════
   PROSE
══════════════════════════════════════════════════════════════ */
p { margin-bottom: 1.25em; orphans: 2; widows: 2; }
p:last-child { margin-bottom: 0; }
em { font-style: italic; }
strong { font-weight: 600; }

/* Drop cap — only on p.lede */
p.lede { margin-bottom: 1.4em; }

p.lede::first-letter {
  float: left;
  font-size: 4.2em;
  line-height: 0.88;
  padding: 0.06em 0.12em 0 0;
  font-weight: 400;
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════
   AVAILABILITY SIGNAL
   Small pulsing blue dot + italic line. Unmissable but not loud.
══════════════════════════════════════════════════════════════ */
.available {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin-top: 20px;
  margin-bottom: 16px; /* Reduced to pull resume CTA closer */
}

.available-dot {
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.resume-section {
  margin-bottom: 52px; /* Restore spacing below the banner */
}

.resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 200ms ease, background-color 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.resume-btn:hover {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 5%, transparent);
  color: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.resume-btn:active {
  transform: translateY(0);
  background: color-mix(in srgb, var(--blue) 8%, transparent);
}

.resume-icon {
  flex-shrink: 0;
  transition: transform 200ms ease;
}

.resume-btn:hover .resume-icon {
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════
   TABLE-OF-CONTENTS (homepage index)
══════════════════════════════════════════════════════════════ */
.toc { list-style: none; }

.toc-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.toc-entry:first-child { border-top: 1px solid var(--rule); }

.toc-title {
  grid-column: 1;
  grid-row: 1;
  font-size: 15px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  border-bottom: none;
  transition: color 150ms ease;
}

.toc-title::after {
  content: '\00A0↗';
  color: var(--blue);
  font-style: normal;
  font-size: 13px;
}

.toc-title:hover { color: var(--blue); border-bottom: none; }

.toc-tag {
  grid-column: 2;
  grid-row: 1;
  font-size: 12px;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
  align-self: center;
}

.toc-desc {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 16px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   SECTION HEADINGS — sub-pages
══════════════════════════════════════════════════════════════ */
h1.page-title {
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.2;
}

h2 {
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.09em;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

h2 .sec-num {
  display: inline-block;
  width: 26px;
  color: var(--ink);
}

h3 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin-bottom: 4px;
  margin-top: 36px;
  color: var(--ink);
  transition: color 200ms ease;
}

h3:first-child { margin-top: 0; }

.role-meta {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 14px;
}

.project-title-link {
  color: var(--blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 200ms ease;
}

.project-title-link:hover {
  color: var(--blue-hover);
}

.project-title-link::after {
  content: '→';
  display: inline-block;
  transition: transform 180ms ease;
  font-size: 16px;
  color: var(--muted);
}

.project-title-link[target="_blank"]::after {
  content: '↗';
}

.project-title-link:hover::after {
  transform: translate(4px, 0);
  color: var(--blue-hover);
}

.project-title-link[target="_blank"]:hover::after {
  transform: translate(3px, -3px);
}

/* ═══════════════════════════════════════════════════════════════
   LINKS
══════════════════════════════════════════════════════════════ */
a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(30, 79, 216, 0.28);
  transition: text-decoration-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

a:hover {
  color: var(--blue-hover);
  text-decoration-color: var(--blue-hover);
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   SIDENOTES (Tufte-style margin notes)
══════════════════════════════════════════════════════════════ */
.sidenote {
  display: block;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.45;
  margin: 6px 0 10px;
  padding-left: 12px;
  border-left: 2px solid var(--rule);
}

.title-container {
  position: relative;
}

@media (min-width: 1120px) {
  .sidenote {
    position: absolute;
    left: calc(100% + 40px);
    width: 200px;
    margin: -2px 0 0;
    padding-left: 0;
    border-left: none;
    font-size: 13px;
    line-height: 1.5;
  }

  .title-container .sidenote {
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
  }

  .sidenote::before {
    content: '';
    display: inline-block;
    width: 4px; height: 4px;
    background: var(--muted);
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
    opacity: 0.55;
  }

  .has-note { position: relative; }
}

.has-note > p:last-of-type { margin-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════
   NOW LIST
══════════════════════════════════════════════════════════════ */
.now-list {
  list-style: none;
  border-top: 1px dashed var(--rule);
}

.now-list li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--rule);
  display: flex;
  gap: 14px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}

.now-list li::before {
  content: '·';
  color: var(--muted);
  flex-shrink: 0;
}

.now-meta {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 10px;
  font-variant: small-caps;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════
   RECOGNITION LIST (awards, talks)
══════════════════════════════════════════════════════════════ */
.rec-list { list-style: none; }

.rec-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.rec-entry:first-child { border-top: 1px solid var(--rule); }

.rec-title {
  grid-column: 1; grid-row: 1;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.4;
}

.rec-year {
  grid-column: 2; grid-row: 1;
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  align-self: start;
  padding-top: 2px;
}

.rec-sub {
  grid-column: 1 / -1; grid-row: 2;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════
   NOTES / BLOG LIST
══════════════════════════════════════════════════════════════ */
.notes-list { list-style: none; }

.notes-entry {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.notes-entry:first-child { border-top: 1px solid var(--rule); }

.notes-date {
  font-size: 12px;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.notes-entry-title {
  font-size: 19px;
  margin-bottom: 4px;
  line-height: 1.35;
}

.notes-summary {
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

.notes-placeholder { opacity: 0.5; }

/* ═══════════════════════════════════════════════════════════════
   SOCIAL ICONS (colophon)
══════════════════════════════════════════════════════════════ */
.social-icons {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.social-icons a {
  color: var(--muted);
  opacity: 0.6;
  text-decoration: none;
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  transition: color 180ms ease, opacity 180ms ease;
}

.social-icons a:hover {
  color: var(--blue);
  opacity: 1;
  border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════════
   COLOPHON
══════════════════════════════════════════════════════════════ */
.colophon {
  margin-top: 88px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
  line-height: 1.8;
}

.colophon a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 150ms, border-color 150ms;
}

.colophon a:hover { color: var(--blue); border-bottom-color: var(--blue); }

/* ═══════════════════════════════════════════════════════════════
   REVEAL ON SCROLL
══════════════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 480ms ease-out, transform 480ms ease-out;
}

.reveal.visible { opacity: 1; transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  .page { padding: 44px 24px 80px; }
  body { font-size: 18px; }
  .nav {
    margin-bottom: 32px;
    font-size: 13.5px;
    justify-content: center;
    gap: 16px;
  }
  .nav .nav-sep {
    display: none;
  }
  .nav a,
  .nav .nav-current {
    padding: 6px 12px;
  }
  .nav a[href*="resume"],
  .nav a[href*="Resume"] {
    display: none;
  }
  section { margin-top: 40px; }
  p.lede::first-letter { font-size: 3.6em; }
  .toc-entry { grid-template-columns: 1fr; }
  .toc-tag { display: none; }
  .rec-entry { grid-template-columns: 1fr; }
  .rec-year { grid-row: 2; margin-top: -2px; }
  
  h3 {
    font-size: 18px;
    margin-top: 28px;
    margin-bottom: 2px;
  }
  .sidenote {
    margin: 8px 0 22px;
    padding-left: 14px;
  }
}

@media (max-width: 420px) {
  body { font-size: 17px; }
}

/* ═══════════════════════════════════════════════════════════════
   SELECTION / ACCESSIBILITY
══════════════════════════════════════════════════════════════ */
::selection { background: rgba(30, 79, 216, 0.15); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  body { opacity: 1; animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .available-dot { animation: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    transition: none !important;
  }
}

@media print {
  body { background: white !important; color: black !important; font-size: 12pt; }
  .sidenote { position: static; width: auto; font-size: 10pt; margin: 10px 0; display: block; }
  a { color: black !important; text-decoration: underline; }
  .colophon, .reveal { opacity: 1 !important; }
  .nav, .theme-toggle, .back-link, .proj-cta, .available, .colophon .social-icons, #themeToggle, .resume-btn { display: none !important; }
  * { box-shadow: none !important; text-shadow: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   TABS (work.html)
══════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 44px;
  margin-top: 32px;
  position: relative; /* Relative for sliding indicator */
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 20px 10px 0;
  font-family: var(--serif);
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 180ms ease;
  white-space: nowrap;
  position: relative;
  z-index: 2;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.active {
  color: var(--ink);
}

.tab-slider {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
  transition: left 240ms cubic-bezier(0.25, 1, 0.5, 1), width 240ms cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
}

.tab-panel {
  display: none;
  opacity: 0;
  transform: translateY(5px);
}

.tab-panel.active {
  display: block;
  animation: tab-in 150ms ease-out forwards;
}

@keyframes tab-in {
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 580px) {
  .tab-btn { font-size: 12px; padding: 8px 14px 8px 0; }
}

/* ═══════════════════════════════════════════════════════════════
   NOTES — expandable panels
══════════════════════════════════════════════════════════════ */
.note-card {
  border-top: 1px solid var(--rule);
  padding: 0;
  transition: background 150ms ease;
  border-radius: 4px;
}

.note-card:last-child { border-bottom: 1px solid var(--rule); }

.note-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 20px 0;
  cursor: pointer;
  user-select: none;
}

.note-header:hover .note-title { color: var(--blue); }

.note-date {
  grid-column: 1; grid-row: 1;
  font-size: 12px;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.06em;
}

.note-title {
  grid-column: 1; grid-row: 2;
  font-size: 20px;
  line-height: 1.3;
  color: var(--ink);
  transition: color 180ms ease;
}

.note-teaser {
  grid-column: 1; grid-row: 3;
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
  margin-top: 4px;
}

.note-toggle {
  grid-column: 2;
  grid-row: 2 / 4;
  align-self: center;
  font-size: 13px;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.05em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.note-chevron {
  display: inline-block;
  transition: transform 220ms ease;
  font-style: normal;
}

.note-card.open .note-chevron { transform: rotate(180deg); }
.note-card.open .note-title { color: var(--blue); }

/* Slide-open panel */
.note-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 520ms cubic-bezier(0.4, 0, 0.2, 1);
}

.note-card.open .note-body { max-height: 3600px; }

.note-content {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 380ms ease 100ms, transform 380ms ease 100ms;
  padding: 0 0 32px;
  font-size: 17px;
  line-height: 1.7;
  border-top: 1px dashed var(--rule);
  padding-top: 24px;
}

.note-card.open .note-content {
  opacity: 1;
  transform: translateY(0);
}

.note-content p { margin-bottom: 1.1em; }
.note-content p:last-child { margin-bottom: 0; }

.note-content h4 {
  font-size: 14px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 400;
  margin: 1.6em 0 0.5em;
}

.note-content blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 16px;
  font-style: italic;
  color: var(--muted);
  margin: 1.2em 0;
}

.note-content .note-meta {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  margin-top: 1.6em;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

/* The chevron on note cards now points right (modal style) */
.note-chevron { font-style: normal; }

/* ═══════════════════════════════════════════════════════════════
   MODAL READER
══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}

.modal-overlay.open {
  pointer-events: all;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(252, 252, 250, 0.55);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  cursor: pointer;
}

.modal-sheet {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  max-width: 660px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  padding: 48px 52px 52px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  transform: translateY(16px) scale(0.98);
  transition: transform 320ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease;
  opacity: 0;
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 0;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
  z-index: 10;
}

.modal-close:hover {
  background: var(--rule);
  color: var(--ink);
  transform: scale(1.05);
}

.modal-date {
  font-size: 12px;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

.modal-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 28px;
  padding-bottom: 20px;
  padding-right: 44px; /* Ensure title does not overlap absolute close button */
  border-bottom: 1px solid var(--rule);
}

.modal-body { font-size: 17px; line-height: 1.7; }
.modal-body p { margin-bottom: 1.1em; }
.modal-body h4 {
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 400;
  margin: 1.8em 0 0.6em;
}

/* Scrollbar inside modal */
.modal-sheet::-webkit-scrollbar { width: 4px; }
.modal-sheet::-webkit-scrollbar-track { background: transparent; }
.modal-sheet::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }

@media (max-width: 680px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-sheet {
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding: 32px 28px 40px;
    transform: translateY(100%);
    transition: transform 380ms cubic-bezier(0.32, 0.94, 0.6, 1), opacity 380ms ease;
  }
  .modal-sheet::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--rule);
    border-radius: 2px;
    opacity: 0.8;
  }
  .modal-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .modal-overlay.open .modal-sheet {
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════
   RANDOM THOUGHTS
══════════════════════════════════════════════════════════════ */
.thoughts-section { margin-top: 64px; }

.thoughts-header {
  margin-bottom: 0;
}

.thoughts-sub {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  margin: 4px 0 20px;
}

.thought-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.thought-tab {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 6px 16px;
  font-family: var(--serif);
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.thought-tab:hover { color: var(--ink); border-color: var(--ink); }
.thought-tab.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.thought-panel { display: none; }
.thought-panel.active {
  display: block;
  animation: tab-in 300ms ease-out forwards;
}

/* Bento-style masonry grid */
.thought-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.thought-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px 22px 22px;
  position: relative;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.thought-card:hover {
  border-color: rgba(17,17,17,0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

.thought-card.tc-large {
  grid-column: 1 / -1;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.thought-card.tc-wide {
  grid-column: 1 / -1;
}

.thought-card p {
  font-size: 16px;
  line-height: 1.65;
  margin: 0;
  color: inherit;
}

.thought-card.tc-large p { color: var(--paper); }
.thought-card.tc-large .tc-num { color: rgba(252,252,250,0.35); }

.tc-num {
  font-size: 11px;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  color: var(--rule);
  margin-bottom: 10px;
  font-family: var(--mono);
}

@media (max-width: 560px) {
  .thought-grid { grid-template-columns: 1fr; }
  .thought-card.tc-large,
  .thought-card.tc-wide { grid-column: 1; }
}

/* ═══════════════════════════════════════════════════════════════
   NOTEWORTHY READING
══════════════════════════════════════════════════════════════ */
.reading-list { margin-top: 8px; }

.reading-entry {
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}

.reading-entry:first-child { border-top: 1px solid var(--rule); }

.reading-meta {
  margin-bottom: 6px;
}

.reading-source {
  font-size: 12px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.reading-title {
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 12px;
  line-height: 1.3;
}

.reading-quote {
  border-left: 2px solid var(--rule);
  padding-left: 16px;
  font-style: italic;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 12px;
  transition: border-color 200ms ease;
}

.reading-entry:hover .reading-quote { border-left-color: var(--blue); }

.reading-note {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   NOTES PAGE — full-width layout + main tabs
══════════════════════════════════════════════════════════════ */

/* Notes page gets a wider container to use the side margins */
.notes-page .page { max-width: 820px; }

.notes-page-header { margin-bottom: 32px; }

.notes-tagline {
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  margin-top: 6px;
}

/* Main 3-tab row */
.notes-main-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0;
  position: relative; /* Relative for sliding indicator */
}

.notes-main-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 18px 12px;
  font-family: var(--serif);
  font-size: 14px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 180ms ease;
  position: relative;
  z-index: 2;
}

.notes-main-btn svg { opacity: 0.6; transition: opacity 180ms ease; }
.notes-main-btn:hover { color: var(--ink); }
.notes-main-btn:hover svg { opacity: 1; }

.notes-main-btn.active {
  color: var(--ink);
}

.notes-main-btn.active svg { opacity: 1; }

.notes-tab-slider {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
  transition: left 240ms cubic-bezier(0.25, 1, 0.5, 1), width 240ms cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
}

.notes-main-panel { display: none; }
.notes-main-panel.active {
  display: block;
  animation: tab-in 150ms ease-out both;
}

.ntab-sub {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ─── Note cards grid (2-col bento) ─────────────────────────── */
.nc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.nc-card {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
  background: var(--paper);
}

.nc-card:hover {
  border-color: rgba(17,17,17,0.3);
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
  transform: translateY(-3px);
}

.nc-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Large accent number */
.nc-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--rule);
  padding: 18px 20px 0;
  transition: color 220ms ease;
}

.nc-card:hover .nc-num { color: var(--muted); }

.nc-inner {
  padding: 10px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.nc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.nc-tag {
  font-size: 11px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--paper);
  background: var(--ink);
  padding: 2px 8px;
  border-radius: 10px;
}

.nc-date {
  font-size: 12px;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.05em;
}

.nc-title {
  font-size: 19px;
  line-height: 1.3;
  margin-bottom: 10px;
  transition: color 180ms ease;
}

.nc-card:hover .nc-title { color: var(--blue); }

.nc-teaser {
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
  margin-bottom: 16px;
}

.nc-cta {
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 180ms ease;
}

.nc-card:hover .nc-cta { color: var(--blue); }

@media (max-width: 600px) {
  .nc-grid { grid-template-columns: 1fr; }
}

/* ─── Reading tab — magazine style ──────────────────────────── */
.rf-list { margin-top: 4px; }

.rf-entry {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0 24px;
  padding: 36px 0;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.rf-entry:first-child { border-top: 1px solid var(--rule); }

/* Blue bar on hover */
.rf-entry::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--blue);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 300ms ease;
}

.rf-entry:hover::before { transform: scaleY(1); }

.rf-num {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 400;
  color: var(--rule);
  padding-top: 4px;
  line-height: 1;
  transition: color 220ms ease;
}

.rf-entry:hover .rf-num { color: var(--ink); }

.rf-body {}

.rf-source {
  font-size: 12px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}

.rf-title {
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 18px;
}

.rf-quote {
  border-left: none;
  padding: 0;
  margin: 0 0 16px;
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--ink);
}

.rf-quote p { margin-bottom: 1em; }
.rf-quote p:last-child { margin-bottom: 0; }
.rf-quote strong { font-weight: 600; font-style: normal; }

.rf-sep {
  border: none;
  border-top: 1px dashed var(--rule);
  margin: 16px 0;
}

.rf-note {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  line-height: 1.5;
  font-style: italic;
}

@media (max-width: 600px) {
  .rf-entry { grid-template-columns: 1fr; gap: 0; }
  .rf-num { font-size: 14px; margin-bottom: 8px; }
  .rf-entry::before { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   HOMEPAGE — TOC icon + hover bar + stagger
══════════════════════════════════════════════════════════════ */
.toc-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 7px;
  opacity: 0.5;
  transition: opacity 180ms ease;
  flex-shrink: 0;
}

.toc-title:hover .toc-icon,
.toc-entry:hover .toc-icon { opacity: 1; }

/* Left blue bar on toc row hover */
.toc-entry {
  position: relative;
  transition: background 200ms ease;
}

.toc-entry::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--blue);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 280ms ease;
}

.toc-entry:hover::before { transform: scaleY(1); }

/* Stagger entrance on homepage */
.toc-entry:nth-child(1) { animation-delay: 80ms; }
.toc-entry:nth-child(2) { animation-delay: 160ms; }

/* Now list icons */
.now-list li {
  align-items: flex-start;
}

/* ═══════════════════════════════════════════════════════════════
   HOMEPAGE — subtle dot-grid background ornament
══════════════════════════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  top: 0; right: 0;
  width: 320px; height: 320px;
  background-image: radial-gradient(circle, rgba(17,17,17,0.055) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at top right, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at top right, black 20%, transparent 70%);
}

/* only on index */
body:not(.notes-page) .page { position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════════════════
   DARK MODE TOKENS
══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --ink:        #D8D4CC;
  --paper:      #141210;
  --rule:       #2A2723;
  --muted:      #7A756C;
  --blue:       #7AA2F7;
  --blue-hover: #9ABCF8;
}


/* Smooth transition for all elements on theme switch */
*, *::before, *::after {
  transition: background-color 300ms ease, border-color 300ms ease, color 300ms ease, opacity 300ms ease;
}


/* Dark dot-grid */
[data-theme="dark"] body::before {
  background-image: radial-gradient(circle, rgba(255,255,255,0.055) 1px, transparent 1px);
}

/* Dark selection */
[data-theme="dark"] ::selection {
  background: rgba(91, 138, 240, 0.25);
  color: var(--ink);
}

/* Dark modal sheet */
[data-theme="dark"] .modal-sheet {
  background: #1C1916;
  border-color: #2A2723;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(20, 18, 16, 0.72);
  backdrop-filter: blur(20px) saturate(0.8);
  -webkit-backdrop-filter: blur(20px) saturate(0.8);
}

/* Dark rcard and life-card */
[data-theme="dark"] .rcard,
[data-theme="dark"] .life-card {
  background: #1C1916;
  border-color: #2A2723;
}

[data-theme="dark"] .nc-card {
  background: #1C1916;
  border-color: #2A2723;
}

/* Dark tags — outline pill, no blinding solid fill */
[data-theme="dark"] .nc-tag,
[data-theme="dark"] .rcard-source {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
══════════════════════════════════════════════════════════════ */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.theme-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: scale(1.08);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Spin animation on click */
.theme-toggle.spin { animation: toggle-spin 400ms ease-out !important; }
@keyframes toggle-spin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(0.85); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Theme toggle mobile specific styles */
@keyframes toggle-mobile-entrance {
  from { transform: translate(100px, 0) rotate(90deg); opacity: 0; }
  to { transform: translate(0, 0) rotate(0deg); opacity: 1; }
}

@keyframes toggle-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 0 0 0px color-mix(in srgb, var(--blue) 25%, transparent); }
  50% { box-shadow: 0 4px 16px rgba(0,0,0,0.15), 0 0 0 8px color-mix(in srgb, var(--blue) 0%, transparent); }
}

@media (max-width: 680px) {
  .theme-toggle {
    top: auto;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    animation: toggle-mobile-entrance 600ms cubic-bezier(0.16, 1, 0.3, 1) 400ms both,
               toggle-pulse 2.5s ease-in-out 2s infinite;
  }
}

/* ═══════════════════════════════════════════════════════════════
   LIFE TAB — 2×2 card grid
══════════════════════════════════════════════════════════════ */
.life-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}

.life-card {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px 22px 22px;
  background: var(--paper);
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
  position: relative;
  overflow: hidden;
}

/* Subtle top-left corner accent */
.life-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 40px; height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms ease;
}

.life-card:hover {
  border-color: rgba(17,17,17,0.25);
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
}

.life-card:hover::before { transform: scaleX(1); }

[data-theme="dark"] .life-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

.life-icon {
  color: var(--muted);
  margin-bottom: 14px;
  transition: color 220ms ease, transform 220ms ease;
}

.life-card:hover .life-icon {
  color: var(--blue);
  transform: rotate(8deg);
}

.life-card:hover .life-title {
  color: var(--blue);
}

.life-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  transition: color 180ms ease;
}

.life-card p {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
}

@media (max-width: 560px) {
  .life-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   RECOGNITION — redesigned single-column with category headers
══════════════════════════════════════════════════════════════ */
.rec-section { padding-top: 4px; }

.rec-category { margin-bottom: 44px; }
.rec-category:last-child { margin-bottom: 0; }

.rec-cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
  transition: border-color 200ms ease;
}

.rec-cat-header:hover {
  border-color: var(--blue);
}

.rec-cat-header:hover .rec-cat-icon {
  color: var(--blue);
  transform: scale(1.1) rotate(-8deg);
}

.rec-cat-header:hover .rec-cat-label {
  color: var(--ink);
}

.rec-cat-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--rule);
}

.rec-cat-icon {
  color: var(--muted);
  flex-shrink: 0;
  transition: color 200ms ease, transform 200ms ease;
}

.rec-cat-label {
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 400;
  transition: color 200ms ease;
}

.rec-items { list-style: none; }

.rec-item {
  padding: 16px 12px;
  margin: 0 -12px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: background-color 200ms ease, padding-left 200ms ease;
  border-radius: 6px;
}

.rec-item:hover {
  background: color-mix(in srgb, var(--blue) 3%, transparent);
  padding-left: 18px;
}

/* Blue left accent on hover */
.rec-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 14px; bottom: 14px;
  width: 3px;
  background: var(--blue);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 260ms ease;
  border-radius: 1.5px;
}

.rec-item:hover::before { transform: scaleY(1); }

.rec-item:last-child { border-bottom: none; }

.rec-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.rec-item-title {
  font-size: 17px;
  color: var(--ink);
  line-height: 1.4;
  flex: 1;
  transition: color 180ms ease;
}

.rec-item:hover .rec-item-title { color: var(--blue); }

.rec-item-year {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.rec-item-sub {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   DROP CAP on homepage lede — ink colour, no blue
══════════════════════════════════════════════════════════════ */
p.lede-blue::first-letter {
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════
   EXTRA ANIMATION: social icon lift
══════════════════════════════════════════════════════════════ */
.social-icons a:hover {
  transform: translateY(-2px);
}

/* nc-num blue on card hover */
.nc-card:hover .nc-num { color: var(--blue); }

/* ═══════════════════════════════════════════════════════════════
   WORTH READING — card grid
══════════════════════════════════════════════════════════════ */
.rcard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}

.rcard {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 22px 22px 18px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
  position: relative;
}

.rcard::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 8px 8px 0 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms ease;
}

.rcard:hover {
  border-color: rgba(17,17,17,0.22);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

[data-theme="dark"] .rcard:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.3); }

.rcard:hover::before { transform: scaleX(1); }

.rcard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.rcard-source {
  font-size: 11px;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--rule);
  padding: 2px 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--rule) 15%, transparent);
  display: inline-block;
  line-height: 1;
}

.rcard-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--rule);
}

.rcard-title {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  transition: color 180ms ease;
}

.rcard-quote {
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
  border-left: 2px solid var(--rule);
  padding-left: 12px;
  margin-bottom: 12px;
  flex: 1;
  transition: border-color 220ms ease;
}

.rcard:hover .rcard-quote { border-left-color: var(--blue); }
.rcard:hover .rcard-title { color: var(--blue); }

.rcard-cta {
  font-size: 12px;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: auto;
  padding-top: 12px;
  transition: color 180ms ease;
}

.rcard:hover .rcard-cta { color: var(--blue); }

@media (max-width: 600px) {
  .rcard-grid { grid-template-columns: 1fr; }
}

/* ─── Home logo letter-wave keyframes ────────────────────────────── */
@keyframes letter-wave {
  0%, 100% { transform: translateY(0); color: inherit; }
  50% { transform: translateY(-6px); color: var(--blue); }
}

/* ─── Tactile Mobile Touch Feedback ──────────────────────────────── */
@media (hover: none) {
  .rcard:active, .life-card:active, .note-card:active, .nc-card:active, .feat-card:active, .proj-stat:active, .stat-box:active, .rec-item:active {
    transform: translateY(1px) scale(0.97);
    background: color-mix(in srgb, var(--blue) 5%, transparent);
    transition: transform 80ms ease, background-color 80ms ease;
  }
  .tab-btn:active, .resume-btn:active, .btn:active, .modal-close:active, .back-to-top:active {
    transform: scale(0.95);
    opacity: 0.85;
    transition: transform 80ms ease, opacity 80ms ease;
  }
  .toc-entry:active {
    background: color-mix(in srgb, var(--blue) 5%, transparent);
  }
  .toc-entry:active::before {
    transform: scaleY(1);
  }
  .nav a:active {
    color: var(--blue);
    transform: scale(0.95);
  }
}

/* ─── Social Icons Floating Tooltips (Pure CSS) ─────────────────── */
.social-icons a {
  position: relative;
}

.social-icons a::after {
  content: attr(aria-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--paper);
  padding: 5px 9px;
  font-size: 9px;
  font-family: var(--mono);
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.social-icons a:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

/* Dark mode custom background for tooltips */
[data-theme="dark"] .social-icons a::after {
  background: var(--rule);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.05);
}

/* ─── Floating Back-to-Top Button ────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 76px;
  z-index: 199;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 220ms ease, transform 220ms ease, border-color 200ms ease, color 200ms ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0);
}

@media (max-width: 680px) {
  .back-to-top {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 76px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .back-to-top:hover {
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM INTERACTIONS & VISUAL EFFECTS
   - View Transitions clip-path customization
   - Mouse-tracking 3D Tilt & Radial Glass Glow for Cards
   - Ambient Background Glow
   - Staggered Entrances
   - Responsive Adjustments
══════════════════════════════════════════════════════════════ */

/* Custom View Transitions for Circular Theme Switch */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* 3D Tilt & Radial Glass Glow for Cards */
.nc-card, .rcard, .life-card {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.nc-card::after, .rcard::after, .life-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    600px circle at var(--mx, 0px) var(--my, 0px),
    rgba(122, 162, 247, 0.05),
    transparent 40%
  );
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}

.nc-card:hover::after, .rcard:hover::after, .life-card:hover::after {
  opacity: 1;
}

[data-theme="dark"] .nc-card::after,
[data-theme="dark"] .rcard::after,
[data-theme="dark"] .life-card::after {
  background: radial-gradient(
    600px circle at var(--mx, 0px) var(--my, 0px),
    rgba(255, 255, 255, 0.04),
    transparent 45%
  );
}

/* Ambient Background Follow-Glow */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(
    800px circle at var(--bg-x, 50%) var(--bg-y, 50%),
    rgba(122, 162, 247, 0.015),
    transparent 50%
  );
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms ease;
}

body:hover::after {
  opacity: 1;
}

[data-theme="dark"] body::after {
  background: radial-gradient(
    800px circle at var(--bg-x, 50%) var(--bg-y, 50%),
    rgba(122, 162, 247, 0.03),
    transparent 60%
  );
}

/* Staggered entrances on scroll */
.reveal.stagger-in {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

.reveal.stagger-in > * {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 300ms cubic-bezier(0.16, 1, 0.3, 1), transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.stagger-in.visible > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal.stagger-in.visible > *:nth-child(1) { transition-delay: 20ms; }
.reveal.stagger-in.visible > *:nth-child(2) { transition-delay: 40ms; }
.reveal.stagger-in.visible > *:nth-child(3) { transition-delay: 60ms; }
.reveal.stagger-in.visible > *:nth-child(4) { transition-delay: 80ms; }
.reveal.stagger-in.visible > *:nth-child(5) { transition-delay: 100ms; }
.reveal.stagger-in.visible > *:nth-child(6) { transition-delay: 120ms; }
.reveal.stagger-in.visible > *:nth-child(7) { transition-delay: 140ms; }
.reveal.stagger-in.visible > *:nth-child(8) { transition-delay: 160ms; }

/* Ensure side button transitions are smooth */
.resume-btn, .btn, .back-link, .theme-toggle {
  transition: transform 300ms cubic-bezier(0.25, 1, 0.5, 1), background-color 220ms, border-color 220ms, color 220ms, box-shadow 220ms;
}

/* Dark mode social icon overrides for improved contrast & interactive glow */
[data-theme="dark"] .social-icons a {
  opacity: 0.75;
}
[data-theme="dark"] .social-icons a:hover {
  opacity: 1;
  filter: drop-shadow(0 0 4px var(--blue));
}

