/* ============================================================
   V3 core-page scenes. Loaded only by the pages that use them.
   Base state is the readable one; .js / .js-motion add the motion.
   ============================================================ */

/* ---------- Comparison table with sticky head (21st 21218) ---------- */
.v3-compare { background: var(--white); border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--line); }
.v3-compare__table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-small); }
.v3-compare__table thead th, .v3-compare__table thead td { position: sticky; top: 84px; z-index: 2; background: var(--white); padding: var(--s-5); text-align: left; vertical-align: bottom; border-bottom: 1px solid var(--line); }
.v3-compare__table thead tr > :first-child { border-top-left-radius: var(--r-lg); }
.v3-compare__table thead tr > :last-child { border-top-right-radius: var(--r-lg); }
.v3-compare__table thead b { display: block; margin-top: var(--s-3); font-size: var(--t-h4); font-weight: 600; letter-spacing: -0.02em; }
.v3-compare__table thead th.is-featured { background: var(--dark); color: var(--on-dark); }
.v3-compare__table tbody th { width: 18%; padding: var(--s-4) var(--s-5); text-align: left; font-weight: 600; vertical-align: top; color: var(--ink); }
.v3-compare__table tbody td { padding: var(--s-4) var(--s-5); vertical-align: top; color: var(--muted); border-left: 1px solid var(--line); }
.v3-compare__table tbody tr + tr > * { border-top: 1px solid var(--line); }
.v3-compare__table td.is-featured { background: var(--accent-wash); color: var(--ink); }
.v3-compare__table tbody tr:last-child td.is-featured { border-bottom-right-radius: 0; }
.v3-compare__table tbody tr { transition: background var(--d-fast); }
.v3-compare__table tbody tr:hover { background: rgba(28, 25, 23, 0.025); }
.v3-compare .checks { gap: var(--s-2); }
@media (max-width: 719px) {
  .v3-compare { background: none; box-shadow: none; }
  .v3-compare__table, .v3-compare__table tbody, .v3-compare__table tr, .v3-compare__table th, .v3-compare__table td { display: block; width: 100%; }
  .v3-compare__table thead { display: none; }
  .v3-compare__table tbody { display: grid; gap: var(--s-4); }
  .v3-compare__table tbody tr { background: var(--white); border-radius: var(--r-md); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
  .v3-compare__table tbody tr + tr > * { border-top: 0; }
  .v3-compare__table tbody th { width: auto; padding: var(--s-4) var(--s-4) var(--s-2); font-size: var(--t-h4); }
  .v3-compare__table tbody td { border-left: 0; border-top: 1px solid var(--line); padding: var(--s-3) var(--s-4); }
  .v3-compare__table tbody td::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: var(--t-xs); font-weight: 600; color: var(--accent-ink); }
}

