/* ============================================================
   Ahmet Erdem - RF & Analog Hardware Portfolio
   Design language: quiet workshop. Warm charcoal, muted green,
   monospace for anything measured.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg:            #1b1c1b;
  --bg-elev:       #232422;
  --bg-elev-2:     #2b2c2a;
  --line:          #32332f;
  --line-strong:   #454741;

  --text:          #f0f1ee;
  --text-muted:    #a6a8a1;
  --text-dim:      #8d8f87;

  --accent:        #5fa87c;   /* muted green  */
  --accent-soft:   rgba(95, 168, 124, 0.14);
  --accent-2:      #c9a15c;   /* warm brass   */
  --accent-2-soft: rgba(201, 161, 92, 0.14);

  --grid:          rgba(178, 192, 168, 0.038);

  --radius:        14px;
  --radius-sm:     9px;
  --maxw:          1120px;
  --gutter:        24px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --shadow: 0 1px 2px rgba(0,0,0,.34), 0 8px 28px rgba(0,0,0,.30);
}

:root[data-theme="light"] {
  --bg:            #f8f8f6;
  --bg-elev:       #ffffff;
  --bg-elev-2:     #f0f0ec;
  --line:          #e6e6e0;
  --line-strong:   #d2d2ca;

  --text:          #1a1c19;
  --text-muted:    #54574f;
  --text-dim:      #6e716a;

  --accent:        #3b7757;
  --accent-soft:   rgba(59, 119, 87, 0.10);
  --accent-2:      #8a6a33;
  --accent-2-soft: rgba(138, 106, 51, 0.10);

  --grid:          rgba(45, 62, 42, 0.05);
  --shadow: 0 1px 2px rgba(26,28,25,.05), 0 8px 24px rgba(26,28,25,.07);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* graticule background - an oscilloscope screen, very faint */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 130% 90% at 50% 0%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 130% 90% at 50% 0%, #000 35%, transparent 100%);
  pointer-events: none;
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: 88px 0; }
.section-head { margin-bottom: 40px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 650; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.16rem; }
p  { margin: 0 0 1em; color: var(--text-muted); }
p.lead { font-size: 1.08rem; color: var(--text-muted); max-width: 66ch; }

/* ---------- nav ---------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 28px;
}
.brand {
  font-weight: 650; text-decoration: none; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 9px; font-size: .97rem;
}
.brand .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
}
.nav-links { display: flex; gap: 26px; margin-left: auto; align-items: center; }
.nav-links a {
  text-decoration: none; font-size: .88rem; color: var(--text-muted);
  transition: color .16s;
}
.nav-links a:hover { color: var(--text); }
.theme-btn {
  background: var(--bg-elev-2); border: 1px solid var(--line);
  color: var(--text-muted); width: 34px; height: 34px;
  border-radius: 9px; cursor: pointer; display: grid; place-items: center;
  transition: border-color .16s, color .16s;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--line-strong); color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }
:root[data-theme="light"] .icon-moon { display: none; }
:root:not([data-theme="light"]) .icon-sun { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 19px; border-radius: 10px;
  font-size: .9rem; font-weight: 550; text-decoration: none;
  border: 1px solid var(--line-strong);
  color: var(--text); background: var(--bg-elev);
  transition: transform .14s, border-color .16s, background .16s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #0d1610; font-weight: 600;
}
:root[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.07); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- hero ---------- */
.hero { padding: 84px 0 64px; }
.hero-status {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  border: 1px solid var(--line); background: var(--bg-elev);
  padding: 6px 13px; border-radius: 100px; margin-bottom: 26px;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.1rem);
  letter-spacing: -.035em; margin-bottom: 14px; font-weight: 700;
}
.hero-role {
  font-family: var(--font-mono); font-size: clamp(.95rem, 2vw, 1.1rem);
  color: var(--accent); margin-bottom: 22px; letter-spacing: -.01em;
}
.hero p.lead { font-size: 1.12rem; max-width: 60ch; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 40px; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chip {
  font-family: var(--font-mono); font-size: .76rem;
  padding: 5px 11px; border-radius: 7px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--text-dim);
}

