:root {
  color-scheme: light;
  --bg: #F8FAFC;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-reflection: linear-gradient(145deg, rgba(255, 255, 255, 0.45), transparent 60%);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-hover: rgba(37, 99, 235, 0.38);
  --glass-shadow: 0 10px 32px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --surface-elevated: rgba(255, 255, 255, 0.88);
  --surface-subtle: rgba(241, 245, 249, 0.8);
  --text: #0F172A;
  --text-muted: #475569;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --line: rgba(15, 23, 42, 0.1);
  --orb-opacity: 0.16;
  --spotlight-color: rgba(0, 102, 255, 0.09);
  --danger: #DC2626;
  --success: #059669;
  --font-heading: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --radius-lg: 1.25rem;
  --radius-md: 0.9rem;
  --radius-sm: 0.55rem;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  color: var(--text);
  background: var(--bg);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070d;
  --glass-bg: rgba(11, 17, 31, 0.58);
  --glass-reflection: linear-gradient(145deg, rgba(175, 211, 255, 0.08), transparent 58%);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(56, 189, 248, 0.42);
  --glass-shadow: 0 16px 44px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(214, 234, 255, 0.1);
  --surface-elevated: rgba(12, 20, 38, 0.9);
  --surface-subtle: rgba(10, 17, 32, 0.72);
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --accent: #38BDF8;
  --accent-hover: #7DD3FC;
  --accent-contrast: #0F172A;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --line: rgba(148, 163, 184, 0.18);
  --orb-opacity: 0.54;
  --spotlight-color: rgba(0, 102, 255, 0.22);
  --danger: #F87171;
  --success: #34D399;
}

@supports not ((backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))) {
  :root { --glass-bg: rgba(255, 255, 255, 0.92); }
  [data-theme="dark"] { --glass-bg: rgba(11, 17, 31, 0.94); }
}

.theme-transition,
.theme-transition body,
.theme-transition .glass-surface,
.theme-transition .orb,
.theme-transition .btn,
.theme-transition .theme-toggle,
.theme-transition .nav-toggle,
.theme-transition .skill-badge,
.theme-transition .tag-list li,
.theme-transition input,
.theme-transition textarea {
  transition: background-color 0.25s ease, background 0.25s ease, color 0.25s ease,
    border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

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

html, body { overflow-x: clip; }

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

/* Fixed ambient lighting beneath the glass surfaces */
.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse closest-side, var(--orb-color), transparent);
  filter: blur(28px);
  opacity: calc(var(--orb-opacity) * var(--orb-intensity, 1));
  animation: orb-float 24s ease-in-out infinite alternate;
}

.orb-1 {
  --orb-color: #0066ff;
  --orb-drift-x: 8vw;
  --orb-drift-y: 10vh;
  width: clamp(30rem, 80vw, 76rem);
  height: clamp(28rem, 85vh, 54rem);
  top: -28vh;
  left: -18%;
  animation-delay: -6s;
}

.orb-2 {
  --orb-color: #00d4ff;
  --orb-intensity: 0.51;
  --orb-drift-x: -9vw;
  --orb-drift-y: -8vh;
  width: clamp(27rem, 68vw, 66rem);
  height: clamp(31rem, 88vh, 59rem);
  top: 9%;
  right: -26%;
  animation-duration: 29s;
  animation-delay: -11s;
}

.orb-3 {
  --orb-color: #1e3a8a;
  --orb-intensity: 0.88;
  --orb-drift-x: 11vw;
  --orb-drift-y: -10vh;
  width: clamp(32rem, 90vw, 78rem);
  height: clamp(25rem, 75vh, 51rem);
  bottom: -30vh;
  left: -3%;
  animation-duration: 34s;
  animation-delay: -16s;
}

@keyframes orb-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(var(--orb-drift-x), var(--orb-drift-y), 0) scale(1.12); }
}

.cursor-spotlight { display: none; }

@media (any-hover: hover) and (any-pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cursor-spotlight {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: clamp(20rem, 52vw, 44rem);
    aspect-ratio: 1;
    background: radial-gradient(circle closest-side, var(--spotlight-color), transparent);
    transform: translate3d(var(--spotlight-x, 0px), var(--spotlight-y, 0px), 0) translate(-50%, -50%);
    opacity: 0;
    transition: opacity 240ms ease-out;
  }

  .cursor-spotlight.is-visible { opacity: 1; }
}

/* Accessibility & Anchors */
.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 60;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--accent);
  border: 1px solid var(--glass-border);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-220%);
}

.skip-link:focus { transform: translateY(0); }

a { color: var(--accent); text-underline-offset: 0.24em; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

section[id], main[id] { scroll-margin-top: 1.5rem; }

/* Layout Helpers */
.container {
  width: min(100% - 2.5rem, 73rem);
  margin-inline: auto;
}

.glass-surface {
  background: var(--glass-reflection), var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Typography */
h1, h2, h3 {
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--text);
  line-height: 1.15;
}

h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); font-weight: 700; }
h3 { font-size: clamp(1.1rem, 1.8vw, 1.28rem); font-weight: 600; }
p { color: var(--text-muted); margin: 0; }

/* Glass Navbar */
.site-header {
  position: relative;
  z-index: 40;
  margin-top: 0.75rem;
}

