/* Project scan presentation v4 */
.projects-scan {
  --scan-x: 50%;
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  padding: clamp(104px, 12vh, 144px) 0 clamp(70px, 9vh, 108px);
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(3,7,18,.16), rgba(3,6,16,.91) 11%, rgba(3,6,16,.96) 88%, rgba(3,7,18,.75)),
    radial-gradient(ellipse 45% 38% at 50% 58%, rgba(74,52,178,.14), transparent 72%);
}

.projects-scan::before,
.projects-scan::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
}

.projects-scan::before {
  opacity: .34;
  background-image:
    linear-gradient(rgba(74,180,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,180,255,.055) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 80%, transparent);
}

.projects-scan::after {
  background:
    radial-gradient(circle at 8% 55%, rgba(39,216,255,.08), transparent 18%),
    radial-gradient(circle at 91% 60%, rgba(139,92,246,.09), transparent 20%);
}

.projects-heading {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto clamp(34px, 5vh, 58px);
  text-align: center;
}

.projects-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 15px;
  color: rgba(183,218,243,.58);
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.projects-kicker span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(73,221,255,.28);
  border-radius: 50%;
  color: #72eaff;
  box-shadow: inset 0 0 16px rgba(39,216,255,.08);
  letter-spacing: 0;
}

.projects-heading h2 {
  margin: 0;
  color: #f5faff;
  font-size: clamp(30px, 3.7vw, 54px);
  line-height: 1.14;
  letter-spacing: -.045em;
}

.projects-heading h2 em {
  color: transparent;
  background: linear-gradient(92deg, #83ecff 5%, #a992ff 85%);
  background-clip: text;
  -webkit-background-clip: text;
  font-style: normal;
}

.projects-heading > p:last-child {
  max-width: 650px;
  margin: 17px auto 0;
  color: rgba(193,215,234,.56);
  font-size: 14px;
  line-height: 1.8;
}

.scan-stage {
  position: relative;
  height: clamp(360px, 47vw, 510px);
  min-height: 410px;
  overflow: hidden;
  border-block: 1px solid rgba(113,195,255,.08);
  cursor: grab;
  user-select: none;
}

.scan-stage:active { cursor: grabbing; }

.scan-stage.is-live::before {
  position: absolute;
  top: 20px;
  left: calc(50% + 20px);
  z-index: 14;
  padding: 6px 9px 6px 20px;
  border: 1px solid rgba(83,229,255,.16);
  border-radius: 999px;
  color: rgba(184,239,255,.58);
  background: rgba(3,10,22,.58);
  font: 600 8px/1 monospace;
  letter-spacing: .14em;
  content: "AUTO SCAN";
  pointer-events: none;
}

.scan-stage.is-live::after {
  position: absolute;
  top: 28px;
  left: calc(50% + 29px);
  z-index: 15;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #43eaff;
  box-shadow: 0 0 10px #43eaff;
  animation: live-dot 1s steps(2, end) infinite;
  content: "";
  pointer-events: none;
}

.scan-grid {
  position: absolute;
  inset: 0;
  opacity: .42;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3,7,18,.94), transparent 9%, transparent 91%, rgba(3,7,18,.94)),
    repeating-linear-gradient(0deg, transparent 0 26px, rgba(61,194,255,.035) 27px);
}

.scan-track {
  position: absolute;
  top: 50%;
  left: 0;
  display: flex;
  gap: clamp(22px, 2.5vw, 42px);
  width: max-content;
  will-change: transform;
}

.project-card {
  position: relative;
  flex: 0 0 clamp(340px, 31vw, 470px);
  width: clamp(340px, 31vw, 470px);
  height: clamp(252px, 22vw, 330px);
  transition: filter .35s ease, opacity .35s ease;
  perspective: 900px;
}

.project-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), .34);
  border-radius: 19px;
  background: #07101e;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.1),
    inset 0 0 45px rgba(var(--accent-rgb), .045),
    0 24px 80px rgba(0,0,0,.38),
    0 0 0 1px rgba(0,0,0,.25);
  transform: rotateY(var(--tilt-y, 0deg)) rotateX(var(--tilt-x, 0deg));
  transition: transform .18s ease-out, border-color .25s ease, box-shadow .25s ease;
}

.project-card:hover .project-shell {
  border-color: rgba(var(--accent-rgb), .68);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 28px 90px rgba(0,0,0,.5), 0 0 34px rgba(var(--accent-rgb), .16);
}

.project-visual,
.project-code {
  position: absolute;
  inset: 0 0 84px;
}

.project-visual {
  overflow: hidden;
  background:
    radial-gradient(circle at 54% 46%, rgba(var(--accent-rgb), .16), transparent 40%),
    linear-gradient(135deg, rgba(var(--accent-rgb), .08), transparent 43%),
    #07101e;
}

.project-visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.09) 48%, transparent 60%);
  transform: translateX(-110%);
  animation: card-sheen 5.8s ease-in-out infinite;
  content: "";
}

.project-render {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(1.08) contrast(1.04) brightness(.88);
  transform: scale(1.015);
  transition: filter .5s ease, transform 1.2s cubic-bezier(.2,.8,.2,1);
}

.project-card:hover .project-render {
  filter: saturate(1.15) contrast(1.05) brightness(.98);
  transform: scale(1.055);
}

.visual-noise {
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.04) 4px);
  pointer-events: none;
}

.visual-stat {
  position: absolute;
  top: 17px;
  right: 18px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(var(--accent-rgb), .2);
  border-radius: 8px;
  color: var(--accent);
  background: rgba(2,8,18,.56);
  backdrop-filter: blur(8px);
}