/* ---------- metric strip ---------- */
.metrics {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 0;
}
.metrics-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.metric {
  padding: 30px 24px;
  border-right: 1px solid var(--line);
}
.metric:last-child { border-right: none; }
.metric .val {
  font-family: var(--font-mono); font-size: 1.62rem;
  font-weight: 600; color: var(--text); letter-spacing: -.03em;
  line-height: 1.15; margin-bottom: 7px;
}
.metric .val em { font-style: normal; color: var(--accent); }
.metric .lbl {
  font-size: .79rem; color: var(--text-dim); line-height: 1.45;
}

/* ---------- project cards - title, picture, button. stacked. ---------- */
.projects { display: grid; grid-template-columns: 1fr; gap: 24px; }
.card {
  display: block; text-decoration: none;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card:hover {
  border-color: var(--line-strong); transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card-head { padding: 18px 24px; }
.card-title {
  font-size: 1.3rem; letter-spacing: -.022em; transition: color .18s;
}
.card:hover .card-title { color: var(--accent); }
.card-media {
  background: var(--bg-elev-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid; place-items: center; padding: 28px 24px;
  overflow: hidden;
}
.card-media img, .card-media svg {
  max-width: 100%; max-height: 330px;
  width: auto; height: auto;
  border-radius: var(--radius-sm);
}
.card-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; font-family: var(--font-mono); font-size: .8rem;
  letter-spacing: .06em; color: var(--text-muted);
  transition: color .18s, background .18s;
}
.card-btn svg { width: 14px; height: 14px; transition: transform .18s; }
.card:hover .card-btn { color: var(--accent); background: var(--accent-soft); }
.card:hover .card-btn svg { transform: translateX(3px); }

/* ---------- about ---------- */
.about {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.about-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 56px var(--gutter);
  display: grid; grid-template-columns: 200px 1fr; gap: 40px;
}
.about-inner h2 { font-size: 1.5rem; }
.about-body p { font-size: 1rem; max-width: 62ch; }
.about-body p:last-child { margin-bottom: 0; }
.about-body strong { color: var(--text); font-weight: 600; }

/* ---------- experience ---------- */
.xp-item {
  display: grid; grid-template-columns: 190px 1fr; gap: 32px;
  padding: 30px 0; border-top: 1px solid var(--line);
}
.xp-item:last-child { border-bottom: 1px solid var(--line); }
.xp-when {
  font-family: var(--font-mono); font-size: .8rem;
  color: var(--text-dim); padding-top: 3px;
}
.xp-where { color: var(--accent); margin-top: 5px; font-size: .8rem; }
.xp-role { font-size: 1.1rem; margin-bottom: 4px; }
.xp-org { font-size: .93rem; color: var(--text-muted); margin-bottom: 14px; font-weight: 500; }
.xp-list { margin: 0; padding-left: 18px; }
.xp-list li {
  color: var(--text-muted); font-size: .93rem; margin-bottom: 9px;
  padding-left: 4px;
}
.xp-list li::marker { color: var(--accent); }
.xp-list b { color: var(--text); font-weight: 600; font-family: var(--font-mono); font-size: .9em; }

/* ---------- skills ---------- */
.skills-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px;
}
.skill-box {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 26px;
}
.skill-box h3 {
  font-size: .82rem; font-family: var(--font-mono);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: .82rem; padding: 5px 11px; border-radius: 7px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  color: var(--text-muted);
}

/* ---------- contact ---------- */
.contact-box {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 52px 44px; text-align: center;
}
.contact-box h2 { margin-bottom: 14px; }
.contact-box p { max-width: 50ch; margin-inline: auto; margin-bottom: 28px; }
.contact-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line); padding: 30px 0;
  font-size: .84rem; color: var(--text-dim);
}
.foot-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  align-items: center;
}
.foot-inner a { color: var(--text-dim); text-decoration: none; }
.foot-inner a:hover { color: var(--accent); }
.foot-links { display: flex; gap: 20px; }

