/* =========================================================
   Design tokens
   ========================================================= */
:root {
  /* Refined emerald + warm amber on warm paper — academic feel */
  --maincolor: #1e6c52;
  --maincolor-soft: rgba(30, 108, 82, 0.08);
  --hovercolor: #14543f;
  --accent: #b6824a;
  --accent-soft: rgba(182, 130, 74, 0.12);
  --callouctcolor: #1e4a6c;
  --darkMaincolor: #5fc197;

  --fg: #181b22;
  --fg-muted: #5a574e;
  --fg-subtle: #8d887d;
  --bg: #faf8f3;
  --bg-soft: #f1eee6;
  --bg-elev: #e6e2d6;
  --border: #e2dccf;
  --border-strong: #cdc6b3;

  --font-sans: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic", system-ui, -apple-system, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "HackGen", "HackGen Console NF", "PlemolJP", "PlemolJP Console NF",
    "M PLUS 1 Code", "JetBrains Mono", "BIZ UDGothic", "IBM Plex Mono",
    "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Hiragino Sans", "Yu Gothic", monospace;
  --font-body: var(--font-mono);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.04),
    0 1px 1px rgba(20, 20, 30, 0.03);
  --shadow-md: 0 6px 24px rgba(20, 20, 30, 0.06),
    0 2px 6px rgba(20, 20, 30, 0.04);

  --content-max: 780px;
  --transition: 160ms ease;
}

/* =========================================================
   Base
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color: var(--fg);
  font-family: var(--font-body);
  font-size: clamp(14px, 0.9rem + 0.12vw, 16px);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-color: var(--bg);
}

body {
  margin: 0;
  background-color: var(--bg);
}

* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

::selection {
  background: var(--maincolor-soft);
  color: var(--fg);
}

p {
  margin: 0 0 1em;
  line-height: 1.75;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

blockquote {
  border-left: 3px solid var(--maincolor);
  color: var(--fg-muted);
  margin: 1.25em 0;
  padding: 0.25em 0 0.25em 1em;
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

a {
  color: var(--maincolor);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition);
}
a:hover {
  color: var(--hovercolor);
  border-bottom-color: var(--hovercolor);
  background-color: transparent;
}
a:focus-visible {
  outline: 2px solid var(--maincolor);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Inline body links: subtle underline so they look like prose, not buttons */
section.body a,
.biography a,
.content-column a,
li a {
  border-bottom: 1px solid var(--border-strong);
}
section.body a:hover,
.biography a:hover,
.content-column a:hover,
li a:hover {
  border-bottom-color: var(--maincolor);
}

ul {
  list-style: disc;
  padding-left: 1.4em;
  margin: 0.5em 0 1em;
}
ul li {
  text-indent: 0;
  margin-bottom: 0.35em;
}
ul li::marker {
  color: var(--maincolor);
}
ul > li::before {
  content: none;
}

