/* ==========================================================================
   Shell + view layouts
   ========================================================================== */

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 248, 252, 0.82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med), background var(--t-med);
}
.site-header.is-scrolled { border-color: var(--line); background: rgba(255, 255, 255, 0.9); }
.nav { height: var(--nav-h); display: flex; align-items: center; gap: var(--s-5); }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; }
.brand__name { font-weight: 600; font-size: var(--fs-base); }
.nav__links { display: flex; gap: 4px; margin-left: auto; }
.nav__link {
  position: relative; padding: 8px 12px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav__link:hover { color: var(--ink); background: var(--bg-alt); }
.nav__link.is-active { color: var(--accent-strong); }
.nav__link.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -14px; height: 2px; background: var(--accent); border-radius: 2px; }
.nav__actions { display: flex; gap: 8px; }
.nav__toggle { display: none; width: 44px; height: 44px; place-items: center; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); margin-left: auto; }

.mnav { display: none; }
@media (max-width: 860px) {
  .nav__links, .nav__actions { display: none; }
  .nav__toggle { display: grid; }
  .mnav {
    display: flex; flex-direction: column; justify-content: space-between;
    position: fixed; inset: var(--nav-h) 0 0 0; z-index: 49;
    padding: var(--s-5) var(--gutter) var(--s-6);
    background: var(--surface);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease), visibility var(--t-med);
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .mnav { opacity: 1; visibility: visible; transform: none; }
  .mnav__link {
    display: flex; align-items: center; gap: var(--s-4);
    padding: var(--s-4) 0; border-bottom: 1px solid var(--line);
    font-size: var(--fs-xl); font-weight: 500; letter-spacing: -0.01em;
  }
  .mnav__link .mono { font-size: var(--fs-xs); color: var(--faint); width: 22px; }
  .mnav__link .i { margin-left: auto; color: var(--faint); }
  .mnav__link.is-active { color: var(--accent); }
  .mnav__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
  .mnav__actions .btn { height: 52px; }
}

