/* ============================================================
   What I Build — pinned card-stack + Read More overlay
   ============================================================ */

/* section flows normally (block), intro then a pinned viewport */
.wib {
  display: block;
  min-height: auto;
  align-content: initial;
  padding: var(--space-lg) var(--section-pad) 0;
}

.wib__intro { max-width: var(--maxw); }
/* title uses the shared .section-title (css/sections.css) */
.wib__lead {
  margin: var(--space-md) auto 0;
  max-width: 62ch;
  text-align: center;
  color: var(--fg-dim);
  font-size: var(--step-0);
  line-height: 1.35;
}

/* ---- pinned viewport (tabs + stack) ---- */
.wib__pin {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(2rem, 4.5vw, 3.5rem);   /* space between tabs and cards; larger = tabs sit higher */
  overflow: hidden;            /* clip the card rising from below */
}

.wib__tabs {
  --wib-tabs-lift: 2.5rem;   /* moves tabs UP only (visual, no layout shift → cards stay put) */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(100% - 2 * var(--section-pad), var(--maxw));
  margin-inline: auto;
  transform: translateY(calc(-1 * var(--wib-tabs-lift)));
}
.wib__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  border-radius: var(--r-md);
  color: var(--fg-faint);
  border: 1px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.wib__tab:hover { color: var(--fg-dim); background: rgba(255, 255, 255, 0.03); }
.wib__tab.is-active {
  color: var(--fg);
  background: rgba(156, 227, 37, 0.08);
  border-color: rgba(156, 227, 37, 0.35);
}
.wib__tab-num { font-size: var(--step--1); color: var(--accent-mid); font-weight: 700; }
.wib__tab-label { font-size: var(--step-0); font-weight: 600; }


/* ---- card stack ---- */
.wib__stack {
  --wib-card-min-h: 560px;   /* floor for card/stack height; inherited by .wib-card */
  --wib-media-w: 600px;      /* media column width; JS recomputes it from card height (3:5) */
  --wib-stack-maxw: 1200px;   /* card width cap for THIS section — lower to narrow the card */
  position: relative;
  width: min(100% - 2 * var(--section-pad), var(--wib-stack-maxw));
  margin-inline: auto;
  height: clamp(360px, 56vh, 560px);   /* JS overrides this with the tallest card's real height */
  min-height: var(--wib-card-min-h);   /* floor: stack never shorter than this */
}

/* transient state while JS measures natural card height: lay cards out in flow
   (overrides the inline GSAP position/transform via !important) so each card's
   offsetHeight reports its true content height */
.wib__stack--measuring { height: auto !important; }
.wib__stack--measuring .wib-card {
  position: static !important;
  inset: auto !important;
  height: auto !important;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}
/* while measuring, the media is a fixed-width, zero-height spacer: it reserves the
   same horizontal room it takes at runtime (so text wraps identically) without
   adding any height, letting each card measure to its true text height. */
.wib__stack--measuring .wib-card__media {
  align-self: start !important;
  height: 0 !important;
}

.wib-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: clamp(1.25rem, 3vw, 2.75rem);
  height: 100%;
  min-height: var(--wib-card-min-h);
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 0;
  border-radius: var(--r-lg);
  background: linear-gradient(155deg, var(--tint, #141414), #0b0c09 78%);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  cursor: pointer;   /* whole card opens the Read More overlay */
}
/* gradient border: 1px ring, white at the top-left fading to 20% at the bottom-right.
   A masked pseudo-element is used so the ring follows the card's border-radius
   (border-image can't do rounded corners). */
.wib-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;   /* = ring thickness */
  background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.wib-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* media stretches to the card's height; width comes from --wib-media-w (JS keeps it
   at height x 3/5), so the frame is 3:5 without CSS having to solve the circular size */
