/* ==========================================================
   Fernando Reina Gálvez — portfolio
   Visual language: black soldermask, copper traces, ENIG pads,
   white silkscreen. Archivo (variable width) + JetBrains Mono.
   ========================================================== */

:root {
  --bg: #0b0c0b;          /* matte soldermask */
  --bg-2: #101210;
  --panel: #141714;
  --line: #222622;
  --line-2: #323832;
  --silk: #efece4;        /* silkscreen white */
  --text: #d6d4cc;
  --muted: #8f958c;
  --copper: #c98a52;
  --copper-hi: #e6ad78;
  --copper-dim: #6b4a2e;
  --enig: #dcb862;        /* gold pad finish */
  --paper: #ffffff;

  --font: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-stretch: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, h4 { color: var(--silk); margin: 0; line-height: 1.15; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.mono { font-family: var(--mono); }

:focus-visible { outline: 2px solid var(--enig); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--enig); color: #000; padding: 8px 14px; border-radius: 6px; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 12, 11, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--silk); }
.mark svg { width: 28px; height: 28px; color: var(--copper); }
.mark span { font-family: var(--mono); font-size: .85rem; letter-spacing: .08em; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: .92rem; transition: color .2s; }
.nav a:hover { color: var(--silk); }
.lang { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; }
.lang button {
  font: 500 .75rem/1 var(--mono); color: var(--muted); background: none; border: 0;
  padding: 7px 11px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s;
}
.lang button[aria-pressed="true"] { background: var(--copper); color: #120c06; }

/* ---------- Buttons ---------- */
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 18px; border-radius: 8px;
  border: 1px solid var(--line-2); background: rgba(255,255,255,.02);
  color: var(--silk); text-decoration: none; font-weight: 550; font-size: .95rem;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: var(--copper); background: rgba(201,138,82,.08); }
.btn--solid { background: var(--copper); border-color: var(--copper); color: #140d06; }
.btn--solid:hover { background: var(--copper-hi); border-color: var(--copper-hi); }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(48px, 9vw, 110px) 0 clamp(56px, 8vw, 96px);
  min-height: min(880px, calc(100vh - 60px));
  display: flex; align-items: center;
}
.hero::before { /* PCB editor grid */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image: radial-gradient(circle, rgba(239,236,228,.09) 1px, transparent 1.3px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 45%, #000 30%, transparent 85%);
          mask-image: radial-gradient(ellipse 80% 70% at 60% 45%, #000 30%, transparent 85%);
}
.hero__traces { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero__traces .tr { fill: none; stroke: var(--copper-dim); stroke-width: 5; stroke-linejoin: round; opacity: .8; }
.hero__traces .vias circle { fill: var(--bg); stroke: var(--copper); stroke-width: 3; }
.hero__traces .pulse {
  fill: none; stroke: var(--copper-hi); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 26 1000; stroke-dashoffset: 1026; opacity: 0;
  filter: drop-shadow(0 0 6px rgba(230,173,120,.8));
}

.hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.hero__loc { color: var(--muted); font-size: .82rem; margin-bottom: 22px; display: flex; align-items: center; gap: 10px; }
.hero__loc::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--enig); }
.hero__name {
  font-size: clamp(2.7rem, 6.6vw, 5.6rem);
  font-weight: 720; font-stretch: 116%;
  letter-spacing: -.025em; line-height: .96;
  margin-bottom: 26px;
}
.hero__lead {
  font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.3; color: var(--silk);
  font-weight: 480; max-width: 30ch; margin-bottom: 16px;
  padding-left: 16px; border-left: 3px solid var(--copper);
}
.hero__sub { color: var(--muted); max-width: 46ch; margin-bottom: 32px; }

.hero__board { margin: 0; position: relative; }
.hero__board::before { /* copper glow under the board */
  content: ""; position: absolute; inset: 12% 8% 6%; z-index: -1;
  background: radial-gradient(closest-side, rgba(201,138,82,.22), transparent);
  filter: blur(20px);
}
.hero__board img { filter: drop-shadow(0 30px 40px rgba(0,0,0,.6)); }
.hero__board figcaption { font-size: .74rem; color: var(--muted); width: fit-content; margin: 6px 0 0 auto; padding: 2px 8px; background: var(--bg); border-radius: 4px; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; border-top: 1px solid var(--line); }
.section--work { background: var(--bg-2); }
.sec-head { margin-bottom: clamp(36px, 5vw, 60px); max-width: 860px; }
.sec-head h2 {
  display: flex; align-items: center; gap: 16px;
  font-size: clamp(1.9rem, 3.8vw, 3rem); font-weight: 680; font-stretch: 112%; letter-spacing: -.02em;
  margin-bottom: 16px;
}
.sec-head h2::before { /* via */
  content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid var(--copper); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--copper-dim);
}
.section--work .sec-head h2::before { box-shadow: 0 0 0 4px var(--bg-2), 0 0 0 5px var(--copper-dim); }
.sec-head h2::after { /* trace leaving the via */
  content: ""; flex: 1; min-width: 40px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--copper-dim), transparent);
  transform-origin: left; transition: transform 1.1s var(--ease) .15s;
}
.js .sec-head.reveal:not(.is-in) h2::after { transform: scaleX(0); }
.sec-intro { color: var(--muted); max-width: 62ch; }

