/* ===========================
   CSS Custom Properties
   =========================== */
:root {
  --bg:          #0a0f1e;
  --bg-alt:      #0d1526;
  --surface:     #112240;
  --accent:      #64ffda;
  --accent-dim:  rgba(100, 255, 218, 0.15);
  --text:        #f5f5f5;
  --text-muted:  #f5f5f5;
  --white:       #f5f5f5;
  --nav-bg:      rgba(10, 15, 30, 0.92);
  --nav-border:  rgba(100, 255, 218, 0.08);
  --hero-ov-1:   rgba(10, 15, 30, 0.72);
  --hero-ov-2:   rgba(10, 15, 30, 0.78);
  --section-ov-1: rgba(10, 15, 30, 0.84);
  --section-ov-2: rgba(10, 15, 30, 0.9);
  --panel-bg:    rgba(17, 34, 64, 0.52);
  --panel-border: rgba(100, 255, 218, 0.2);
  --panel-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --btn-primary-text: #0a0f1e;
  --nav-height:  70px;
  --max-width:   1000px;
  --radius:      6px;
  --transition:  0.25s ease;
  --font-mono:   "Courier New", Courier, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:          #f4f8fc;
    --bg-alt:      #eaf1f7;
    --surface:     #ffffff;
    --accent:      #0f766e;
    --accent-dim:  rgba(15, 118, 110, 0.14);
    --text:        #0f172a;
    --text-muted:  #000000;
    --white:       #111827;
    --nav-bg:      rgba(244, 248, 252, 0.92);
    --nav-border:  rgba(15, 118, 110, 0.18);
    --hero-ov-1:   rgba(244, 248, 252, 0.55);
    --hero-ov-2:   rgba(244, 248, 252, 0.68);
    --section-ov-1: rgba(244, 248, 252, 0.72);
    --section-ov-2: rgba(244, 248, 252, 0.84);
    --panel-bg:    rgba(255, 255, 255, 0.56);
    --panel-border: rgba(15, 118, 110, 0.25);
    --panel-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    --btn-primary-text: #ffffff;
  }
}

:root[data-theme="light"] {
  --bg:          #f4f8fc;
  --bg-alt:      #eaf1f7;
  --surface:     #ffffff;
  --accent:      #0f766e;
  --accent-dim:  rgba(15, 118, 110, 0.14);
  --text:        #0f172a;
  --text-muted:  #000000;
  --white:       #111827;
  --nav-bg:      rgba(244, 248, 252, 0.92);
  --nav-border:  rgba(15, 118, 110, 0.18);
  --hero-ov-1:   rgba(244, 248, 252, 0.55);
  --hero-ov-2:   rgba(244, 248, 252, 0.68);
  --section-ov-1: rgba(244, 248, 252, 0.72);
  --section-ov-2: rgba(244, 248, 252, 0.84);
  --panel-bg:    rgba(255, 255, 255, 0.56);
  --panel-border: rgba(15, 118, 110, 0.25);
  --panel-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  --btn-primary-text: #ffffff;
}

:root[data-theme="dark"] {
  --bg:          #0a0f1e;
  --bg-alt:      #0d1526;
  --surface:     #112240;
  --accent:      #64ffda;
  --accent-dim:  rgba(100, 255, 218, 0.15);
  --text:        #f5f5f5;
  --text-muted:  #f5f5f5;
  --white:       #f5f5f5;
  --nav-bg:      rgba(10, 15, 30, 0.92);
  --nav-border:  rgba(100, 255, 218, 0.08);
  --hero-ov-1:   rgba(10, 15, 30, 0.72);
  --hero-ov-2:   rgba(10, 15, 30, 0.78);
  --section-ov-1: rgba(10, 15, 30, 0.84);
  --section-ov-2: rgba(10, 15, 30, 0.9);
  --panel-bg:    rgba(17, 34, 64, 0.52);
  --panel-border: rgba(100, 255, 218, 0.2);
  --panel-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --btn-primary-text: #0a0f1e;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  background-color: var(--bg);
  background-image: linear-gradient(var(--section-ov-1), var(--section-ov-2)), url("../pistachio_nuts.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

ul { list-style: none; }

/* ===========================
   Navigation
   =========================== */
#navbar {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--nav-border);
  z-index: 1000;
  transition: box-shadow var(--transition);
}

#navbar.scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
}

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

