/* Portfolio page: dark "electronics lab" theme layered on top of style.css */

.portfolio-page {
  --color-background: #0c1622;
  --color-foreground: #e8eef5;
  --color-hover-tint: rgba(232, 238, 245, 0.1);
  --font-family: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --color-pcb: #0f3323;
  --color-pcb-trace: #2e7d52;
  --color-copper: #e0b25a;
  --color-led: #39ff88;
  --color-text-muted: #a9bdb2;
  --trace-x: max(24px, calc(50% - 620px));
  background: var(--color-pcb);
}

/* tilted photos near the edges must not add a horizontal scrollbar;
   "clip" (unlike "hidden") keeps the sticky workbench working */
.portfolio-page main {
  overflow-x: clip;
}

/* ---------- Tabs (overlay) ---------- */

.portfolio-page .site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: 16px;
  pointer-events: none;
}

.portfolio-page .site-nav__tabs {
  border-color: rgba(232, 238, 245, 0.6);
  background: rgba(8, 16, 26, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

/* ---------- LED section navigation ---------- */

.led-nav {
  position: fixed;
  top: 50%;
  right: 20px;
  z-index: 40;
  transform: translateY(-50%);
}

.led-nav__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.led-nav__button {
  display: block;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid rgba(232, 238, 245, 0.55);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.led-nav__button:hover {
  transform: scale(1.25);
}

.led-nav__button.is-active {
  border-color: var(--color-led);
  background: var(--color-led);
  box-shadow: 0 0 10px var(--color-led), 0 0 20px rgba(57, 255, 136, 0.5);
}

/* ---------- Hero: layered workbench ---------- */

.scene-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hero {
  position: relative;
  height: 250vh;
}

.hero__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #0c1622;
}

.scene-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero__heading {
  position: absolute;
  top: 13vh;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero__title {
  max-width: 90vw;
  margin: 0;
  padding: 0 16px;
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 4.2vw, 3.75rem);
  line-height: 1.1;
  color: #ffc83d;
  /* dark halo keeps the title readable over the lamp glow and the instruments */
  text-shadow:
    0 2px 2px rgba(0, 0, 0, 0.7),
    0 0 14px rgba(0, 0, 0, 0.75),
    0 6px 30px rgba(0, 0, 0, 0.6);
}

.hero__byline {
  display: block;
  margin-top: 12px;
  font-family: var(--font-family);
  font-weight: 500;
  font-size: clamp(1rem, 2vw, 1.5rem);
}

.hero__cue {
  margin-top: 12px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: #f4f1ea;
  cursor: pointer;
}

.hero__cue svg {
  display: block;
  width: 20px;
  height: 44px;
  animation: cue-bounce 1.8s ease-in-out infinite;
}

@keyframes cue-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

.scope-wave {
  animation: scope-scroll 2.4s linear infinite;
}

.scope-wave--secondary {
  animation-name: scope-scroll-secondary;
  animation-duration: 1.6s;
}

@keyframes scope-scroll {
  to { transform: translateX(-96px); }
}

@keyframes scope-scroll-secondary {
  to { transform: translateX(-64px); }
}

.led-blink {
  animation: led-blink 1.2s steps(1) infinite;
}

.led-blink--delayed {
  animation-delay: 0.6s;
}

@keyframes led-blink {
  50% { opacity: 0.25; }
}

/* ---------- Curtain: PCB with photo modules ---------- */

/* Starts one screen before the hero ends, so it slides over the pinned workbench
   and covers it exactly when the workbench unpins. */
.curtain {
  position: relative;
  z-index: 2;
  margin-top: -100vh;
}

.curtain__board {
  display: block;
  width: 100%;
  height: max(51vw, 100vh);
}


/* ---------- Taped photos (curtain corners and one per section) ---------- */

/* Rough left/right edges, like tape torn by hand */
.taped-photo {
  --torn-edges: polygon(0 0, 100% 0, calc(100% - 4px) 20%, 100% 40%, calc(100% - 4px) 60%, 100% 80%, calc(100% - 3px) 100%, 0 100%, 4px 80%, 0 60%, 4px 40%, 0 20%);
  position: absolute;
  z-index: 1;
  width: clamp(150px, 19vw, 300px);
  margin: 0;
  padding: 8px 8px 0;
  background: #fbf8f1;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 16px 30px -12px rgba(0, 0, 0, 0.6);
  /* "rotate" composes with the GSAP scale used for the reveal */
  rotate: var(--tilt, 0deg);
}

.taped-photo img {
  display: block;
  width: 100%;
  height: auto;
}

/* strip of tape holding the photo at the top */
.taped-photo::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 50%;
  width: 46%;
  height: 26px;
  background: linear-gradient(rgba(240, 231, 203, 0.82), rgba(226, 214, 180, 0.82));
  clip-path: var(--torn-edges);
  translate: -50% 0;
  rotate: -3deg;
}

/* the legend is handwritten on a second strip of tape across the bottom edge */
.taped-photo__legend {
  position: relative;
  width: fit-content;
  max-width: 108%;
  margin: -14px auto -16px;
  padding: 5px 14px 3px;
  background: linear-gradient(rgba(242, 233, 206, 0.95), rgba(228, 216, 182, 0.95));
  clip-path: var(--torn-edges);
  font-family: "Caveat", cursive;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  color: #2b2620;
  rotate: 1.5deg;
}

.curtain .taped-photo--top-left { top: 7vh; left: 4vw; }
.curtain .taped-photo--top-right { top: 9vh; right: 4vw; }
/* clear of the bottom quarter, which project 1 slides under */
.curtain .taped-photo--bottom-right { bottom: calc(25vh + 6vh); right: 7vw; }

/* In the sections the photos sit in the empty margins beside the 1160px panel */
.project .taped-photo,
.outro .taped-photo {
  --side-offset: calc(28px - max(0px, (100vw - 1160px) / 2));
  width: 200px;
}

.project .taped-photo--top-left { top: 96px; left: var(--side-offset); }
.project .taped-photo--top-right { top: 96px; right: var(--side-offset); }
.project .taped-photo--bottom-left { bottom: 72px; left: calc(var(--side-offset) + 24px); }
.project .taped-photo--bottom-right { bottom: 72px; right: var(--side-offset); }
.outro .taped-photo--bottom-left { bottom: 56px; left: calc(var(--trace-x) + 56px); }

/* Without wide margins, the photo joins the panel's flow above the content */
@media (max-width: 1499px) {
  .project .taped-photo {
    position: relative;
    inset: auto;
    grid-column: 1 / -1;
    width: 180px;
    margin-bottom: 8px;
  }

  .project .taped-photo--top-left,
  .project .taped-photo--bottom-left {
    justify-self: start;
    margin-left: 48px;
  }

  .project .taped-photo--top-right,
  .project .taped-photo--bottom-right {
    justify-self: end;
    margin-right: 24px;
  }
}

@media (max-width: 700px) {
  .outro .taped-photo {
    position: relative;
    inset: auto;
    width: 170px;
    margin-bottom: 32px;
  }

  .curtain .taped-photo {
    width: 140px;
  }

  .taped-photo__legend {
    font-size: 1rem;
  }
}

/* ---------- Projects ---------- */

/* Tucked slightly under the curtain's empty bottom edge so project 1 follows the photos closely. */
.projects {
  position: relative;
  margin-top: -25vh;
}

/* Grid background fades in so it blends with the plain PCB above it. */
.projects::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--color-pcb);
  background-image:
    radial-gradient(circle at 20px 20px, rgba(201, 162, 74, 0.35) 3px, transparent 4px),
    linear-gradient(rgba(46, 125, 82, 0.18) 2px, transparent 2px),
    linear-gradient(90deg, rgba(46, 125, 82, 0.18) 2px, transparent 2px);
  background-size: 160px 160px, 80px 80px, 80px 80px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30vh);
  mask-image: linear-gradient(to bottom, transparent, #000 30vh);
}

