/* ==========================================================================
   Personal Homepage – Static styles
   No build; works on GitHub Pages. Light/dark via [data-theme].
   ========================================================================== */

:root {
  /* Light (default) */
  --bg: #f8f9fa;
  --bg-elevated: #fff;
  --text: #1a1a1a;
  --text-muted: #555;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --focus-ring: 2px solid var(--accent);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --border: #334155;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --focus-ring: 2px solid var(--accent);
}

/* Respect system preference when no manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --border: #334155;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

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

html {
  scroll-behavior: smooth;
  font-size: 14px;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
  border-radius: 4px;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0.5rem;
}

/* -------------------------------------------------------------------------- */
/* Header & Nav                                                               */
/* -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0 1rem;
}


.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}
.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent);
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.nav-link.active {
  color: var(--accent);
  font-weight: 600;
}

.theme-toggle {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--border);
  outline: var(--focus-ring);
  outline-offset: 2px;
}
[data-theme="dark"] .theme-icon.sun,
.theme-icon.moon {
  display: none;
}
[data-theme="dark"] .theme-icon.moon {
  display: inline;
}

/* -------------------------------------------------------------------------- */
/* Layout                                                                     */
/* -------------------------------------------------------------------------- */
.main {
  padding: 2rem 0 4rem;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 2.5rem 0;
  scroll-margin-top: 4rem;
}
.section-title {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* Hero / About                                                               */
/* -------------------------------------------------------------------------- */
.hero {
  padding-top: 1.5rem;
}

.hero-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.avatar-contact {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.page-avatar {
  display: block;
  line-height: 0;
}
.page-avatar img {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.contact-icons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.contact-icons a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
.contact-icons a:hover {
  color: var(--accent-hover);
}
.contact-icons .contact-icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}
.hero-summary {
  min-width: 0;
  flex: 1;
  padding: 0;
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}
.hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.hero-subtitle a {
  text-decoration: none;
}
.hero-subtitle a:hover {
  text-decoration: none;
}
.hero-bio {
  margin: 0;
  color: var(--text-muted);
  max-width: 56ch;
  text-align: justify;
}
.hero-bio a {
  color: var(--accent);
  text-decoration: none;
}
.hero-bio a:hover {
  text-decoration: none;
}

/* -------------------------------------------------------------------------- */
/* News                                                                       */
/* -------------------------------------------------------------------------- */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.news-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.news-item:first-child {
  padding-top: 0;
}
.news-item .news-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.news-item .news-title {
  font-weight: 600;
  margin: 0 0 0.25rem;
}
.news-item .news-title a {
  color: var(--text);
  text-decoration: none;
}
.news-item .news-title a:hover {
  color: var(--accent);
  text-decoration: none;
}
.news-item .news-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.news-item.hidden {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Publications                                                               */
/* -------------------------------------------------------------------------- */
.pub-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.select,
.input {
  font-family: inherit;
  font-size: 0.9375rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}
.search-input {
  flex: 1;
  min-width: 180px;
}
.select:focus,
.input:focus {
  outline: var(--focus-ring);
  outline-offset: 0;
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.pub-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:first-child {
  padding-top: 0;
}
.pub-item.hidden {
  display: none;
}
.pub-item .pub-title {
  font-weight: 600;
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.pub-item .pub-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.pub-item .pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.pub-item .pub-bib {
  margin-top: 0.5rem;
}
.pub-links .btn-link {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
  background: var(--border);
  color: var(--text);
  border-radius: 4px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.pub-links .btn-link:hover {
  background: var(--accent);
  color: #fff;
}
.pub-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.pub-highlights span {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--border);
  border-radius: 4px;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* Resume                                                                     */
/* -------------------------------------------------------------------------- */
.resume-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.resume-actions {
  display: flex;
  gap: 0.5rem;
}
.resume-content.prose {
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
}
.resume-content.prose h3 {
  font-size: 1.125rem;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.resume-content.prose h3:first-child {
  margin-top: 0;
}
.resume-content.prose ul {
  margin: 0.25rem 0;
  padding-left: 1.5rem;
}
.resume-content.prose p {
  margin: 0.25rem 0;
}
.resume-content.prose a {
  color: var(--accent);
  text-decoration: none;
}
.resume-content.prose a:hover {
  text-decoration: none;
}

/* -------------------------------------------------------------------------- */
/* Buttons                                                                    */
/* -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 0.9375rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--text-muted);
  color: var(--bg-elevated);
}

/* -------------------------------------------------------------------------- */
/* Contact                                                                    */
/* -------------------------------------------------------------------------- */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.contact-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.contact-link:hover {
  text-decoration: none;
}
.contact-link:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  background: var(--bg-elevated);
}
.footer-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* Utility                                                                    */
/* -------------------------------------------------------------------------- */
.loading,
.error-msg {
  color: var(--text-muted);
  font-style: italic;
}
.error-msg {
  color: #b91c1c;
}
[data-theme="dark"] .error-msg {
  color: #f87171;
}

/* -------------------------------------------------------------------------- */
/* Print – resume only                                                        */
/* -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .resume-actions,
  .skip-link,
  .theme-toggle,
  .nav,
  .btn,
  .section:not(.resume-section) {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .resume-section {
    padding: 0;
    scroll-margin: 0;
  }
  .resume-content.prose {
    border: none;
    box-shadow: none;
    background: #fff;
    color: #000;
  }
  .resume-content.prose a {
    color: #000;
  }
  .main {
    padding: 0;
  }
  .container {
    max-width: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero-layout {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-title {
    font-size: 1.25rem;
  }
  .nav-list {
    gap: 0.5rem;
  }
  .resume-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
