/* Self-hosted fonts: same files Google serves, without the blocking cross-origin chain.
   Libre Baskerville ships as a variable font, so 400 and 700 share one file. */
@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/libre-baskerville-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/libre-baskerville-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/libre-baskerville-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/libre-baskerville-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/libre-baskerville-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/libre-baskerville-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url('/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font-serif: "Libre Baskerville", Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Warm paper light palette */
  --background: hsl(36 8% 94%);
  --foreground: hsl(0 0% 8%);
  --card: hsl(0 0% 100%);
  --primary: hsl(0 0% 9%);
  --secondary: hsl(0 0% 90% / 0.6);
  --muted: hsl(0 0% 40%);
  --border: hsl(0 0% 84%);
}

[data-theme="dark"] {
  /* Deep zinc dark palette */
  --background: hsl(240 10% 4%);
  --foreground: hsl(0 0% 95%);
  --card: hsl(240 10% 4%);
  --primary: hsl(0 0% 98%);
  --secondary: hsl(240 3.7% 15% / 0.6);
  --muted: hsl(240 5% 62%);
  --border: hsl(240 3.7% 18%);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-serif);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg, picture, video {
  max-width: 100%;
  height: auto;
}

a, button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) {
  a:hover {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

a:active {
  opacity: 0.75;
}

/* Center-Aligned Page Container with safe-area support */
.page-container {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem 1.5rem;
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

/* Top Navigation Bar */
.top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 3.5rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  list-style: none;
  row-gap: 0.35rem;
}

.nav-links li {
  display: inline-flex;
  align-items: center;
}

.nav-links li:not(:last-child)::after {
  content: "·";
  margin: 0 0.55rem;
  color: var(--muted);
  font-weight: bold;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0.2rem;
}

@media (hover: hover) {
  .nav-links a:hover,
  .nav-links a.active {
    color: var(--foreground);
    font-weight: 500;
  }
}

.nav-links a.active {
  color: var(--foreground);
  font-weight: 500;
}

.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s;
}

@media (hover: hover) {
  .theme-toggle-btn:hover {
    color: var(--foreground);
  }
}

/* Minimal Hero */
.hero-section {
  margin-bottom: 3.5rem;
}

.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(1.75rem, 5vw, 2.15rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-avatar {
  width: clamp(58px, 12vw, 68px);
  height: clamp(58px, 12vw, 68px);
  aspect-ratio: 1 / 1;
  border-radius: 24%;
  object-fit: cover;
  border: 1px solid var(--border);
  filter: grayscale(100%);
  transition: filter 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
}

.hero-avatar:hover {
  filter: grayscale(0%);
  transform: scale(1.04);
}

.hero-bio {
  font-size: 1.02rem;
  color: var(--muted);
  line-height: 1.75;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.hero-bio p {
  margin-bottom: 1rem;
}

.hero-bio p:last-child {
  margin-bottom: 0;
}

.social-links-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1.25rem;
}

.social-icon-link {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, transform 0.15s;
}

.social-icon-link:hover {
  color: var(--foreground);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Sections */
.section-block {
  margin-bottom: 3.5rem;
}

.section-heading {
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* Minimal Experience */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.exp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.98rem;
}

.exp-role {
  font-weight: 500;
  color: var(--foreground);
}

.exp-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.exp-tags {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.5;
}

/* Minimal Writing List */
.writing-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.writing-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.25rem 0;
}

.writing-item-row-divided {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.writing-item-row-divided:last-child {
  border-bottom: none !important;
}

.writing-link-title {
  font-size: 1.02rem;
  color: var(--foreground);
  font-weight: 400;
  line-height: 1.5;
}

.writing-item-row:hover .writing-link-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.writing-date-meta {
  font-size: 0.84rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Minimal Projects List */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.project-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.project-item-divided {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.project-item-divided:last-child {
  border-bottom: none !important;
}

.project-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.project-item-title {
  font-size: 1.02rem;
  font-weight: 500;
}

.project-item-links {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
}

.project-item-desc {
  font-size: 0.94rem;
  color: var(--muted);
  line-height: 1.6;
}

.project-item-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Article / Longform Reading */
article.article-body {
  line-height: 1.8;
}

article.article-body h1 {
  font-size: clamp(1.75rem, 5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--muted);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

article.article-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.85rem 0;
}

article.article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.75rem 0 0.6rem 0;
}

article.article-body p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
  color: var(--foreground);
}

article.article-body ul,
article.article-body ol {
  margin: 1rem 0 1.5rem 1.5rem;
  font-size: 0.98rem;
}

article.article-body li {
  margin-bottom: 0.4rem;
}

article.article-body blockquote {
  border-left: 2px solid var(--foreground);
  padding-left: 1rem;
  margin: 1.75rem 0;
  color: var(--muted);
  font-style: italic;
}

article.article-body pre {
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  margin: 1.5rem 0;
  line-height: 1.5;
}

article.article-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--secondary);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

article.article-body pre code {
  background: none;
  padding: 0;
}

article.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Mermaid Diagrams */
.mermaid-container {
  display: flex;
  justify-content: center;
  margin: 2.25rem 0;
  padding: 1.5rem 1rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mermaid-container pre.mermaid {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.mermaid-container svg {
  max-width: 100%;
  height: auto;
}

/* Tables for Research */
.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  overscroll-behavior-x: contain;
}

table.research-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  text-align: left;
  min-width: 480px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

table.research-table th,
table.research-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

table.research-table th {
  background-color: var(--secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

table.research-table td {
  font-family: var(--font-mono);
}

table.research-table tr:last-child td {
  border-bottom: none;
}

/* Math Block Handling */
.math-block {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding: 0.5rem 0;
}

/* Navigation Links */
.back-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

@media (hover: hover) {
  .back-link:hover {
    color: var(--foreground);
  }
}

.back-link:active {
  opacity: 0.7;
}

/* Single Bottom Fin Bar */
.fin-bar {
  margin-top: 4.5rem;
  padding-top: 1.5rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fin-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  font-weight: 400;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: var(--secondary);
  color: var(--foreground);
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Responsive Media Queries */
@media (max-width: 600px) {
  .page-container {
    padding: 2rem 1.15rem 4rem 1.15rem;
    padding-left: max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
  }
  
  .top-bar {
    margin-bottom: 2rem;
    font-size: 0.82rem;
  }

  .top-bar nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .top-bar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-links {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.4rem;
    padding: 0.25rem 0;
  }

  .nav-links li:not(:last-child)::after {
    display: none;
  }

  .nav-links a,
  .nav-links .theme-toggle-btn {
    padding: 0.35rem 0.65rem;
    background-color: var(--secondary);
    border-radius: 4px;
    white-space: nowrap;
    font-size: 0.8rem;
    min-height: 38px;
    min-width: 38px;
  }

  .nav-links a.active {
    background-color: var(--primary);
    color: var(--background);
  }

  .hero-section {
    margin-bottom: 2.75rem;
  }

  .section-block {
    margin-bottom: 2.75rem;
  }

  .exp-row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .writing-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .writing-date-meta {
    font-size: 0.8rem;
    color: var(--muted);
  }

  .project-item-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .project-item-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .project-item-links a {
    min-height: 36px;
    padding: 0.2rem 0.5rem;
    background-color: var(--secondary);
    border-radius: 3px;
  }

  .project-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  article.article-body ul,
  article.article-body ol {
    margin: 0.75rem 0 1.25rem 1.15rem;
  }

  article.article-body pre {
    padding: 0.75rem;
    font-size: 0.82rem;
  }
}

/* Samuel's homepage is scoped separately from the existing archive pages. */
.home-page {
  --background: #f7f5f0;
  --foreground: #1a1c18;
  --primary: #1a1c18;
  --muted: #5a5c54;
  --border: #e0e2d8;
  --secondary: #ebe9e4;
  --accent: #2d4a3e;
  --profile-section-gap: 4rem;
  --profile-entry-gap: 2rem;
  scroll-padding-top: 1.5rem;
  scrollbar-color: var(--border) var(--background);
}

.home-page[data-theme="dark"] {
  --background: #0f1110;
  --foreground: #e8e6e0;
  --primary: #e8e6e0;
  --muted: #8a8c84;
  --border: #2a2d28;
  --secondary: #1a1d18;
  --accent: #7a9a8a;
}

.home-page ::selection {
  background: var(--foreground);
  color: var(--background);
}

/* Add subtle gradient to hero section */
.profile-hero {
  position: relative;
  overflow-x: clip;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -2rem;
  left: -2rem;
  right: -2rem;
  bottom: -2rem;
  background: radial-gradient(ellipse at top right, var(--secondary) 0%, transparent 60%);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.home-page .page-container {
  max-width: 720px;
  padding: 3rem 1.5rem 4rem;
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

.home-page a:focus-visible,
.home-page button:focus-visible {
  outline: 2px solid var(--foreground);
  outline-offset: 4px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  z-index: 1;
  padding: 0.5rem 1rem;
  background: var(--background);
  border: 1px solid var(--foreground);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.home-page .profile-nav {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--profile-section-gap);
}

.profile-nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  list-style: none;
  flex-wrap: wrap;
  row-gap: 0;
}

.profile-nav-links a[aria-current] {
  color: var(--foreground);
}

.profile-nav-links a[aria-current]::after {
  transform: scaleX(1);
}

.home-page article.article-body .sample-note {
  color: var(--muted);
  font-size: 0.9rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.home-page article.article-body {
  max-width: 70ch;
  margin-inline: auto;
}

.profile-nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0.2rem;
  color: var(--muted);
  font-size: 0.86rem;
  transition: color 0.2s ease, transform 0.2s ease;
  position: relative;
  font-family: var(--font-serif);
}

.profile-nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--foreground);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

@media (hover: hover) {
  .profile-nav-links a:hover::after {
    transform: scaleX(1);
  }
}

.profile-nav-links a:active {
  opacity: 0.7;
}

.home-page .theme-toggle-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  white-space: nowrap;
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
  border-radius: 4px;
  font-family: var(--font-serif);
}

@media (hover: hover) {
  .home-page .theme-toggle-btn:hover {
    background-color: var(--secondary);
    transform: scale(1.05);
  }
}

.home-page .theme-toggle-btn:active {
  transform: scale(0.96);
}

.profile-name {
  font-size: clamp(2rem, 7.5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-wrap: balance;
  margin-bottom: 0.5rem;
  overflow-wrap: break-word;
}

.profile-lede {
  max-width: 52ch;
  margin-top: 1.5rem;
  font-size: clamp(1.2rem, 2.5vw, 1.35rem);
  line-height: 1.6;
  text-wrap: pretty;
  color: var(--foreground);
  font-weight: 400;
}

.profile-bio {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
  max-width: 58ch;
}

.profile-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1.5rem;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  max-width: 100%;
  font-size: 0.92rem;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  overflow-wrap: anywhere;
  transition: all 0.2s ease;
  position: relative;
}

@media (hover: hover) {
  .profile-link:hover {
    text-decoration-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
  }
}

.profile-link:active {
  opacity: 0.7;
}

.profile-link-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.profile-section {
  margin-top: var(--profile-section-gap);
}

.profile-section-heading {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.3;
  text-wrap: balance;
  position: relative;
}

.profile-entry-list {
  display: grid;
  gap: var(--profile-entry-gap);
}

.profile-entry {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (hover: hover) {
  .profile-entry:hover {
    transform: translateX(3px);
  }
}

.profile-entry:active {
  opacity: 0.85;
}

.profile-entry-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
}

.profile-entry-title {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.4;
  text-wrap: pretty;
}

.profile-entry-title .profile-link {
  font-size: inherit;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .profile-entry-title .profile-link:hover {
    color: var(--accent);
  }
}

.profile-entry-role,
.profile-entry-date,
.profile-study-meta {
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  line-height: 1.5;
  font-weight: 400;
}

.profile-entry-role {
  margin-top: 0.25rem;
}

.profile-entry-date,
.profile-study-meta {
  font-variant-numeric: tabular-nums;
}

.profile-entry-description,
.profile-entry-impact,
.profile-campus-note,
.profile-contact > p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.profile-entry-description {
  margin-top: 0.5rem;
}

.profile-entry-impact {
  margin-top: 0.75rem;
  color: var(--foreground);
  font-weight: 400;
  line-height: 1.6;
  border-left: 2px solid var(--accent);
  padding-left: 0.75rem;
}

.profile-study-degree {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.profile-study-meta {
  text-align: right;
}

.profile-notes {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
  font-size: 0.92rem;
  line-height: 1.7;
}

.profile-note {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1rem;
  transition: background-color 0.2s ease;
  padding: 0.5rem;
  border-radius: 4px;
}

@media (hover: hover) {
  .profile-note:hover {
    background-color: var(--secondary);
  }
}

.profile-note dt {
  font-weight: 500;
  color: var(--foreground);
  text-transform: lowercase;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.profile-note dd {
  color: var(--muted);
}

.profile-exam-study {
  display: inline;
}

.profile-campus-note {
  margin-top: 1.25rem;
}

.profile-contact .profile-section-heading {
  border: none;
  padding-bottom: 0;
  margin-bottom: 1rem;
}

.profile-contact .profile-location {
  margin-top: 1rem;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.home-page .fin-bar {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .home-page {
    --profile-section-gap: 3rem;
    --profile-entry-gap: 1.75rem;
  }

  .home-page .page-container {
    padding: 1.5rem 1.25rem 3.5rem;
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
  }

  .home-page .profile-nav {
    margin-bottom: 2rem;
    gap: 0.5rem;
  }

  .profile-nav-links {
    gap: clamp(0.5rem, 2.5vw, 1.25rem);
  }

  .profile-entry-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-study-meta {
    text-align: left;
  }

  .profile-note {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }

  .profile-hero::before {
    top: -1rem;
    left: -1rem;
    right: -1rem;
    bottom: -1rem;
  }
}

@media (max-width: 400px) {
  .home-page .page-container {
    padding: 1.25rem 1rem 3rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .profile-nav-links {
    gap: 0.4rem;
  }

  .profile-nav-links a {
    font-size: 0.82rem;
    padding: 0.2rem 0.1rem;
  }
  
  .home-page .theme-toggle-btn {
    font-size: 0.8rem;
    padding: 0.35rem;
    min-width: 38px;
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-page {
    scroll-behavior: auto;
  }

  .home-page a,
  .home-page button {
    transition: none;
  }
}