ol {
  padding-left: 1.5em;
  margin: 0.5em 0 1em;
}
ol li {
  margin-bottom: 0.35em;
}
ol li::marker {
  color: var(--maincolor);
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Images / figures
   ========================================================= */
img {
  border: 0;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

figure {
  box-sizing: border-box;
  display: inline-block;
  margin: 1em 0;
  max-width: 100%;
}
figure img {
  max-height: 500px;
}
@media screen and (min-width: 600px) {
  figure {
    padding: 0 40px;
  }
}
figure h4 {
  font-size: 1rem;
  margin: 0.5em 0 0;
  color: var(--fg-muted);
}
figure h4::before {
  content: "↳ ";
}

/* =========================================================
   Code
   ========================================================= */
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
code {
  background-color: var(--bg-elev);
  color: var(--fg);
  padding: 0.12em 0.35em;
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--bg-elev);
  line-height: 1.55;
  overflow-x: auto;
  padding: 1em 1.1em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
pre code {
  background-color: transparent;
  color: inherit;
  font-size: 0.9em;
  padding: 0;
}

.highlight {
  position: relative;
  margin: 1em 0;
}
.highlight pre {
  margin: 0;
}
.highlight pre ::selection {
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
}
.highlight pre code[class*="language-"]::before {
  background: var(--fg);
  border-radius: 0 var(--radius-md) 0 var(--radius-sm);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  position: absolute;
  right: 0;
  text-align: right;
  text-transform: uppercase;
  top: 0;
}

/* =========================================================
   Layout
   ========================================================= */
.content {
  margin: 0 auto;
  max-width: var(--content-max);
  padding: 1.5rem 1.25rem 4rem;
  word-wrap: break-word;
}
@media screen and (min-width: 700px) {
  .content {
    padding: 2rem 1.5rem 5rem;
  }
}

/* =========================================================
   Header
   ========================================================= */
header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

header .main {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
header .main a {
  color: var(--fg);
  border-bottom: none;
}
header .main a:hover {
  color: var(--maincolor);
  background: transparent;
}

header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
header nav a {
  color: var(--fg-muted);
  border-bottom: none;
  padding: 0.15rem 0;
  position: relative;
}
header nav a:hover {
  color: var(--maincolor);
  background: transparent;
}
header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--maincolor);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition);
}
header nav a:hover::after {
  transform: scaleX(1);
}

#dark-mode-toggle {
  cursor: pointer;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition);
}
#dark-mode-toggle:hover {
  color: var(--maincolor);
  background-color: var(--bg-soft);
}

@media screen and (max-width: 480px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  header nav {
    width: 100%;
  }
}

/* =========================================================
   Headings
   ========================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 2em 0 0.6em;
}

h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.85rem);
  margin-top: 1.6em;
}
h2 {
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.45rem);
}
h3 {
  font-size: 1.15rem;
}
h4,
h5,
h6 {
  font-size: 1rem;
}

h1::before,
h2::before,
h3::before,
h4::before,
h5::before,
h6::before {
  color: var(--maincolor);
  font-family: var(--font-mono);
  font-weight: 500;
  margin-right: 0.45em;
  opacity: 0.85;
}
h1::before { content: "#"; }
h2::before { content: "##"; }
h3::before { content: "###"; }
h4::before { content: "####"; }
h5::before { content: "#####"; }
h6::before { content: "######"; }

/* =========================================================
   Meta / time / utility
   ========================================================= */
.meta {
  color: var(--fg-subtle);
  font-size: 0.88rem;
  letter-spacing: 0;
}

time {
  color: var(--fg-subtle);
}

.toc {
  background-color: var(--bg-soft);
  color: var(--fg);
  padding: 1em 1.2em;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
  margin: 1em 0;
}

/* =========================================================
   Footer
   ========================================================= */
footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 0;
  margin-top: 3rem;
  color: var(--fg-subtle);
  font-size: 0.85rem;
}

.soc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  transition: color var(--transition), background-color var(--transition);
}
.soc:hover {
  color: var(--maincolor);
  background: var(--bg-soft);
}

.border {
  display: none; /* legacy spacer between social icons; replaced by gap */
}

.footer-info {
  margin-left: auto;
}
.footer-info a {
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-strong);
}
.footer-info a:hover {
  color: var(--maincolor);
  border-bottom-color: var(--maincolor);
}

@media screen and (max-width: 480px) {
  footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-info {
    margin-left: 0;
  }
}

/* =========================================================
   Posts
   ========================================================= */
.title h1 {
  margin-bottom: 0.2em;
}

article .title {
  margin-bottom: 1.5em;
  padding-bottom: 1.25em;
  border-bottom: 1px solid var(--border);
}

