/* =====================================================================
   PORTFOLIO — title-page nav, projects, about, contact
   ===================================================================== */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* top nav on the title page */
.topnav {
  position: absolute; z-index: 6; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px clamp(16px, 4vw, 48px);
  font: 600 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  animation: fade 1s ease .2s both;
}
.topnav a { color: var(--ink); text-decoration: none; }
.topnav .mark { font: 800 17px/1 "Inter Tight", sans-serif; letter-spacing: -0.02em; text-transform: none; border: 2px solid var(--ink); padding: 6px 7px; }
.topnav nav { display: flex; gap: clamp(14px, 3vw, 34px); }
.topnav nav a { color: #4b5560; transition: color .2s; }
.topnav nav a:hover, .topnav nav a:focus-visible { color: var(--ink); }
@media (max-width: 600px) { .topnav { font-size: 10px; letter-spacing: .12em; } .topnav nav { gap: 12px; } }

.hero .tagline {
  margin: 24px auto 0; max-width: 560px;
  font-size: clamp(15px, 1.6vw, 19px); line-height: 1.5; color: #4b5560;
  animation: rise 1s var(--ease) .65s both;
}

/* shared section chrome */
.sec { position: relative; background: var(--page); padding: clamp(96px, 12vw, 168px) clamp(16px, 5vw, 72px); }
.sec-head { max-width: 1180px; margin: 0 auto clamp(40px, 5vw, 64px); display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.kicker { display: block; font: 600 12px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: #6b7684; margin-bottom: 18px; }
.sec h2 { font-size: clamp(38px, 5.6vw, 76px); line-height: .98; letter-spacing: -0.045em; font-weight: 800; }
.sec-head p { max-width: 380px; color: #4b5560; font-size: 16px; line-height: 1.6; }

/* projects */
.grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.pcard {
  grid-column: span 2; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 280px; padding: 28px;
  background: #000; color: #fff;
}
.pcard.wide { grid-column: span 3; }
.pcard .n { position: absolute; top: 26px; right: 26px; font: 600 11px/1 var(--mono); color: #6b7380; }
.pcard .ico { width: 48px; height: 48px; }
.pcard .ico svg { width: 100%; height: 100%; overflow: visible; }
.pcard .ico * { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pcard h3 { margin: auto 0 8px; padding-top: 36px; font-size: 25px; letter-spacing: -0.025em; line-height: 1.1; }
.pcard p { color: #c9d0d9; font-size: 15px; line-height: 1.55; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags span { font: 500 11px/1 var(--mono); padding: 5px 8px; border: 1px solid rgba(255,255,255,.25); color: #e6eaf0; }
.pcard .scan { /* thin scanline swept down the card on hover */
  position: absolute; left: 0; right: 0; top: 0; height: 1px; background: #fff; opacity: 0; pointer-events: none;
}
@media (max-width: 960px) { .grid { grid-template-columns: 1fr 1fr; } .pcard, .pcard.wide { grid-column: span 1; } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } .pcard { min-height: 240px; } }

/* Envoy blueprint (drawn over the teardown stage as it scrolls in) */
.bp .bp-lines *, .bp .knob * { fill: none; stroke: #e9edf2; stroke-width: .3; stroke-linecap: round; stroke-linejoin: round; }
.bp .bp-lines .enc { stroke: #fff; stroke-width: .45; }
.bp .bp-lines .board { stroke: rgba(255,255,255,.4); }
.bp .soft { stroke: rgba(233,237,242,.5); }
.bp .bp-lines .pin { fill: rgba(233,237,242,.75); stroke: none; }
.bp .knob { transform-box: fill-box; transform-origin: 50% 50%; }
.bp .knob .mark { stroke: var(--req); stroke-width: .6; }
.bp .led { fill: var(--req); stroke: none; opacity: .35; }
.bp .dim path { fill: none; stroke: var(--req); stroke-width: .3; }
.bp .dt { fill: var(--req); font: 600 2.6px var(--mono); letter-spacing: .05em; }
.bp .lb { fill: #8e96a3; font: 600 2.2px var(--mono); letter-spacing: .08em; }

/* about */
.about { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(36px, 7vw, 110px); align-items: start; }
.about-side { position: sticky; top: 48px; }
.facts { margin-top: 40px; border-top: 1px solid #e3e7ec; }
.facts > div { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 15px 0; border-bottom: 1px solid #e3e7ec; }
.facts dt { font: 600 11px/1.7 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #6b7684; }
.facts dd { font-size: 15px; line-height: 1.55; color: var(--ink); }
.about-copy p { font-size: clamp(17px, 1.45vw, 20px); line-height: 1.75; color: #2a3038; margin-bottom: 26px; }
.about-copy p:first-child { font-size: clamp(21px, 2.1vw, 28px); line-height: 1.5; color: var(--ink); letter-spacing: -0.01em; }
.about-copy a { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--req); }
.about-copy a:hover { background: #eef3ff; }
.toolbox { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.toolbox span { font: 500 12px/1 var(--mono); padding: 8px 10px; background: #000; color: #fff; }
@media (max-width: 900px) { .about { grid-template-columns: 1fr; } .about-side { position: static; } }

/* qube: why it exists (a short lead-in to the 3D stack) */
.qube-intro { padding-bottom: clamp(40px, 6vw, 80px); }
.why { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.why > div { position: relative; padding: 30px 28px 28px; background: #000; color: #fff; }
.why > div::before { content: ""; position: absolute; left: 0; top: 0; width: 48px; height: 3px; background: var(--req); }
.why .n { display: block; margin-bottom: 26px; font: 600 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #8e96a3; }
.why h3 { margin-bottom: 10px; font-size: 24px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 800; }
.why p { color: #c9d0d9; font-size: 15px; line-height: 1.6; }
@media (max-width: 900px) { .why { grid-template-columns: 1fr; } .why .n { margin-bottom: 16px; } }

/* contact: the scroll-in tunnel, each card a link. It runs on a "screen" layer so that at the very end
   outro.js can zoom out and show it was on the CRT from the original site the whole time. */
.tunnel-contact { height: auto; }
.tunnel-contact .tunnel-stage { background: #02030a; perspective: none; }
.tunnel-contact .tunnel-track { height: 520vh; margin-top: -100vh; margin-top: -100svh; }   /* the cards' share of the scroll */
.tunnel-contact .outro-track { height: 160vh; }                                               /* then the zoom-out */
.outro-scene { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; opacity: 0; visibility: hidden; pointer-events: none;
  will-change: transform; }                       /* its own GPU layer: zooming it never repaints it */
.screen {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden;
  transform-origin: 0 0; perspective: 900px;      /* the cards' 3D lives on the screen now */
  will-change: transform;
  background: radial-gradient(ellipse 70% 45% at 50% 50%, #fff 30%, rgba(255,255,255,0) 100%), linear-gradient(#fff, #f6f8fa);
}
.crt-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.06) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 140px rgba(0,0,0,.5);
  will-change: opacity; }                         /* kept off the animating canvas' layer, so its big shadow is painted once */
/* the finale card: bigger, it's the last thing on the screen when the camera pulls back */
.tcard.finale { width: min(900px, calc(100vw - 32px)); padding: clamp(40px, 6vw, 76px) clamp(28px, 6vw, 76px); }
.tcard.finale::before { width: 150px; height: 4px; }
.tcard.finale .num { font-size: 13px; margin-bottom: 18px; }
.tcard.finale h2 { font-size: clamp(56px, 10vw, 132px); line-height: .9; letter-spacing: -0.05em; font-weight: 800; margin-bottom: 20px; }
.tcard.finale p { font-size: clamp(15px, 1.7vw, 20px); }
.activate {
  position: absolute; z-index: 4; right: 6%; bottom: 7%; display: grid; gap: 6px; opacity: 0;
  pointer-events: none; user-select: none; -webkit-user-select: none;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; color: rgba(70,70,70,.5);
}
.activate span { font-size: 36px; font-weight: 400; letter-spacing: .6px; }
.activate small { font-size: 24px; }
.tcard.link { display: block; text-decoration: none; cursor: pointer; transition: background-color .25s; }
.tcard.link::before { transition: width .35s cubic-bezier(.22, 1, .36, 1); }
.tcard.link:hover, .tcard.link:focus-visible { background: #0b0d11; outline: none; }
.tcard.link:hover::before, .tcard.link:focus-visible::before { width: 100%; }
.tcard .go { display: inline-block; margin-top: 18px; font: 600 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #a9c1ff; }
.tcard.link:hover .go { color: #fff; }
/* platform logos (img/social): a white mark above the label and a big faint watermark */
.tcard.link { overflow: hidden; }
.tcard .brand { display: block; width: 40px; height: 40px; margin-bottom: 22px; color: #fff;
  transition: color .3s, transform .4s cubic-bezier(.22, 1, .36, 1); }
.tcard .brand svg, .tcard .wm { display: block; width: 100%; height: 100%; fill: currentColor; }
.tcard .wm { position: absolute; right: -28px; bottom: -36px; width: 180px; height: 180px; color: #fff; opacity: .07; pointer-events: none;
  transition: opacity .4s, transform .6s cubic-bezier(.22, 1, .36, 1); }
.tcard.link:hover .brand, .tcard.link:focus-visible .brand { color: var(--brand, #fff); transform: translateY(-2px) scale(1.06); }
.tcard.link:hover .wm, .tcard.link:focus-visible .wm { opacity: .12; transform: rotate(-8deg) scale(1.05); }
.tcard.link:hover::before, .tcard.link:focus-visible::before { background: var(--brand, var(--req)); }
.tcard.link > :not(.wm):not(.of) { position: relative; }

/* scroll reveal starting state (only once JS + anime.js are ready) */
.reveal-ready [data-r] { opacity: 0; }