.projects__trace {
  position: absolute;
  top: 50vh;
  bottom: 0;
  left: var(--trace-x);
  width: 4px;
  background: rgba(46, 125, 82, 0.6);
}

.projects__trace-fill {
  height: 100%;
  background: linear-gradient(var(--color-copper), #c27a3a);
  transform-origin: top;
}

.project__via {
  position: absolute;
  top: 50%;
  left: calc(var(--trace-x) - 8px);
  width: 20px;
  height: 20px;
  border: 4px solid var(--color-copper);
  border-radius: 50%;
  background: var(--color-pcb);
  transform: translateY(-50%);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.is-active > .project__via {
  background: var(--color-led);
  box-shadow: 0 0 12px var(--color-led);
}

.project {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 64px;
  min-height: 100vh;
  min-height: 100svh;
  max-width: 1160px;
  margin: 0 auto;
  padding: 96px 56px 64px 72px;
}

.project--reversed .project__media {
  order: 2;
}

.project__screen {
  aspect-ratio: 16 / 10;
  padding: 10px;
  border-radius: 16px;
  background: #232a33;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 2px #3a4352;
}

.project__placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  border-radius: 8px;
  background-color: #08160f;
  background-image:
    linear-gradient(rgba(57, 255, 136, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 136, 0.12) 1px, transparent 1px);
  background-size: 10% 12.5%;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-led);
}