.posts {
  list-style: none;
  padding: 0;
  margin: 1.5em 0;
}
.posts .post {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  text-indent: 0;
}
.posts .post::before {
  content: none;
}
.posts .post a {
  border-bottom: 1px solid transparent;
  flex: 1 1 auto;
  min-width: 0;
}
.posts .post a:hover {
  color: var(--maincolor);
  border-bottom-color: var(--maincolor);
}
.posts .post .meta {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.page-title {
  margin-top: 0;
}

/* =========================================================
   Callout / tags / draft
   ========================================================= */
.callout {
  background-color: var(--callouctcolor);
  color: #fff;
  padding: 1em 1.2em;
  border-radius: var(--radius-md);
  margin: 1.25em 0;
}
.callout p {
  font-family: var(--font-mono);
  margin: 0;
}
.callout a {
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}
.callout a:hover {
  background-color: #fff;
  color: var(--callouctcolor);
}

.site-description {
  display: flex;
  justify-content: space-between;
}

.tags {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 1em 0;
}
.tags li {
  text-indent: 0;
  margin: 0;
}
.tags li::before {
  content: none;
}
.tags a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--fg-muted);
  background: var(--bg);
}
.tags a::before {
  content: "#";
  color: var(--maincolor);
  margin-right: 0.25em;
}
.tags a:hover {
  color: var(--maincolor);
  border-color: var(--maincolor);
  background: var(--maincolor-soft);
}

svg {
  max-height: 18px;
  width: 18px;
}

.draft-label {
  color: var(--accent);
  text-decoration: none;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  background-color: rgba(177, 93, 255, 0.12);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* Code language tags */
.highlight pre code[class=language-javaScript]::before,
.highlight pre code[class="language-js"]::before {
  content: "js";
  background: #f7df1e;
  color: black;
}
.highlight pre code[class*='language-yml']::before,
.highlight pre code[class*='language-yaml']::before {
  content: 'yaml';
  background: #f71e6a;
  color: white;
}
.highlight pre code[class*='language-shell']::before,
.highlight pre code[class*='language-bash']::before,
.highlight pre code[class*='language-sh']::before {
  content: 'shell';
  background: #2c8a3a;
  color: white;
}
.highlight pre code[class*='language-json']::before {
  content: 'json';
  background: #1f8fff;
  color: #fff;
}
.highlight pre code[class*='language-python']::before,
.highlight pre code[class*='language-py']::before {
  content: 'py';
  background: #3776ab;
  color: #ffd43b;
}
.highlight pre code[class*='language-css']::before {
  content: 'css';
  background: #2196f3;
  color: white;
}
.highlight pre code[class*='language-go']::before {
  content: 'Go';
  background: #00add8;
  color: white;
}
.highlight pre code[class*='language-md']::before {
  content: 'Markdown';
  background: #4263eb;
  color: whitesmoke;
}

/* =========================================================
   Profile (bio page)
   ========================================================= */
.profile-container {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 0 0.5rem;
}
.profile-container .profile-text {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
.profile-container > img {
  width: 140px;
  height: auto;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  border: 4px solid var(--bg);
  outline: 1px solid var(--border);
}

@media screen and (min-width: 640px) {
  .profile-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    text-align: left;
  }
  .profile-container > img {
    width: 180px;
    flex: 0 0 auto;
    order: 2;
  }
  .profile-container .profile-text {
    order: 1;
  }
}

/* The profile section's first H1 (e.g. 基本情報) */
.profile-text section > h1 {
  margin-top: 0;
}

/* Compact "name: value" list inside profile */
.profile-text ul {
  list-style: none;
  padding-left: 0;
  margin: 0.4em 0;
}
.profile-text ul li {
  position: relative;
  padding-left: 0;
  margin-bottom: 0.3em;
  text-indent: 0;
}
.profile-text ul li::marker {
  content: none;
}
.profile-text ul ul {
  margin: 0.3em 0 0.2em 0.6em;
  padding-left: 1em;
  list-style: disc;
}
.profile-text ul ul li {
  margin-bottom: 0.15em;
}

/* =========================================================
   Date / content rows — refined timeline (spine layout)
   Mobile: timeline rail at the left edge.
   Desktop: timeline rail sits BETWEEN the date column and the
   content column (no large left gutter).
   ========================================================= */
.date-content-container {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.05rem 1rem;
  padding: 0.45rem 0.5rem 0.45rem 1.25rem;
  border-radius: var(--radius-sm);
  transition: background-color 140ms ease;
}
/* Vertical rail */
.date-content-container::before {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
/* Dot marker */
.date-content-container::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  box-sizing: border-box;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.date-content-container:hover {
  background-color: var(--maincolor-soft);
}
.date-content-container:hover::after {
  border-color: var(--maincolor);
  background: var(--maincolor);
}

/* Round off the rail at first/last items so it doesn't look cut */
.date-content-container:first-of-type::before {
  top: 0.45rem;
  border-radius: 1px 1px 0 0;
}
.date-content-container:last-of-type::before {
  bottom: auto;
  height: 1.1rem;
  border-radius: 0 0 1px 1px;
}

/* Ongoing entries — solid emerald dot with subtle pulse */
.date-content-container.is-ongoing::after {
  background: var(--maincolor);
  border-color: var(--maincolor);
  animation: pulse-dot 2.6s ease-in-out infinite;
}
.date-content-container.is-ongoing .date-column {
  color: var(--maincolor);
  font-weight: 600;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--maincolor-soft); }
  50%      { box-shadow: 0 0 0 5px transparent; }
}