/* ---------- Capabilities ---------- */
.caps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(20px, 3vw, 40px); }
.cap { position: relative; padding: 28px 0 36px; border-top: 1px solid var(--line-2); }
.cap::before { content: ""; position: absolute; top: -2px; left: 0; width: 44px; height: 3px; background: var(--copper); transition: width .5s var(--ease); }
.cap:hover::before { width: 96px; }
.cap__icon { width: 40px; height: 40px; margin-bottom: 18px; fill: none; stroke: var(--copper); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cap__icon .fill { fill: var(--copper); }
.cap h3 { font-size: 1.2rem; font-weight: 640; margin-bottom: 10px; }
.cap p { color: var(--muted); font-size: .98rem; }

/* ---------- Role ---------- */
.role__title { color: var(--silk); font-size: 1.25rem; font-weight: 600; margin-bottom: 6px; }
.role__meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--copper-hi); font-size: .8rem; margin-bottom: 14px; }

/* ---------- Case studies ---------- */
.case { padding: clamp(36px, 5vw, 56px) 0; border-top: 1px solid var(--line); }
.case:last-child { padding-bottom: 0; }
.case__title { font-size: clamp(1.35rem, 2.4vw, 1.85rem); font-weight: 650; font-stretch: 106%; margin-bottom: 32px; max-width: 30ch; }
.flow { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); margin-bottom: 36px; }
.flow::before { /* trace connecting the three steps */
  content: ""; position: absolute; top: 6px; left: 7px; right: 7px; height: 2px;
  background: linear-gradient(90deg, var(--copper), var(--copper-dim) 60%, var(--enig));
}
.flow li { position: relative; padding-top: 30px; }
.flow li::before { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-2); border: 3px solid var(--copper); }
.flow li:last-child::before { border-color: var(--enig); background: var(--enig); }
.flow h4 { font: 500 .78rem/1 var(--mono); color: var(--copper-hi); margin-bottom: 12px; letter-spacing: .02em; }
.flow li:last-child h4 { color: var(--enig); }
.flow p { color: var(--text); font-size: .98rem; }

