:root {
  --bg: #080c16;
  --bg-elevated: #0f1524;
  --bg-soft: #121a2c;
  --panel: rgba(18, 26, 44, 0.72);
  --panel-solid: #121a2c;
  --text: #edf3ff;
  --muted: #a7b2c9;
  --faint: #72809b;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #6ea8ff;
  --accent-strong: #3b82f6;
  --accent-2: #75e6d1;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shell: min(1160px, calc(100% - 40px));
}

html[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-elevated: #ffffff;
  --bg-soft: #eef3fb;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --text: #111827;
  --muted: #56627a;
  --faint: #7b879f;
  --line: rgba(17, 24, 39, 0.10);
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-2: #0f9f8a;
  --shadow: 0 24px 60px rgba(30, 41, 59, 0.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
button, input, textarea { font: inherit; }
a { color: inherit; }
img { max-width: 100%; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 9999;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 16px; }

.shell { width: var(--shell); margin: 0 auto; }
.section-pad { padding: 112px 0; position: relative; }
.section-muted { background: linear-gradient(180deg, transparent, rgba(110, 168, 255, .035), transparent); }

.ambient {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(120px);
  opacity: .10;
  pointer-events: none;
  z-index: -1;
}
.ambient-one { background: var(--accent); top: -180px; right: -180px; }
.ambient-two { background: var(--accent-2); left: -220px; top: 55vh; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06111f;
  box-shadow: 0 8px 30px rgba(59, 130, 246, .24);
}
.brand-text { font-size: .9rem; }
.desktop-nav { display: flex; gap: 22px; align-items: center; }
.desktop-nav a, .mobile-nav a { color: var(--muted); text-decoration: none; font-size: .84rem; font-weight: 650; }
.desktop-nav a:hover, .mobile-nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  border-radius: 10px;
  cursor: pointer;
}
.icon-button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.menu-toggle { display: none; }
.menu-toggle span { width: 17px; height: 1.5px; background: var(--text); display: block; margin: 2px 0; }
.mobile-nav { display: none; padding: 8px 20px 18px; gap: 4px; }
.mobile-nav[hidden] { display: none !important; }
.mobile-nav a { padding: 10px 0; }
.scroll-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.hero { padding-top: 124px; min-height: 84vh; display: flex; align-items: center; }
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 72px; align-items: center; }
.eyebrow, .section-kicker {
  margin: 0 0 16px;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent-2);
}
.eyebrow { display: flex; align-items: center; gap: 9px; letter-spacing: .08em; text-transform: none; font-size: .82rem; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-2) 16%, transparent); }
.hero h1, .section-heading h2, .split-heading h2, .contact-card h2 {
  margin: 0;
  letter-spacing: -.045em;
  line-height: 1.04;
}
.hero h1 { max-width: 760px; font-size: clamp(3.1rem, 7vw, 6.7rem); }
.hero h1 span { color: var(--accent); }
.hero-lede { max-width: 680px; font-size: clamp(1.05rem, 1.7vw, 1.28rem); color: var(--muted); margin: 28px 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 13px;
  padding: 0 17px;
  font-size: .92rem;
  font-weight: 760;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: linear-gradient(135deg, var(--accent-strong), var(--accent)); color: #fff; box-shadow: 0 14px 35px rgba(59, 130, 246, .22); }
.button-secondary { background: var(--panel); border-color: var(--line); color: var(--text); }
.hero-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 54px; padding-top: 22px; border-top: 1px solid var(--line); }
.hero-meta div { display: grid; gap: 2px; }
.hero-meta strong { font-size: .86rem; }
.hero-meta span { color: var(--faint); font-size: .78rem; }

.hero-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-solid) 90%, transparent), color-mix(in srgb, var(--panel-solid) 70%, transparent));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.terminal-topline { min-height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); color: var(--faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.terminal-dots { display: flex; gap: 7px; }
.terminal-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); opacity: .45; }
.terminal-body { padding: 28px 26px 18px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }
.terminal-body p { margin: 0 0 12px; }
.prompt { color: var(--accent-2); font-weight: 800; }
.terminal-output { color: var(--muted); padding-left: 18px; line-height: 1.72; }
.terminal-accent { color: var(--accent); }
.tech-pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 26px 26px; }
.tech-pill, .tag { border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--muted); border-radius: 999px; padding: 7px 10px; font-size: .74rem; font-weight: 700; }

