/* index2.html — image-led chapters: each one opens on a full-bleed image and
   flows down into what you can do with it. Uses the tokens from nomad.css. */

.ch { position: relative; }
.ch + .ch { margin-top: clamp(40px, 6vw, 96px); }

/* the opening image */
.ch-stage {
  position: relative;
  min-height: min(92vh, 860px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}
.ch-stage > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -2;
  transform: scale(1.06);
  transition: transform 1.6s cubic-bezier(.2,.7,.2,1);
}
.ch.is-in .ch-stage > img { transform: scale(1); }
.ch-stage::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(5,7,13,.55) 0%, rgba(5,7,13,0) 22%),
    linear-gradient(0deg, var(--ink-900) 0%, rgba(5,7,13,.86) 18%, rgba(5,7,13,0) 58%);
}
.ch-stage.is-left::after {
  background:
    linear-gradient(90deg, rgba(5,7,13,.82) 0%, rgba(5,7,13,.35) 42%, rgba(5,7,13,0) 70%),
    linear-gradient(0deg, var(--ink-900) 0%, rgba(5,7,13,0) 30%);
}
.ch-copy { padding-bottom: clamp(28px, 5vw, 64px); }
.ch-num {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ch-accent, var(--blue-2));
}
.ch-num::before { content: ""; width: 28px; height: 2px; background: currentColor; border-radius: 2px; }
.ch-title {
  margin: 14px 0 0;
  font-size: clamp(2.2rem, 5.4vw, 4.4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.01em;
  max-width: 14ch;
  text-shadow: 0 2px 24px rgba(0,0,0,.45);
}
.ch-title em { font-style: italic; color: var(--ch-accent, var(--blue-2)); }
.ch-lead {
  margin-top: 16px;
  max-width: 46ch;
  font-size: clamp(1.02rem, 1.4vw, 1.18rem);
  line-height: 1.55;
  color: var(--txt-2);
}
.ch-head-center {
  text-align: center;
  max-width: 860px;
  margin: 0 auto clamp(24px, 3.5vw, 42px);
}
.ch-head-center .ch-num {
  justify-content: center;
}
.ch-head-center .ch-title {
  max-width: 26ch;
  margin: 14px auto 0;
  text-align: center;
}
.ch-head-center .ch-lead {
  max-width: 68ch;
  margin: 16px auto 0;
  text-align: center;
}

/* what it does — straight under the image, no boxes */
.ch-body { padding-top: clamp(22px, 3vw, 40px); }
.ch-does {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 44px);
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 22px;
}
.ch-does h3 { font-size: 1.04rem; font-weight: 700; margin: 0 0 6px; }
.ch-does p { margin: 0; color: var(--txt-2); line-height: 1.55; font-size: .96rem; }
.ch-link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 26px;
  font-weight: 700;
  color: var(--ch-accent, var(--blue-2));
  text-decoration: none;
}
.ch-link::after { content: "→"; transition: transform .2s; }
.ch-link:hover::after { transform: translateX(4px); }

/* Create — three words to a directed scene */
.ch-ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.ch-ladder figure { margin: 0; }
.ch-ladder img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 14px; display: block;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  transition: transform .25s ease, box-shadow .25s ease;
}
.ch-ladder figure:hover img {
  transform: translateY(-3px);
  box-shadow: 0 16px 44px rgba(0,0,0,.6);
}
.ch-ladder figcaption { margin-top: 10px; font-size: .9rem; color: var(--txt-2); line-height: 1.45; }
.ch-ladder figcaption b { display: block; color: var(--txt); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 3px; }
.ch-ladder q { quotes: "“" "”"; font-style: italic; }
.ch-ladder.is-3col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px clamp(14px, 2.2vw, 24px);
}
@media (max-width: 900px) {
  .ch-ladder.is-3col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .ch-ladder.is-3col { grid-template-columns: 1fr; }
}
/* Create's families and levers: art made as card backgrounds, with an empty
   dark side for text; a squarer crop around --pos keeps the subject. */
.ch-ladder.is-crop img {
  aspect-ratio: 4 / 3;
  object-position: var(--pos, center);
}
.ch-ladder figure a {
  text-decoration: none;
  color: inherit;
  display: block;
}
.ch-ladder figure a img {
  transition: transform .25s ease, box-shadow .25s ease;
}
.ch-ladder figure a:hover img {
  transform: translateY(-3px);
  box-shadow: 0 16px 44px rgba(0,0,0,.6);
}
.ch-ladder .ch-link-sub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ch-accent, var(--blue-2));
}
.ch-ladder .ch-link-sub::after {
  content: "→";
  transition: transform .2s ease;
}
.ch-ladder figure a:hover .ch-link-sub::after {
  transform: translateX(3px);
}