/* ---------- Learning path checklist (21st 23569) ---------- */
.v3-path { position: relative; display: grid; gap: var(--s-5); max-width: 860px; counter-reset: none; --p: 1; }
.v3-path::before, .v3-path::after { content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 2px; border-radius: 2px; background: var(--line-strong); }
.v3-path::after { background: var(--accent); transform-origin: top; transform: scaleY(var(--p)); transition: transform var(--d-slow) var(--ease-out); }
.v3-path__step { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: var(--s-5); align-items: start; }
.v3-path__step h3 { font-weight: 500; font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); line-height: 1.15; letter-spacing: -0.03em; margin-top: 8px; }
.v3-path__step p { margin-top: var(--s-2); color: var(--muted); }
.v3-path__tick { position: relative; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--white); box-shadow: 0 0 0 1px var(--line-strong); font-size: var(--t-xs); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); transition: background var(--d-med) var(--ease-out), box-shadow var(--d-med), color var(--d-med); }
.v3-path__tick::after { content: ""; position: absolute; width: 14px; height: 8px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: translateY(-2px) rotate(-45deg) scale(0); transition: transform var(--d-med) var(--ease-out); }
.v3-path__tick i { font-style: normal; transition: opacity var(--d-fast), transform var(--d-med) var(--ease-out); }
.v3-path.is-live .v3-path__step:not(.is-done) .v3-path__tick { box-shadow: 0 0 0 1px var(--line-strong); }
.v3-path.is-live .v3-path__step:not(.is-done) h3 { color: var(--muted); }
.v3-path__step h3 { transition: color var(--d-med); }
.v3-path:not(.is-live) .v3-path__tick, .v3-path__step.is-done .v3-path__tick { background: var(--ink); color: var(--on-dark); box-shadow: 0 8px 18px -10px rgba(28, 25, 23, 0.6); }
.v3-path__step.is-done .v3-path__tick i { opacity: 0; transform: scale(0.6); }
.v3-path__step.is-done .v3-path__tick::after { transform: translateY(-2px) rotate(-45deg) scale(1); color: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { .v3-path *, .v3-path::after { transition: none !important; } }

/* ---------- Horizontal process timeline (21st 26930) ---------- */
.v3-track { position: relative; --p: 0; }
.v3-track__pin { position: relative; }
.v3-track__body { position: relative; margin-top: var(--s-7); }
.v3-track__line { position: absolute; left: 0; right: 0; top: 11px; height: 2px; background: var(--line-strong); border-radius: 2px; }
.v3-track__line i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--p)); }
.v3-track__rail { position: relative; display: flex; gap: var(--s-5); overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 0 var(--s-4); scrollbar-width: thin; }
.v3-track__rail:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 4px; border-radius: var(--r-sm); }
.v3-track__item { flex: 0 0 min(78vw, 340px); scroll-snap-align: start; padding-top: 40px; position: relative; }
.v3-track__dot { position: absolute; top: 4px; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--line-strong); transition: box-shadow var(--d-med), background var(--d-med); }
.v3-track__item.is-in .v3-track__dot { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-wash); }
.v3-track__item h3 { font-weight: 500; font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.85rem); line-height: 1.1; letter-spacing: -0.035em; margin: var(--s-3) 0 var(--s-3); }
.v3-track__item p { color: var(--muted); }
.v3-track__item { background: none; }
/* pinned mode (wide screens, motion allowed; set by js/pages.js) */
.v3-track.is-pinned .v3-track__pin { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.v3-track.is-pinned .v3-track__rail { overflow: visible; scroll-snap-type: none; will-change: transform; padding-right: 30vw; }
.v3-track.is-pinned .v3-track__item { flex-basis: 400px; opacity: 0.35; transform: translateY(14px); transition: opacity var(--d-slow) var(--ease-out), transform var(--d-slow) var(--ease-out); }
.v3-track.is-pinned .v3-track__item.is-in { opacity: 1; transform: none; }

/* ---------- Sticky split (21st 26064) ---------- */
.v3-split { display: grid; gap: var(--s-7); grid-template-columns: 1fr; }
.v3-split__media { position: sticky; top: 84px; z-index: 1; aspect-ratio: 16 / 10; box-shadow: 0 18px 30px -18px rgba(0, 0, 0, 0.8); border-radius: var(--r-xl); overflow: hidden; background: var(--dark-2); }
.v3-split__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity var(--d-slow) var(--ease-out), transform 1200ms var(--ease-out); }
.v3-split__media img.is-on { opacity: 1; transform: none; }
.v3-split__count { position: absolute; left: var(--s-5); bottom: var(--s-5); padding: 6px 14px; border-radius: var(--r-pill); background: rgba(28, 25, 23, 0.72); color: var(--on-dark); font-size: var(--t-small); font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); }
.v3-split__steps { display: grid; gap: var(--s-5); }
.v3-split__step { padding: var(--s-5) 0 var(--s-5) var(--s-5); border-left: 2px solid var(--dark-3); transition: border-color var(--d-med), opacity var(--d-med); }
.v3-split__step h3 { margin: var(--s-3) 0; }
.v3-split__step p { color: var(--on-dark-2); max-width: 46ch; }
.v3-split__step .step__n { color: var(--accent-soft); }
.v3-split__step.is-active { border-color: var(--accent); }
@media (min-width: 900px) {
  .v3-split { grid-template-columns: 1.05fr 1fr; align-items: start; }
  .v3-split__media { position: sticky; top: 110px; aspect-ratio: 4 / 5; max-height: calc(100vh - 140px); }
  .v3-split__steps { gap: 0; }
  .v3-split__step { min-height: 52vh; display: flex; flex-direction: column; justify-content: center; }
  .js .v3-split__step:not(.is-active) { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) { .v3-split__media img, .v3-split__step { transition: none; } }

/* ---------- Bento grid (21st 4517) ---------- */
.v3-bento { display: grid; gap: var(--s-4); grid-template-columns: 1fr; list-style: none; padding: 0; }
.v3-bento__tile { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end; min-height: 200px; padding: var(--s-6) var(--s-5) var(--s-5); border-radius: var(--r-lg); background: var(--white); box-shadow: 0 0 0 1px var(--line); transition: transform var(--d-med) var(--ease-out), box-shadow var(--d-med); }
.v3-bento__tile:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--line-strong), 0 18px 40px -26px rgba(28, 25, 23, 0.5); }
.v3-bento__n { position: absolute; top: var(--s-4); right: var(--s-5); font-size: clamp(3rem, 2rem + 4vw, 5.5rem); font-weight: 600; line-height: 1; letter-spacing: -0.06em; color: var(--bg-soft); z-index: -1; font-variant-numeric: tabular-nums; }
.v3-bento__tile h3 { font-weight: 500; font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); line-height: 1.12; letter-spacing: -0.03em; }
.v3-bento__tile p { margin-top: var(--s-2); color: var(--muted); }
.v3-bento__tile:first-child { background: var(--dark); color: var(--on-dark); box-shadow: none; }
.v3-bento__tile:first-child::before { content: ""; position: absolute; z-index: -1; width: 70%; aspect-ratio: 1; right: -20%; bottom: -35%; border-radius: 50%; background: radial-gradient(circle, var(--glow-orange), transparent 68%); }
.v3-bento__tile:first-child .v3-bento__n { color: var(--dark-3); }
.v3-bento__tile:first-child p { color: var(--on-dark-2); }
@media (min-width: 720px) {
  .v3-bento { grid-template-columns: repeat(2, 1fr); }
  .v3-bento__tile:first-child { grid-row: span 2; }
}
@media (min-width: 1024px) {
  .v3-bento { grid-template-columns: repeat(3, 1fr); }
  .v3-bento__tile:first-child { grid-row: span 2; min-height: 420px; }
  .v3-bento__tile:first-child h3 { font-size: var(--t-h3); }
  /* five tiles: big one plus a 2x2 */
  .v3-bento[style*="--n:5"] { grid-template-columns: 1.3fr 1fr 1fr; }
  /* six tiles: big one, then 2 + 3 */
  .v3-bento[style*="--n:6"] .v3-bento__tile:nth-child(6) { grid-column: 2 / -1; }
}
.v3-bento--dark .v3-bento__tile:not(:first-child) { background: var(--dark-2); box-shadow: 0 0 0 1px var(--dark-3); color: var(--on-dark); }
.v3-bento--dark .v3-bento__tile:not(:first-child) p { color: var(--on-dark-2); }
.v3-bento--dark .v3-bento__tile:not(:first-child) .v3-bento__n { color: var(--dark-3); }
@media (prefers-reduced-motion: reduce) { .v3-bento__tile, .v3-bento__tile:hover { transition: none; transform: none; } }