.wib-card__media { flex: 0 0 var(--wib-media-w); align-self: stretch; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.wib-card__media img,
.wib-card__media video { width: 100%; height: 100%; object-fit: cover; }

.wib-card__content { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: clamp(0.55rem, 1.4vw, 0.85rem); min-width: 0; }

/* in-card prompt with a subtle shimmer sweep to draw the eye */
.wib-card__hint {
  align-self: flex-start;
  margin: 0.2rem 0 0;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: transparent;
  background: linear-gradient(100deg, var(--fg-faint) 44%, var(--accent) 50%, var(--fg-faint) 56%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  animation: wib-hint-shimmer 3.4s linear infinite;
}
/* the highlight band sits in the middle third of a 3x-wide gradient, so both the
   start (0%) and end (100%) frames show only the faint base colour — identical end
   states → the infinite loop repeats with no snap. The glint sweeps through mid-cycle. */
@keyframes wib-hint-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wib-card__hint { animation: none; color: var(--accent-mid); background: none; }
}

.wib-card__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.wib-card__tags li {
  padding: 0.32rem 0.7rem;
  border-radius: var(--r-pill);
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: var(--accent);
  font-size: var(--step--2);
  font-weight: 600;
}

.wib-card__title {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.05;
  color: var(--fg);
}
.wib-card__body { 
  display: flex; 
  flex-direction: column; 
  gap: 0.5rem; 
  color: var(--fg-dim); 
  font-size: var(--step--1)
}
.wib-card__body p { max-width: 60ch; }

/* stats row (number + label) — sits directly under the body in flow */
.wib-stats {
  display: flex;
  flex-wrap: nowrap;              /* keep all stats on one row (desktop) */
  gap: clamp(0rem, 1.4vw, .8rem) 1.2rem;
  padding-block: clamp(0.6rem, 1.6vw, 0.9rem);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.wib-stat {
  flex: 1 1 0;                    /* equal width, share the row */
  min-width: 0;                  /* allow shrink below content size */
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.2rem;
}
.wib-stat__n {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--step-2);
  line-height: 1;

  /* gradient fill: #9CE325 80% -> 20% (matches .section-title) */
  color: transparent;
  background: linear-gradient(90deg, rgba(156, 227, 37, 0.80), rgba(156, 227, 37, 0.20));
  -webkit-background-clip: text;
          background-clip: text;

  /* solid green outline */
  -webkit-text-stroke: 1.3px #9CE325;
  paint-order: stroke fill;

  /* white 20% drop shadow, offset down + left */
  text-shadow: -2px 2px 0 rgba(255, 255, 255, 0.2);
}
.wib-stat__l { font-size: var(--step--1); color: #fff; max-width: 24ch; line-height: 1.25; }

/* reduced-motion / no-GSAP fallback: static vertical list */
.wib__stack--static { height: auto; display: flex; flex-direction: column; gap: var(--space-md); }
.wib__stack--static .wib-card { position: static !important; height: auto; opacity: 1 !important; transform: none !important; }

@media (max-width: 860px) {
  .wib__stack { height: auto; }
  .wib-card { grid-template-columns: 1fr; }
}

/* ============================================================
   Read More overlay
   ============================================================ */
body.wib-overlay-open { overflow: hidden; }

.wib-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  background: rgba(6, 7, 5, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.32s var(--ease-out);
}
/* author display:flex above beats the UA [hidden] rule, so restore it —
   otherwise the fixed, full-screen overlay swallows clicks while "closed" */
.wib-overlay[hidden] { display: none; }
.wib-overlay.is-open { opacity: 1; }

.wib-overlay__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
}
.wib-ov__tabs { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.wib-ov__pill {
  white-space: nowrap;
  padding: 0.5rem 1rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: var(--step--1);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.wib-ov__pill:hover { color: var(--fg); }
.wib-ov__pill.is-active { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }

.wib-overlay__close {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.wib-overlay__close:hover { color: var(--fg); border-color: var(--border-strong); }
.wib-overlay__close svg { width: 14px; height: 14px; }

.wib-overlay__scroll { flex: 1; overflow-y: auto; }
.wib-ov__body {
  width: min(100% - 2 * clamp(1rem, 4vw, 3rem), 980px);
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(3rem, 8vw, 6rem);
}

.wib-ov__head { text-align: center; }
.wib-ov__title { font-family: var(--font-head); font-weight: 800; font-size: var(--step-3); color: var(--fg); }
.wib-ov__byline { margin-top: 0.6rem; color: var(--fg-dim); max-width: 60ch; margin-inline: auto; }
.wib-ov__head .wib-stats { justify-content: center; border-top: none; padding-top: 1.4rem; }

.wib-ov__media { margin: 1.6rem 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.wib-ov__media img,
.wib-ov__media video { width: 100%; aspect-ratio: 3 / 5; object-fit: cover; }

.wib-ov__section { margin-top: 1.6rem; }
.wib-ov__section h4 { font-family: var(--font-head); font-weight: 700; font-size: var(--step-2); color: var(--accent-mid); margin-bottom: 0.5rem; }
.wib-ov__section p { color: var(--fg-dim); max-width: 72ch; margin-bottom: 0.6rem; }
.wib-ov__section ul { margin: 0.4rem 0 0.6rem 1.2rem; color: var(--fg-dim); list-style: disc; }
.wib-ov__section li { margin-bottom: 0.4rem; }
.wib-ov__section em { color: var(--fg); font-style: italic; }
.wib-ov__todo { color: var(--fg-faint); font-style: italic; }
