:root {
  --bg: #08111f;
  --bg-soft: #0d1829;
  --panel: rgba(17, 31, 50, 0.88);
  --panel-solid: #111f32;
  --text: #edf4ff;
  --muted: #a8b7ca;
  --line: rgba(164, 188, 219, 0.18);
  --accent: #66d9c6;
  --accent-strong: #27bfa8;
  --accent-soft: rgba(102, 217, 198, 0.12);
  --blue: #7da9ff;
  --warning: #f1c56f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --shell: 1180px;
}

:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-soft: #eaf0f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --text: #102039;
  --muted: #52657e;
  --line: rgba(16, 32, 57, 0.14);
  --accent: #087f70;
  --accent-strong: #05695e;
  --accent-soft: rgba(8, 127, 112, 0.09);
  --blue: #245fc1;
  --warning: #94620e;
  --shadow: 0 24px 60px rgba(49, 70, 99, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(71, 129, 191, 0.24), transparent 32rem),
    radial-gradient(circle at 88% 5%, rgba(58, 193, 169, 0.16), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { font: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 200;
  padding: .75rem 1rem;
  border-radius: 10px;
  color: var(--bg);
  background: var(--accent);
  font-weight: 800;
}
.skip-link:focus { top: 1rem; }

.shell { width: min(calc(100% - 2rem), var(--shell)); margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}
.nav { min-height: 72px; display: flex; align-items: center; gap: 2rem; }
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -.04em;
  background: var(--panel);
}
.brand span { color: var(--accent); }
.nav-links { margin-left: auto; display: flex; gap: 1.4rem; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 700; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }
.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  align-items: center;
  gap: clamp(2.5rem, 8vw, 7rem);
  padding-block: clamp(4rem, 9vw, 8rem);
}
.eyebrow {
  margin: 0 0 .8rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: .6rem;
  font-size: clamp(3.2rem, 9vw, 7.5rem);
  line-height: .92;
  letter-spacing: -.075em;
}
h2 { margin-bottom: 1rem; font-size: clamp(2rem, 4vw, 3.55rem); line-height: 1.08; letter-spacing: -.045em; }
h3 { line-height: 1.2; letter-spacing: -.025em; }
.headline { margin-bottom: 1.6rem; color: var(--blue); font-size: clamp(1.25rem, 2.4vw, 2rem); font-weight: 800; }
.hero-summary { max-width: 760px; color: var(--muted); font-size: clamp(1.05rem, 1.8vw, 1.28rem); }
.hero-actions, .card-actions, .contact-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.contact-row { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.6rem; color: var(--muted); font-size: .93rem; }
.contact-row a { text-decoration: none; }
.contact-row a:hover { color: var(--accent); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .75rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 13px;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover, .button:focus-visible { transform: translateY(-2px); }
.button.primary { color: #06231e; background: var(--accent); }
.button.primary:hover { background: color-mix(in srgb, var(--accent) 85%, white); }
.button.secondary { color: var(--text); border-color: var(--line); background: var(--panel); }
.button.ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button.small { min-height: 40px; padding: .58rem .82rem; font-size: .88rem; }

.hero-panel {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel-solid) 82%, transparent));
  box-shadow: var(--shadow);
}
.metric { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: .9rem; padding: 1.15rem .75rem; border-bottom: 1px solid var(--line); }
.metric strong { font-size: 2.35rem; line-height: 1; letter-spacing: -.06em; color: var(--accent); }
.metric span { color: var(--muted); font-size: .95rem; }
.availability { margin: 1rem .75rem .4rem; color: var(--muted); font-size: .9rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: .5rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }

.section { padding-block: clamp(4.5rem, 8vw, 7.5rem); }
.section-alt { border-block: 1px solid var(--line); background: color-mix(in srgb, var(--bg-soft) 73%, transparent); }
.section-heading { max-width: 840px; margin-bottom: 2.4rem; }
.section-heading > p:not(.eyebrow) { color: var(--muted); }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); }
.two-column p { color: var(--muted); }
.two-column .lead { color: var(--text); font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.55; }

