/* ============================================================
   HERO CARD — isladjan-style "3D" card, tailored to csurette.com
   Recipe: flat solid face + a clip-path'd sibling strip that fakes
   an extruded side edge + 2px ink borders + pixel/mono type.
   Scoped to .hero-card so it can be dropped into index.html later.
   ============================================================ */

/* ---------- floating card wrappers ----------
   The parallax scene is a fixed layer, so every card overlay is fixed
   too, each fading in/out over its own scroll window (data-show /
   data-hide, read by card.js): the hero card lingers pinned over the
   first stretch of scroll before fading (instead of scrolling away
   instantly), the sky card owns screen two, the moon card screen
   three. z-index 6 clears the parallax svg (3), scrollElement (4) and
   footer (5), but stays below the pop-out menu (90) and header pills
   (100) so the nav is always reachable. pointer-events are off while
   hidden so an invisible card never eats clicks meant for the page. */
.float-card-wrap {
  position: fixed;
  top: 9vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(560px, 90vw);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.6s ease,
    visibility 0s linear 0.6s;
}

.float-card-wrap.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

/* hero card sits lower than the sky-band cards */
.hero-card-wrap.float-card-wrap {
  top: 22vh;
}

.hero-card {
  /* palette pulled from the parallax hero: warm sunset face,
     dusk-purple side edge, near-black ink lines */
  --card-face: #ffd9b8;
  --card-side: #1b1734;
  --card-ink: #14101f;
  --card-accent: #f07560;
  --side-w: 26px;

  /* flip progress 0..1: 0 = depth on the right (rest pose),
     0.5 = flat/front-facing, 1 = mirrored, depth on the left.
     card.js writes --scroll-p; hover adds --hover-p; the sum is
     clamped so the two never fight. --p itself jumps instantly —
     the smoothing lives on the width/filter transitions of the
     layers below, so the face (and its text) is NEVER transformed
     and stays perfectly crisp. */
  --scroll-p: 0;
  --hover-p: 0;
  --p: clamp(0, calc(var(--scroll-p) + var(--hover-p)), 1);

  display: flex;              /* left depth + face + right depth in a row */
  font-family: ibm-plex-mono, "Courier New", monospace;
  color: var(--card-ink);
  cursor: pointer;            /* click-to-recolor affordance */
  /* shadow swings right (+6px) -> centered (0) -> left (-6px) so the
     lighting tracks the flip; drop-shadow only, no blur radius */
  filter: drop-shadow(calc(6px * (1 - 2 * var(--p))) 8px 0 rgba(20, 16, 31, 0.35));
  transition: filter 0.35s ease;
}

/* hover:hover gate keeps touch devices from getting a stuck hover
   state — mobile relies on the scroll flip instead */
@media (hover: hover) {
  .hero-card:hover {
    --hover-p: 1;
  }
}

/* ---------- reversed variant (screen-two sky card) ----------
   Mirrors the resting pose: --scroll-p defaults to 1 (depth strip on
   the LEFT, card facing right) and card.js inverts the scroll mapping
   for .card-reversed. Hover pushes the flip the other way (-1); the
   shared clamp in --p keeps the sum in 0..1 either direction. */
.hero-card.card-reversed {
  --scroll-p: 1;
}

@media (hover: hover) {
  .hero-card.card-reversed:hover {
    --hover-p: -1;
  }
}

/* ---------- the flat front face ----------
   FIXED width (not flex:1) so the text column never rewraps while
   the depth strips animate — the content layer stays untouched and
   sharp; only the strips flanking it change size */
.hero-card .card-face {
  flex: none;
  box-sizing: border-box;
  width: calc(min(560px, 90vw) - var(--side-w));
  background: var(--card-face);
  border: 2px solid var(--card-ink);
  padding: 1.4rem 1.6rem 1.5rem;
  transition: background-color 0.4s ease;
}

/* ---------- the fake extruded sides ----------
   plain divs; the polygon pulls the outer-top corner down so a
   rectangle reads as a folded-back 3D edge (same trick as isladjan).
   The flip: right strip collapses over the first half of --p
   (full -> 0 at p=0.5), the left strip grows over the second half
   (0 -> full at p=1). At p=0.5 both are gone = flat mid-pose.
   Width transitions carry the smoothing. */
