/* ---------- Media & placeholders ---------- */

.media {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  aspect-ratio: 16 / 10;
}
.media--card { border-radius: 0; border: 0; }
.media--phone { aspect-ratio: 9 / 19.5; border: 0; border-radius: 0; }

.media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at 30% 25%, rgba(139, 92, 246, .2), transparent 60%),
    radial-gradient(ellipse at 75% 80%, rgba(34, 211, 238, .14), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg-elev);
}
.placeholder__name {
  font-family: var(--font-title);
  font-size: clamp(.9rem, 2.4vw, 1.1rem);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.placeholder__text { color: var(--text-dim); font-size: .8rem; }
.placeholder--compact .placeholder__name { font-size: .82rem; }
.placeholder--compact .placeholder__text { font-size: .74rem; }

.placeholder__corner {
  position: absolute;
  width: 16px; height: 16px;
  border-color: rgba(34, 211, 238, .45);
  border-style: solid;
  border-width: 0;
}
.placeholder__corner--tl { top: 14px; left: 14px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: 6px; }
.placeholder__corner--tr { top: 14px; right: 14px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.placeholder__corner--bl { bottom: 14px; left: 14px; border-bottom-width: 2px; border-left-width: 2px; border-bottom-left-radius: 6px; }
.placeholder__corner--br { bottom: 14px; right: 14px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

/* ---------- Featured projects ---------- */

.features { display: grid; gap: 28px; }

.feature {
  position: relative;
  display: grid;
  gap: 22px;
  align-items: center;
  padding: 14px 14px 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  backdrop-filter: blur(10px);
}
.feature::before {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  opacity: .8;
}
.feature:hover { border-color: var(--border-strong); background-color: var(--card-hover); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }

.feature__media {
  display: block;
  border-radius: var(--radius);
  text-decoration: none;
  transform: translateZ(30px);
}
.feature__body {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 0 8px;
  transform: translateZ(20px);
}

.feature__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: .8rem;
  font-weight: 500;
}

.feature__title { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.feature__title a { text-decoration: none; }
.feature__title a:hover { color: var(--cyan); }

.feature__intro { max-width: 54ch; color: var(--text-dim); }
.feature .actions { margin-top: 4px; }

/* ---------- Experiment card ---------- */

.experiment {
  position: relative;
  display: grid;
  gap: 28px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(90% 90% at 100% 0%, rgba(167, 139, 250, .12), transparent 60%),
    var(--card);
}
.experiment__body { display: grid; gap: 14px; align-content: start; transform: translateZ(20px); }
.experiment__title { font-size: clamp(1.5rem, 4vw, 2rem); }
.experiment__title a { text-decoration: none; }
.experiment__title a:hover { color: var(--cyan); }
.experiment__intro { max-width: 58ch; color: var(--text-dim); }
.experiment__diagram { transform: translateZ(34px); }

/* ---------- Flow diagram (Jarvis) ---------- */

.flow { display: grid; }
.flow__step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(7, 7, 12, .7);
}
.flow__step + .flow__step { margin-top: 26px; }
.flow__step + .flow__step::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -26px;
  width: 2px;
  height: 26px;
  margin-left: -1px;
  background: linear-gradient(var(--violet), var(--cyan));
}
.flow__step + .flow__step::after {
  content: "";
  position: absolute;
  left: calc(50% - 5px);
  top: -9px;
  border: 5px solid transparent;
  border-top: 6px solid var(--cyan);
}
.flow__step--node { border-color: rgba(167, 139, 250, .45); box-shadow: 0 0 24px rgba(139, 92, 246, .15); }
.flow__index { font-family: var(--font-title); font-size: .75rem; font-weight: 700; color: var(--st-experiment); }
.flow--compact .flow__step { padding: 11px 14px; font-size: .92rem; }

.bridge { display: flex; flex-direction: column; align-items: stretch; }
.bridge__node {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(7, 7, 12, .7);
  font-family: var(--font-title);
  font-weight: 700;
  text-align: center;
}
.bridge__node--core {
  border-color: transparent;
  background: var(--gradient);
  color: #07070c;
  box-shadow: 0 10px 32px var(--glow-violet);
}
.bridge__link {
  position: relative;
  align-self: center;
  width: 2px;
  height: 40px;
  background: linear-gradient(var(--violet), var(--cyan));
}
.bridge__link::before,
.bridge__link::after {
  content: "";
  position: absolute;
  left: -4px;
  border: 5px solid transparent;
}
.bridge__link::before { top: -2px; border-bottom: 6px solid var(--violet); border-top: 0; }
.bridge__link::after { bottom: -2px; border-top: 6px solid var(--cyan); border-bottom: 0; }

/* ---------- Small cards (games) ---------- */

.cards { display: grid; gap: 18px; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.card:hover { border-color: var(--border-strong); background-color: var(--card-hover); }
.card .media { border-bottom: 1px solid var(--border); }
.card__body { display: grid; flex: 1; gap: 12px; align-content: start; padding: 20px; }
.card__title { font-size: 1.22rem; }
.card__text { color: var(--text-dim); font-size: .94rem; }

.card__facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; }
.card__facts div { display: flex; gap: 6px; }
.card__facts dt { color: var(--faint); }
.card__facts dd { color: var(--text-soft); }

.card--slot {
  display: grid;
  gap: 12px;
  align-content: center;
  min-height: 240px;
  padding: 28px 22px;
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
}
.card__slot-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--gradient);
  color: #07070c;
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: 0 8px 20px var(--glow-violet);
}

