/* ============================================================
   t-lorenz.com — Custom Hugo Theme
   ============================================================ */

/* --- Tokens --- */
:root {
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'DM Mono', 'Menlo', monospace;

  --color-bg: #ffffff;
  --color-surface: #f6f7f9;
  --color-text: #0f0f10;
  --color-text-secondary: #4a4a4a;
  --color-text-tertiary: #767676;
  --color-accent: #1565c0;
  --color-accent-subtle: #e3edf7;
  --color-border: #e2e4e8;
  --color-border-light: #eef0f2;

  --content-width: 800px;
  --s: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #111113;
    --color-surface: #18181b;
    --color-text: #eaeaea;
    --color-text-secondary: #a0a0a0;
    --color-text-tertiary: #666;
    --color-accent: #64b5f6;
    --color-accent-subtle: #1a2332;
    --color-border: #262628;
    --color-border-light: #1e1e20;
  }
}

[data-theme="dark"] {
  --color-bg: #111113;
  --color-surface: #18181b;
  --color-text: #eaeaea;
  --color-text-secondary: #a0a0a0;
  --color-text-tertiary: #666;
  --color-accent: #64b5f6;
  --color-accent-subtle: #1a2332;
  --color-border: #262628;
  --color-border-light: #1e1e20;
}

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

html {
  font-size: 16.5px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--color-accent); color: #fff; }

/* --- Layout --- */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 calc(var(--s) * 3);
}

/* ============================================================
   Navigation
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

@supports (backdrop-filter: blur(12px)) {
  nav {
    background: color-mix(in srgb, var(--color-bg) 80%, transparent);
    backdrop-filter: blur(12px);
  }
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav-identity {
  display: flex;
  align-items: center;
  gap: calc(var(--s) * 1.5);
}
.nav-identity:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.nav-identity:hover .nav-name {
  color: var(--color-accent);
  text-decoration: none;
}
.nav-name-medium,
.nav-name-short { display: none; }
.nav-name:hover { text-decoration: none; }

/* On homepage: hide nav identity, right-align links */
.home .nav-identity { display: none; }
.home nav .container { justify-content: flex-end; }

.nav-links {
  display: flex;
  align-items: center;
  gap: calc(var(--s) * 3);
  list-style: none;
}

.nav-links a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}
.nav-links a:hover {
  color: var(--color-text);
  text-decoration: none;
}
.nav-links a[aria-current="page"] { color: var(--color-text); }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-tertiary);
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.theme-toggle:hover { color: var(--color-text); }

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

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

/* ============================================================
   Hero / Identity Card (homepage)
   ============================================================ */
.hero {
  padding: calc(var(--s) * 7) 0 calc(var(--s) * 5);
}

.identity-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: calc(var(--s) * 4);
  align-items: start;
}

.identity-photo {
  width: 160px;
  height: 200px;
  object-fit: cover;
  object-position: center top;
}

.identity-content {
  display: flex;
  flex-direction: column;
  gap: calc(var(--s) * 1.5);
}

.identity-content h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.identity-role {
  font-size: 1rem;
  color: #444;
  line-height: 1.55;
  text-align: justify;
}

.identity-role a {
  color: #444;
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
}
.identity-role a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .identity-role,
  :root:not([data-theme="light"]) .identity-role a { color: var(--color-text-secondary); }
}

[data-theme="dark"] .identity-role,
[data-theme="dark"] .identity-role a { color: var(--color-text-secondary); }

.identity-links {
  display: flex;
  gap: calc(var(--s) * 2);
  margin-top: calc(var(--s) * 0.5);
}

.identity-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}
.identity-links a:hover { color: var(--color-accent); text-decoration: underline; }

.identity-links .sep {
  color: var(--color-border);
  user-select: none;
}

.identity-previous {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  margin-top: calc(var(--s) * 0.75);
  letter-spacing: 0.01em;
}

/* Research statement */
.research-statement {
  margin-top: calc(var(--s) * 5);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.72;
  text-align: justify;
}

.research-statement strong { font-weight: 600; }

/* ============================================================
   Sections (shared)
   ============================================================ */
.section {
  padding: calc(var(--s) * 6) 0;
  border-top: 1px solid var(--color-border-light);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: calc(var(--s) * 3);
}

.section-title {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.section-more {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}
.section-more:hover { color: var(--color-accent); }

/* ============================================================
   Page header (subpages)
   ============================================================ */
.page-header {
  padding: calc(var(--s) * 6) 0 calc(var(--s) * 4);
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.page-header .subtitle {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-top: calc(var(--s) * 1);
}

/* ============================================================
   Publications
   ============================================================ */
.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-entry {
  padding: calc(var(--s) * 2.5) 0;
  border-bottom: 1px solid var(--color-border-light);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: calc(var(--s) * 2.5);
  align-items: baseline;
}

.pub-entry:first-child { padding-top: 0; }
.pub-entry:last-child { border-bottom: none; }

.pub-venue-col {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
  padding-top: 2px;
}

.pub-venue-name {
  font-weight: 500;
  color: var(--color-accent);
}

.pub-venue-year {
  margin-top: 1px;
}

.pub-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

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

.pub-authors {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-top: 3px;
  line-height: 1.45;
}

.pub-authors .me {
  color: var(--color-text);
  font-weight: 600;
}

.pub-meta {
  display: flex;
  align-items: center;
  gap: calc(var(--s) * 1.5);
  margin-top: calc(var(--s) * 0.75);
}

.pub-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}
.pub-link:hover { text-decoration: underline; }

.pub-link-sep {
  color: var(--color-border);
  font-size: 0.8rem;
  user-select: none;
}

.pub-note {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  margin-left: auto;
}

.pub-tldr {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-top: calc(var(--s) * 1);
  line-height: 1.55;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Abstract (expandable on single pub pages) */
.pub-abstract {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-top: calc(var(--s) * 2);
  padding-top: calc(var(--s) * 2);
  border-top: 1px solid var(--color-border-light);
  text-align: justify;
}

/* BibTeX block */
.pub-bibtex {
  margin-top: calc(var(--s) * 2);
}

.pub-bibtex summary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  cursor: pointer;
  letter-spacing: 0.02em;
}

.pub-bibtex-body {
  position: relative;
  margin-top: calc(var(--s) * 1);
}

.pub-bibtex-copy {
  position: absolute;
  top: calc(var(--s) * 1);
  right: calc(var(--s) * 1);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--color-text-tertiary);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1.6;
  transition: color 0.15s, border-color 0.15s;
}