/* ============================================================
   PROJECT PAGE
   ============================================================ */
.back {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .86rem; color: var(--text-muted); text-decoration: none;
  margin-bottom: 30px; font-family: var(--font-mono);
}
.back:hover { color: var(--accent); }
.back svg { width: 14px; height: 14px; }

.proj-head { padding: 44px 0 40px; }
.proj-head h1 {
  font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.035em;
  margin-bottom: 16px; max-width: 20ch;
}
.proj-head p.lead { font-size: 1.1rem; }
.proj-meta {
  display: flex; flex-wrap: wrap; gap: 30px;
  padding: 22px 0; margin-top: 30px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.proj-meta div { min-width: 0; }
.proj-meta dt {
  font-family: var(--font-mono); font-size: .69rem; letter-spacing: .11em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px;
}
.proj-meta dd { margin: 0; font-size: .89rem; color: var(--text); }

/* spec table */
.spec-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  font-size: .91rem;
}
.spec-table caption {
  text-align: left; font-family: var(--font-mono); font-size: .73rem;
  letter-spacing: .11em; text-transform: uppercase; color: var(--accent);
  padding-bottom: 12px;
}
.spec-table th, .spec-table td {
  padding: 13px 20px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.spec-table th { font-weight: 500; color: var(--text-muted); width: 46%; }
.spec-table td {
  font-family: var(--font-mono); color: var(--text); font-size: .88rem;
}
.spec-table td .good { color: var(--accent); }
.spec-table td .warn { color: var(--accent-2); }

/* prose - the column is full width; text blocks inside are held to a readable
   measure, while figures, tables and chain diagrams get the whole width. */
.prose { max-width: 100%; }
.prose > p,
.prose > h2,
.prose > h3,
.prose > ul,
.prose > ol,
.prose > .callout,
.prose > .spec-table { max-width: 70ch; }
.prose h2 { margin: 52px 0 18px; font-size: 1.55rem; }
.prose h3 { margin: 34px 0 12px; font-size: 1.08rem; color: var(--text); }
.prose p  { font-size: 1rem; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 1.2em; }
.prose li { color: var(--text-muted); margin-bottom: 9px; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text); font-weight: 600; }
.prose code {
  font-family: var(--font-mono); font-size: .87em;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; color: var(--accent);
}
.prose a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* callout - the "key insight" box */
.callout {
  border-left: 2px solid var(--accent-2);
  background: var(--accent-2-soft);
  padding: 20px 24px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 28px 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-label {
  font-family: var(--font-mono); font-size: .71rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 8px;
  display: block; font-weight: 600;
}

/* figure */
figure {
  margin: 34px 0; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
figure img { width: 100%; height: auto; background: #fff; }
figure figcaption {
  padding: 14px 20px; font-size: .84rem; color: var(--text-dim);
  border-top: 1px solid var(--line); line-height: 1.55;
}
figure figcaption b { color: var(--text-muted); font-weight: 600; }

/* figures and chain diagrams always take the full column */
.prose > figure, .prose > .chain { max-width: 100%; width: 100%; }

/* signal chain diagram */
.chain {
  display: flex; align-items: stretch; gap: 0; flex-wrap: wrap;
  margin: 30px 0; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: var(--bg-elev);
}
.chain-block {
  flex: 1 1 120px; padding: 18px 14px; text-align: center;
  border-right: 1px solid var(--line); min-width: 0;
}
.chain-block:last-child { border-right: none; }
.chain-block .cb-name {
  font-size: .85rem; font-weight: 600; margin-bottom: 5px; color: var(--text);
}
.chain-block .cb-spec {
  font-family: var(--font-mono); font-size: .74rem; color: var(--accent);
}
.chain-block.dim .cb-spec { color: var(--accent-2); }

/* next-project nav */
.proj-nav {
  border-top: 1px solid var(--line); margin-top: 60px; padding-top: 34px;
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .about-inner { grid-template-columns: 1fr; gap: 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: none; }
  .metric:nth-child(1), .metric:nth-child(2) { border-bottom: 1px solid var(--line); }
  .xp-item { grid-template-columns: 1fr; gap: 14px; }
  .skills-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  section { padding: 60px 0; }
  :root { --gutter: 16px; }
  .nav-inner, .foot-inner { padding-left: 16px; padding-right: 16px; }
  .nav-links { gap: 15px; }
  .nav-links a.hide-sm { display: none; }
  .hero { padding: 56px 0 44px; }
  .contact-box { padding: 38px 22px; }
  .proj-meta { gap: 20px; }
  .metric { padding: 22px 18px; }
  .metric .val { font-size: 1.35rem; }
  .chain-block { flex: 1 1 100%; border-right: none; border-bottom: 1px solid var(--line); }
  .chain-block:last-child { border-bottom: none; }
  .spec-table th, .spec-table td { padding: 11px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ============================================================
   FLOOR PLAN - interactive survey map for the CSI case study
   ============================================================ */
.fp-wrap {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 34px 0;
}
.fp-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  background: var(--bg-elev-2);
}
.fp-controls .fp-hint {
  font-size: .82rem; color: var(--text-dim); margin-left: auto;
}
.fp-btn {
  font-family: var(--font-mono); font-size: .78rem;
  padding: 6px 13px; border-radius: 7px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--text-muted); transition: border-color .15s, color .15s;
}
.fp-btn:hover { border-color: var(--line-strong); color: var(--text); }
.fp-btn[aria-pressed="true"] {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
}
.fp-stage { padding: 18px; }
.fp-svg { width: 100%; height: auto; display: block; }

.fp-grid line { stroke: var(--line); stroke-width: 1; opacity: .5; }
.fp-outline {
  fill: color-mix(in srgb, var(--bg-elev-2) 70%, transparent);
  stroke: var(--text-muted); stroke-width: 4; stroke-linejoin: round;
}
.fp-wall { fill: var(--text-muted); opacity: .85; }
.fp-door line { stroke: var(--accent); stroke-width: 4; stroke-dasharray: 7 6; opacity: .9; }

.fp-rt {
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  opacity: .30; transition: opacity .18s, stroke-width .18s, stroke .18s;
}
.fp-svg.filtered .fp-rt { opacity: .07; }
.fp-svg.filtered .fp-rt.on { opacity: .95; stroke-width: 2.6; }
.fp-rt.out { stroke: var(--accent); }
.fp-rt.inb { stroke: var(--accent-2); }

.fp-esp rect {
  fill: var(--bg); stroke: var(--accent-2); stroke-width: 3;
}
.fp-esp text {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  fill: var(--accent-2); text-anchor: middle;
}
.fp-router circle { fill: var(--bg); stroke: var(--text-muted); stroke-width: 3; }
.fp-wave { fill: none; stroke: var(--text-muted); stroke-width: 2; opacity: .5; }
.fp-router text {
  font-family: var(--font-mono); font-size: 12px;
  fill: var(--text-dim); text-anchor: middle;
}

.fp-pt { cursor: pointer; }
.fp-hit { fill: transparent; }
.fp-dot {
  fill: var(--bg-elev); stroke: var(--accent); stroke-width: 2.4;
  transition: fill .15s, stroke-width .15s;
}
.fp-pt text {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  fill: var(--text); text-anchor: middle; pointer-events: none;
}
.fp-pt:hover .fp-dot, .fp-pt:focus-visible .fp-dot { stroke-width: 4; }
.fp-pt.sel .fp-dot { fill: var(--accent); stroke-width: 4; }
.fp-pt.sel text { fill: #0d1610; }
:root[data-theme="light"] .fp-pt.sel text { fill: #fff; }
.fp-pt-door .fp-dot { stroke: var(--accent-2); stroke-dasharray: 4 3; }

.fp-legend {
  display: flex; flex-wrap: wrap; gap: 18px;
  padding: 14px 20px; border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--text-dim); background: var(--bg-elev-2);
}
.fp-legend span { display: inline-flex; align-items: center; gap: 7px; }
.fp-key { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; }
.fp-key.esp { border: 2.5px solid var(--accent-2); background: var(--bg); }
.fp-key.pt  { border: 2.5px solid var(--accent); border-radius: 50%; background: var(--bg-elev); }
.fp-key.rtr { border: 2.5px solid var(--text-muted); border-radius: 50%; background: var(--bg); }
.fp-key.out { background: var(--accent); height: 3px; border-radius: 2px; }
.fp-key.inb { background: var(--accent-2); height: 3px; border-radius: 2px; }

/* route list */
.route-cols {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-elev); margin: 28px 0;
}
.route-group { padding: 16px 18px; border-right: 1px solid var(--line); }
.route-group:last-child { border-right: none; }
.route-group h4 {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px; font-weight: 600;
}
.route-group ol { margin: 0; padding: 0; list-style: none; }
.route-group li {
  font-family: var(--font-mono); font-size: .79rem; color: var(--text-muted);
  margin-bottom: 4px; display: flex; gap: 8px;
}
.route-group li b { color: var(--text-dim); font-weight: 400; min-width: 1.6em; }
.route-group li em { font-style: normal; color: var(--text); }

@media (max-width: 900px) {
  .route-cols { grid-template-columns: repeat(2, 1fr); }
  .route-group:nth-child(2) { border-right: none; }
  .route-group:nth-child(1), .route-group:nth-child(2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .route-cols { grid-template-columns: 1fr; }
  .route-group { border-right: none; border-bottom: 1px solid var(--line); }
  .route-group:last-child { border-bottom: none; }
  .fp-stage { padding: 10px; }
  .fp-controls { padding: 12px 14px; }
  .fp-controls .fp-hint { margin-left: 0; flex-basis: 100%; }
}
.fp-svg.routes-off .fp-rt { opacity: 0; }
.fp-pt:focus { outline: none; }
.fp-pt:focus-visible .fp-dot { stroke: var(--accent-2); stroke-width: 4.5; }

/* lead board photo at the top of a case study */
.lead-board {
  margin: 0 0 8px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.lead-board img { width: 100%; height: auto; background: #e8e8e4; }
.lead-board figcaption {
  padding: 14px 20px; font-size: .84rem; color: var(--text-dim);
  border-top: 1px solid var(--line); line-height: 1.55;
}
.lead-board figcaption b { color: var(--text-muted); font-weight: 600; }

/* ============================================================
   CIRCUIT BLOCKS - "how it works", one idea per card.
   Add class .with-img and a .blk-img child when a schematic
   crop is available; no other change needed.
   ============================================================ */
.blocks { margin: 26px 0 8px; }
.blk {
  display: grid; grid-template-columns: 1fr;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 14px;
}
.blk.with-img { grid-template-columns: 1fr 1.15fr; }
.blk-txt { padding: 22px 24px; }
.blk-n {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em;
  color: var(--accent); display: block; margin-bottom: 8px; font-weight: 600;
}
.blk h3 { font-size: 1.05rem; margin-bottom: 9px; }
.blk p { font-size: .93rem; margin-bottom: .7em; }
.blk p:last-child { margin-bottom: 0; }
.blk ul { margin: 0; padding-left: 18px; }
.blk li { font-size: .91rem; color: var(--text-muted); margin-bottom: 7px; }
.blk li:last-child { margin-bottom: 0; }
.blk li::marker { color: var(--accent); }
.blk-img {
  background: #e8e8e4; border-left: 1px solid var(--line);
  display: grid; place-items: center; padding: 14px; min-width: 0;
}
.blk-img img {
  max-width: 100%; width: auto; height: auto;
  max-height: 430px;               /* keep tall schematics from stretching a block */
  border-radius: var(--radius-sm);
}

@media (max-width: 760px) {
  .blk.with-img { grid-template-columns: 1fr; }
  .blk-img { border-left: none; border-top: 1px solid var(--line); }
}

/* two-up figure grid - keeps a results section compact */
.fig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0; }
.fig-grid figure { margin: 0; }
.fig-grid figure img { background: #fff; }
.fig-grid figcaption { padding: 12px 16px; font-size: .8rem; }
@media (max-width: 760px) { .fig-grid { grid-template-columns: 1fr; } }

/* ============================================================
   HOME - name + about, collapsible panels, icon-only contact
   ============================================================ */
.hero-grid {
  display: grid; grid-template-columns: 1fr 300px; gap: 48px; align-items: start;
}
.hero-text h1 { margin-bottom: 10px; }
.hero-text p { font-size: 1rem; max-width: 62ch; }
.hero-text p:last-child { margin-bottom: 0; }
.hero-role {
  font-family: var(--font-mono); font-size: 1rem;
  color: var(--accent); margin-bottom: 26px;
}

/* swipeable portrait */
.portrait { position: sticky; top: 96px; }
.portrait-track {
  display: flex; gap: 10px; overflow-x: auto; scroll-behavior: smooth;
  scroll-snap-type: x mandatory; scrollbar-width: none;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg-elev);
}
.portrait-track::-webkit-scrollbar { display: none; }
.portrait-track img {
  flex: 0 0 100%; scroll-snap-align: center;
  width: 100%; aspect-ratio: 0.72; object-fit: cover; display: block;
}
.portrait-dots { display: flex; justify-content: center; gap: 7px; margin-top: 12px; }
.portrait-dots .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong); transition: background .18s, transform .18s;
  cursor: pointer;
}
.portrait-dots .dot.on { background: var(--accent); transform: scale(1.25); }

/* collapsible panels */
.panels { padding: 0 0 20px; }
.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-elev); margin-bottom: 14px; overflow: hidden;
}
.panel > summary {
  list-style: none; cursor: pointer; padding: 17px 24px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 1.02rem; color: var(--text);
  transition: color .16s;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary:hover { color: var(--accent); }
.panel-chev { width: 17px; height: 17px; transition: transform .2s; flex-shrink: 0; }
.panel[open] .panel-chev { transform: rotate(90deg); }
.panel-body { padding: 22px 24px 24px; border-top: 1px solid var(--line); }
.panel-body .xp-item:first-child { border-top: none; padding-top: 4px; }
.panel-body .xp-item:last-child { border-bottom: none; padding-bottom: 0; }

/* contact - just the links */
.contact-simple { text-align: center; }
.contact-simple h2 { margin-bottom: 22px; }
.icon-links { display: flex; justify-content: center; gap: 16px; }
.icon-links a {
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); color: var(--text-muted);
  background: var(--bg-elev);
  transition: color .16s, border-color .16s, transform .16s, background .16s;
}
.icon-links a:hover {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-soft); transform: translateY(-2px);
}
.icon-links svg { width: 21px; height: 21px; }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .portrait { position: static; max-width: 320px; }
}

