/* =========================================================
   Engineering Portfolio — dark theme
   Change the colors below to re-theme the whole site.
   ========================================================= */
:root {
  --bg: #0a0e16;
  --bg-2: #0e1420;
  --surface: #131a28;
  --surface-2: #182133;
  --border: #223049;
  --text: #e6edf7;
  --muted: #93a3bd;
  --faint: #5f6f8a;
  --accent: #4f8dfd;
  --accent-2: #38bdf8;
  --accent-soft: rgba(79, 141, 253, 0.12);
  --radius: 14px;
  --maxw: 1100px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 650; }
p { margin: 0 0 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.eyebrow {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: .75rem;
  display: block;
}

/* ---------- Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 22, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }

.nav-links { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px 14px; }
}

/* ---------- Page header / hero ---------- */
.blueprint {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(79,141,253,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,141,253,.06) 1px, transparent 1px),
    linear-gradient(rgba(79,141,253,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,141,253,.03) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.blueprint::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 0%, rgba(79,141,253,.18), transparent 60%);
  pointer-events: none;
}
.blueprint > * { position: relative; z-index: 1; }

.hero { padding: 110px 0 90px; }
.hero h1 .hl { color: var(--accent); }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }

.page-head { padding: 72px 0 48px; }
.page-head p { color: var(--muted); max-width: 680px; font-size: 1.1rem; margin: 0; }

section.block { padding: 64px 0; }
section.block + section.block { border-top: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, background .15s, transform .15s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3f7cf0; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}
.portrait {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  display: grid; place-items: center;
  color: var(--faint);
  font-family: var(--mono);
  font-size: .85rem;
  overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 28px; }
.fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.fact .k { font-family: var(--mono); font-size: .75rem; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }
.fact .v { font-weight: 600; }

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.skill-card h3 { font-size: 1rem; color: var(--accent-2); font-family: var(--mono); font-weight: 600; }

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .portrait { max-width: 240px; }
}

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tag {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--accent-2);
  background: var(--accent-soft);
  border: 1px solid rgba(79,141,253,.25);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- Experience timeline ---------- */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--border));
}
.job { position: relative; padding-left: 44px; margin-bottom: 36px; }
.job:last-child { margin-bottom: 0; }
.job::before {
  content: "";
  position: absolute;
  left: 0; top: 26px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.job-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-bottom: 4px; }
.job-top h3 { margin: 0; }
.job-date { font-family: var(--mono); font-size: .85rem; color: var(--muted); white-space: nowrap; }
.job-org { color: var(--accent-2); font-weight: 500; margin-bottom: 14px; }
.job ul { margin: 0 0 16px; padding-left: 20px; color: var(--muted); }
.job li { margin-bottom: 6px; }
.job li strong { color: var(--text); font-weight: 600; }

/* ---------- Projects list ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  position: sticky; top: 64px; z-index: 10;
  padding: 14px 0;
  background: var(--bg);
}
.chip {
  font-family: var(--mono);
  font-size: .85rem;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.year-group { padding: 36px 0 20px; }
.year-head {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 22px;
}
.year-head h2 { margin: 0; }
.year-head .count { font-family: var(--mono); font-size: .85rem; color: var(--faint); }
.year-head::after { content: ""; flex: 1; height: 1px; background: var(--border); align-self: center; }
.year-desc { color: var(--muted); margin: -10px 0 22px; }

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

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px -12px rgba(79,141,253,.35);
}
.card-img {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #15233d, #0f1726);
  display: grid; place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.ph { font-family: var(--mono); color: var(--faint); font-size: .8rem; }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-meta { font-family: var(--mono); font-size: .78rem; color: var(--faint); margin-bottom: 6px; }
.card-body h3 { margin-bottom: 8px; }
.card-body p { color: var(--muted); font-size: .95rem; flex: 1; }
.card-more { font-weight: 600; font-size: .9rem; color: var(--accent-2); margin-top: 6px; }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--faint);
  text-align: center;
  font-family: var(--mono);
  font-size: .9rem;
}

/* ---------- Project detail ---------- */
.back { font-family: var(--mono); font-size: .88rem; color: var(--muted); display: inline-block; margin-bottom: 22px; }
.back:hover { color: var(--text); }

.detail-hero-img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  aspect-ratio: 16 / 8;
  background: linear-gradient(135deg, #15233d, #0f1726);
  display: grid; place-items: center;
  margin-bottom: 40px;
}
.detail-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}
.detail-main h2 {
  font-size: 1.45rem;
  margin-top: 1.8em;
  padding-top: .2em;
}
.detail-main h2:first-child { margin-top: 0; }
.detail-main p, .detail-main li { color: #c7d2e3; }
.detail-main ul, .detail-main ol { padding-left: 22px; }
.detail-main li { margin-bottom: 6px; }
.detail-main code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
}
.detail-main pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: .88rem;
}
.detail-main pre code { background: none; padding: 0; }

.detail-main .todo {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--faint);
  font-style: italic;
}

figure { margin: 28px 0; }
figure img { border-radius: 10px; border: 1px solid var(--border); }
figcaption { font-size: .88rem; color: var(--faint); margin-top: 8px; text-align: center; }

.sidebar {
  position: sticky; top: 88px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.sidebar h4 {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 10px;
}
.sidebar section + section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.specs { margin: 0; display: grid; gap: 10px; }
.specs div { display: grid; gap: 1px; }
.specs dt { font-size: .82rem; color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; font-size: .95rem; }
.side-links { display: grid; gap: 8px; }
.side-links a { font-size: .95rem; }

.toc { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.toc a { color: var(--muted); font-size: .92rem; }
.toc a:hover { color: var(--text); }

@media (max-width: 880px) {
  .detail-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; order: -1; }
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.contact-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.contact-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.contact-card .icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-2);
  display: grid; place-items: center;
  margin-bottom: 8px;
}
.contact-card .icon svg { width: 22px; height: 22px; }
.contact-card .label { font-family: var(--mono); font-size: .78rem; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }
.contact-card .value { font-weight: 600; word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--faint);
  font-size: .88rem;
  margin-top: 40px;
}
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.site-footer a { color: var(--muted); }