.section-heading, .split-heading { display: grid; grid-template-columns: 1fr minmax(300px, 500px); gap: 70px; align-items: end; margin-bottom: 46px; }
.section-heading h2, .split-heading h2, .contact-card h2 { font-size: clamp(2.2rem, 5vw, 4.4rem); }
.section-heading > p, .body-copy p, .contact-card > div > p:last-child { margin: 0; color: var(--muted); }
.body-copy { display: grid; gap: 16px; }
.body-copy p { margin: 0; }

.timeline { display: grid; gap: 18px; }
.timeline-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}
.timeline-meta { display: grid; align-content: start; gap: 5px; }
.timeline-meta .period { color: var(--accent-2); font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.timeline-meta .company { font-size: .9rem; color: var(--muted); }
.timeline-content h3 { margin: 0 0 8px; font-size: 1.35rem; }
.timeline-content > p { margin: 0 0 16px; color: var(--muted); }
.timeline-content ul { margin: 0 0 20px; padding-left: 20px; color: var(--muted); }
.timeline-content li + li { margin-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }

.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.project-card {
  position: relative;
  min-height: 330px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel-solid) 80%, transparent));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.project-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -90px; top: -90px; border-radius: 50%; background: var(--accent); filter: blur(75px); opacity: .09; }
.project-card .project-index { color: var(--faint); font: 700 .75rem ui-monospace, monospace; }
.project-card .project-eyebrow { color: var(--accent-2); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin: 38px 0 8px; }
.project-card h3 { margin: 0; font-size: 1.55rem; letter-spacing: -.025em; }
.project-card p { color: var(--muted); }
.project-impact { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); font-size: .88rem; }
.project-impact strong { color: var(--text); }

.skills-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.skill-card { padding: 24px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--panel); }
.skill-card h3 { margin: 0 0 18px; font-size: 1rem; }
.skill-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.skill-card li { color: var(--muted); font-size: .88rem; display: flex; gap: 9px; align-items: center; }
.skill-card li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }

.gallery-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.gallery-item { grid-column: span 4; position: relative; border-radius: var(--radius-md); overflow: hidden; min-height: 280px; border: 1px solid var(--line); background: var(--panel-solid); cursor: zoom-in; }
.gallery-item:nth-child(5n + 1), .gallery-item:nth-child(5n + 4) { grid-column: span 8; }
.gallery-item img { width: 100%; height: 100%; min-height: 280px; object-fit: cover; display: block; transition: transform .35s ease; }
.gallery-item:hover img { transform: scale(1.025); }
.gallery-overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 20px 18px; background: linear-gradient(transparent, rgba(3,7,18,.88)); color: white; }
.gallery-overlay strong { display: block; font-size: .95rem; }
.gallery-overlay span { color: rgba(255,255,255,.72); font-size: .76rem; }
.gallery-empty { grid-column: 1 / -1; padding: 64px 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-md); color: var(--muted); }
.gallery-empty h3 { margin: 8px 0; color: var(--text); }
.gallery-empty p { max-width: 560px; margin: 0 auto; }
.empty-icon { font-size: 2rem; color: var(--accent); }

.contact-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--bg-soft) 80%, transparent)); padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: 1fr auto; gap: 50px; align-items: end; box-shadow: var(--shadow); }
.contact-card h2 { max-width: 820px; }
.contact-card > div > p:last-child { max-width: 720px; margin-top: 18px; }
.contact-actions { min-width: 210px; display: grid; gap: 10px; }
.contact-actions .button { width: 100%; }

.site-footer { border-top: 1px solid var(--line); padding: 34px 0; }
.footer-inner { display: grid; grid-template-columns: 1fr auto auto; gap: 30px; align-items: center; }
.footer-inner strong { font-size: .92rem; }
.footer-inner p { margin: 3px 0 0; color: var(--faint); font-size: .78rem; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: .82rem; }
.footer-links a:hover { color: var(--text); }
.copyright { text-align: right; }