/* video clip figure */
.clip {
  margin: 0 0 30px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.clip video { width: 100%; height: auto; display: block; background: #fff; }
.clip figcaption {
  padding: 14px 20px; font-size: .84rem; color: var(--text-dim);
  border-top: 1px solid var(--line); line-height: 1.6;
}
.clip figcaption b { color: var(--text-muted); font-weight: 600; }
.clip figcaption strong { color: var(--text-muted); font-weight: 600; }

/* make the floor plan read as interactive */
.fp-hint {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; border-radius: 100px;
  border: 1px dashed var(--accent); background: var(--accent-soft);
  color: var(--accent) !important; font-weight: 550;
}
.fp-hint svg { width: 15px; height: 15px; flex-shrink: 0; }
/* the waypoints breathe until the visitor touches one */
@keyframes fp-breathe {
  0%, 100% { r: 10; }
  50%      { r: 12.5; }
}
.fp-svg:not(.filtered):not(.routes-off) .fp-dot { animation: fp-breathe 2.6s ease-in-out infinite; }
.fp-svg .fp-pt:nth-child(2) .fp-dot { animation-delay: .35s; }
.fp-svg .fp-pt:nth-child(4) .fp-dot { animation-delay: .7s; }
.fp-svg .fp-pt:nth-child(6) .fp-dot { animation-delay: 1.05s; }
@media (prefers-reduced-motion: reduce) {
  .fp-svg .fp-dot { animation: none !important; }
}
.clip-note {
  padding: 11px 20px; font-size: .79rem; line-height: 1.55;
  color: var(--accent-2); background: var(--accent-2-soft);
  border-top: 1px solid var(--line);
}
.clip-note strong { color: var(--accent-2); font-weight: 650; }

/* resume box: looks like a panel, behaves like a link */
.panel-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 24px; text-decoration: none;
  font-weight: 600; font-size: 1.02rem; color: var(--text);
  transition: color .16s, border-color .16s;
}
.panel-link:hover { color: var(--accent); border-color: var(--line-strong); }
.panel-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ============================================================
   PROJECT TABS
   Circuitry / Results / Measurements. Photos carry the page,
   the bar decides which set you are looking at. With no JS
   every panel simply stacks.
   ============================================================ */
.tabs { margin: 34px 0 0; }
.tabs-bar {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.tab-btn {
  appearance: none; background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 11px 17px; font: inherit; font-size: .92rem; font-weight: 600;
  color: var(--text-dim); cursor: pointer;
  transition: color .16s, border-color .16s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn[aria-selected="true"] {
  color: var(--accent); border-bottom-color: var(--accent);
}
.tab-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -3px;
  border-radius: var(--radius-sm);
}
.tab-panel { padding-top: 4px; }
.tab-panel[hidden] { display: none; }
.tab-panel > .spec-table { max-width: 70ch; }

/* photo grid inside a panel */
.shots {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 22px 0 0;
}
.shot {
  margin: 0; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.shot.wide { grid-column: 1 / -1; }
.shot-img {
  flex: 1; min-height: 0; padding: 14px;
  background: #fff; display: grid; place-items: center; cursor: zoom-in;
}
.shot-img img { width: auto; max-width: 100%; max-height: 340px; }
.shot.wide .shot-img img { max-height: 400px; }
.shot.tall .shot-img img { max-height: 560px; }
.shot figcaption {
  padding: 12px 16px; font-size: .85rem; font-weight: 600;
  color: var(--text-muted); border-top: 1px solid var(--line);
}
@media (max-width: 760px) {
  .shots { grid-template-columns: 1fr; }
  .shot-img img, .shot.wide .shot-img img { max-height: 260px; }
}

/* full-size view */
.lightbox {
  position: fixed; inset: 0; z-index: 90; padding: 26px;
  background: rgba(21, 22, 20, .92); display: grid; place-items: center;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 100%; width: auto;
  background: #fff; border-radius: var(--radius-sm);
}

/* instrument screenshots: let the black bleed to the card edge instead of
   floating on a white mat */
.shot.screen .shot-img { background: #000; padding: 0; }
.shot.screen .shot-img img { width: auto; max-width: 100%; max-height: 540px;
                             background: transparent; }
@media (max-width: 760px) { .shot.screen .shot-img img { max-height: 300px; } }

/* portrait: nudge buttons that show up when the cursor is over the photo.
   They anchor to .portrait-frame, not .portrait: .portrait is sticky and must
   stay that way, and the frame excludes the dots so 50% is the photo's middle. */
.portrait-frame { position: relative; }
.portrait-prev,
.portrait-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(255,255,255,.28); color: #fff;
  background: rgba(10,12,10,.42); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .18s, background .18s, transform .18s;
}
.portrait-prev { left: 12px; }
.portrait-next { right: 12px; }
.portrait-frame:hover .portrait-prev,
.portrait-frame:hover .portrait-next,
.portrait-prev:focus-visible,
.portrait-next:focus-visible { opacity: 1; }
.portrait-prev:hover, .portrait-next:hover { background: rgba(10,12,10,.62); }
.portrait-prev:active, .portrait-next:active { transform: translateY(-50%) scale(.93); }
.portrait-prev svg, .portrait-next svg { width: 17px; height: 17px; }
/* no hover on touch, so leave them showing */
@media (hover: none) { .portrait-prev, .portrait-next { opacity: .85; } }
