﻿
/* =========================================================
   Studio layer — editorial warm paper, chapter rail,
   ghost numerals, hero orbits and richer micro-interactions.
   Loaded after the original stylesheet; all content is preserved.
   ========================================================= */

:root {
  --studio-ease: cubic-bezier(0.16, 1, 0.3, 1);
}


/* paper grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9996;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

html[data-theme="dark"] body::after {
  opacity: 0.035;
  mix-blend-mode: normal;
}

/* selection + scrollbar details */
::selection {
  background: rgba(79, 70, 229, 0.18);
  color: var(--text);
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* page section rhythm, slightly more editorial */
:root {
  --section-pad: clamp(82px, 9.5vw, 122px);
}

.section {
  isolation: isolate;
}

.section > .container {
  position: relative;
  z-index: 1;
}

/* oversized chapter numeral, sitting behind the section content */
.section[data-chapter]::after {
  content: attr(data-chapter);
  position: absolute;
  z-index: 0;
  top: clamp(28px, 4vw, 58px);
  right: clamp(18px, 5vw, 86px);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(6.2rem, 13vw, 12.5rem);
  font-weight: 800;
  line-height: 0.72;
  letter-spacing: -0.09em;
  opacity: 0.035;
  pointer-events: none;
  user-select: none;
}

/* chapter rail: desktop-only orientation device */
.chapter-rail {
  display: none;
}

@media (min-width: 1360px) {
  .chapter-rail {
    position: fixed;
    left: 12px;
    top: 50%;
    z-index: 35;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform: translateY(-50%);
    padding: 10px 0;
  }

  .chapter-rail::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 1px;
    background: linear-gradient(transparent, var(--border-strong) 18%, var(--border-strong) 82%, transparent);
    opacity: 0.55;
  }

  .chapter-rail a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 22px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.04em;
    text-decoration: none;
    opacity: 0.55;
    transition: opacity 0.3s var(--ease), color 0.3s var(--ease);
  }

  .chapter-rail a::before {
    content: "";
    flex: none;
    width: 13px;
    height: 1px;
    background: currentColor;
    opacity: 0.55;
    transition: width 0.35s var(--studio-ease), background-color 0.3s var(--ease);
  }

  .chapter-rail a b {
    width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-4px);
    transition: width 0.35s var(--studio-ease), opacity 0.3s var(--ease), transform 0.35s var(--studio-ease);
  }

  .chapter-rail a:hover,
  .chapter-rail a.is-active {
    color: var(--accent);
    opacity: 1;
  }

  .chapter-rail a:hover b,
  .chapter-rail a.is-active b {
    width: 42px;
    opacity: 1;
    transform: translateX(0);
  }

  .chapter-rail a.is-active::before {
    width: 25px;
    background: var(--accent-2);
    opacity: 1;
  }
}

/* hero: pointer spotlight + code-card orbit rings */
.hero {
  isolation: isolate;
  --spot-x: 63%;
  --spot-y: 35%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    520px circle at var(--spot-x) var(--spot-y),
    rgba(79, 70, 229, 0.11),
    transparent 68%
  );
  transition: background 0.5s linear;
}

html[data-theme="dark"] .hero::after {
  background: radial-gradient(
    520px circle at var(--spot-x) var(--spot-y),
    rgba(124, 140, 255, 0.13),
    transparent 68%
  );
}

.hero > .container,
.hero > .scroll-hint {
  position: relative;
  z-index: 2;
}

.hero-visual-inner {
  isolation: isolate;
}

.hero-visual-inner::before,
.hero-visual-inner::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0.52;
}

.hero-visual-inner::before {
  inset: -13% -8%;
  transform: rotate(-18deg) scaleY(0.56);
  animation: studioOrbit 42s linear infinite;
}

.hero-visual-inner::after {
  inset: -3% -18%;
  border-style: dashed;
  transform: rotate(22deg) scaleY(0.4);
  opacity: 0.32;
  animation: studioOrbitReverse 56s linear infinite;
}

@keyframes studioOrbit {
  from { transform: rotate(-18deg) scaleY(0.56); }
  to { transform: rotate(342deg) scaleY(0.56); }
}

@keyframes studioOrbitReverse {
  from { transform: rotate(22deg) scaleY(0.4); }
  to { transform: rotate(-338deg) scaleY(0.4); }
}