.theme-toggle {
  min-height: 40px;
  padding: 0 12px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--nav-border);
  background: transparent;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.theme-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--accent-dim);
}

/* Hamburger (mobile) */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===========================
   Hero
   =========================== */
.hero {
  min-height: 100vh;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  padding: 0 24px;
  padding-top: var(--nav-height);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      var(--hero-ov-1),
      var(--hero-ov-2)
    ),
    url("../halfdome_illuminated.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 92%,
    transparent 100%
  );
  z-index: 0;
  pointer-events: none;
}



.hero-content {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  text-align: center;
  max-width: 860px;
  position: relative;
  z-index: 1;
}

.hero-greeting {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 16px;
}

.hero-name {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--white);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
}

.hero-tagline {
  font-size: clamp(1.5rem, 5vw, 3rem);
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 24px;
}

.hero-description {
  max-width: 540px;
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 1.15rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: var(--btn-primary-text);
}
.btn-primary:hover {
  background: transparent;
  color: var(--accent);
  outline: 1px solid var(--accent);
}

.btn-outline {
  color: var(--accent);
  border: 1px solid var(--accent);
  background: transparent;
}
.btn-outline:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ===========================
   Sections
   =========================== */
.section {
  padding: 100px 24px;
}

.section-alt {
  background: transparent;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.text-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 28px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.section-title {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  color: var(--white);
  margin-bottom: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
  text-align: center;
}

.section-title::after {
  display: none;
}

/* ===========================
   About
   =========================== */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(220px, 1fr);
  max-width: 980px;
  margin: 0 auto;
  gap: 32px;
  align-items: center;
  justify-items: stretch;
}

.about-text {
  max-width: 760px;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: left;
}

.about-image {
  justify-self: end;
}

.publications-intro {
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}

.publication-list {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.publication-list li {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-muted);
  padding-left: 18px;
  position: relative;
}

.publication-list li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.publication-list a {
  color: var(--accent);
}

.publication-list a:hover {
  color: var(--white);
}

.publication-meta {
  display: block;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.publication-updated {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 16px;
}

.image-wrapper {
  position: relative;
  border-radius: var(--radius);
  max-width: 280px;
}

.image-wrapper img {
  border-radius: var(--radius);
  filter: grayscale(30%);
  transition: filter var(--transition);
}

.image-wrapper img:hover { filter: none; }

.image-wrapper::after {
  content: "";
  display: block;
  position: absolute;
  top: 12px;
  left: 12px;
  width: 100%;
  height: 100%;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  z-index: -1;
  transition: transform var(--transition);
}

.image-wrapper:hover::after {
  transform: translate(4px, 4px);
}

/* ===========================
   Projects
   =========================== */
.project-group + .project-group {
  margin-top: 40px;
}

.project-group-title {
  font-size: 1rem;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-icon {
  font-size: 2rem;
  color: var(--accent);
}

.project-links {
  display: flex;
  gap: 12px;
}

.project-links a {
  color: var(--text-muted);
  font-size: 1.1rem;
}

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

.project-title {
  font-size: 1.1rem;
  color: var(--white);
  font-weight: 700;
}

.project-description {
  color: var(--text-muted);
  font-size: 1rem;
  flex: 1;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.project-tech li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===========================
   Contact
   =========================== */
.contact-container {
  text-align: center;
  max-width: 600px;
}

.contact-intro {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1.15rem;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 48px;
}

.social-links a {
  color: var(--text-muted);
  font-size: 1.4rem;
  transition: color var(--transition), transform var(--transition);
}

.social-links a:hover {
  color: var(--accent);
  transform: translateY(-3px);
}

/* ===========================
   Footer
   =========================== */
footer {
  padding: 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--surface);
}

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

/* ===========================
   Fade-in animation
   =========================== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    right: 0;
    width: min(75vw, 300px);
    height: calc(100vh - var(--nav-height));
    background: var(--surface);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    transform: translateX(100%);
    transition: transform var(--transition);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
  }

  .nav-links.open { transform: translateX(0); }

  .hamburger { display: flex; }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-image {
    order: -1;
    justify-self: center;
  }

  .about-text p {
    text-align: center;
  }

  .image-wrapper {
    margin: 0 auto;
  }

  .section-title::after { display: none; }
}

@media (max-width: 480px) {
  .text-panel { padding: 20px; }

  .hero-cta { flex-direction: column; }
  .btn { text-align: center; }
}