/* Refine — before / after you drag */
.ba {
  position: relative;
  margin-top: clamp(20px, 3vw, 34px);
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  max-width: 620px;
  user-select: none;
  touch-action: pan-y;
  cursor: ew-resize;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ba .ba-top { clip-path: inset(0 calc(100% - var(--ba, 50%)) 0 0); }
.ba-line {
  position: absolute; top: 0; bottom: 0; left: var(--ba, 50%);
  width: 2px; margin-left: -1px; background: #fff;
  box-shadow: 0 0 12px rgba(0,0,0,.5);
}
.ba-line::after {
  content: "⇆";
  position: absolute; top: 50%; left: 50%;
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%; background: #fff; color: #111;
  display: grid; place-items: center; font-size: 18px; font-weight: 700;
}
.ba-tag {
  position: absolute; top: 14px; padding: 5px 10px; border-radius: 999px;
  background: rgba(5,7,13,.72); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.ba-tag.is-before { left: 14px; }
.ba-tag.is-after { right: 14px; }
.ch-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
}
.ch-split .ch-prompt {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 3px solid var(--ch-accent, var(--blue-2));
  background: rgba(255,255,255,.03);
  border-radius: 0 10px 10px 0;
  font-size: .98rem;
  color: var(--txt);
}
.ch-split .ch-prompt span { display: block; font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-3); margin-bottom: 4px; }

/* Mix — the photo that stays the same */
.ch-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: clamp(20px, 3vw, 34px);
}
.ch-pair img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; display: block; min-height: 240px; }

/* Split Hero Variant: text left, large art right with lateral blur */
.ch-stage-split {
  padding: clamp(24px, 3.5vw, 44px) 0 14px;
}
.ch-split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(16px, 2.5vw, 36px);
  align-items: center;
  max-width: 1240px;
  margin-inline: auto;
}
.ch-split-copy {
  min-width: 0;
  max-width: 490px;
  justify-self: end;
}
.ch-split-copy .ch-title {
  font-size: clamp(2.1rem, 3.5vw, 3.4rem);
  line-height: 1.05;
  max-width: 15ch;
}
.ch-split-copy .ch-lead {
  max-width: 46ch;
  margin-top: 14px;
  font-size: clamp(.96rem, 1.15vw, 1.06rem);
}
.ch-split-art {
  position: relative;
  margin: 0;
  border-radius: 24px;
  overflow: hidden;
  background: var(--ink-900);
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  min-width: 0;
}
.ch-split-art img {
  width: 100%;
  height: 100%;
  min-height: 340px;
  max-height: 450px;
  object-fit: cover;
  object-position: 40% center;
  display: block;
}
/* Lateral blur & soft dissolve on left side - tighter and closer */
.ch-split-art.has-left-blur {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.3) 2%, rgba(0,0,0,0.9) 8%, #000 18%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.3) 2%, rgba(0,0,0,0.9) 8%, #000 18%);
}
.ch-split-art.has-left-blur::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 24%;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to right, #000 0%, rgba(0,0,0,0.5) 40%, transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, rgba(0,0,0,0.5) 40%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}
.ch-split-art.has-left-blur::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 22%;
  background: linear-gradient(to right, rgba(5,7,13,0.75) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* Tighter body and mini cards to sit closer to split hero */
.ch-body { padding-top: 0; }
.ch-ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.ch-link {
  margin-top: 14px;
}

/* Flow family pills with color coding - borderless & luminous */
.flow-pill-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.flow-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: none;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.flow-pill.is-builtin {
  background: rgba(16, 30, 64, 0.90);
  color: #c2dcff;
}
.flow-pill.is-builtin::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7AA0FF;
  box-shadow: 0 0 10px #7AA0FF;
}
.flow-pill.is-pack {
  background: rgba(42, 20, 66, 0.90);
  color: #edd5ff;
}
.flow-pill.is-pack::before {
  content: "◈";
  font-size: .75rem;
  color: #C084FC;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.8);
}
.flow-pill small {
  opacity: .85;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-left: 3px;
  font-weight: 600;
}
.flow-pill:hover {
  transform: translateY(-1px);
}
.flow-pill.is-builtin:hover {
  background: rgba(26, 48, 102, 0.96);
  color: #fff;
  box-shadow: 0 4px 18px rgba(122, 160, 255, 0.35);
}
.flow-pill.is-pack:hover {
  background: rgba(65, 30, 102, 0.96);
  color: #fff;
  box-shadow: 0 4px 18px rgba(192, 132, 252, 0.4);
}

/* Larger, clear borderless legend */
.family-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 24px;
  font-size: .98rem;
  color: var(--txt);
}
.family-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.family-legend-item .flow-pill {
  font-size: .88rem;
  padding: 7px 16px;
  font-weight: 700;
}