/* small index marks on skill cards */
.skill-card::after {
  content: "↗";
  position: absolute;
  top: 18px;
  right: 18px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.35;
  transition: color 0.3s var(--ease), transform 0.35s var(--studio-ease), opacity 0.3s;
  pointer-events: none;
}

.skill-card:hover::after {
  color: var(--accent);
  opacity: 1;
  transform: translate(2px, -2px);
}

.skill-card:hover .skill-icon {
  transform: rotate(-5deg) scale(1.04);
}

.skill-icon {
  transition: transform 0.4s var(--studio-ease), border-color 0.3s var(--ease);
}

/* books read as physical objects */
.book-preview-card {
  perspective: 900px;
}

.book-preview-cover {
  transform-origin: 12% 50%;
  transition: transform 0.5s var(--studio-ease), box-shadow 0.5s var(--ease);
  box-shadow: 0 10px 26px -24px rgba(30, 22, 12, 0.8);
}

.book-preview-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 11%, transparent 92%, rgba(0, 0, 0, 0.09)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 30%);
}

.book-preview-card:hover .book-preview-cover {
  transform: translateY(-7px) rotateY(-7deg) rotateX(1.5deg);
  box-shadow: -16px 28px 50px -28px rgba(30, 22, 12, 0.55);
}

/* project cards: a little more depth without fighting the existing spotlight */
.project-card {
  transform-style: preserve-3d;
}

.project-card .project-media {
  transition: transform 0.55s var(--studio-ease);
}

.project-card:hover .project-media {
  transform: scale(1.012);
}

/* about identity card: quiet orbit detail */
.profile-card {
  position: relative;
  overflow: hidden;
}

.profile-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -56px;
  width: 150px;
  height: 150px;
  border: 1px solid var(--border);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.5;
}

/* primary actions: a restrained pointer-follow sheen */
.hero-actions .btn,
.contact-actions .btn {
  position: relative;
  overflow: hidden;
}

.hero-actions .btn::after,
.contact-actions .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    140px circle at var(--pointer-x, 50%) var(--pointer-y, 50%),
    rgba(255, 255, 255, 0.16),
    transparent 68%
  );
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.hero-actions .btn:hover::after,
.contact-actions .btn:hover::after {
  opacity: 1;
}

/* contact panel gets a restrained edge glow on hover */
.contact-panel {
  transition: border-color 0.4s var(--ease), box-shadow 0.5s var(--ease);
}

.contact-panel:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft), 0 0 90px -60px var(--glow);
}

/* better focus indication without changing the visual language */
:where(a, button, input, textarea, select):focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 4px;
}

/* on touch or reduced motion, remove purely decorative motion */
@media (max-width: 900px) {
  .section[data-chapter]::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-visual-inner::before,
  .hero-visual-inner::after,
  .book-preview-cover,
  .project-card .project-media,
  .skill-card:hover .skill-icon {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  body::after,
  .chapter-rail,
  .section[data-chapter]::after,
  .hero::after,
  .hero-visual-inner::before,
  .hero-visual-inner::after {
    display: none !important;
  }
}

/* =========================================================
   Homepage arcade entry — a visible, dark counterpoint
   to the warm paper page.
   ========================================================= */

.nav-link--game {
  color: var(--accent-2);
}

.nav-link--game:hover {
  color: var(--text);
}

.arcade-promo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 190px;
  margin: clamp(30px, 4.5vw, 52px) 0 clamp(10px, 1.8vw, 18px);
  padding: clamp(26px, 4vw, 44px) clamp(24px, 4.5vw, 54px);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(139, 157, 255, 0.24);
  border-radius: 24px;
  background:
    radial-gradient(ellipse 55% 100% at 82% 42%, rgba(79, 70, 229, 0.3), transparent 70%),
    radial-gradient(ellipse 48% 100% at 16% 100%, rgba(13, 148, 136, 0.18), transparent 72%),
    linear-gradient(115deg, #080c17 0%, #0b1020 58%, #0b0d18 100%);
  color: #f5f2ea;
  text-decoration: none;
  box-shadow: 0 26px 60px -42px rgba(5, 8, 18, 0.8);
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease);
}

.arcade-promo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(153, 174, 230, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(153, 174, 230, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, #000, transparent 76%);
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 76%);
}

