/* ==========================================================================
   CSS Custom Properties — Light (default) & Dark
   ========================================================================== */

:root {
  --bg-primary:     #f8f7f4;
  --bg-secondary:   #efede8;
  --bg-header:      #eae8e3;
  --text-primary:   #1a1a1a;
  --text-secondary: #555555;
  --text-tertiary:  #888888;
  --border:         #d5d3ce;
  --border-subtle:  #e8e6e1;
  --accent:         #2b7a78;
  --accent-hover:   #3aafa9;
  --accent-subtle:  #d4eeec;
}

[data-theme="dark"] {
  --bg-primary:     #111111;
  --bg-secondary:   #1a1a1a;
  --bg-header:      #161616;
  --text-primary:   #e0ddd5;
  --text-secondary: #a8a49a;
  --text-tertiary:  #6b6860;
  --border:         #2a2a28;
  --border-subtle:  #222220;
  --accent:         #2b7a78;
  --accent-hover:   #3aafa9;
  --accent-subtle:  rgba(43, 122, 120, 0.15);
}

/* ==========================================================================
   Base
   ========================================================================== */

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* ==========================================================================
   Typography
   ========================================================================== */

h2, h3 {
  font-family: 'Newsreader', Georgia, serif;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* Inline links in body text */
.content-area a {
  text-decoration: underline;
  text-decoration-color: var(--accent-subtle);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

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

p {
  margin: 1rem 0;
}

b {
  color: var(--text-primary);
}

/* ==========================================================================
   Header
   ========================================================================== */

#magic {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
  top: 0;
  left: 0;
  z-index: 1;
}

.header {
  height: 240px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  box-sizing: border-box;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-links {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.header-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.header-links a:hover {
  color: var(--accent);
}

.header-links .separator {
  color: var(--text-tertiary);
  margin: 0 0.5rem;
}

/* ==========================================================================
   Theme Toggle
   ========================================================================== */

#theme-toggle {
  position: absolute;
  top: 12px;
  right: 20px;
  z-index: 10;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: border-color 0.2s ease, color 0.2s ease;
  padding: 0;
}

#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#theme-toggle svg {
  width: 18px;
  height: 18px;
}

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

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-nav {
  display: flex;
  gap: 2rem;
  justify-content: flex-start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.3s ease;
}

.site-nav a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 1px;
  background-color: var(--accent);
  transition: width 0.2s ease;
}

.site-nav a:hover::after {
  width: 100%;
}

/* ==========================================================================
   Section Headings
   ========================================================================== */

.section-heading {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 3rem 0 1.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.section-heading .back-to-top {
  float: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  line-height: 2.5rem;
}

.section-heading .back-to-top:hover {
  color: var(--accent);
}

/* ==========================================================================
   Profile
   ========================================================================== */

.profile-img {
  float: left;
  padding: 20px 16px 0 0;
  border-radius: 4px;
  width: 230px;
  height: auto;
}

/* ==========================================================================
   Project Cards
   ========================================================================== */

.project-item {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.3s ease;
}

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

.project-item img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.project-item p {
  margin: 0;
}

.tixy-wrapper {
  width: 120px;
  height: 120px;
  flex: 0 0 120px;
  border-radius: 4px;
  overflow: hidden;
}

.tixy-wrapper iframe {
  width: 400px;
  height: 400px;
  border: 0;
  pointer-events: none;
  zoom: 0.3;
}

.project-item-stax {
  align-items: flex-end;
}

/* ==========================================================================
   Publication Categories
   ========================================================================== */

.pub-category {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--accent);
}

/* ==========================================================================
   Publications List
   ========================================================================== */

.pub-list p {
  margin-bottom: 1.25rem;
  line-height: 1.65;
  font-size: 0.9375rem;
}

.pub-list b {
  color: var(--text-primary);
}

/* ==========================================================================
   Talks
   ========================================================================== */

.talks-list {
  line-height: 1.65;
  font-size: 0.9375rem;
}

.talks-list b {
  color: var(--text-primary);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  text-align: center;
  padding: 2rem 0 3rem 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 3rem;
  transition: border-color 0.3s ease;
}

.footer-quote {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  margin: 0 0 0.5rem 0;
  padding: 0 2rem;
}

.footer-credit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}
