/* =========================================================================
   CHAPTER PAGES — rails of cards, and the card popup.

   The chapters used to be one long scroll-driven scene. They are now what
   apple.com does on its front page: a titled row of cards you push sideways.
   A card is a headline and a picture; everything else waits behind a tap, so
   the page stays quiet and nothing scroll-jacks the reader.
   ========================================================================= */
body.chapter { background:#f5f5f7; color:var(--black); }
/* the chapter switcher is pinned to the bottom of the window, so the page has
   to end above it rather than under it */
body.chapter main { padding-bottom:calc(var(--pfoot-h, 3.6rem) + 2rem); }

/* ---- the opening, built like the brochure covers ----
   One rounded card with the headline and its pills, and the chapter's own
   photograph breaking out over its edge. The overlap is the whole point: a
   panel with everything tidily inside it reads as a slide. */
.chero {
  position:relative;
  width:min(76rem,92vw); margin:0 auto;
  padding:clamp(1.6rem,4vw,3rem) 0 clamp(3rem,7vw,5.5rem);
}
.chero__card {
  position:relative; z-index:1;
  width:min(100%, 70%);
  border-radius:clamp(24px,3vw,36px);
  padding:clamp(1.8rem,4vw,3.2rem);
  background:
    radial-gradient(120% 130% at 8% 4%, #ffffff 0%, #eef1f6 52%, #e4e9f2 100%);
  box-shadow:0 40px 80px -44px rgba(16,32,64,0.55), 0 2px 10px -6px rgba(16,32,64,0.3);
}
.chero__logo { position:absolute; top:clamp(1.4rem,3vw,2.2rem); right:clamp(1.4rem,3vw,2.2rem); height:2.4rem; }

/* the pills, straight off the brochure covers */
.chero__pills { list-style:none; display:flex; flex-wrap:wrap; gap:0.5rem; margin:1.1rem 0 0; }
/* A pill keeps its text on one line — until the line is longer than the phone.
   "First second-generation graduate (with Dr. Abel)" is 344px of nowrap on a
   320px screen, and a flex row cannot wrap what refuses to break, so it hung
   65px off the edge and let the whole page pan sideways. */
.chero__pills li { max-width:100%; }
@media (max-width:640px) { .chero__pills li { white-space:normal; } }
.chero__pills li {
  padding:0.42rem 1rem; border-radius:999px;
  border:1.5px solid rgba(16,42,90,0.22); background:rgba(255,255,255,0.72);
  font-size:0.82rem; font-weight:600; color:#1a2b47; white-space:nowrap;
}

/* the photograph, hung off the card's right edge.

   Taufik, 21 August 2026: "make it bigger" — then, seeing it: "the top part
   each NEU, revert it, i just want it to be more landscape. more wide".

   So the answer was never a bigger portrait. At 34rem and 4/5 the frame stood
   693px tall against a 560px card and became the subject of the opening, with
   the headline reading as a caption beside it. WIDE was the ask all along:
   34rem across at 3/2, which is 544x363 — wider than the 432px it started at,
   and barely half the height of the portrait it briefly became.

   Landscape also suits what is actually in these pictures. Every one is a
   group, a room or a scene; the only portrait subject on the site is a
   founder's head, and that lives on NEUStory in a different frame entirely.

   THE HEIGHT CAP CAME OUT WITH THE PORTRAIT. It was there because a tall
   frame pinned to the bottom of the section climbed out of the top on the
   three chapters whose card is short — NEUNature's is 489px against NEUDoc's
   661. At 363px tall there is no chapter it does not fit inside, so the ratio
   holds exactly on all eight instead of being squashed to 4/4.5 on three of
   them. Measured; not assumed. */
.chero__pop {
  position:absolute; z-index:2; margin:0;
  right:0; bottom:0; width:min(52%, 34rem); aspect-ratio:3/2;
  border-radius:clamp(18px,2.4vw,28px); overflow:hidden;
  box-shadow:0 50px 90px -40px rgba(16,32,64,0.75), 0 0 0 8px rgba(255,255,255,0.85);
  transform:rotate(-1.4deg);
}
.chero__pop img { width:100%; height:100%; object-fit:cover; display:block; }

/* ── WHEN THE PHOTOGRAPH HAS A DRAWING OF ITSELF ──
   The frame keeps its rounded corner, its white border and its tilt; the
   button inside it is only the two pictures, so none of that is drawn twice.
   `.mug` brings its own radius, shadow and pale background for the founders'
   portraits, and all three are wrong inside a frame that already has them. */
.chero__pop--mug .mug {
  height:100%; border-radius:0; box-shadow:none; background:transparent;
}
/* the founders' portraits are heads, and want the top of the frame; a group
   photograph wants its middle, which is where everybody's face is */
.chero__pop--mug .mug > img { object-position:50% 50%; }
.chero__pop--mug .mug .mug__toon { background:transparent; }
.chero__pop--mug .mug__hint { right:auto; left:.55rem; top:.55rem; }

/* THE WAY TO SEE IT PROPERLY. Bottom-right, opposite the hint, so the two
   never sit on top of each other; over the button rather than inside it,
   because a link inside a button is not something a browser will accept. */
.chero__pop .popout {
  position:absolute; z-index:3; right:.55rem; bottom:.55rem;
  padding:.3rem .7rem; border-radius:999px;
  background:rgba(9,20,34,.66); color:#fff; text-decoration:none;
  font-size:.7rem; font-weight:700; letter-spacing:.03em; white-space:nowrap;
  backdrop-filter:blur(6px);
  transition:background .18s ease, transform .12s ease;
}
.chero__pop .popout:hover { background:var(--blue); transform:translateY(-1px); }
.chero__pop .popout:focus-visible { outline:3px solid #fff; outline-offset:2px; }

.chero__kicker {
  font-size:0.78rem; font-weight:700; letter-spacing:0.14em; text-transform:uppercase;
  color:var(--blue); margin-bottom:0.7rem;
}
.chero__h {
  font-size:clamp(2rem,4.6vw,3.4rem); line-height:1.06; letter-spacing:-0.02em;
  font-weight:700;
}
.chero__h em { font-style:normal; color:#6e6e73; }
/* the copy stops short of where the photograph overlaps the card */
.chero__card > * { max-width:min(100%, 30rem); }
.chero__lead {
  font-size:clamp(1rem,1.5vw,1.2rem); line-height:1.5; color:#3a3a3e;
  margin-top:0.9rem;
}
.chero__meta {
  display:flex; flex-wrap:wrap; gap:0.4rem 2rem; margin-top:1.4rem;
  font-size:0.82rem; color:#6e6e73;
}
.chero__meta span { display:grid; }
.chero__meta b {
  color:var(--black); font-size:0.72rem; letter-spacing:0.08em; text-transform:uppercase;
}

/* ---- a rail ---- */
.crail { width:100%; padding:clamp(1.4rem,3.5vw,2.6rem) 0; }
.rail__head {
  display:flex; align-items:flex-end; gap:1rem;
  width:min(76rem,92vw); margin:0 auto 1rem;
}
.rail__title {
  font-size:clamp(1.3rem,2.4vw,1.9rem); font-weight:700; letter-spacing:-0.02em;
  line-height:1.2; margin-right:auto; max-width:52rem;
}
.rail__title span { color:#86868b; font-weight:600; }
.rail__nav { display:flex; gap:0.5rem; flex:none; }
/* ── BIG ENOUGH FOR A THUMB ──
   44 CSS pixels is the minimum Apple and Google both publish, and both of
   these were under it on every phone — the rail arrows at 37 and the chapter
   back-link 22 tall. Found by tools/mobile-audit.mjs, which measures every
   pressable thing on every screen size.
   The BOX grows, not the mark inside it: a bigger arrow would be a design
   change, and a bigger target is only a target. */
.rail__arrow {
  width:2.75rem; height:2.75rem; border-radius:50%; border:0; cursor:pointer;
  background:rgba(0,0,0,0.06); color:#1d1d1f; font-size:1.3rem; line-height:1;
  display:grid; place-items:center;
  transition:background 0.18s ease, opacity 0.18s ease;
}
.rail__arrow:hover { background:rgba(0,0,0,0.12); }
.rail__arrow:disabled { opacity:0.25; cursor:default; }
.crail:not(.is-scrollable) .rail__nav { display:none; }

.rail__track {
  list-style:none; display:flex; gap:1.25rem;
  overflow-x:auto; overscroll-behavior-x:contain;
  scroll-snap-type:x mandatory;
  scroll-padding-left:max(4vw, calc((100vw - 76rem) / 2));
  /* Room above the cards for the lift. overflow-x:auto makes overflow-y auto
     too, so a card that rises has to rise into padding or it is clipped —
     which the hover lift was already just barely getting away with. */
  padding:1.4rem max(4vw, calc((100vw - 76rem) / 2)) 1.6rem;
  scrollbar-width:none;
}
.rail__track::-webkit-scrollbar { display:none; }
.rail__track.is-dragging { scroll-snap-type:none; cursor:grabbing; }
.rail__item { flex:none; scroll-snap-align:start; width:clamp(16rem,25vw,22rem); }

/* ---- a card ---- */
.acard {
  display:flex; flex-direction:column; width:100%; aspect-ratio:3/4;
  border:0; padding:0; cursor:pointer; text-align:left; overflow:hidden;
  border-radius:22px; background:var(--white); color:var(--black);
  box-shadow:0 2px 10px -4px rgba(0,0,0,0.16);
  transition:transform 0.28s cubic-bezier(0.2,0.9,0.3,1.1), box-shadow 0.28s ease;
}
.acard:hover, .acard:focus-visible {
  /* THE LIFT IS A VARIABLE, not a transform of its own. Since 23 August the
     card also leans towards the pointer — Taufik: "the animation and
     transition style of tcg.pokemon.com" — and two `transform` declarations
     on the same element do not add up, the later one simply replaces the
     earlier. Both live in ONE transform in shine.css and this sets its lift.
     Anything else that wants to move a card should join that line. */
  --lift: -6px;
  box-shadow:0 26px 48px -22px rgba(0,0,0,0.45);
}
.acard:focus-visible { outline:3px solid var(--blue); outline-offset:3px; }
/* ── THREE TONES, DECIDED BY POSITION ──
   Taufik: "make it automatic, normal mode, dark mode, black mode."
   Light is the card itself and carries no class. Dark is graphite; black is
   black. They sit next to each other in the cycle, so the two are lifted
   apart a little more than they were — at #111114 against #000 a reader
   would have taken them for one tone rendered twice. */
.acard--dark  { background:#1d1d23; color:var(--white); }
.acard--black { background:#000000; color:var(--white); }

.acard__body { display:block; padding:1.5rem 1.5rem 0.6rem; }
.acard__kicker {
  display:block; font-size:0.7rem; font-weight:700; letter-spacing:0.1em;
  text-transform:uppercase; color:#bf5a11; margin-bottom:0.55rem;
}
.acard--dark .acard__kicker, .acard--black .acard__kicker { color:#ff9f4a; }
.acard__kicker.is-live { color:#0e8b51; }
.acard--dark .acard__kicker.is-live, .acard--black .acard__kicker.is-live { color:#3ddc97; }
.acard__title {
  display:block; font-size:clamp(1.15rem,1.7vw,1.45rem); font-weight:700;
  line-height:1.18; letter-spacing:-0.015em;
}
.acard__sub { display:block; font-size:0.85rem; color:#6e6e73; margin-top:0.4rem; }
.acard--dark .acard__sub, .acard--black .acard__sub { color:#a1a1a6; }
.acard__big {
  display:block; font-size:clamp(2.2rem,4vw,3rem); font-weight:700; letter-spacing:-0.03em;
  color:var(--blue); margin:0 0 0.35rem; line-height:1;
}
.acard--dark .acard__big, .acard--black .acard__big { color:#5cb2ff; }
.acard__media { display:block; flex:1; min-height:0; margin-top:0.8rem; }
.acard__media img { width:100%; height:100%; object-fit:cover; display:block; }

/* ---- the closing band ---- */
.cband {
  width:min(76rem,92vw); margin:clamp(1.5rem,4vw,3rem) auto 0;
  background:var(--black); color:var(--white); border-radius:26px;
  padding:clamp(2rem,5vw,3.4rem); text-align:center;
}
.cband h2 { font-size:clamp(1.5rem,3vw,2.3rem); font-weight:700; letter-spacing:-0.02em; }
.cband h2 em { font-style:normal; color:#8ec5ff; }
.cband p { color:#a1a1a6; margin:0.7rem auto 1.4rem; max-width:38rem; }

@media (max-width:900px) {
  /* nothing hangs off anything on a phone — the picture simply sits under the
     card, still overlapping it a little so the pair still reads as one thing */
  .chero__card { width:100%; padding-bottom:clamp(4rem,18vw,7rem); }
  /* wider here too — 62vw left more than a third of a phone screen empty
     beside it, and a picture too small on a laptop was not somehow the right
     size on a phone. 3/2 to match the desktop frame, so the same photograph
     is not cropped to two different shapes depending on what you read it on. */
  .chero__pop {
    position:relative; right:auto; bottom:auto; width:min(24rem,80vw);
    aspect-ratio:3/2; margin:-3.5rem 0 0 auto; transform:rotate(-1.4deg);
  }
  .chero__logo { height:1.9rem; }
  .rail__track { scroll-padding-left:4vw; padding-left:4vw; padding-right:4vw; }
  .rail__head { width:92vw; }
  .rail__item { width:min(17rem,74vw); }
}

@media (prefers-reduced-motion:reduce) { .acard { transition:none; } }

/* a box that has not been published yet — only ever seen on the preview link */
.acard--draft { outline: 3px dashed #ffb020; outline-offset: -3px; }
.acard__draft {
  position: absolute; top: 0.8rem; right: 0.8rem; z-index: 2;
  background: #ffb020; color: #3a2600; font-size: 0.62rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.2rem 0.55rem; border-radius: 999px;
}
.acard { position: relative; }

/* =========================================================================
   THE USHER
   A salesperson does not hand a stranger a brochure and walk away. They point
   at one thing, say what it is, then point at the next. This is that, in a
   row of cards: each one is scanned, lifts, and settles, left to right, and
   then the row rests before going round again.

   Only ONE row on the page does it at a time — whichever is nearest the middle
   of the screen. Eight rows all pointing at once is not a guide, it is a
   fairground.

   It stops the moment somebody touches the row. They have taken over, and
   being led by the elbow after that is annoying rather than helpful.
   ========================================================================= */
.acard.is-usher {
  z-index: 3;
  animation: usher-lift 900ms cubic-bezier(0.22, 1.3, 0.34, 1);
}

@keyframes usher-lift {
  0%   { transform: none; }
  26%  { transform: translateY(-9px) scale(1.032); }
  52%  { transform: translateY(-2px) scale(1.006); }
  74%  { transform: translateY(-6px) scale(1.020); }
  100% { transform: none; }
}

/* the scan passing over it. ::after belongs to the shine that every card
   already carries, so this is ::before. */
.acard::before {
  content: '';
  position: absolute; inset: 0; z-index: 4;
  pointer-events: none; border-radius: inherit;
  opacity: 0;
}
.acard.is-usher::before {
  /* A NARROW band, and a see-through one. The first version ran from 38% to
     62% of an image two and a half times the card's width — well over half the
     card lit at once, in near-solid blue, which did not read as light passing
     over the card so much as paint being poured on it. You could not read the
     card underneath. */
  background: linear-gradient(
    100deg,
    transparent 45%,
    color-mix(in srgb, var(--blue) 18%, transparent) 48.5%,
    color-mix(in srgb, #dbeeff 62%, transparent) 50%,
    color-mix(in srgb, var(--blue) 18%, transparent) 51.5%,
    transparent 55%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: usher-scan 900ms ease-out;
}
@keyframes usher-scan {
  0%   { opacity: 0;   background-position: 100% 0; }
  14%  { opacity: 0.9; }
  78%  { opacity: 0.9; }
  100% { opacity: 0;   background-position: 0% 0; }
}

/* and a ring, so the card is picked out of the row even where the scan has
   already passed */
.acard.is-usher {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--blue) 70%, transparent),
    0 26px 52px -20px color-mix(in srgb, var(--blue) 45%, transparent),
    0 18px 40px -22px rgba(0, 0, 0, 0.5);
}

/* A card being pointed at should not also be swept by the ambient shine —
   two lights on the same object at once reads as a glitch. */
.acard.is-usher.shine::after { animation-play-state: paused; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .acard.is-usher, .acard.is-usher::before { animation: none; }
  .acard.is-usher { box-shadow: 0 0 0 2px var(--blue); }
}