.project-heading, .experience-heading { max-width: none; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.project-heading > div:first-child, .experience-heading > div:first-child { max-width: 760px; }
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.filter {
  padding: .58rem .78rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}
.filter.active, .filter:hover { color: var(--bg); border-color: var(--accent); background: var(--accent); }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.project-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 15px 45px rgba(0, 0, 0, .1);
  transition: transform .2s ease, border-color .2s ease;
}
.project-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.project-card.featured { background: linear-gradient(145deg, var(--accent-soft), var(--panel)); }
.project-card[hidden] { display: none; }
.project-topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.project-number { color: var(--muted); font-size: .8rem; font-weight: 900; letter-spacing: .12em; }
.badge { padding: .35rem .62rem; border-radius: 999px; font-size: .74rem; font-weight: 900; }
.badge.live { color: var(--accent); background: var(--accent-soft); }
.badge.source { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.project-card h3 { margin-bottom: .8rem; font-size: 1.55rem; }
.project-description, .project-note { color: var(--muted); }
.project-note { padding-top: 1rem; border-top: 1px solid var(--line); font-size: .9rem; }
.tech-list { display: flex; flex-wrap: wrap; gap: .45rem; margin: .6rem 0 1.2rem; padding: 0; list-style: none; }
.tech-list li { padding: .33rem .55rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.card-actions { margin-top: auto; padding-top: .7rem; }

.skill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.skill-grid article, .education-grid article {
  padding: 1.45rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.skill-grid h3, .education-grid h3 { margin-bottom: .65rem; font-size: 1.08rem; }
.skill-grid p, .education-grid p { margin: 0; color: var(--muted); font-size: .93rem; }

.experience-controls { display: flex; flex-wrap: wrap; gap: .6rem; }
.timeline { position: relative; display: grid; gap: .7rem; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 24px; bottom: 24px; width: 1px; background: var(--line); }
.experience-item { position: relative; margin-left: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); overflow: hidden; }
.experience-item::before { content: ""; position: absolute; left: 17px; top: 25px; width: 9px; height: 9px; border: 3px solid var(--panel-solid); border-radius: 50%; background: var(--accent); z-index: 2; }
.experience-item summary { display: flex; justify-content: space-between; gap: 1.5rem; padding: 1.15rem 1.2rem 1.15rem 3rem; cursor: pointer; list-style: none; }
.experience-item summary::-webkit-details-marker { display: none; }
.experience-item summary span { display: grid; gap: .15rem; }
.experience-item summary strong { font-size: 1rem; }
.experience-item summary small { color: var(--muted); }
.experience-item time { flex: 0 0 auto; color: var(--accent); font-size: .86rem; font-weight: 900; }
.experience-body { padding: 0 1.3rem 1.3rem 3rem; color: var(--muted); }
.experience-body ul { margin: .2rem 0 0; padding-left: 1.15rem; }
.experience-body li + li { margin-top: .45rem; }
.history-link { margin: 1.5rem 0 0; text-align: right; }
.history-link a { color: var(--accent); font-weight: 850; text-decoration: none; }

.education-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.year { display: inline-block; margin-bottom: .9rem; color: var(--accent); font-size: .8rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.contact-section { padding-block: clamp(4rem, 8vw, 7rem); border-top: 1px solid var(--line); background: linear-gradient(125deg, var(--accent-soft), transparent 55%); }
.contact-layout { display: grid; grid-template-columns: 1.35fr .65fr; align-items: center; gap: 3rem; }
.contact-layout h2 { max-width: 760px; }
.contact-layout p { color: var(--muted); }
.contact-actions { align-content: center; }
.site-footer { padding-block: 1.3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer .shell { display: flex; justify-content: space-between; gap: 1rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 150; max-width: min(320px, calc(100vw - 2rem)); padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--panel-solid); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 78%, white); outline-offset: 3px; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .icon-button { margin-left: auto; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding-top: 5rem; }
  .hero-panel { max-width: 680px; }
  .project-heading, .experience-heading { align-items: start; flex-direction: column; }
  .filters { justify-content: flex-start; }
  .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 1.2rem), var(--shell)); }
  .hero { padding-top: 3.5rem; }
  h1 { font-size: clamp(3.25rem, 18vw, 5.4rem); }
  .two-column, .project-grid, .skill-grid, .education-grid { grid-template-columns: 1fr; }
  .hero-actions .button, .contact-actions .button { width: 100%; }
  .metric { grid-template-columns: 78px 1fr; }
  .experience-item summary { align-items: start; flex-direction: column; gap: .45rem; }
  .experience-item time { padding-left: 0; }
  .site-footer .shell { flex-direction: column; }
}

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

@media print {
  :root, :root[data-theme="light"] {
    --bg: #fff;
    --bg-soft: #fff;
    --panel: #fff;
    --panel-solid: #fff;
    --text: #111;
    --muted: #333;
    --line: #ccc;
    --accent: #065f55;
    --blue: #1d4f91;
  }
  body { background: #fff; font-size: 10.5pt; }
  .site-header, .hero-actions, .filters, .experience-controls, .contact-section, .site-footer, .toast { display: none !important; }
  .hero { min-height: auto; grid-template-columns: 1fr 280px; gap: 1rem; padding: 0 0 1.2rem; }
  h1 { font-size: 38pt; }
  h2 { font-size: 21pt; }
  .section { padding-block: 1rem; }
  .section-alt { border: 0; background: #fff; }
  .project-grid, .skill-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card, .skill-grid article, .education-grid article, .experience-item, .hero-panel { break-inside: avoid; box-shadow: none; }
  .project-card { min-height: auto; }
  .project-card[data-tags="source"] { display: none; }
  .button { border: 0; padding: 0; min-height: 0; }
  .card-actions a::after { content: " (" attr(href) ")"; font-weight: 400; }
  a { text-decoration: none; }
}