/* ---------- Learning lab ---------- */

.labs { display: grid; gap: 14px; }

.lab {
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.lab::before {
  content: "";
  position: absolute;
  top: -60%; right: -30%;
  width: 180px; height: 180px;
  background: var(--gradient);
  filter: blur(70px);
  opacity: .16;
  pointer-events: none;
}
.lab:hover { border-color: var(--border-strong); background-color: var(--card-hover); }
.lab__head { display: flex; align-items: center; gap: 12px; }
.lab__tag {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--gradient);
  color: #07070c;
  font-family: var(--font-title);
  font-size: .72rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(139, 92, 246, .3);
}
.lab__title { font-size: 1.08rem; }
.lab__text { color: var(--text-dim); font-size: .92rem; }
.lab__items { display: grid; gap: 4px; color: var(--text-soft); font-size: .9rem; }
.lab__items li::before { content: "▹ "; color: var(--cyan); }

/* ---------- Skills ---------- */

.skills { display: grid; gap: 16px; }
.skills__group {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.skills__group:hover { border-color: var(--border-strong); background-color: var(--card-hover); }
.skills__title { font-size: 1.15rem; }
.skills__note { color: var(--text-dim); font-size: .9rem; }
.skills__list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.skills__list li {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  font-size: .88rem;
  font-weight: 500;
}
.skills__group--exploring { border-style: dashed; border-color: var(--border-strong); background: transparent; }
.skills__group--exploring .skills__title { color: var(--st-experiment); }
.skills__group--exploring .skills__list li { border-style: dashed; color: var(--text-soft); }

/* ---------- Case-study page ---------- */

.case { position: relative; padding: 20px 0 72px; overflow: hidden; }
.case .glow-orbs { height: 700px; }

.back {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-dim);
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
}
.back:hover { color: var(--text); }

