:root {
  --bg: #05060d;
  --surface: #0b0f1b;
  --card: #0f1425;
  --card-strong: #0b1120;
  --text: #f6f9ff;
  --muted: #c4d1ec;
  --text-plain: #eef3ff;
  --muted-plain: #b8c7e2;
  --accent: #5dd5ff;
  --accent-2: #f6b35c;
  --accent-3: #4f6fbf;
  --border: rgba(255, 255, 255, 0.12);
  --glow: 0 25px 80px rgba(93, 213, 255, 0.22);
  --radius: 18px;
  font-family: 'Sora', 'Space Grotesk', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

/* Logo link styling */
.logo-link {
  text-decoration: none;
  display: inline-flex;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 55% 35%, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(135deg, #060918 0%, #0d1830 45%, #0a1022 100%);
  color: var(--text-plain);
}

body.projects-page { overflow: auto; }
body.tile-open .site-header { display: none; }
body.tile-open { overflow: hidden; }

.grid-overlay {
  display: none;
}

.page { position: relative; z-index: 1; padding: 1.5rem; }
.projects-page .page { min-height: calc(100vh - 72px); height: auto; padding: 1.25rem; overflow: visible; }
.projects-page .section { margin-top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.9) 0%, rgba(5, 7, 15, 0.7) 65%, rgba(5, 7, 15, 0) 100%);
  border-bottom: none;
  box-shadow: none;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #05070f;
  box-shadow: var(--glow);
}

.nav { display: flex; gap: 0.75rem; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav a.active {
  color: var(--text);
  background: rgba(93, 213, 255, 0.15);
  border: 1px solid rgba(93, 213, 255, 0.3);
}

.menu-toggle { display: none; }

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  align-items: center;
  padding: 2rem 0.5rem 1rem;
}

.hero-text h1 { font-size: clamp(2.8rem, 5vw, 3.8rem); margin: 0.25rem 0; }
.role { color: var(--accent); font-weight: 600; letter-spacing: 0.02em; margin: 0 0 0.5rem; }
.lede { color: var(--muted-plain); line-height: 1.7; max-width: 44rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.25rem 0; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag { background: rgba(255, 255, 255, 0.08); color: var(--text); padding: 0.35rem 0.7rem; border-radius: 999px; border: 1px solid var(--border); font-size: 0.95rem; }
.tag:hover { border-color: rgba(93, 213, 255, 0.4); }

.hero-visual { width: 100%; display: flex; justify-content: flex-end; }
.visual-frame {
  width: min(520px, 100%);
  aspect-ratio: 4 / 5;
  background: linear-gradient(155deg, rgba(93, 213, 255, 0.14), rgba(246, 179, 92, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: var(--glow);
}
.hero-photo { width: 100%; height: 100%; object-fit: cover; display: block; }

.section { margin: 2rem 0; padding: 1rem 0.5rem; }
.section-head h2, .section-head h1 { margin: 0.25rem 0; }
.muted { color: var(--muted-plain); }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
  color: var(--muted-plain);
  margin: 0;
}

.edu-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.card {
  background: linear-gradient(145deg, var(--card), var(--card-strong));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--glow);
  color: var(--text);
}
.edu-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.pill {
  background: rgba(246, 179, 92, 0.15);
  border: 1px solid rgba(246, 179, 92, 0.55);
  color: #fff3e2;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}
.pill-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--muted);
}

.section-cta .cta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.section-cta h3 { margin: 0.4rem 0; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; color: var(--text); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.15rem;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
  color: var(--text);
}
.button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #2aa6e8 55%, var(--accent-2) 100%);
  color: #081019;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 30px rgba(93, 213, 255, 0.32), 0 6px 18px rgba(0, 0, 0, 0.35);
}
.button.ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
}
.button:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3); }

.footer { text-align: center; color: var(--muted); padding: 1.5rem; font-size: 0.95rem; }

/* Projects page grid */
.tile-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}

.tile {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--glow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  color: var(--text);
}

.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--tile-accent, var(--accent)) 50%, transparent), transparent 55%);
  opacity: 0.8;
  pointer-events: none;
}

.tile:hover { transform: none; border-color: color-mix(in srgb, var(--tile-accent, var(--accent)) 50%, transparent); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28); }
.tile-body, .tile-detail { position: relative; z-index: 1; }
.tile-detail { display: none; }

.tile.active {
  position: fixed;
  inset: 0;
  z-index: 30;
  padding: 1.5rem;
  background: rgba(5, 7, 15, 0.96);
  border: none;
  box-shadow: none;
  overflow: hidden;
}
.tile.active .tile-body { display: none; }
.tile.active .tile-detail {
  display: block;
  max-height: calc(100vh - 3rem);
  overflow: hidden;
  padding-right: 0.5rem;
  padding-top: 2.5rem;
  position: relative;
}
.tile.active::before { opacity: 0.3; }

.tile-detail__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.tile-detail ul { color: var(--muted); padding-left: 1.1rem; line-height: 1.6; }
.tile-detail a { color: var(--accent); text-decoration: none; }
.tile-detail a:hover { text-decoration: underline; }

.tile-back,
.tile-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}
.tile-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
  position: absolute;
  top: 12px;
  left: 12px;
  transform: none;
  z-index: 2;
  padding: 0.4rem 0.55rem;
  font-size: 1rem;
}
.tile-back::before { content: '←'; }

body.tile-open { overflow: hidden; }

@media (max-width: 900px) {
  .hero { padding-top: 1.5rem; }
  .tile.active { inset: 0.75rem; }
}

@media (max-width: 768px) {
  .nav { display: none; }
  .menu-toggle { display: inline-flex; background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 0.35rem 0.6rem; font-size: 1.2rem; }
  .site-header.open .nav {
    position: absolute;
    top: 70px;
    right: 16px;
    flex-direction: column;
    background: rgba(5, 7, 15, 0.95);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
  }
  .page { padding: 1rem; }
  .tile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-text h1 { font-size: 2.4rem; }
  .visual-frame { aspect-ratio: 3 / 4; }
  .tile.active { inset: 0.25rem; }
}

/* 404 Error Page */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  text-align: center;
}
.error-content h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin: 0.5rem 0 1rem;
}
.error-content .muted {
  max-width: 400px;
  margin: 0 auto 1.5rem;
}
.error-content .hero-actions {
  justify-content: center;
}

/* Print Stylesheet */
@media print {
  *,
  *::before,
  *::after {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.5;
    background: white !important;
  }

  .site-header,
  .footer,
  .menu-toggle,
  .grid-overlay,
  .hero-actions,
  .tags,
  .tile-back,
  .tile-close,
  .button {
    display: none !important;
  }

  .page {
    padding: 0;
    margin: 0;
  }

  .hero {
    display: block;
    padding: 0;
  }

  .hero-visual {
    display: none;
  }

  .hero-text h1 {
    font-size: 24pt;
    margin-bottom: 0.5rem;
  }

  .card,
  .tile {
    background: white !important;
    border: 1px solid #ccc !important;
    border-radius: 0 !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    page-break-inside: avoid;
  }

  .edu-list,
  .tile-grid,
  .cta-grid {
    display: block !important;
  }

  a {
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #555;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  .section {
    page-break-inside: avoid;
  }
}