.date-column {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--fg-subtle);
  text-align: left;
  list-style: none;
  padding-left: 0;
  margin: 0;
  letter-spacing: 0.02em;
  text-indent: 0;
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
  line-height: 1.6;
}
.content-column {
  list-style: none;
  padding: 0;
  margin: 0;
  text-indent: 0;
  min-width: 0;
  font-size: 0.88rem;
}
.content-column div { margin-bottom: 0.15rem; }
.content-column div:last-child { margin-bottom: 0; }

/* DESKTOP: fixed-width date column based on YYYY.MM.DD - YYYY.MM.DD (23ch in
   monospace). The "-" separator is always centered because each Start/End is
   padded to 10ch via inline-block widths in markup. Timeline rail sits in
   the column gap. */
@media screen and (min-width: 700px) {
  .timeline {
    position: relative;
  }
  /* Single vertical rail for the whole section, in the column gap */
  .timeline::before {
    content: "";
    position: absolute;
    left: calc(23ch + 0.75rem - 0.5px);
    top: 0.5rem;
    bottom: 0.5rem;
    width: 1px;
    background: var(--border);
    z-index: 0;
  }

  .timeline > .date-content-container {
    grid-template-columns: 23ch 1fr;
    column-gap: 1.5rem;
    align-items: baseline;
    padding: 0.4rem 0;
    border-radius: var(--radius-sm);
  }
  /* Hide the mobile rail; .timeline::before handles it */
  .timeline > .date-content-container::before {
    display: none;
  }
  /* Dot sits in the column gap, aligned with the rail */
  .timeline > .date-content-container::after {
    left: calc(23ch + 0.75rem - 3.5px);
    top: 0.65rem;
    z-index: 1;
  }

  .timeline .date-column {
    text-align: right;
    font-size: 0.78rem;
    width: 23ch;
    line-height: 1.5;
  }
  .timeline .content-column {
    font-size: 0.9rem;
  }

  /* Each part of the date is padded to a fixed 10ch in monospace so that
     "-" is always at the same column regardless of YYYY.MM vs YYYY.MM.DD.
     Forcing tabular-nums + nowrap guarantees per-character monospace metrics. */
  .timeline .date-start,
  .timeline .date-end,
  .timeline .date-sep {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "palt" 0;
    white-space: nowrap;
  }
  .timeline .date-start { width: 10ch; text-align: right; }
  .timeline .date-end   { width: 10ch; text-align: left; }
  .timeline .date-sep   { width: 3ch; text-align: center; }
}