.case__header {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  padding: 16px 0 32px;
}
.case__title {
  font-size: clamp(2.5rem, 10vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff 35%, var(--cyan) 80%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.case__intro {
  max-width: 62ch;
  color: var(--text-soft);
  font-size: clamp(1.04rem, 2.4vw, 1.2rem);
  line-height: 1.55;
}

.case__hero { position: relative; z-index: 2; margin-bottom: 44px; }
.case__hero .media { box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.case__hero--diagram {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
}

/* Live CV preview */
.browser {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(139, 92, 246, .12);
}
.browser__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
}
.browser__dots { display: flex; gap: 6px; flex: none; }
.browser__dots span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.browser__dots span:nth-child(1) { background: var(--coral); }
.browser__dots span:nth-child(2) { background: var(--gold); }
.browser__dots span:nth-child(3) { background: var(--green); }
.browser__url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: var(--text-dim);
  font-size: .78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.browser__open {
  flex: none;
  color: var(--cyan);
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
}
.browser__open:hover { text-decoration: underline; }
.browser iframe {
  width: 100%;
  height: min(78vh, 720px);
  border: 0;
  background: var(--bg);
}

.case__layout { position: relative; z-index: 2; display: grid; gap: 36px; }
.case__aside .facts { padding: 6px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.case__aside .facts > div:last-child { border-bottom: 0; }
.case__aside .facts .actions { flex-direction: column; align-items: flex-start; }
.case__content { display: grid; gap: 40px; min-width: 0; }

.block { display: grid; gap: 16px; }
.block__title { font-size: 1.4rem; }
.block--wide { margin-top: 64px; }
.block--wide > .block__title { text-align: center; }

.lead { max-width: 62ch; color: var(--text); font-size: 1.1rem; }

.list { display: grid; gap: 10px; }
.list li {
  position: relative;
  max-width: 68ch;
  padding-left: 24px;
  color: var(--text-dim);
}
.list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 8px var(--glow-cyan);
}
.block--works .list li { color: var(--text-soft); }
.block--works .list li::before {
  top: .42em;
  width: 9px; height: 5px;
  border-radius: 0;
  border-left: 2px solid var(--st-working);
  border-bottom: 2px solid var(--st-working);
  background: none;
  box-shadow: none;
  transform: rotate(-45deg);
}
.block--progress .list li::before { background: var(--st-dev); box-shadow: 0 0 8px rgba(251, 191, 36, .5); }

.works { display: grid; gap: 14px; }
.works__group {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.works__title {
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Android block (Dragon Snake) ---------- */

.android {
  position: relative;
  display: grid;
  gap: 32px;
  align-items: center;
  overflow: hidden;
  margin-top: 64px;
  padding: 32px 20px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(70% 70% at 15% 30%, rgba(34, 211, 238, .14), transparent 65%),
    radial-gradient(60% 60% at 90% 90%, rgba(139, 92, 246, .16), transparent 65%),
    var(--bg-elev);
}
.android__phone { display: flex; justify-content: center; perspective: 1100px; }
.android__text { display: grid; gap: 14px; max-width: 46ch; }
.android__title { font-size: clamp(1.8rem, 6vw, 3rem); }
.android__text p:not(.eyebrow) { color: var(--text-dim); }

.phone {
  position: relative;
  width: min(240px, 64vw);
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 38px;
  background: linear-gradient(145deg, #1a1a26, #07070c);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9), 0 0 60px rgba(34, 211, 238, .12), inset 0 0 0 1px rgba(255, 255, 255, .04);
  transform: rotateY(-16deg) rotateX(6deg);
  transform-style: preserve-3d;
}
.phone__notch {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 2;
  width: 10px; height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #22222e;
}
.phone__screen { overflow: hidden; border-radius: 29px; background: var(--bg-elev); }
.phone__screen .media { border: 0; border-radius: 0; }
.phone__screen .placeholder { padding: 16px; }
.phone__screen .placeholder__corner { display: none; }

/* ---------- Gallery & video ---------- */

.gallery { display: grid; gap: 16px; }
.gallery__item { margin: 0; }
.gallery__video { margin-bottom: 16px; }

.video {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
}
.video video { width: 100%; height: auto; max-height: 80vh; margin: 0 auto; }

/* ---------- Pager ---------- */

.pager {
  display: grid;
  gap: 14px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.pager__link {
  display: grid;
  gap: 4px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-decoration: none;
  transition: border-color .25s var(--ease), transform .3s var(--ease), background-color .25s var(--ease);
}
.pager__link:hover { transform: translateY(-4px); border-color: var(--border-strong); background-color: var(--card-hover); }
.pager__label { color: var(--text-dim); font-size: .8rem; }
.pager__name { font-family: var(--font-title); font-size: 1.25rem; font-weight: 700; }
.pager__link--next { text-align: right; }

.case__hero.tilt { border-radius: var(--radius); }
.case__hero > .tilt__glare { z-index: 4; }

.overview { display: grid; gap: 12px; max-width: 68ch; color: var(--text-soft); }
.block--features .works__group:first-child { grid-column: auto; }
.media--contain > img { object-fit: contain; object-position: center; }
.media__kind {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(7, 7, 12, .78);
  color: var(--text-soft);
  font-size: .68rem;
  font-weight: 500;
  pointer-events: none;
}