.gallery { display: grid; gap: 14px; }
.gallery--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shot { margin: 0; }
.shot .zoom {
  display: grid; place-items: center; aspect-ratio: 1 / 1; padding: 8%;
  background:
    radial-gradient(circle at 50% 55%, rgba(201,138,82,.10), transparent 65%),
    radial-gradient(circle, rgba(239,236,228,.06) 1px, transparent 1.3px) 0 0 / 18px 18px,
    var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.shot img { width: 100%; height: 100%; object-fit: contain; }
.shot figcaption { font-size: .85rem; color: var(--muted); margin-top: 10px; }
.render-note { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: .74rem; color: var(--muted); }
.render-note svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--enig); stroke-width: 1.3; stroke-linejoin: round; }

/* logic-analyzer strip (case 2) */
.scope { margin-bottom: 28px; }
.scope__screen {
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 18px 18px 14px;
  background:
    linear-gradient(90deg, rgba(239,236,228,.05) 1px, transparent 1px) 0 0 / 10% 100%,
    var(--bg);
}
.scope__row { display: flex; align-items: center; gap: 14px; height: 34px; }
.scope__lbl { width: 34px; flex: none; font-size: .72rem; color: var(--muted); }
.scope__frames {
  flex: 1; height: 16px;
  background: repeating-linear-gradient(90deg, var(--copper) 0 34%, transparent 34% 100%) 0 0 / 10% 100%;
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 3px, rgba(0,0,0,.55) 3px 5px);
          mask-image: repeating-linear-gradient(90deg, #000 0 3px, rgba(0,0,0,.55) 3px 5px);
  border-radius: 2px;
}
.scope__frames--log {
  height: 10px;
  background: repeating-linear-gradient(90deg, transparent 0 36%, var(--enig) 36% 52%, transparent 52% 100%) 0 0 / 10% 100%;
  -webkit-mask-image: none; mask-image: none;
}

.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0 0 22px; }
.figures div { border-left: 2px solid var(--line-2); padding-left: 16px; }
.figures dt { font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--copper-hi); font-weight: 500; line-height: 1.1; }
.figures dd { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.case__extra { color: var(--muted); font-size: .95rem; }

/* ---------- Projects ---------- */
.proj {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 60px); align-items: start;
  padding: clamp(36px, 5vw, 64px) 0; border-top: 1px solid var(--line);
}
@media (min-width: 861px) {
  .proj > * { position: sticky; top: 92px; }
}
.proj:first-of-type { border-top: 0; padding-top: 0; }
.proj--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.proj--flip .proj__media { order: 2; }
.proj__media { margin: 0; }
.proj__media .zoom,
.proj__media--pair figure .zoom,
.proj__media--stack figure .zoom {
  display: grid; place-items: center; padding: 6%;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(201,138,82,.13), transparent 65%),
    radial-gradient(circle, rgba(239,236,228,.06) 1px, transparent 1.3px) 0 0 / 20px 20px,
    var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.proj--halo .proj__media .zoom { padding: 0; overflow: hidden; background: #0f1724; }
.proj__media--pair { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; align-items: stretch; }
.proj__media--pair figure, .proj__media--stack figure { margin: 0; display: flex; flex-direction: column; }
.proj__media--pair figure .zoom { flex: 1; }
.proj__media--stack { display: grid; gap: 12px; }
.proj__media figcaption { font-size: .72rem; color: var(--muted); margin-top: 8px; }
.proj__media img { filter: drop-shadow(0 18px 24px rgba(0,0,0,.55)); }
.proj--halo .proj__media img { filter: none; }

.proj__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 14px; }
.proj__top h3 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 670; font-stretch: 108%; letter-spacing: -.01em; }
.proj__date { font-size: .78rem; color: var(--muted); }
.proj__body > p:not(.status) { color: var(--text); margin-bottom: 20px; max-width: 58ch; }

.status {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 16px;
  font: 500 .74rem/1.35 var(--mono); color: var(--copper-hi);
  border: 1px solid var(--copper-dim); border-radius: 999px; padding: 6px 12px 6px 10px;
}
.status::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; border: 2px solid var(--copper); }
.status--live { color: var(--enig); border-color: rgba(220,184,98,.4); }
.status--live::before { border: 0; background: var(--enig); box-shadow: 0 0 8px var(--enig); }