/* ---------- Study list with cursor preview (21st 28258) ---------- */
.v3-hl { position: relative; }
.v3-hl__list { border-top: 1px solid var(--line-strong); }
.v3-hl__row { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-6); padding: var(--s-5) 0; border-bottom: 1px solid var(--line-strong); }
.v3-hl__row h3 { grid-column: 1; }
.v3-hl__row h3 a { text-decoration: none; color: var(--ink); transition: color var(--d-fast); }
.v3-hl__row h3 a::after { content: " →"; opacity: 0; transition: opacity var(--d-fast); }
.v3-hl__row:hover h3 a, .v3-hl__row h3 a:focus-visible { color: var(--accent-ink); }
.v3-hl__row:hover h3 a::after, .v3-hl__row h3 a:focus-visible::after { opacity: 1; }
.v3-hl__row > p { grid-column: 1; max-width: 70ch; font-size: var(--t-small); }
.v3-hl__meta { grid-column: 2; grid-row: 1; font-size: var(--t-xs); color: var(--muted-2); white-space: nowrap; align-self: center; }
.v3-hl__row > .link { grid-column: 2; grid-row: 2; justify-self: end; font-size: var(--t-small); }
.v3-hl__float { position: absolute; left: 0; top: 0; z-index: 3; width: 170px; pointer-events: none; opacity: 0; scale: 0.85; transition: opacity var(--d-med) var(--ease-out), scale var(--d-med) var(--ease-out); display: none; }
@media (hover: hover) and (pointer: fine) {
  .v3-hl__float { display: flex; }
  .v3-hl.is-hover .v3-hl__float { opacity: 1; scale: 1; }
}
@media (max-width: 599px) {
  .v3-hl__row { grid-template-columns: 1fr; }
  .v3-hl__meta, .v3-hl__row > .link { grid-column: 1; grid-row: auto; justify-self: start; }
}

/* ---------- Tilt portraits (21st 12244) ---------- */
.v3-tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 400ms var(--ease-out); will-change: transform; }
.v3-tilt::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.28), transparent 45%); opacity: 0; transition: opacity var(--d-med); }
.v3-tilt:hover::after { opacity: 1; }
.media__frame.v3-tilt { position: relative; }

/* ---------- Parallax covers (21st 20023) ---------- */
.v3-parallax { will-change: transform; transition: none !important; }