#view { outline: none; min-height: 60vh; }
#view section[id], .cs-sec { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: var(--s-8) 0 var(--s-7);
  background:
    radial-gradient(900px 420px at 85% 10%, rgba(21, 86, 240, 0.07), transparent 70%),
    var(--bg);
  overflow: hidden;
}
.hero__grid { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: var(--s-7); align-items: center; }
.hero__title { font-size: clamp(3rem, 1.6rem + 5.2vw, 5.6rem); line-height: 1.02; letter-spacing: -0.04em; font-weight: 600; color: var(--ink); }
.hero__tagline { font-size: clamp(1.15rem, 0.95rem + 0.75vw, 1.5rem); line-height: var(--lh-snug); font-weight: 500; color: var(--accent-deep); margin-top: var(--s-5); max-width: 30ch; letter-spacing: -0.01em; }
.hero__sub { font-size: var(--fs-base); color: var(--muted); margin-top: var(--s-3); max-width: 46ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.hero__visual { position: relative; filter: drop-shadow(0 24px 48px rgba(21, 56, 140, 0.12)); }

@media (max-width: 1100px) { .hero__grid { gap: var(--s-6); } }
@media (max-width: 860px) {
  .hero { padding-top: var(--s-6); }
  .hero__grid { grid-template-columns: minmax(0, 1fr); }
  .hero__visual { max-width: 620px; }
}
@media (max-width: 600px) {
  .hero__cta .btn { flex: 1 1 auto; }
}

/* Hero artwork — Electrical + Computer Engineering, one system, text-free, bright */
.hero-visual { width: 100%; height: auto; overflow: visible; }
.hv-sheet { fill: var(--surface); stroke: #cfdcf1; }
.hv-gridline { stroke: rgba(21, 86, 240, 0.06); stroke-width: 1; }

.ee-pcb { fill: #f3f7ff; stroke: #a9bfe6; stroke-width: 1.4; }
.ee-hole { fill: #fff; stroke: #a9bfe6; stroke-width: 1.2; }
.ee-hole-sm { fill: #fff; stroke: #6f88b8; }
.ee-pins line { stroke: #6f88b8; stroke-width: 2.4; stroke-linecap: round; }
.ee-pins--sm line { stroke-width: 1.8; }

/* digital */
.ee-cpu { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.8; }
.ee-die { fill: #fff; stroke: var(--accent); stroke-width: 1.3; }
.ee-core { fill: #f2f6ff; stroke: #9fb6e0; stroke-width: 1; }
.ee-alu { fill: #d4e2ff; stroke: var(--accent); stroke-width: 1.3; animation: ee-alu 2.8s ease-in-out infinite; }
.ee-alu__notch { fill: none; stroke: var(--accent); stroke-width: 1.3; }
.ee-cell { fill: #d4e2ff; animation: ee-cell 2.4s steps(1, end) infinite; }
.ee-strip { fill: #d4e2ff; animation: ee-strip 2.2s ease-in-out infinite; }
.ee-ctl { fill: none; stroke: var(--accent); stroke-width: 1.3; }
.ee-ctl__in { fill: var(--accent); animation: ee-pulse 1.8s ease-in-out infinite; }
.ee-dp { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.ee-node { fill: var(--accent); animation: ee-pulse 2s ease-in-out infinite; }
.ee-chip { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.4; }
.ee-bit { fill: #2f5596; }
.ee-bit--0 { fill: #fff; stroke: #6f88b8; stroke-width: 1; }
.ee-gate { fill: #fff; stroke: #2f5596; stroke-width: 1.4; }
.ee-gate--out { fill: #e3ecff; stroke: var(--accent); animation: ee-gate 2.4s ease-in-out infinite; }
.ee-wire-d { fill: none; stroke: #6f88b8; stroke-width: 1.3; stroke-linejoin: round; }
.ee-bus { fill: none; stroke: var(--accent); stroke-width: 1.4; opacity: .55; stroke-linejoin: round; }
.ee-smd { fill: #dfe8fb; stroke: #6f88b8; stroke-width: 1; }

/* power */
.ee-power { fill: none; stroke: #9fb6e0; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.ee-reg__tab { fill: #eef2f8; stroke: #6f88b8; stroke-width: 1.2; }
.ee-reg { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.3; }
.ee-leg { fill: none; stroke: #8a9ab5; stroke-width: 1.6; stroke-linecap: round; }
.ee-ecap { fill: #eef3fc; stroke: #2f5596; stroke-width: 1.3; }
.ee-ecap__stripe { fill: #b9cdf5; }

/* bridge */
.ee-mcu { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.7; }
.ee-mcu__dot { fill: #2f5596; }
.ee-mcu__core { fill: #fff; stroke: var(--accent); stroke-width: 1.3; animation: ee-core 2s ease-in-out infinite; }
.ee-led-sm { fill: var(--accent); animation: ee-blink 1.6s steps(1, end) infinite; }
.ee-xtal { fill: #f7f9fd; stroke: #6f88b8; stroke-width: 1.3; }
.ee-header { fill: #dfe8fb; stroke: #6f88b8; stroke-width: 1; }
.ee-hpin { fill: #2f5596; }
.ee-trace { fill: none; stroke: #9fb6e0; stroke-width: 1.8; stroke-linejoin: round; }
.ee-trace--flow { stroke: var(--accent); stroke-dasharray: 4 10; opacity: .7; animation: ee-flow 1.3s linear infinite; }

/* analog → digital */
.ee-pad { fill: #fff; stroke: #2f5596; stroke-width: 1.4; }
.ee-analog { fill: none; stroke: #5b8cff; stroke-width: 1.8; stroke-linecap: round; }
.ee-stair { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.ee-digital { fill: none; stroke: #2f5596; stroke-width: 1.6; stroke-linejoin: round; }

/* camera (secondary) */
.ee-cambrd { fill: #f7faff; stroke: #2f5596; stroke-width: 1.3; }
.ee-camhouse { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.2; }
.ee-lens1 { fill: #fff; stroke: #2f5596; stroke-width: 1.3; }
.ee-lens2 { fill: #d4e2ff; stroke: var(--accent); }
.ee-lens3 { fill: #3d63a8; }
.ee-glint { fill: #fff; }
.ee-cone { fill: none; stroke: #9fb6e0; stroke-width: 1; stroke-dasharray: 3 3; }
.ee-frame { fill: #fff; stroke: #a9bfe6; stroke-width: 1.2; }
.ee-fig { fill: #dfe8fb; stroke: #2f5596; stroke-width: 1.1; }
.ee-det { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; animation: ee-fade 2.6s ease-in-out infinite; }
.ee-scan { stroke: var(--accent); stroke-width: 1; opacity: .35; }

/* physical */
.ee-bb { fill: #f7faff; stroke: #a9bfe6; stroke-width: 1.4; }
.ee-bbhole { fill: #c3d1ea; }
.ee-rail { stroke: #2f5596; stroke-width: 1; opacity: .35; }
.ee-rail--p { stroke: var(--accent); opacity: .5; }
.ee-channel { fill: #e6edf9; }
.ee-ldr { fill: #fff; stroke: #2f5596; stroke-width: 1.3; }
.ee-ldr__track { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.ee-to92 { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.3; }
.ee-res { fill: #eef3fc; stroke: #2f5596; stroke-width: 1.2; }
.ee-band { fill: none; stroke: var(--accent); stroke-width: 2; }
.ee-capside { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.2; }
.ee-capside__stripe { fill: #9fb6e0; }
.ee-led { fill: #b9cdf5; stroke: #2f5596; stroke-width: 1.2; animation: ee-led 2.4s ease-in-out infinite; }
.ee-ledglow { fill: var(--accent); opacity: 0; animation: ee-glow 2.4s ease-in-out infinite; }
.ee-jumper { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.ee-jumper--a { stroke: var(--accent); }
.ee-jumper--b { stroke: #2f5596; }
.ee-jumper--analog { stroke: #7fa3ea; }
.ee-motor { fill: #e3ecff; stroke: #2f5596; stroke-width: 1.4; }
.ee-motor__cap { fill: #fff; stroke: #2f5596; stroke-width: 1.2; }
.ee-motor__vent { fill: none; stroke: #9fb6e0; stroke-width: 1.2; }
.ee-shaft { stroke: #6f88b8; stroke-width: 3; stroke-linecap: round; }
.ee-blade { fill: #d4e2ff; stroke: var(--accent); stroke-width: 1.1; }
.ee-hub { fill: #2f5596; }

.ee-pkt__dot { fill: var(--accent); }
.ee-pkt__halo { fill: var(--accent); opacity: .15; }
.ee-pkt--analog .ee-pkt__dot { fill: #5b8cff; }

@keyframes ee-flow { to { stroke-dashoffset: -28; } }
@keyframes ee-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes ee-cell { 0%, 100% { fill: #d4e2ff; } 45% { fill: var(--accent); } 70% { fill: #9fb6e0; } }
@keyframes ee-strip { 0%, 100% { fill: #d4e2ff; } 50% { fill: #7fa3ea; } }
@keyframes ee-alu { 0%, 100% { fill: #e3ecff; } 50% { fill: #b9cdf5; } }
@keyframes ee-gate { 0%, 100% { fill: #e3ecff; } 50% { fill: #b9cdf5; } }
@keyframes ee-core { 0%, 100% { fill: #fff; } 50% { fill: #e3ecff; } }
@keyframes ee-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes ee-fade { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ee-led { 0%, 55%, 100% { fill: #b9cdf5; } 65%, 90% { fill: var(--accent); } }
@keyframes ee-glow { 0%, 55%, 100% { opacity: 0; } 65%, 90% { opacity: .2; } }
@media (max-width: 600px) { .ee .ee-minor { display: none; } }
@media (prefers-reduced-motion: reduce) { .ee-pkt, .ee-scan { display: none; } }

/* ---------- Domains / embedded ---------- */
.dgrid { align-items: stretch; }
.others { margin-top: var(--s-6); }
.others__label { display: flex; align-items: center; gap: 10px; font-size: 0.6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-3); }
.others__label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.others__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.orow {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.orow:hover { border-color: var(--accent); background: var(--accent-soft); }
.orow__name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600; }
.orow__sub { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); margin-top: 1px; }
.orow__count { font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }
.orow__arrow { color: var(--faint); transition: color var(--t-fast), transform var(--t-fast); }
.orow:hover .orow__arrow { color: var(--accent); transform: translateX(3px); }
.dgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.others__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .dgrid { grid-template-columns: minmax(0, 1fr); } .others__list { grid-template-columns: minmax(0, 1fr); } }
.dstrip {
  display: flex; align-items: center; gap: var(--s-4);
  margin-top: var(--s-5); padding: var(--s-4) var(--s-5);
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.dstrip:hover { border-color: var(--accent); background: var(--surface); }
.dstrip__k { font-size: 0.625rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 4px; }
.dstrip__main { flex: 1; display: grid; min-width: 0; font-size: var(--fs-sm); }
.dstrip__main span { color: var(--muted); }
.dstrip__tools { display: flex; gap: 6px; }
.dstrip__arrow { color: var(--faint); }
.dstrip:hover .dstrip__arrow { color: var(--accent); }
@media (max-width: 600px) { .dstrip { flex-wrap: wrap; } .dstrip__main { flex-basis: 100%; order: 3; } .dstrip__arrow { display: none; } }

/* ---------- Skill explorer ---------- */
.sx { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-6); align-items: start; }
.sx-left { min-width: 0; }
.sx-left .seg { margin-bottom: var(--s-5); max-width: 100%; }
.sx-group { margin-bottom: var(--s-5); }
.sx-group__label { font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-3); display: flex; gap: 8px; }
.sx-group__label span { color: var(--faint); }
.sx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; }
.sx-tile {
  display: flex; align-items: center; gap: 10px; text-align: left;
  min-height: 48px; padding: 6px 8px 6px 10px; line-height: 1.25;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 500;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.sx-tile__name { flex: 1; min-width: 0; }
.sx-tile:hover { border-color: var(--accent); }
.sx-tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.sx-note { font-size: 0.6875rem; color: var(--faint); }
.sx-panel {
  position: sticky; top: calc(var(--nav-h) + 16px);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  transition: opacity var(--t-fast);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.sx-panel.is-swapping { opacity: .3; }
.sx-panel__inner { padding: var(--s-5); }
.sx-panel__head { display: flex; align-items: center; gap: var(--s-4); }
.sx-panel__title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; }
.sx-panel__evidence { margin: var(--s-4) 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-alt); font-size: var(--fs-sm); color: var(--ink-2); }
.sx-panel__evidence b { color: var(--accent-strong); font-weight: 600; }
.sx-panel__block { margin-top: var(--s-4); }
.sx-panel__foot { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .sx { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 860px) {
  .sx { grid-template-columns: minmax(0, 1fr); }
  .sx-panel { position: static; }
  .sx-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 600px) {
  .seg { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .seg__btn { white-space: nowrap; }
  .sx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Approach ---------- */
.approach { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.approach__step { display: grid; gap: 4px; padding: var(--s-4); border-right: 1px solid var(--line); position: relative; }
.approach__step:last-child { border-right: 0; }
.approach__step:not(:last-child)::after {
  content: ""; position: absolute; right: -5px; top: 22px; width: 8px; height: 8px; z-index: 1;
  border-top: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent); transform: rotate(45deg); background: var(--surface);
}
.approach__n { font-size: 0.6875rem; color: var(--accent); }
.approach__title { font-weight: 600; }
.approach__text { font-size: var(--fs-sm); color: var(--muted); }
.about-short { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--s-7); align-items: start; }
@media (max-width: 1100px) { .approach { grid-template-columns: repeat(2, 1fr); } .approach__step:nth-child(2) { border-right: 0; } .approach__step:nth-child(-n+2) { border-bottom: 1px solid var(--line); } .approach__step:nth-child(2)::after { display: none; } }
@media (max-width: 860px) { .about-short { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); } }
@media (max-width: 600px) { .approach { grid-template-columns: 1fr; } .approach__step { border-right: 0; border-bottom: 1px solid var(--line); } .approach__step::after { display: none; } }

/* ---------- Page head (sub-pages) ---------- */
.phead {
  padding: var(--s-7) 0 var(--s-6);
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border-bottom: 1px solid var(--line);
}
.phead__row { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-6); }
.phead__title { font-size: var(--fs-3xl); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin-top: var(--s-3); }
.phead__lead { font-size: var(--fs-md); color: var(--ink-2); margin-top: var(--s-4); max-width: 60ch; }
.phead__lead b { color: var(--accent-strong); }
.phead__logo { display: inline-flex; vertical-align: middle; margin: -6px 16px 0 0; }
.phead .eyebrow .glyph { margin-right: 2px; }
@media (max-width: 860px) { .phead__row { flex-direction: column; align-items: flex-start; } }


.estack > * + * { margin-top: var(--s-7); }
.eblock__title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; margin-bottom: var(--s-5); }
.toolrow { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.toolrow__item { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); transition: color var(--t-fast); }
.toolrow__item:hover { color: var(--accent); }
.phead__hw { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-6); align-items: center; }
.phead__visual {
  display: grid; place-items: center; aspect-ratio: 16 / 10; padding: var(--s-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.phead__visual .hw-art, .phead__visual .hw-photo { width: 100%; height: 100%; object-fit: contain; }
.phead__count { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--accent); }
@media (max-width: 860px) { .phead__hw { grid-template-columns: minmax(0, 1fr); } .phead__visual { max-width: 520px; } }

/* ---------- Projects page ---------- */
.pfilters { display: grid; gap: var(--s-3); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pfilters__row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: var(--s-4); }
.pfilters__k { font-size: 0.6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pfilters__count { font-size: var(--fs-xs); color: var(--muted); padding-top: var(--s-3); border-top: 1px dashed var(--line); }
.pgrid { transition: opacity var(--t-fast); }
.pgrid.is-filtering { opacity: 0.3; }
@media (max-width: 600px) {
  .pfilters { padding: var(--s-4); }
  .pfilters__row { grid-template-columns: 1fr; gap: 8px; }
  .pfilters .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--s-4)); padding-inline: var(--s-4); }
  .pfilters .fchip, .pfilters .schip { flex-shrink: 0; }
}

/* ---------- Case study ---------- */
.cs-head { padding: var(--s-7) 0 var(--s-6); background: var(--surface); border-bottom: 1px solid var(--line); }
.cs-head__grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--s-7); align-items: start; }
.cs-head__title { font-size: var(--fs-3xl); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin-top: var(--s-3); }
.cs-head__subtitle { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--s-3); }
.cs-head__summary { font-size: var(--fs-md); color: var(--ink-2); margin-top: var(--s-4); max-width: 60ch; }
.cs-head__cta { margin-top: var(--s-5); }
.spec { margin: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.spec__row { display: grid; grid-template-columns: 112px 1fr; gap: var(--s-3); padding: 12px var(--s-4); border-bottom: 1px solid var(--line); align-items: center; }
.spec__row:last-child { border-bottom: 0; }
.spec dt { font-size: 0.625rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.spec dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-sm); }
.spec .chip { height: 30px; }
.meter { flex: 1; min-width: 60px; height: 4px; border-radius: 4px; background: var(--bg-alt); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.cs-media { margin-top: var(--s-6); aspect-ratio: 21 / 8; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cs-media .pv__glyph .i { width: 96px; height: 96px; }
@media (max-width: 1100px) { .cs-head__grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); } .spec { max-width: 640px; } }
@media (max-width: 600px) { .cs-media { aspect-ratio: 16 / 9; } .spec__row { grid-template-columns: 92px 1fr; } }

.cs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-7); align-items: start; }
.cs-toc { position: sticky; top: calc(var(--nav-h) + 24px); }
.cs-toc__label { font-size: 0.625rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-3); }
.cs-toc ol { border-left: 1px solid var(--line); }
.cs-toc a { display: flex; gap: 10px; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: var(--fs-sm); color: var(--muted); transition: color var(--t-fast), border-color var(--t-fast); }
.cs-toc a .mono { font-size: 0.6875rem; color: var(--faint); padding-top: 2px; }
.cs-toc a:hover { color: var(--ink); }
.cs-toc a.is-active { color: var(--accent-strong); border-color: var(--accent); }
.cs-toc a.is-active .mono { color: var(--accent); }
.cs-sec { padding: var(--s-6) 0; border-bottom: 1px solid var(--line); }
.cs-sec:first-child { padding-top: 0; }
.cs-sec__idx { font-size: var(--fs-xs); color: var(--accent); }
.cs-sec__title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; margin: 4px 0 var(--s-4); }
.cs-ph { padding: var(--s-4) var(--s-5); border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.reqs li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); color: var(--ink-2); }
.reqs__id { font-size: var(--fs-xs); color: var(--accent); padding-top: 3px; }
.arch { margin: 0; padding: var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background-color: var(--surface);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px; }
.arch__chain { display: flex; flex-wrap: wrap; align-items: center; gap: 0; row-gap: var(--s-4); }
.arch__block { position: relative; display: grid; gap: 2px; padding: 10px 14px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 6px; font-size: var(--fs-sm); font-weight: 500; }
.arch__block.is-ph { border-style: dashed; border-color: var(--line-strong); color: var(--faint); font-family: var(--font-mono); font-size: var(--fs-xs); }
.arch__n { font-size: 0.625rem; color: var(--accent); }
.arch__wire { width: 28px; height: 1.5px; background: var(--ink-2); position: relative; }
.arch__wire::after { content: ""; position: absolute; right: -1px; top: -3.5px; border: 4px solid transparent; border-left: 6px solid var(--ink-2); border-right: 0; }
.arch figcaption { margin-top: var(--s-4); font-size: var(--fs-xs); color: var(--muted); }
.repo-card { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.repo-card.is-pending { border-style: dashed; background: var(--surface-2); }
.repo-card__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--ink); color: #fff; flex-shrink: 0; }
.repo-card__text { flex: 1; min-width: 0; }
.repo-card__title { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500; overflow-wrap: anywhere; }
.repo-card__sub { font-size: var(--fs-sm); color: var(--muted); }
.explore { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--s-6); }
@media (max-width: 860px) {
  .cs-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .cs-toc { position: static; }
  .cs-toc ol { display: flex; overflow-x: auto; border-left: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .cs-toc a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; padding: 8px 12px; margin: 0 0 -1px; }
}
@media (max-width: 600px) { .repo-card { flex-wrap: wrap; } .repo-card .btn { width: 100%; } .arch__chain { flex-direction: column; align-items: stretch; } .arch__wire { width: 1.5px; height: 18px; margin-left: 20px; } .arch__wire::after { right: -3.5px; top: auto; bottom: -1px; border: 4px solid transparent; border-top: 6px solid var(--ink-2); border-bottom: 0; } }

/* ---------- About page ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s-7); align-items: start; }
.about__main > * + * { margin-top: var(--s-6); }
.about__side { position: sticky; top: calc(var(--nav-h) + 24px); padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.about__domains a { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: var(--fs-sm); font-weight: 500; border-bottom: 1px dashed var(--line); }
.about__domains li:last-child a { border-bottom: 0; }
.about__domains a:hover { color: var(--accent); }
@media (max-width: 860px) { .about { grid-template-columns: minmax(0, 1fr); } .about__side { position: static; } }

/* ---------- Credentials ---------- */
.credgrid { gap: var(--s-6); }

/* ---------- Contact band ---------- */
.contact-band {
  background: var(--ink); color: #fff;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: var(--s-9) 0;
  scroll-margin-top: var(--nav-h);
}
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-7); align-items: center; }
.contact .eyebrow { color: #8fb0ff; }
.contact .eyebrow__idx { color: rgba(255,255,255,.5); }
.contact .eyebrow__idx::after { content: ""; }
.contact__title { font-size: var(--fs-2xl); line-height: var(--lh-tight); letter-spacing: -0.02em; font-weight: 600; margin-top: var(--s-3); max-width: 16ch; }
.contact__lead { margin-top: var(--s-4); color: rgba(255,255,255,.65); max-width: 44ch; }
.contact__list { display: grid; gap: 10px; }
.contact__item {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5); border-radius: var(--r-md);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12);
  transition: background var(--t-fast), border-color var(--t-fast);
}
a.contact__item:hover { background: rgba(21, 86, 240, .25); border-color: var(--accent); }
.contact__item.is-pending { border-style: dashed; }
.contact__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; flex-shrink: 0; }
.contact__main { display: grid; flex: 1; min-width: 0; }
.contact__k { font-size: 0.625rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.contact__v { font-weight: 500; overflow-wrap: anywhere; }
.contact__v .ph { color: rgba(255,255,255,.45); border-color: rgba(255,255,255,.25); }
.contact__arrow { color: rgba(255,255,255,.4); }
@media (max-width: 860px) { .contact { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); } .contact-band { padding: var(--s-8) 0; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); border-top: 1px solid rgba(255,255,255,.08); color: rgba(255,255,255,.7); }
.footer { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); padding-block: var(--s-6); flex-wrap: wrap; }
.footer .brand__name { color: #fff; }
.footer__meta { font-size: 0.6875rem; color: rgba(255,255,255,.5); }
.footer__meta .ph { color: rgba(255,255,255,.4); border-color: rgba(255,255,255,.2); }
.footer__nav { display: flex; gap: var(--s-4); font-size: var(--fs-sm); }
.footer__nav a:hover { color: #fff; }

/* GitHub handoff for non-featured project routes */
.gh-redirect { max-width: 680px; padding: var(--s-7) 0; }
.gh-redirect .phead__title { margin-top: var(--s-3); }

/* ---------- Projects gallery ---------- */
.gallery-head { padding: var(--s-8) 0 var(--s-4); }
.gallery-head__title { font-size: var(--fs-3xl); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin-top: var(--s-3); }
.gallery-head__lead { font-size: var(--fs-md); color: var(--muted); margin-top: var(--s-3); max-width: 52ch; }
.gallery-head__filters { margin-top: var(--s-6); }
.gallery { padding-top: var(--s-5); }
.pgallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6) var(--s-5); }
.pgallery .pcard__media { aspect-ratio: 4 / 3; }
.pgallery .pcard__body { padding: var(--s-5) var(--s-5) var(--s-5); gap: 8px; }
.pgallery .pcard__title { font-size: var(--fs-lg); }
@media (max-width: 1000px) { .pgallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .gallery-head { padding: var(--s-7) 0 var(--s-3); }
  .pgallery { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
  .gallery-head__filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .gallery-head__filters .fchip { flex-shrink: 0; }
}

.selected__more { margin-top: var(--s-6); display: flex; justify-content: center; }
.selected__more .tlink { font-size: var(--fs-base); }

/* Selected Engineering Work: 4 (or any even number) → large 2-column showcase */
.pgallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6); }
.pgallery--selected .pcard__media { aspect-ratio: 16 / 10; }
.pgallery--2 .pcard__title { font-size: var(--fs-xl); }
@media (max-width: 600px) { .pgallery--2 { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); } .pgallery--2 .pcard__title { font-size: var(--fs-lg); } }