.specs { border-top: 1px solid var(--line-2); margin-bottom: 18px; }
.specs li {
  display: grid; grid-template-columns: minmax(0, 13.5em) minmax(0, 1fr); gap: 4px 16px;
  padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-size: .92rem;
}
.specs li > span:first-child { color: var(--silk); font-size: .82rem; padding-top: 2px; }
.specs li > span:last-child { color: var(--muted); }

.link {
  display: inline-flex; align-items: center; gap: 8px; color: var(--enig); text-decoration: none;
  font-family: var(--mono); font-size: .9rem; border-bottom: 1px solid rgba(220,184,98,.4); padding-bottom: 2px;
}
.link::after { content: ""; width: 9px; height: 9px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg) translate(-1px, 1px); }
.link:hover { border-bottom-color: var(--enig); }

/* ---------- More designs (compact grid) ---------- */
.more { padding-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); }
.more__head { margin-bottom: 28px; }
.more__head h3 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); font-weight: 660; font-stretch: 108%; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.more__head h3::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--copper); }
.more__head p { color: var(--muted); max-width: 62ch; }
.more__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); }
.mini {
  display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); overflow: hidden;
  transition: border-color .3s;
}
.mini:hover { border-color: var(--line-2); }
.mini__media {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; padding: 5%;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(201,138,82,.12), transparent 65%),
    radial-gradient(circle, rgba(239,236,228,.06) 1px, transparent 1.3px) 0 0 / 18px 18px,
    var(--panel);
  border-bottom: 1px solid var(--line);
}
.mini__media img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0,0,0,.5)); }
.mini__tag {
  position: absolute; left: 10px; bottom: 10px; z-index: 1; font-size: .68rem; color: var(--muted);
  background: rgba(11,12,11,.78); border: 1px solid var(--line-2); border-radius: 4px; padding: 3px 7px;
}
.mini__body { padding: 18px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.mini__date { font-size: .74rem; color: var(--muted); margin-bottom: 6px; }
.mini h4 { font-size: 1.12rem; font-weight: 640; font-stretch: 104%; line-height: 1.25; margin-bottom: 12px; }
.mini .status { align-self: flex-start; margin-bottom: 12px; }
.mini__body > p:not(.status):not(.mini__date) { color: var(--text); font-size: .94rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.chips li { font-size: .72rem; line-height: 1; color: var(--text); border: 1px solid var(--line-2); border-radius: 4px; padding: 6px 8px; background: rgba(255,255,255,.015); }

.status--sw { color: var(--silk); border-color: var(--line-2); }
.status--sw::before { border-radius: 2px; border-color: var(--silk); }

/* terminal (Board Architect) */
.mini__media--term { place-items: stretch; align-content: center; padding: 18px; gap: 8px; background: #070807; }
.term {
  margin: 0; font-size: clamp(.62rem, 1.05vw, .74rem); line-height: 1.55; color: var(--text);
  white-space: pre; overflow-x: auto; max-width: 100%; scrollbar-width: thin;
}
.term__p { color: var(--copper-hi); }
.term__bad { color: #e5786a; }
.term__warn { color: var(--enig); }
.term__cap { font-size: .68rem; color: var(--muted); }

/* block diagram (LoRa alarm) */
.mini__media--diag { padding: 18px 14px; }
.diag { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.diag__col { display: flex; flex-direction: column; align-items: stretch; gap: 0; flex: 1; max-width: 170px; }
.diag__box {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  font: 600 .8rem/1.2 var(--font); color: var(--silk);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 8px; background: var(--bg);
}
.diag__box small { font: 400 .68rem/1.2 var(--mono); color: var(--muted); }
.diag__box--hi { border-color: var(--copper-dim); box-shadow: inset 0 0 0 1px rgba(201,138,82,.15); }
.diag__link {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .68rem; color: var(--copper-hi); padding: 0 4px; white-space: nowrap;
}
.diag__link small { font-size: .6rem; color: var(--muted); }
.diag__link::before, .diag__link::after { content: ""; height: 2px; width: 100%; min-width: 28px; background: var(--copper); border-radius: 2px; }
.diag__link--v { padding: 4px 0; }
.diag__link--v::before, .diag__link--v::after { width: 2px; min-width: 0; height: 12px; }

/* zoomable images */
.zoom { position: relative; cursor: zoom-in; text-decoration: none; overflow: hidden; }
.zoom img { transition: transform .6s var(--ease); }
.zoom:hover img, .zoom:focus-visible img { transform: scale(1.045); }
.zoom::after {
  content: ""; position: absolute; right: 10px; bottom: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(11,12,11,.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23efece4' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='M15 15l5 5M10.5 8v5M8 10.5h5'/%3E%3C/svg%3E") center / 16px no-repeat;
  border: 1px solid var(--line-2); opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s;
}
.zoom:hover::after, .zoom:focus-visible::after { opacity: 1; transform: none; }

/* ---------- Stack ---------- */
.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 30px clamp(20px, 3vw, 44px); }
.stack__group h3 { font-size: 1.02rem; font-weight: 620; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.stack__group h3::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--copper); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font: 400 .8rem/1 var(--mono); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 8px 10px;
  background: rgba(255,255,255,.015);
}

/* ---------- Education ---------- */
.edu__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--copper), var(--copper-dim)); }
.timeline li { position: relative; padding-bottom: 34px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -34px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--copper); }
.timeline__when { font-size: .76rem; color: var(--copper-hi); margin-bottom: 8px; }
.timeline h3 { font-size: 1.25rem; font-weight: 640; margin-bottom: 4px; }
.timeline p:not(.timeline__when) { color: var(--muted); }