.pub-bibtex-copy:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.pub-bibtex pre {
  padding: calc(var(--s) * 2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  color: var(--color-text-secondary);
}

/* ============================================================
   Activities page
   ============================================================ */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-entry {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: calc(var(--s) * 2.5);
  padding: calc(var(--s) * 1.5) 0;
  border-bottom: 1px solid var(--color-border-light);
  align-items: baseline;
}

.activity-year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
}

.activity-body {
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.45;
}

.activity-entry:last-child {
  border-bottom: none;
}

/* ============================================================
   Talks
   ============================================================ */
.talk-entry {
  padding: calc(var(--s) * 2) 0;
  border-bottom: 1px solid var(--color-border-light);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: calc(var(--s) * 2.5);
  align-items: baseline;
}

.talk-entry:first-child { padding-top: 0; }
.talk-entry:last-child { border-bottom: none; }

.talk-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  letter-spacing: 0.02em;
}

.talk-title {
  font-size: 1rem;
  font-weight: 500;
}

.talk-host {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

.talk-links {
  display: flex;
  gap: calc(var(--s) * 1.5);
  margin-top: calc(var(--s) * 0.5);
}

.talk-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}

/* ============================================================
   Service / Background text blocks
   ============================================================ */
.service-text,
.bg-text {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.service-text .award {
  font-weight: 600;
  color: var(--color-text);
}

.bg-text a {
  color: var(--color-text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
}
.bg-text a:hover { color: var(--color-accent); text-decoration-color: var(--color-accent); }

/* ============================================================
   Prose content (about page, etc.)
   ============================================================ */
.prose {
  font-size: 1rem;
  line-height: 1.72;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.prose p + p { margin-top: calc(var(--s) * 2.5); }
.prose h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: calc(var(--s) * 5);
  margin-bottom: calc(var(--s) * 2);
  letter-spacing: -0.015em;
}
.prose h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: calc(var(--s) * 4);
  margin-bottom: calc(var(--s) * 1.5);
}
.prose ul, .prose ol {
  margin-top: calc(var(--s) * 1.5);
  margin-bottom: calc(var(--s) * 1.5);
  padding-left: calc(var(--s) * 3);
}
.prose li { margin-bottom: calc(var(--s) * 0.75); }
.prose a {
  text-decoration: underline;
  color: var(--color-text);
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
}
.prose a:hover {
  text-decoration-color: var(--color-accent);
  color: var(--color-accent);
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  border-top: 1px solid var(--color-border);
  padding: calc(var(--s) * 4) 0 calc(var(--s) * 5);
  margin-top: calc(var(--s) * 2);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}

.footer-inner a { color: var(--color-text-tertiary); }
.footer-inner a:hover { color: var(--color-accent); }

.footer-links {
  display: flex;
  gap: calc(var(--s) * 2);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  html { font-size: 15.5px; }
  .container { padding: 0 calc(var(--s) * 2); }

  .hero { padding: calc(var(--s) * 4) 0 calc(var(--s) * 3); }

  .identity-card {
    display: block;
  }

  .identity-photo {
    float: none;
    display: block;
    width: 160px;
    height: 200px;
    margin: 0 auto calc(var(--s) * 1.5);
  }

  .identity-content { display: block; }
  .identity-content h1 {
    clear: both;
    font-size: 1.4rem;
  }

  .identity-links {
    margin-top: 0;
    gap: calc(var(--s) * 1.5);
    flex-wrap: wrap;
  }

  .identity-previous { clear: both; }

  .pub-entry,
  .talk-entry {
    grid-template-columns: 1fr;
    gap: calc(var(--s) * 0.5);
  }

  .pub-venue-col { padding-top: 0; }
  .pub-venue-year { display: inline; }
  .pub-venue-year::before { content: " · "; }

  .nav-name-full { display: none; }
  .nav-name-medium { display: inline; }
  .nav-name-short { display: none; }

  .nav-links {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: calc(var(--s) * 1.5);
    justify-content: flex-end;
    gap: calc(var(--s) * 1.5);
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links li { flex: 0 0 auto; }
  .nav-links a { white-space: nowrap; }

  .footer-inner {
    flex-direction: column;
    gap: calc(var(--s) * 1.5);
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  nav .container { padding: 0 calc(var(--s) * 1.5); }
  .nav-name-medium { display: none; }
  .nav-name-short { display: inline; }
  .nav-links {
    margin-left: calc(var(--s));
    gap: calc(var(--s));
    justify-content: flex-start;
  }
}
