/* =========================================================================
   CTRL-V PROJECT PAGE — page-specific styles.
   Reuses tokens, .btn, .stack-badge and .section-head from ../style.css.
   Everything here is unique to this page: the retro window hero, the
   overview, the interactive shortcut keyboard, the live game embed, the
   screenshot grid and the team credits.

   Design note: it stays inside the site's "forest sheet" palette, but leans
   on JetBrains Mono and a Win95-ish window chrome to echo the game's own
   pixel-art antivirus look. Every text block that floats over the bare
   dot-field background gets the shared readability veil (see below), and the
   solid surfaces (keys, window, play frame) carry their own blur/veil so
   nothing sits unbacked on the field.
   ========================================================================= */

/* ============================================================
   UTILITIES — cross-cutting
   ============================================================ */

/* Only vertical scrolling. `overflow-x: clip` (unlike hidden/auto) does NOT
   create a scroll container, so the sticky .cv-top bar keeps working while any
   stray horizontal overflow is clipped away. Applied at html + body + main so
   nothing can widen the page sideways. */
html:has(> .cv-body) { overflow-x: clip; }
.cv-body { background: var(--paper); overflow-x: clip; }
.cv-main { overflow-x: clip; }

/* ---------- Cross-document transition from the portfolio ----------
   The portfolio's CTRL-V card links here as a full navigation. The card's
   cover image and this page's hero logo share the name `ctrl-v-cover`, so one
   morphs into the other (and back on return via the &larr; link). */
@view-transition { navigation: auto; }
.cv-hero__logo { view-transition-name: ctrl-v-cover; }
::view-transition-old(ctrl-v-cover),
::view-transition-new(ctrl-v-cover) { animation-duration: 0.5s; }

/* ---------- Readability veil under floating text ----------
   Same technique used site-wide: a soft feathered paper wash under text that
   floats over the dot-field background. Applied to bare-background text only;
   NOT to elements that already carry their own surface (keys, window, play
   frame, team members). */
.cv-hero__eyebrow,
.cv-hero__tagline,
.cv-hero__spec,
.cv-overview__label,
.cv-overview__lead,
.cv-overview__text,
.cv-keys__intro,
.cv-key__combo,
.cv-keys__readout,
.cv-play__intro,
.cv-play__hint,
.cv-team__note,
.cv-footer {
  position: relative;
}
.cv-hero__eyebrow::before,
.cv-hero__tagline::before,
.cv-hero__spec::before,
.cv-overview__label::before,
.cv-overview__lead::before,
.cv-overview__text::before,
.cv-keys__intro::before,
.cv-key__combo::before,
.cv-keys__readout::before,
.cv-play__intro::before,
.cv-play__hint::before,
.cv-team__note::before,
.cv-footer::before {
  content: "";
  position: absolute;
  inset: -0.6rem -0.9rem;
  z-index: -1;
  background: var(--veil);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(115% 130% at 50% 50%, #000 52%, transparent 100%);
  mask-image: radial-gradient(115% 130% at 50% 50%, #000 52%, transparent 100%);
}

/* ============================================================
   TOP BAR
   ============================================================ */
.cv-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem var(--gutter);
  background: var(--veil);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.cv-back { font-weight: 600; }
.cv-back:hover { color: var(--forest); }
.cv-top__links { display: flex; gap: 1.25rem; }
.cv-top__link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--forest);
}
.cv-top__link:hover { text-decoration: underline; }

/* ============================================================
   MAIN RHYTHM
   ============================================================ */
.cv-main > section {
  padding: 0 var(--gutter);
  margin: 0 auto;
  max-width: 1180px;
}
.cv-main > section:not(.cv-hero) { margin-top: var(--section-gap); }
.cv-main { padding-bottom: var(--section-gap); }

.cv-section-head { margin-bottom: 2rem; }

/* ============================================================
   HERO
   ============================================================ */
