:root {
  --bg: #fafafa;
  --text: #171717;
  --muted: #525252;
  --faint: #666666;
  --border: #e5e5e5;
  --card-bg: #ffffff;
  --badge-bg: #eeeeee;
  --badge-text: #171717;
  --accent: #171717;
  --toggle-bg: #ffffff;
  --toggle-hover: #f5f5f5;
  --font-serif: "Newsreader", "Charis SIL", "Georgia", "Cambria", "Times New Roman", Times, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #111111;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #999999;
  --border: #262626;
  --card-bg: #161616;
  --badge-bg: #262626;
  --badge-text: #f5f5f5;
  --accent: #ffffff;
  --toggle-bg: #1a1a1a;
  --toggle-hover: #262626;
}

[data-theme="light"] {
  --bg: #fafafa;
  --text: #171717;
  --muted: #525252;
  --faint: #666666;
  --border: #e5e5e5;
  --card-bg: #ffffff;
  --badge-bg: #eeeeee;
  --badge-text: #171717;
  --accent: #171717;
  --toggle-bg: #ffffff;
  --toggle-hover: #f5f5f5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111;
    --text: #f5f5f5;
    --muted: #a3a3a3;
    --faint: #999999;
    --border: #262626;
    --card-bg: #161616;
    --badge-bg: #262626;
    --badge-text: #f5f5f5;
    --accent: #ffffff;
    --toggle-bg: #1a1a1a;
    --toggle-hover: #262626;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.5rem 1.5rem 4rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.65;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Minimal Top-Right Action for Theme Switch */
.top-actions {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
}

.theme-toggle {
  background: var(--toggle-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 0.55rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.theme-toggle:hover {
  background-color: var(--toggle-hover);
  color: var(--text);
  border-color: var(--muted);
  transform: translateY(-1px);
}

/* Icon Switching */
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .icon-moon { display: block; }
}

/* Main Container */
.container {
  max-width: 720px;
  width: 100%;
  animation: fadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header & Brand */
.site-header {
  text-align: left;
  margin-bottom: 3.5rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin-bottom: 0;
}

.logo {
  width: 62px;
  height: 50px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: translateY(-1px);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 2.55rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.15;
}

.tagline {
  font-size: 0.84rem;
  color: var(--faint);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  margin: 0.25rem 0 0 0;
}

/* Section Common */
.section {
  margin-bottom: 3.5rem;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Thesis & Four Pillars */
.section-thesis {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.thesis-block {
  margin-bottom: 2.25rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  display: block;
  margin-bottom: 0.75rem;
}

.thesis-heading {
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 1rem;
}

.thesis-body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 680px;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 860px) {
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }
  .thesis-heading {
    font-size: 1.6rem;
  }
}

.pillar-item {
  border: none;
  border-top: 1px solid var(--border);
  padding: 1rem 0 0 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.pillar-symbol {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.pillar-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.pillar-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

/* Report Card (Report 01) */
.report-card {
  padding: 0 0 1rem 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.report-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.intersection-tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-weight: 500;
  font-size: 0.74rem;
}

.report-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.report-author {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.report-abstract {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted);
}

.report-abstract p {
  margin-bottom: 0.85rem;
}

.report-abstract p:last-child {
  margin-bottom: 0;
}

.report-abstract strong {
  color: var(--text);
  font-weight: 600;
}

.report-abstract code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--toggle-hover);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Empirical Metrics Bar */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.25rem 0;
  margin: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.metric-num {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

@media (max-width: 540px) {
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--muted);
  background: var(--toggle-hover);
  transform: translateY(-1px);
}

/* BibTeX Drawer */
.bibtex-drawer {
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.bibtex-drawer summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  transition: color 0.15s ease;
}

.bibtex-drawer summary:hover {
  color: var(--text);
}

.bibtex-box {
  position: relative;
  margin-top: 0.75rem;
}

.bibtex-box pre {
  margin: 0;
  padding: 1rem 3.5rem 1rem 1rem;
  background: var(--toggle-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
  color: var(--muted);
  font-size: 0.74rem;
}

.btn-copy-bibtex {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-bibtex:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn-copy-bibtex.copied {
  color: var(--text);
  border-color: var(--text);
}

/* Projects List */
.project-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.project-card {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.project-card + .project-card {
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.project-card:hover {
  transform: none;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.project-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
}

.project-title a {
  color: inherit;
  text-decoration: none;
}

.project-title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--faint);
  background: var(--toggle-hover);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.project-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.project-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.project-features li {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  position: relative;
  padding-left: 0.95rem;
}

.project-features li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--faint);
  font-family: var(--font-mono);
}

.project-features li strong {
  color: var(--text);
  font-weight: 500;
}

.project-links {
  margin-top: auto;
  padding-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.project-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.project-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

.lab-card {
  border: none;
  border-left: 2px solid var(--border);
  border-radius: 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  background: transparent;
}

.lab-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.lab-tags {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lab-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
}

.lab-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Origins & Principals */
.origins-card {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.principals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

.principal-item {
  border: none;
  border-top: 1px solid var(--border);
  padding: 1rem 0 0 0;
  background: transparent;
}

.principal-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.principal-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.principal-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.timeline-block {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
}

.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-list li {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.timeline-list li strong {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  margin-right: 0.35rem;
}

.collab-note {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.collab-note p {
  margin-bottom: 0.5rem;
}

.collab-action {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--faint);
}

.collab-action a {
  color: var(--text);
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer a {
  color: var(--muted);
}

.sep {
  display: inline-block;
  margin: 0 0.25rem;
  color: var(--border);
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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