/* ---- Seis familias y Cuatro palancas (Create) ---- */
:is(#flow-families, #palancas-create) .card-visual .card-bg-img {
  filter: brightness(0.96) contrast(1.08) saturate(1.15);
  opacity: 1;
}
:is(#flow-families, #palancas-create) .card-visual:hover .card-bg-img {
  filter: brightness(1.05) contrast(1.12) saturate(1.22);
}
:is(#flow-families, #palancas-create) .card-visual .card-bg-overlay {
  background:
    /* Scrim suave a la izquierda para proteger el texto sin apagar la imagen */
    linear-gradient(92deg, rgba(4, 6, 12, 0.72) 0%, rgba(4, 6, 12, 0.42) 46%, rgba(4, 6, 12, 0.08) 75%, transparent 100%),
    linear-gradient(180deg, rgba(4, 6, 12, 0.22) 0%, transparent 40%, rgba(4, 6, 12, 0.52) 100%);
}
:is(#flow-families, #palancas-create) .card-visual .eyebrow {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px #000, 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.9);
}
:is(#flow-families, #palancas-create) .card-visual .d4 {
  color: #ffffff;
  text-shadow:
    0 1px 3px #000,
    0 2px 8px rgba(0, 0, 0, 0.98),
    0 4px 16px rgba(0, 0, 0, 0.95),
    0 0 30px rgba(0, 0, 0, 0.9);
}
:is(#flow-families, #palancas-create) .card-visual p {
  color: #ffffff;
  font-weight: 450;
  text-shadow:
    0 1px 2px #000,
    0 2px 8px rgba(0, 0, 0, 0.98),
    0 0 16px rgba(0, 0, 0, 0.92);
}
:is(#flow-families, #palancas-create) .card-visual .control-card-tags {
  color: #f1f5f9;
  border-top-color: rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 3px #000, 0 2px 6px rgba(0, 0, 0, 0.98);
}
:is(#flow-families, #palancas-create) .card-visual .control-card-tags span {
  text-shadow: 0 1px 3px #000, 0 2px 6px rgba(0, 0, 0, 0.98);
}
#flow-families .card-visual .flow-pill-list {
  border-top-color: rgba(255, 255, 255, 0.22);
}
#flow-families .card-visual .flow-pill {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

@media (max-width: 860px) {
  .ch-stage { min-height: 74vh; }
  .ch-split-grid { grid-template-columns: 1fr; gap: 28px; }
  .ch-split-art img { min-height: 260px; max-height: 380px; }
  .ch-split-art.has-left-blur {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 15%);
  }
  .ch-split-art.has-left-blur::before,
  .ch-split-art.has-left-blur::after { display: none; }
  .ch-does { grid-template-columns: 1fr; }
  .ch-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-split, .ch-pair { grid-template-columns: 1fr; }
  .ba { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ch-stage > img { transition: none; transform: none; }
}

/* Create, Build: every section between the hero and the closing CTA keeps the same
   breathing room (it mixed .ch chapters, which have none, with .sec blocks
   at up to 132px a side and one hand-tuned exception). */
:is(.page-create, .page-build) main > section:not(.hero-x):not(.lib-hero):not(:last-of-type) {
  margin-top: 0;
  padding-block: clamp(40px, 5vw, 72px);
}

/* Build: portrait style samples and a two-up row of saved assets. */
.ch-ladder.is-tall img { aspect-ratio: 3 / 4; }
.ch-ladder.is-tall figure:first-child img { object-position: 50% top; }
.ch-ladder.is-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px clamp(14px, 2.2vw, 24px);
  max-width: 980px;
  margin-inline: auto;
}
.ch-ladder.is-2col img { aspect-ratio: 4 / 3; }
@media (max-width: 580px) {
  .ch-ladder.is-2col { grid-template-columns: 1fr; }
}
.page-build .ch-split-copy .ch-link { margin-top: 22px; }
.page-build .ch-split-art.lib-app-shot img { min-height: 0; max-height: none; object-fit: contain; }
.page-build .eng-note { text-align: center; margin-top: 22px; }
.page-build main > section { scroll-margin-top: 90px; }

/* Tutorials: video covers with a play mark, length and a "coming soon" state. */
.tut-thumb { position: relative; display: block; }
.tut-thumb img { aspect-ratio: 16 / 9; }
.tut-play {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%; background: rgba(4, 6, 12, .55); border: 1px solid rgba(255, 255, 255, .35);
  backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease;
}
.tut-play::after {
  content: ""; position: absolute; left: 21px; top: 16px;
  border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent #fff;
}
.ch-ladder figure a:hover .tut-play { opacity: 1; }
.tut-len, .tut-soon {
  position: absolute; right: 10px; bottom: 10px; padding: 3px 8px; border-radius: 6px;
  background: rgba(4, 6, 12, .78); color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em;
}
.tut-soon { left: 10px; right: auto; top: 10px; bottom: auto; background: var(--ch-accent, var(--blue-2)); }
.ch-ladder figure.is-soon img { filter: saturate(.55) brightness(.75); }
.ch-ladder figure.is-soon figcaption { opacity: .7; }
.page-tutorials .tut-page { padding-top: var(--page-intro-gap, 89px); }
.page-tutorials .eng-note { text-align: center; margin-top: 26px; }