.project__placeholder::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--color-led);
  box-shadow: 0 0 12px var(--color-led);
  opacity: 0.6;
  animation: screen-sweep 3s linear infinite;
}

@keyframes screen-sweep {
  to { left: 100%; }
}

.project__screen img,
.project__screen video {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.project__index {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--color-copper);
}

.project__title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
}

.project__tagline {
  margin: 12px 0 0;
  font-size: 1.15rem;
  color: #ffd99a;
}

.project__description {
  margin: 16px 0 0;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.project__features-heading {
  margin: 24px 0 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-led);
}

.project__features {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project__features li {
  position: relative;
  padding: 6px 0 6px 24px;
  line-height: 1.4;
}

.project__features li::before {
  content: "";
  position: absolute;
  top: 0.85em;
  left: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--color-copper);
  border-radius: 50%;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.project__tags li {
  padding: 4px 10px;
  border-radius: 4px;
  background: #15191e;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #d7e3da;
  box-shadow: inset 3px 0 0 #aab3bf, inset -3px 0 0 #aab3bf;
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.project__link {
  padding: 8px 20px;
  border: 2px solid var(--color-copper);
  border-radius: 9999px;
  font-weight: 500;
  text-decoration: none;
  color: var(--color-copper);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.project__link:hover {
  background: var(--color-copper);
  color: var(--color-pcb);
}

/* ---------- Outro ---------- */

.outro {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 64px 56px;
  text-align: center;
}

.outro__title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.outro__text {
  margin: 12px 0 0;
  color: var(--color-text-muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .portfolio-page {
    --trace-x: 20px;
  }

  .project {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 96px 20px 64px 52px;
  }

  .project--reversed .project__media {
    order: 0;
  }

  .project__via {
    top: 120px;
    transform: none;
  }

  .led-nav {
    right: 10px;
  }

  .outro {
    padding: 64px 20px 64px 52px;
  }
}

.radio-wave {
  opacity: 0;
  animation: radio-wave-pulse 1.8s ease-out infinite;
}

.radio-wave--middle {
  animation-delay: 0.3s;
}

.radio-wave--outer {
  animation-delay: 0.6s;
}

@keyframes radio-wave-pulse {
  30% { opacity: 0.9; }
  100% { opacity: 0; }
}