.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-monogram { display: block; flex-shrink: 0; }
.monogram-frame { stroke: var(--accent); fill: var(--surface-elevated); }
.monogram-s { stroke: var(--text); }
.monogram-k { stroke: var(--accent); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.brand-tagline {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

.brand-sub {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.primary-nav a {
  padding: 0.45rem 0.78rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a.is-active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.44rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle:hover,
.nav-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

/* Hero Section */
.hero-section { padding-block: clamp(1.5rem, 3.5vw, 2.75rem) clamp(2rem, 4vw, 3rem); }

.hero-card {
  display: grid;
  grid-template-columns: 1.3fr 0.78fr;
  gap: clamp(1.75rem, 4vw, 3.75rem);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 3.25rem);
  border-radius: var(--radius-lg);
}

.hero-card > * { min-width: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 1.15rem;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero-name {
  font-size: clamp(2.1rem, 4.8vw, 3.75rem);
  font-weight: 700;
  line-height: 1.08;
}

.hero-role {
  margin-top: 0.65rem;
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.hero-value {
  margin-top: 1.15rem;
  max-width: 40rem;
  font-size: clamp(0.98rem, 1.4vw, 1.06rem);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border-color: var(--glass-border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  list-style: none;
  padding: 1.35rem 0 0;
  margin: 1.75rem 0 0;
  border-top: 1px solid var(--line);
}

.hero-metrics li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hero-metrics strong {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  letter-spacing: 0.03em;
  color: var(--text);
}

.hero-metrics span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.hero-portrait {
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--surface-subtle);
  box-shadow: var(--glass-shadow);
}

.hero-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1100 / 1288;
  object-fit: cover;
}

/* Sections */
.page-section {
  padding-block: clamp(2.5rem, 5vw, 4.25rem);
  border-top: 1px solid var(--line);
}

.section-header { margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }

.section-kicker {
  font-size: 0.84rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* About & Skills */
.about-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.2fr;
  gap: 1.25rem;
  align-items: start;
}

.about-layout > * { min-width: 0; }

.about-summary {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.skill-group {
  padding: 1.25rem;
  border-radius: var(--radius-md);
}

.skill-group h3 {
  font-size: 1rem;
  margin-bottom: 0.85rem;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.skill-badge {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--glass-border);
}

.skill-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Experience Vertical Timeline */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-left: 2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.56rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--line) 100%);
}

.timeline-item { position: relative; }

.timeline-marker {
  position: absolute;
  left: -2rem;
  top: 1.5rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-card {
  padding: clamp(1.35rem, 3vw, 1.85rem);
  border-radius: var(--radius-md);
}

.timeline-card:hover {
  border-color: var(--glass-border-hover);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.timeline-company {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline-date {
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.achievement-list {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: var(--text-muted);
}

.achievement-list strong { color: var(--text); }

/* Featured Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1.2rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 1.45rem;
  border-radius: var(--radius-md);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-hover);
}

.project-period {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.project-subtitle {
  margin-top: 0.3rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.project-desc { font-size: 0.93rem; }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: auto 0 0;
}

.tag-list li {
  padding: 0.24rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.project-link {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.project-link:hover { text-decoration: underline; }

/* Education */
.education-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
}

.edu-card {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.edu-period {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.edu-institution {
  color: var(--text);
  font-weight: 500;
}

.edu-detail { font-size: 0.93rem; }
.edu-detail strong { color: var(--text); }

/* Contact & Form */
.contact-grid {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 1.25rem;
  align-items: start;
}

.contact-info,
.contact-form {
  padding: 1.55rem;
  border-radius: var(--radius-md);
}

.contact-info { display: flex; flex-direction: column; gap: 0.95rem; }

.contact-links {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-links li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.contact-links li:last-child { border-bottom: none; padding-bottom: 0; }

.contact-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.contact-links a { font-weight: 500; word-break: break-word; }

.contact-form { display: flex; flex-direction: column; gap: 1rem; }

.form-field { display: flex; flex-direction: column; gap: 0.4rem; }

.form-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--surface-subtle);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.form-field textarea { resize: vertical; min-height: 6.5rem; }

.form-field input.is-invalid,
.form-field textarea.is-invalid {
  border-color: var(--danger);
}

.field-error {
  min-height: 1.1em;
  font-size: 0.8rem;
  color: var(--danger);
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.15rem;
}

.honeypot-field { display: none; }

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.form-status { font-size: 0.9rem; font-weight: 500; }
.form-status.is-pending { color: var(--text-muted); }
.form-status.is-success { color: var(--success); }
.form-status.is-error { color: var(--danger); }

/* Footer */
.site-footer { padding-block: 1.5rem 2.25rem; }

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius-md);
}

.footer-copy { font-size: 0.88rem; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .about-layout { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .hero-card,
  .contact-grid { grid-template-columns: 1fr; }
  .hero-portrait { max-width: 22rem; }
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }

  .primary-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--glass-reflection), var(--surface-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
  }

  .primary-nav.is-open { display: flex; }
  .primary-nav a { padding: 0.65rem 0.85rem; }
}

@media (max-width: 720px) {
  .education-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .container { width: min(100% - 1.5rem, 73rem); }
  .skills-grid { grid-template-columns: 1fr; }
  .hero-metrics { grid-template-columns: 1fr; gap: 0.7rem; }
  .timeline { padding-left: 1.5rem; }
  .timeline::before { left: 0.4rem; }
  .timeline-marker { left: -1.5rem; width: 0.95rem; height: 0.95rem; }
}