/* H2 inside sections: refined accent bar (replaces "##" prefix) */
section h2 {
  position: relative;
  padding-left: 0.85em;
  margin-top: 2em;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  bottom: 0.32em;
  width: 2px;
  border-radius: 1px;
  background: var(--maincolor);
  margin-right: 0;
  opacity: 1;
}

/* =========================================================
   Section H1 — emphasized divider
   ========================================================= */
section > h1 {
  position: relative;
  padding-bottom: 0.35em;
  margin-bottom: 1em;
}
section > h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.5em;
  height: 2px;
  background: linear-gradient(90deg, var(--maincolor), transparent);
  border-radius: 2px;
}

/* =========================================================
   Scroll-reveal animations
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .date-content-container.is-ongoing::after {
    animation: none;
  }
  header nav a::after,
  .date-content-container,
  .date-content-container::after {
    transition: none;
  }
}

/* =========================================================
   News list (bio page)
   ========================================================= */
.news-list {
  list-style: none;
  padding: 0;
  margin: 1em 0;
}
.news-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--border);
  text-indent: 0;
}
.news-list li::before {
  content: none;
}
.news-list .news-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.news-list a {
  color: var(--fg);
  border-bottom: 1px solid transparent;
  flex: 1 1 240px;
  min-width: 0;
}
.news-list a:hover {
  color: var(--maincolor);
  border-bottom-color: var(--maincolor);
}

/* =========================================================
   Biography paragraph
   ========================================================= */
.biography {
  font-family: var(--font-mono);
  line-height: 1.95;
  margin: 1em 0 1.75em;
  font-size: 0.82rem;
  color: var(--fg-muted);
  padding: 1.1em 1.3em;
  background: transparent;
  border: 1px solid var(--border);
  border-left: 2px solid var(--maincolor);
  border-radius: 2px;
}
.biography p {
  margin: 0;
}

/* =========================================================
   Email copy-to-clipboard
   ========================================================= */
.email-copy {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  border-bottom: 1px dashed var(--maincolor);
  padding: 0 2px;
  transition: background-color var(--transition), color var(--transition);
  border-radius: 2px;
}
.email-copy:hover {
  background-color: var(--maincolor-soft);
  color: var(--maincolor);
}
.email-copy canvas {
  display: inline;
  vertical-align: middle;
  border: none;
  border-radius: 0;
}

/* =========================================================
   Bio TOC sidebar (desktop only)
   ========================================================= */
.bio-toc {
  display: none;
}

@media screen and (min-width: 1200px) {
  .bio-toc {
    display: block;
    position: fixed;
    top: 80px;
    left: max(20px, calc(50vw - 580px));
    width: 170px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    font-size: 0.82rem;
    line-height: 1.7;
    padding: 0.5rem 0 0.5rem 0.9rem;
    border-left: 2px solid var(--border);
  }
  .bio-toc strong {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-subtle);
    display: block;
    margin-bottom: 0.5rem;
  }
  .bio-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
  }
  .bio-toc ul ul {
    padding-left: 0.85em;
    font-size: 0.92em;
    margin-top: 0.15em;
  }
  .bio-toc ul li {
    text-indent: 0;
    margin-bottom: 0.2rem;
  }
  .bio-toc ul li::before,
  .bio-toc ul li::marker {
    content: none;
  }
  .bio-toc a {
    border-bottom: none;
    color: var(--fg-muted);
    display: block;
    padding: 1px 0;
    transition: color var(--transition);
  }
  .bio-toc a:hover {
    color: var(--maincolor);
    background-color: transparent;
  }
}

/* =========================================================
   Tables
   ========================================================= */
table {
  border-spacing: 0;
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.95rem;
}
table th,
table td {
  padding: 0.65em 0.9em;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 0.95rem;
}
table tbody tr:hover {
  background: var(--bg-soft);
}

/* =========================================================
   Section spacing (papers / bio)
   ========================================================= */
section {
  scroll-margin-top: 1rem;
}
section + section {
  margin-top: 0.5rem;
}