.cv-hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding-top: clamp(2.5rem, 7vh, 5rem);
  min-height: 70vh;
}
.cv-hero__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--forest);
  margin-bottom: 1.25rem;
}
.cv-hero__titlerow { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.cv-hero__logo {
  width: clamp(56px, 9vw, 84px);
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  image-rendering: pixelated;
  box-shadow: 0 6px 20px rgba(var(--forest-rgb), 0.18);
}
.cv-hero__title {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 125, "wght" 800;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: -0.01em;
}
.cv-hero__tagline {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  color: var(--ink);
  max-width: 34ch;
  margin-bottom: 1.6rem;
}
.cv-hero__spec {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.25rem;
  margin-bottom: 1.9rem;
}
.cv-hero__spec dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-bottom: 0.2rem;
}
.cv-hero__spec dd { font-weight: 600; }
.cv-hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2rem; }
.cv-hero__mark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--graphite);
}
.cv-hero__mark-cross { color: var(--forest); font-size: 1rem; }

/* The player character, standing on its own in the hero */
.cv-hero__art {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: clamp(240px, 34vw, 380px);
}
.cv-hero__char {
  width: clamp(170px, 26vw, 300px);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 18px 16px rgba(var(--forest-rgb), 0.32));
  animation: cv-bob 3.4s var(--ease-soft) infinite;
  pointer-events: none;
}
@keyframes cv-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
.cv-window {
  width: min(100%, 440px);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper-raise);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(var(--forest-rgb), 0.22);
}
.cv-window__bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  background: var(--forest-deep);
  color: var(--paper);
}
.cv-window__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--forest-glow);
  box-shadow: 16px 0 0 rgba(var(--paper-rgb), 0.35), 32px 0 0 rgba(var(--paper-rgb), 0.35);
}
.cv-window__title {
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.cv-window__body { background: var(--forest-deep); padding: 0; }
.cv-window__body img {
  width: 100%;
  image-rendering: pixelated;
  display: block;
}

/* ============================================================
   OVERVIEW
   ============================================================ */
.cv-overview { max-width: 760px; }
.cv-overview__label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: 1rem;
}
.cv-overview__lead {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.5;
  margin-bottom: 1.1rem;
}
.cv-overview__text { color: var(--graphite); font-size: 1.08rem; }

/* ============================================================
   MECHANICS — the interactive shortcut keyboard
   ============================================================ */
.cv-keys__intro {
  display: inline-block;
  max-width: 60ch;
  color: var(--graphite);
  margin-bottom: 2.5rem;
}
.cv-keys__intro kbd {
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 700;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  background: var(--forest);
  color: var(--paper);
}

/* No surrounding card: the keys sit straight on the dot field. */
.cv-keys__board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.25rem, 4vw, 3rem);
  padding: 1rem 0 0.5rem;
}

.cv-key {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding-top: 2.4rem; /* room for the pop-up label */
  --key-accent: var(--forest);
}

/* Pop-up action label above the cap */
.cv-key__label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, 6px);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--key-accent);
  padding: 0.28em 0.7em;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
  box-shadow: 0 6px 16px rgba(var(--forest-rgb), 0.3);
}
.cv-key__label::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px;
  background: var(--key-accent);
}

/* The physical keycap — the game's own 32x32 sprites, scaled up crisp.
   Two frames are stacked: --up (raised, CTRL_Press000) and --down (pressed,
   CTRL_Press001). The down frame reveals on hover / focus / real key press. */
.cv-key__caps {
  position: relative;
  display: block;
  width: clamp(66px, 12vw, 94px);
  height: clamp(66px, 12vw, 94px);
  filter: drop-shadow(0 8px 12px rgba(var(--forest-rgb), 0.28));
}
.cv-key__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  transition: opacity 0.08s steps(1, end);
}
.cv-key__img--down { opacity: 0; }
.cv-key__combo {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--graphite);
}

/* Pressed state: hover, focus, or a real key press (JS toggles .is-pressed) */
.cv-key:hover,
.cv-key:focus-visible { outline: none; }
.cv-key:hover .cv-key__label,
.cv-key:focus-visible .cv-key__label,
.cv-key.is-pressed .cv-key__label {
  opacity: 1;
  transform: translate(-50%, 0);
}
.cv-key:hover .cv-key__img--down,
.cv-key:focus-visible .cv-key__img--down,
.cv-key.is-pressed .cv-key__img--down { opacity: 1; }
.cv-key:hover .cv-key__img--up,
.cv-key:focus-visible .cv-key__img--up,
.cv-key.is-pressed .cv-key__img--up { opacity: 0; }
.cv-key:hover .cv-key__caps,
.cv-key:focus-visible .cv-key__caps,
.cv-key.is-pressed .cv-key__caps {
  filter: drop-shadow(0 3px 6px rgba(var(--forest-rgb), 0.3));
}