.hero-card .card-side {
  width: calc(var(--side-w) * max(0, 1 - 2 * var(--p)));
  background: var(--card-side);
  clip-path: polygon(0 0, 100% 9%, 100% 100%, 0 100%);
  transition: width 0.35s ease, background-color 0.4s ease;
}

.hero-card .card-side-left {
  width: calc(var(--side-w) * max(0, 2 * var(--p) - 1));
  background: var(--card-side);
  /* mirrored fold: outer-top corner (left edge) dips instead */
  clip-path: polygon(0 9%, 100% 0, 100% 100%, 0 100%);
  transition: width 0.35s ease, background-color 0.4s ease;
}

/* ---------- title row ---------- */
.hero-card .card-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  border-bottom: 2px solid var(--card-ink);
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
}

.hero-card .card-index {
  font-family: vcr-osd-mono, ibm-plex-mono, monospace;
  font-size: 0.9rem;
  background: var(--card-ink);
  color: var(--card-face);
  padding: 2px 7px;
  transition: color 0.4s ease;
}

.hero-card .card-title {
  margin: 0;
  font-family: vcr-osd-mono, ibm-plex-mono, monospace;
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ---------- body copy ---------- */
.hero-card .card-text {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* typewriter caret: card.js types the real text back in char-by-char
   and appends this span at the write head. Blink via steps() (not
   opacity keyframes with easing) so the on/off snap stays crisp
   instead of fading soft — same "no blur on retro details" rule as
   the rest of the card. */
.hero-card .card-text .type-cursor {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 1px;
  background: var(--card-ink);
  vertical-align: text-bottom;
  animation: card-cursor-blink 0.85s steps(1, jump-none) infinite;
}

@keyframes card-cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- footer: tags + button ---------- */
.hero-card .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  border-top: 2px solid var(--card-ink);
  padding-top: 0.9rem;
}

.hero-card .card-tags {
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hero-card .card-tags .tag-label {
  display: inline-block;
  background: var(--card-ink);
  color: var(--card-face);
  padding: 2px 6px;
  margin-bottom: 5px;
  transition: color 0.4s ease;
}

.hero-card .card-tags .tag-list {
  display: block;
  line-height: 1.5;
}

.hero-card .card-btn {
  font-family: vcr-osd-mono, ibm-plex-mono, monospace;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--card-ink);
  background: var(--card-face);
  border: 2px solid var(--card-ink);
  padding: 0.5rem 1rem;
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--card-ink);
  transition: box-shadow 0.15s, transform 0.15s, background-color 0.25s ease;
}

.hero-card .card-btn:hover {
  background: var(--card-accent);
  transform: translate(3px, 3px);   /* button "presses" into its shadow */
  box-shadow: 0 0 0 var(--card-ink);
}

/* two-action cards (screen four) stack their buttons in a tidy
   column; each keeps the full chip styling above */
.hero-card .card-btns {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: stretch;
}

.hero-card .card-btns .card-btn {
  text-align: center;
}

/* MARK: mobile */
@media (max-width: 490px) {
  .hero-card { --side-w: 18px; }
  .hero-card .card-face { padding: 1.1rem 1.1rem 1.2rem; }

  /* keep MADE WITH + Explore side by side instead of stacking --
     stacking was pushing the card noticeably taller on phones.
     Shrinking the tag text (and tightening the button a touch)
     buys enough width for both to share the row. */
  .hero-card .card-footer {
    align-items: center;
    gap: 0.6rem;
  }

  .hero-card .card-tags {
    flex: 1 1 auto;
    min-width: 0; /* let the tag text wrap instead of forcing the row wider */
    /* 0.7rem, not the 0.62rem this started at: 0.62 rendered at 9.9px,
       the last sub-11px text left on the site. Measured across all four
       cards — the footer still shares one row and card height is
       unchanged, so the width this rule was buying wasn't needed. */
    font-size: 0.7rem;
  }

  .hero-card .card-tags .tag-list {
    line-height: 1.4;
  }

  .hero-card .card-btn {
    flex: none;
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
  }
}

/* Touch targets — the hero-card CTA was 33px tall on a phone. */
@media (hover:none) and (pointer:coarse), (max-width:700px){
  .hero-card .card-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:44px;
  }
}