.visual-stat b { font: 700 17px/1 "SFMono-Regular", Consolas, monospace; }
.visual-stat span { color: rgba(218,235,247,.53); font-size: 9px; }

.project-code {
  z-index: 2;
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--scan-reveal, 0px)) 0 0);
  background:
    radial-gradient(circle at 100% 50%, rgba(var(--accent-rgb), .13), transparent 32%),
    linear-gradient(90deg, #03070f 0%, #060a14 100%);
}

.project-code::before {
  position: absolute;
  inset: 0;
  opacity: .22;
  background-image:
    linear-gradient(rgba(var(--accent-rgb), .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), .12) 1px, transparent 1px);
  background-size: 22px 22px;
  content: "";
}

.project-code pre {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: clamp(23px, 2.5vw, 36px);
  color: rgba(180,223,240,.72);
  font: 500 clamp(10px, .85vw, 13px)/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-shadow: 0 0 12px rgba(var(--accent-rgb), .25);
}

.project-code pre i { color: rgba(var(--accent-rgb), .7); font-style: normal; }
.project-code pre b { color: var(--accent); font-weight: 600; }

.card-scan-edge {
  position: absolute;
  top: 0;
  bottom: 84px;
  left: var(--scan-reveal, 0px);
  z-index: 3;
  width: 2px;
  opacity: var(--edge-opacity, 0);
  transform: translateX(-1px);
  background: #eaffff;
  box-shadow: 0 0 5px #fff, 0 0 14px var(--accent), 0 0 34px var(--accent);
}

.project-meta {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  height: 84px;
  padding: 13px 20px 14px;
  border-top: 1px solid rgba(var(--accent-rgb), .18);
  background: linear-gradient(90deg, rgba(4,10,20,.97), rgba(10,14,29,.96));
}

.project-index { color: rgba(var(--accent-rgb), .68); font: 600 8px/1 monospace; letter-spacing: .15em; }
.project-meta h3 { margin: 6px 0 3px; color: #f2f8ff; font-size: 18px; line-height: 1; letter-spacing: -.02em; }
.project-meta p { margin: 0; overflow: hidden; color: rgba(192,212,230,.48); font-size: 10px; line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }

.scanner {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: var(--scan-x);
  z-index: 12;
  width: 1px;
  pointer-events: none;
}

.scanner-beam {
  position: absolute;
  top: 4%;
  bottom: 4%;
  left: -34px;
  width: 68px;
  background: linear-gradient(90deg, transparent, rgba(136,88,255,.09) 30%, rgba(91,226,255,.17) 50%, rgba(136,88,255,.09) 70%, transparent);
  filter: blur(4px);
}

.scanner-core {
  position: absolute;
  inset: 0;
  width: 2px;
  transform: translateX(-1px);
  background: linear-gradient(180deg, transparent, #925dff 15%, #f2ffff 50%, #44e7ff 85%, transparent);
  box-shadow: 0 0 7px #fff, 0 0 18px #7f65ff, 0 0 46px #2bdeff, 0 0 90px rgba(109,71,255,.8);
  animation: scanner-pulse 1.8s ease-in-out infinite;
}

.scanner-core::before,
.scanner-core::after {
  position: absolute;
  left: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid #bdf7ff;
  background: #765cff;
  box-shadow: 0 0 16px #43e8ff;
  transform: translate(-50%, -50%) rotate(45deg);
  content: "";
}

.scanner-core::before { top: 5%; }
.scanner-core::after { top: 95%; }

.scanner-label {
  position: absolute;
  top: 50%;
  left: 13px;
  width: max-content;
  color: rgba(184,241,255,.6);
  font: 600 8px/1 monospace;
  letter-spacing: .18em;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: left center;
}

.scan-particles { position: absolute; inset: 0; z-index: 11; width: 100%; height: 100%; pointer-events: none; }

.scan-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 48px);
  margin: 27px auto 0;
  color: rgba(170,203,228,.42);
  font: 600 9px/1 monospace;
  letter-spacing: .12em;
}

.scan-legend span { display: inline-flex; align-items: center; gap: 8px; }
.scan-legend i { width: 24px; height: 1px; }
.legend-code { background: #936aff; box-shadow: 0 0 9px #936aff; }
.legend-visual { background: #43e7ff; box-shadow: 0 0 9px #43e7ff; }
.scan-legend b { color: rgba(214,240,255,.68); font-weight: 600; }

@keyframes scanner-pulse { 50% { opacity: .72; filter: brightness(1.45); } }
@keyframes card-sheen { 0%,55% { transform: translateX(-110%); } 75%,100% { transform: translateX(110%); } }
@keyframes live-dot { 50% { opacity: .25; } }

@media (max-width: 720px) {
  .projects-scan { padding-top: 92px; }
  .projects-heading { width: calc(100% - 32px); margin-bottom: 30px; }
  .projects-heading h2 { font-size: clamp(29px, 9vw, 39px); }
  .projects-heading > p:last-child { font-size: 13px; }
  .scan-stage { height: 390px; min-height: 390px; }
  .project-card { flex-basis: min(84vw, 360px); width: min(84vw, 360px); height: 264px; }
  .project-meta { padding-inline: 16px; }
  .scan-legend { gap: 14px; font-size: 8px; letter-spacing: .07em; }
  .scan-legend i { width: 14px; }
  .scanner-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .project-visual::after { animation: none; }
}