.edu__side { display: grid; gap: 28px; align-content: start; }
.award { display: flex; gap: 18px; align-items: center; padding: 20px; border: 1px solid rgba(220,184,98,.35); border-radius: var(--radius); background: linear-gradient(135deg, rgba(220,184,98,.08), transparent 60%); }
.award svg { width: 46px; height: 46px; flex: none; fill: none; stroke: var(--enig); stroke-width: 2; stroke-linejoin: round; }
.award svg .fill { fill: var(--enig); stroke: none; }
.award h3 { font-size: 1.2rem; margin-bottom: 2px; }
.award p { color: var(--muted); font-size: .92rem; }
.edu__block h3 { font-size: 1rem; font-weight: 620; margin-bottom: 10px; }
.edu__block li { color: var(--muted); padding: 6px 0 6px 18px; position: relative; font-size: .96rem; }
.edu__block li::before { content: ""; position: absolute; left: 0; top: 15px; width: 8px; height: 2px; background: var(--copper); }

/* ---------- Contact ---------- */
.contact {
  position: relative; overflow: hidden;
  padding: clamp(80px, 11vw, 140px) 0 40px; border-top: 1px solid var(--line);
  background:
    radial-gradient(ellipse 60% 50% at 15% 0%, rgba(201,138,82,.12), transparent 70%),
    var(--bg);
}
.contact h2 { font-size: clamp(1.9rem, 4.2vw, 3.3rem); font-weight: 700; font-stretch: 112%; letter-spacing: -.02em; max-width: 20ch; margin-bottom: 14px; }
.contact .sec-intro { margin-bottom: 30px; }
.contact__mail {
  display: inline-block; font-size: clamp(1.25rem, 3.6vw, 2.4rem); font-weight: 520; font-stretch: 108%;
  color: var(--copper-hi); text-decoration: none; margin-bottom: 30px; overflow-wrap: anywhere;
  background: linear-gradient(var(--copper), var(--copper)) 0 100% / 0 2px no-repeat;
  transition: background-size .45s var(--ease);
}
.contact__mail:hover { background-size: 100% 2px; }
.colophon { margin-top: clamp(64px, 9vw, 110px); padding-top: 22px; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0;
  background: rgba(6,7,6,.94); color: var(--text);
}
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox::backdrop { background: rgba(0,0,0,.6); }
.lightbox__stage { display: grid; place-items: center; overflow: hidden; padding: 56px 16px 8px; min-height: 0; }
.lightbox__stage img {
  max-width: min(94vw, 1600px); max-height: calc(100vh - 130px); width: auto; height: auto; object-fit: contain;
  cursor: zoom-in; transition: transform .35s var(--ease);
}
.lightbox__stage img.is-zoomed { transform: scale(2.2); cursor: zoom-out; }
.lightbox__cap { text-align: center; padding: 10px 16px 22px; font-size: .8rem; color: var(--muted); }
.lightbox__close {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(20,23,20,.9); color: var(--silk); cursor: pointer; display: grid; place-items: center;
}
.lightbox__close svg { width: 20px; height: 20px; }
.lightbox__close:hover { border-color: var(--copper); }
body.lb-open { overflow: hidden; }