.arcade-promo::after {
  content: "";
  position: absolute;
  right: 22%;
  top: 20%;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(139, 157, 255, 0.16);
  border-radius: 50%;
  transform: rotate(-22deg) scaleY(0.42);
  pointer-events: none;
  transition: transform 0.6s var(--ease-out);
}

.arcade-promo:hover {
  border-color: rgba(110, 231, 216, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 36px 80px -44px rgba(5, 8, 18, 0.9), 0 0 60px -38px rgba(110, 231, 216, 0.5);
}

.arcade-promo:hover::after {
  transform: rotate(-14deg) scaleY(0.48);
}

.arcade-promo-copy {
  position: relative;
  z-index: 2;
  max-width: 560px;
}

.arcade-promo-kicker {
  color: #8f9ab5;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.arcade-promo-kicker span {
  color: #6ee7d8;
}

.arcade-promo-title {
  margin-top: 10px;
  color: #f5f2ea;
  font-size: clamp(2.1rem, 3.7vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.arcade-promo-title span {
  color: #6ee7d8;
}

.arcade-promo-desc {
  max-width: 400px;
  margin-top: 13px;
  color: #a6b2ca;
  font-size: 13px;
  line-height: 1.7;
}

.arcade-promo-art {
  position: absolute;
  right: 20%;
  bottom: 18px;
  z-index: 1;
  width: 180px;
  height: 120px;
  pointer-events: none;
}

.arcade-promo-orbit {
  position: absolute;
  left: 2px;
  bottom: 14px;
  width: 176px;
  height: 66px;
  border: 1px solid rgba(139, 157, 255, 0.24);
  border-radius: 50%;
  transform: rotate(-14deg);
}

.arcade-promo-runner {
  position: absolute;
  left: 55px;
  bottom: 43px;
  width: 72px;
  height: 48px;
  background: #6ee7d8;
  clip-path: polygon(0 38%, 58% 38%, 58% 12%, 100% 12%, 100% 48%, 74% 48%, 74% 100%, 54% 100%, 54% 70%, 42% 70%, 42% 100%, 22% 100%, 22% 70%, 0 70%);
  filter: drop-shadow(0 0 14px rgba(110, 231, 216, 0.3));
  transition: transform 0.35s var(--ease-out);
}

.arcade-promo:hover .arcade-promo-runner {
  transform: translate(5px, -5px);
}

.arcade-promo-spark {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #dbe6ff;
  opacity: 0.6;
}

.arcade-promo-spark--a { left: 18px; top: 24px; }
.arcade-promo-spark--b { right: 20px; top: 10px; width: 2px; height: 2px; }
.arcade-promo-spark--c { left: 128px; top: 52px; width: 2px; height: 2px; background: #d8b4fe; }

.arcade-promo-cta {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid rgba(110, 231, 216, 0.48);
  border-radius: 999px;
  background: rgba(110, 231, 216, 0.08);
  color: #dffcf5;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.arcade-promo-cta span {
  color: #6ee7d8;
  transition: transform 0.25s var(--ease);
}

.arcade-promo:hover .arcade-promo-cta {
  border-color: #6ee7d8;
  background: rgba(110, 231, 216, 0.14);
}

.arcade-promo:hover .arcade-promo-cta span {
  transform: translate(2px, -2px);
}

.arcade-promo:active {
  transform: translateY(-1px) scale(0.995);
}

@media (max-width: 760px) {
  .arcade-promo {
    display: block;
    min-height: 0;
    padding: 24px 22px;
    border-radius: 19px;
  }

  .arcade-promo::after {
    right: -36px;
    top: 12px;
    width: 170px;
    height: 170px;
  }

  .arcade-promo-art {
    right: 8%;
    bottom: 10px;
    width: 130px;
    height: 90px;
    opacity: 0.6;
  }

  .arcade-promo-orbit {
    width: 132px;
    height: 50px;
  }

  .arcade-promo-runner {
    left: 40px;
    bottom: 31px;
    width: 52px;
    height: 35px;
  }

  .arcade-promo-title {
    font-size: 2.15rem;
  }

  .arcade-promo-desc {
    max-width: 240px;
    font-size: 12px;
    line-height: 1.65;
  }

  .arcade-promo-cta {
    margin-top: 20px;
    min-height: 38px;
    padding: 0 14px;
    font-size: 9px;
  }
}