.lightbox { position: fixed; inset: 0; z-index: 2500; background: rgba(2, 6, 16, .94); display: grid; place-items: center; padding: 50px 20px 80px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1180px, 92vw); max-height: 78vh; object-fit: contain; border-radius: 12px; box-shadow: 0 40px 100px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; right: 22px; top: 18px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: white; font-size: 1.7rem; cursor: pointer; }
.lightbox-caption { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: white; text-align: center; display: grid; }
.lightbox-caption span { color: rgba(255,255,255,.66); font-size: .8rem; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

.admin-body { min-height: 100vh; }
.admin-main { padding: 70px 0 110px; }
.admin-shell { width: min(960px, calc(100% - 40px)); margin: 0 auto; }
.admin-heading { margin-bottom: 28px; }
.admin-heading h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1; letter-spacing: -.04em; margin: 0 0 12px; }
.admin-heading p { color: var(--muted); max-width: 680px; }
.admin-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; }
.admin-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-md); padding: 24px; }
.admin-card h2 { margin: 0 0 6px; }
.admin-card > p { color: var(--muted); margin-top: 0; }
.form-stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: .82rem; font-weight: 750; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 12px; padding: 12px 13px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.field small { color: var(--faint); }
.file-drop { border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 14px; padding: 22px; text-align: center; background: color-mix(in srgb, var(--accent) 4%, transparent); }
.file-drop input { display: none; }
.file-drop label { cursor: pointer; display: block; }
.preview-image { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); margin-top: 12px; }
.admin-button { border: 0; cursor: pointer; }
.admin-status { min-height: 22px; margin: 12px 0 0; font-size: .84rem; color: var(--muted); }
.admin-status.error { color: #ff8e8e; }
.admin-status.success { color: var(--accent-2); }
.admin-session { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--panel); }
.admin-session p { margin: 0; color: var(--muted); font-size: .84rem; }
.link-button { background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 750; padding: 0; }
.admin-gallery { display: grid; gap: 10px; margin-top: 18px; }
.admin-image-row { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.admin-image-row img { width: 84px; height: 62px; object-fit: cover; border-radius: 8px; }
.admin-image-row strong { display: block; font-size: .9rem; }
.admin-image-row span { display: block; color: var(--faint); font-size: .75rem; }
.delete-button { border: 1px solid rgba(255, 93, 93, .24); background: rgba(255, 93, 93, .07); color: #ff9494; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.security-note { padding: 16px; border: 1px solid color-mix(in srgb, var(--accent-2) 30%, var(--line)); background: color-mix(in srgb, var(--accent-2) 5%, transparent); border-radius: 12px; color: var(--muted); font-size: .82rem; }
.security-note strong { color: var(--text); }

@media (max-width: 960px) {
  .desktop-nav { display: none; }
  .menu-toggle { display: grid; }
  .mobile-nav:not([hidden]) { display: grid; }
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero { min-height: auto; }
  .section-heading, .split-heading { grid-template-columns: 1fr; gap: 20px; align-items: start; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline-card { grid-template-columns: 1fr; gap: 18px; }
  .contact-card { grid-template-columns: 1fr; align-items: start; }
  .contact-actions { min-width: 0; max-width: 300px; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  :root { --shell: min(100% - 28px, 1160px); }
  .section-pad { padding: 80px 0; }
  .hero { padding-top: 72px; }
  .hero h1 { font-size: clamp(2.9rem, 16vw, 4.5rem); }
  .hero-meta { grid-template-columns: 1fr; }
  .projects-grid, .skills-grid { grid-template-columns: 1fr; }
  .gallery-item, .gallery-item:nth-child(5n + 1), .gallery-item:nth-child(5n + 4) { grid-column: 1 / -1; }
  .footer-inner { grid-template-columns: 1fr; align-items: start; }
  .copyright { text-align: left; }
  .brand-text { display: none; }
  .timeline-card, .project-card, .skill-card { padding: 22px; }
  .admin-image-row { grid-template-columns: 68px 1fr; }
  .admin-image-row img { width: 68px; height: 54px; }
  .admin-image-row .delete-button { grid-column: 1 / -1; width: 100%; }
}

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