/* ---------- Motion ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .hero__traces .tr { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw 1.8s var(--ease) forwards; }
  .hero__traces .tr--2 { animation-delay: .08s; }
  .hero__traces .tr--3 { animation-delay: .16s; }
  .hero__traces .tr--4 { animation-delay: .24s; }
  .hero__traces .tr--5 { animation-delay: .5s; }
  .hero__traces .tr--6 { animation-delay: .58s; }
  .hero__traces .vias circle { opacity: 0; animation: pop .4s ease-out 1.5s forwards; }
  .hero__traces .pulse { animation: pulse 3.6s linear 2.1s infinite; }
  .hero__traces .pulse--b { animation-delay: 3.9s; animation-duration: 4.2s; }
  .hero__board { animation: rise 1.2s var(--ease) .1s both; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { opacity: 1; } }
@keyframes pulse { 0% { stroke-dashoffset: 1026; opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .sec-head h2::after { transition: none; }
  .js .sec-head.reveal:not(.is-in) h2::after { transform: none; }
  .zoom img, .lightbox__stage img { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .nav { display: none; }
  .lang { margin-left: auto; }
  .caps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 761px) {
  .more__grid > .mini:last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; }
  .more__grid > .mini:last-child:nth-child(odd) .mini__media { flex: 0 0 50%; aspect-ratio: auto; min-height: 300px; border-bottom: 0; border-right: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .more__grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero { min-height: 0; }
  .hero__traces { display: none; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__board { max-width: 520px; margin: 8px auto 0; }
  .proj, .proj--flip { grid-template-columns: 1fr; }
  .proj--flip .proj__media { order: 0; }
  .edu__grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; gap: 26px; }
  .flow::before { top: 7px; bottom: 7px; left: 6px; right: auto; width: 2px; height: auto; background: linear-gradient(var(--copper), var(--copper-dim) 60%, var(--enig)); }
  .flow li { padding-top: 0; padding-left: 32px; }
}
@media (max-width: 560px) {
  body { font-size: 1rem; }
  .sec-head h2 { font-size: 1.75rem; font-stretch: 104%; gap: 12px; }
  .sec-head h2::after { min-width: 24px; }
  .caps { grid-template-columns: 1fr; }
  .cap { padding: 24px 0 28px; }
  .gallery--2 { grid-template-columns: 1fr; }
  .figures { grid-template-columns: 1fr; gap: 14px; }
  .specs li { grid-template-columns: 1fr; gap: 2px; }
  .proj__media--pair { grid-template-columns: 1fr 1fr; gap: 8px; }
  .btn { padding: 11px 15px; }
  .hero__board figcaption { margin-left: 0; padding-left: 0; }
  .mark span { display: none; }
}