/* Readout under the board */
.cv-keys__readout {
  margin-top: 1.75rem;
  text-align: center;
  min-height: 3.2rem;
}
.cv-keys__readout-action {
  display: block;
  font-family: var(--font-display);
  font-variation-settings: "wdth" 120, "wght" 700;
  font-size: 1.5rem;
  color: var(--forest);
}
.cv-keys__readout-desc { color: var(--graphite); }

/* ============================================================
   PLAY — the live embedded build
   ============================================================ */
.cv-play__intro { display: inline-block; color: var(--graphite); margin-bottom: 2rem; max-width: 58ch; }

.cv-play__frame {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  aspect-ratio: var(--w) / var(--h);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--forest-deep);
  box-shadow: 0 24px 60px rgba(var(--forest-rgb), 0.28);
}
.cv-play__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.cv-play__poster { position: absolute; inset: 0; }
.cv-play__poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  filter: blur(6px) brightness(0.55) saturate(1.1);
  transform: scale(1.08);
}
.cv-play__launch {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--paper);
  transition: background 0.25s var(--ease-out);
}
.cv-play__launch:hover { background: rgba(var(--forest-rgb), 0.35); }
.cv-play__launch-icon {
  display: grid;
  place-items: center;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--paper);
  font-size: 1.9rem;
  padding-left: 6px; /* optically center the triangle */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--ease-out);
}
.cv-play__launch:hover .cv-play__launch-icon { transform: scale(1.08); }
.cv-play__launch-text {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 120, "wght" 700;
  font-size: 1.6rem;
  margin-top: 0.6rem;
}
.cv-play__launch-note {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  opacity: 0.82;
}
.cv-play__frame.is-loaded .cv-play__poster { display: none; }

.cv-play__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 980px;
  margin: 1rem auto 0;
}
.cv-play__hint {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--graphite);
}

/* ============================================================
   GALLERY
   ============================================================ */
.cv-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.cv-gallery__grid img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  image-rendering: pixelated;
  box-shadow: 0 14px 36px rgba(var(--forest-rgb), 0.18);
}

/* ============================================================
   TEAM
   ============================================================ */
.cv-team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}
.cv-team__member {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  background: rgba(var(--paper-rgb), 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cv-team__member--me {
  background: rgba(var(--forest-rgb), 0.1);
  border-color: rgba(var(--forest-rgb), 0.4);
}
.cv-team__name { font-weight: 700; }
.cv-team__name em { font-style: normal; color: var(--forest); font-family: var(--font-mono); font-size: 0.85em; }
.cv-team__role { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.03em; color: var(--graphite); }
.cv-team__note { display: inline-block; margin-top: 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--graphite); }

/* ============================================================
   FOOTER
   ============================================================ */
.cv-footer {
  display: inline-block;
  padding: var(--section-gap) var(--gutter) 3rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--graphite);
}
.cv-footer a { color: var(--forest); }
.cv-footer a:hover { text-decoration: underline; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .cv-key__img, .cv-key__label, .cv-key__caps, .cv-play__launch, .cv-play__launch-icon,
  .cv-hero__char,
  ::view-transition-old(ctrl-v-cover), ::view-transition-new(ctrl-v-cover) {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .cv-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    text-align: left;
  }
  /* Extra headroom so the idle bob never lifts the character over the
     sticky top bar (the art is now the first item in the stacked hero). */
  .cv-hero__art { order: -1; min-height: auto; padding-top: 1.5rem; }
}
@media (max-width: 560px) {
  .cv-top__links { gap: 0.9rem; }
  .cv-gallery__grid { grid-template-columns: 1fr; }
  .cv-key { padding-top: 2.1rem; }
  /* 2x2 grid instead of an unbalanced 3+1 wrap */
  .cv-keys__board {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: center;
    gap: 1.5rem 2.5rem;
  }
}
