/* REFINE — /programas/ (spec programs-launch, T10: Plan D).
 * The Home's format: each section has its photo behind and everything else on top (title, index, pass, table).
 * Below 1024px it follows the landings' rule (Fran, 2026-11-10): the photo becomes a block with Julie whole and the
 * text goes around it, never over her; the glass pass overlaps the bottom of the photo.
 * Tokens from tokens.css; the program colors and their walls are the same as the test's result (fit.css).
 * Mobile first.
 */

/* — Shared pieces — */
.pg-glass {
  background: rgb(246 243 238 / 0.9);
  border: 1px solid var(--refine-beige);
  border-radius: 28px;
}

.pg-label,
.pg-meta {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--refine-ink);
}

.pg-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
}

/* A data line only breaks at its « · » (refine_nowrap_parts()). */
.pg-nowrap { white-space: nowrap; }

.pg-meta--rule {
  padding-block-end: 14px;
  border-block-end: 1px solid var(--summer-line-strong);
}

/* — Portada: tríptico (Hero 1, Fran, 2026-11-10) —
 * The Home's three program photos side by side. Phone and tablet: the title on the off-white above, then three
 * strips with the name sideways. Desktop (below): the panels fill the screen and the title runs across their top. */
.pg-hero {
  display: flex;
  flex-direction: column;
  background: var(--refine-offwhite);
}

.pg-hero__head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(var(--header-top) + var(--header-h) + 24px) var(--gutter) 24px;
}

.pg-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: calc(clamp(46px, 12.8vw, 96px) * var(--type-display));
  line-height: 0.88;
  letter-spacing: var(--track-display);
  word-spacing: var(--word-display);
  text-transform: uppercase;
}

.pg-hero__panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  height: clamp(440px, 64svh, 720px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-panel { position: relative; min-width: 0; }

.pg-panel[data-program="lean-form"] { background: #D3CEC5; }
.pg-panel[data-program="tone-flow"] { background: #E2DED7; }
.pg-panel[data-program="run-shape"] { background: #CCC8BF; }

.pg-panel__link {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--refine-cream);
  text-decoration: none;
}

.pg-panel__link:focus-visible { outline: 3px solid var(--refine-ink); outline-offset: -3px; }

.pg-panel__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  transition: transform var(--dur-slow) ease;
}

.pg-panel[data-program="lean-form"] .pg-panel__img { object-position: 58% 45%; }
.pg-panel[data-program="tone-flow"] .pg-panel__img { object-position: 55% 45%; }
.pg-panel[data-program="run-shape"] .pg-panel__img { object-position: 48% 40%; }

.pg-panel__link:hover .pg-panel__img { transform: scale(1.03); }

/* The Home's program cards filter (Fran, 2026-11-10: «más oscuro, como los programas en el home»): the dark veil at
   the top (`--ways-veil-top`, gone at 24 %), a light ink over the whole photo, and an ink veil at the foot for the
   cream name. */
.pg-panel__link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, var(--ways-veil-top) 0%, transparent 24%),
    linear-gradient(180deg, rgb(34 34 34 / 0) 42%, rgb(34 34 34 / 0.66) 100%),
    rgb(34 34 34 / 0.12);
  pointer-events: none;
}

/* Phone and tablet: the name sideways, read from the bottom up, centred on its strip. */
.pg-panel__text {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 2;
  display: flex;
  gap: 10px;
  writing-mode: vertical-rl;
  transform: translateX(-50%) rotate(180deg);
}

.pg-panel__meta {
  display: none;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pg-panel__name {
  font-family: var(--font-display);
  font-size: calc(clamp(30px, 9.4vw, 44px) * var(--type-mid));
  font-weight: 300;
  line-height: 1;
  letter-spacing: var(--track-program);
  word-spacing: var(--word-program);
  white-space: nowrap;
}

.pg-panel__name strong { font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .pg-panel__img { transition: none; }
  .pg-panel__link:hover .pg-panel__img { transform: none; }
}

/* — Capítulos — */
.pg-chapter {
  --pg-wall: var(--photo-pearl);
  --pg-name: var(--refine-ink);
  --pg-dot: var(--refine-ink);
  --pg-cta: var(--refine-ink);
  display: grid;
  grid-template-areas: "head" "media" "pass";
  background: var(--pg-wall);
}

.pg-chapter[data-program="lean-form"] { --pg-wall: #D3CEC5; --pg-name: var(--lean-form); --pg-dot: var(--lean-form); --pg-cta: var(--lean-form); }
/* Each pass's button in its program's color (Fran, 2026-11-11, only on /programas/). Tone's pink and Run's light blue
   take ink text: cream on them is 1.8:1 and 1.9:1, ink is 8.6:1 and 8.2:1. Lean's maroon keeps cream (15.5:1). */
.pg-chapter[data-program="tone-flow"] { --pg-wall: #E2DED7; --pg-dot: var(--tone-flow); --pg-cta: var(--tone-flow); --pg-cta-text: var(--refine-ink); }
.pg-chapter[data-program="run-shape"] { --pg-wall: #CCC8BF; --pg-dot: var(--run-shape); --pg-cta: var(--run-shape); --pg-cta-text: var(--refine-ink); }

.pg-chapter__media {
  grid-area: media;
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.pg-chapter__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
}

/* The square crop of a landscape photo: each one framed so Julie is whole (Lean's foot and Tone's raised foot
   reach the right edge). */
.pg-chapter[data-program="lean-form"] .pg-chapter__img { object-position: 96% 50%; }
.pg-chapter[data-program="tone-flow"] .pg-chapter__img { object-position: 86% 50%; }
.pg-chapter[data-program="run-shape"] .pg-chapter__img { object-position: 70% 50%; }

.pg-chapter__content { display: contents; }

.pg-chapter__head {
  grid-area: head;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(var(--header-top) + var(--header-h) + 24px) var(--gutter) 28px;
}

/* One line, like the landings' hero name (Fran, 2026-11-11: two lines at 164px were too big, about 56px too small). */
.pg-chapter__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(clamp(56px, 8vw, 132px) * var(--type-display));
  line-height: 1;
  letter-spacing: var(--track-program);
  word-spacing: var(--word-program);
  white-space: nowrap;
  color: var(--pg-name);
}

.pg-chapter__strong { font-weight: 700; }
.pg-chapter__light { font-weight: 300; }

/* — El pase — */
.pg-pass {
  grid-area: pass;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: -88px var(--gutter) 56px;
  padding: 22px;
}

/* Run's feet reach the bottom of its photo: the pass overlaps less there. */
.pg-chapter[data-program="run-shape"] .pg-pass { margin-block-start: -16px; }

.pg-pass__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  white-space: nowrap;
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--summer-ink-soft);
}

.pg-pass__name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--pg-name);
}

.pg-pass__dot {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--pg-dot);
}

.pg-pass__rows { margin: 0; }

.pg-pass__row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding-block: 10px;
  border-block-start: 1px solid var(--refine-beige);
}

.pg-pass__row:last-child { border-block-end: 1px solid var(--refine-beige); }

.pg-pass__row dt {
  padding-block-start: 3px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--summer-ink-soft);
}

.pg-pass__row dd { margin: 0; font-size: 16px; }

.pg-pass__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pg-pass__soon {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--summer-ink-soft);
}

/* The passes' buttons in their program's color (see .pg-chapter[data-program]); the test's stays ink. */
.pg-pass__cta,
.pg-test__cta {
  background: var(--pg-cta, var(--refine-ink));
  color: var(--pg-cta-text, var(--refine-cream));
}

/* The global focus ring is currentColor: cream text made it 1.1:1 on the glass card. Ink on the card is 14.4:1. */
.pg-pass__cta:focus-visible,
.pg-test__cta:focus-visible { outline-color: var(--refine-ink); }

.pg-pass__cta:hover,
.pg-pass__cta:focus-visible,
.pg-test__cta:hover,
.pg-test__cta:focus-visible { background: color-mix(in srgb, var(--pg-cta, var(--refine-ink)) 86%, #000); }

/* Run & Shape: one link per version */
.pg-versions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-versions__opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--admin-field-border, #8E857A);
  border-radius: 14px;
  color: var(--refine-ink);
  text-decoration: none;
  transition: background-color var(--dur-fast);
}

a.pg-versions__opt:hover { background: rgb(34 34 34 / 0.06); }
a.pg-versions__opt:focus-visible { outline: 2px solid var(--refine-ink); outline-offset: 2px; }

.pg-versions__label {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.pg-versions__note { font-size: 13px; color: var(--summer-ink-soft); }

/* — Comparación — */
.pg-compare {
  position: relative;
  overflow: hidden;
  background: var(--photo-pearl);
}

.pg-compare__media { position: absolute; inset: 0; margin: 0; }

.pg-compare__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pg-compare__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1200px;
  margin-inline: auto;
  padding: 72px var(--gutter);
}

.pg-compare__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 40px;
}

.pg-compare__title {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: calc(clamp(36px, 4.6vw, 68px) * var(--type-mid));
  line-height: 0.95;
  letter-spacing: var(--track-heading);
  word-spacing: var(--word-heading);
}

.pg-compare__title strong { font-style: italic; font-weight: 700; }
.pg-compare__note { max-width: 360px; margin: 0; }

/* Phones: the comparison turned around (one block per row, the three programs inside), never a table that
   scrolls sideways. From 768px, the table. */
.pg-compare__panel { display: none; }

.pg-compare__list { padding: 4px 20px 20px; }

.pg-cmp { padding-block: 18px; }
.pg-cmp + .pg-cmp { border-block-start: 1px solid var(--refine-beige); }

.pg-cmp__term {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--summer-ink-soft);
}

.pg-cmp__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-cmp__item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  font-size: 15px;
}

.pg-cmp__name,
.pg-table__name {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: var(--track-program);
  word-spacing: var(--word-program);
  white-space: nowrap;
}

.pg-cmp__name { font-size: 16px; }

.pg-cmp__name strong,
.pg-table__name strong { font-weight: 700; }

.pg-cmp__item[data-program="lean-form"] .pg-cmp__name,
.pg-table th[data-program="lean-form"] { color: var(--lean-form); }

/* The program's dot, as on the pass: all three, Lean too. */
.pg-cmp__name::after,
.pg-table__name::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-inline-start: 6px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--pg-dot, var(--refine-ink));
}

.pg-cmp__item[data-program="lean-form"],
.pg-table th[data-program="lean-form"] { --pg-dot: var(--lean-form); }

.pg-cmp__item[data-program="tone-flow"],
.pg-table th[data-program="tone-flow"] { --pg-dot: var(--tone-flow); }

.pg-cmp__item[data-program="run-shape"],
.pg-table th[data-program="run-shape"] { --pg-dot: var(--run-shape); }

.pg-cmp__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 16px 0 0;
  border-block-start: 1px solid var(--refine-beige);
  list-style: none;
}

.pg-cmp__links a,
.pg-table__links a {
  color: var(--refine-ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pg-cmp__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.pg-cmp__links a:hover,
.pg-table__links a:hover { text-decoration-thickness: 2px; }

.pg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  text-align: left;
}

.pg-table th,
.pg-table td {
  padding: 16px;
  vertical-align: top;
}

.pg-table thead td,
.pg-table tbody th { width: 16%; }

.pg-table tbody tr { border-block-start: 1px solid var(--refine-beige); }

@media (min-width: 768px) {
  .pg-compare__list { display: none; }
  .pg-compare__panel { display: block; overflow-x: auto; }
  .pg-compare__panel:focus-visible { outline: 2px solid var(--refine-ink); outline-offset: 3px; }
}

.pg-table thead th { padding-block: 22px; }

.pg-table__name { font-size: 22px; }
.pg-table__name::after { width: 10px; height: 10px; margin-inline-start: 8px; }

.pg-table tbody th {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--summer-ink-soft);
}

/* — Test — */
.pg-test {
  display: grid;
  grid-template-areas: "media" "card";
  background: var(--photo-brand-wall);
}

.pg-test__media {
  grid-area: media;
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.pg-test__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 80% 50%;
}

.pg-test__inner {
  grid-area: card;
  position: relative;
  z-index: 1;
  min-width: 0; /* a grid item: without it, a long title widened the card past the screen */
  margin: -64px var(--gutter) 56px;
}

.pg-test__card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 460px;
  padding: 24px;
}

.pg-test__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: calc(clamp(27px, 3vw, 44px) * var(--type-mid));
  line-height: 1.02;
  letter-spacing: var(--track-heading);
  word-spacing: var(--word-heading);
}

/* Two lines, the question and then «Hacé el test.», aligned right against the end of the question (Fran,
   2026-11-11): the title is as wide as its first line, and the second sits at its end. No `nowrap`: the question
   fits on one line from 320px (the 27px floor), and with WCAG 1.4.12 text spacing it may wrap instead of pushing
   the card off the screen. */
.pg-test__title {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 100%;
}
.pg-test__title strong { align-self: flex-end; font-style: italic; font-weight: 700; }
.pg-test__text { margin: 0; color: var(--summer-ink-soft); }
.pg-test__cta { align-self: flex-start; }

/* — Tablet: the pass and the cover's blocks keep a readable width — */
@media (min-width: 600px) and (max-width: 1023.98px) {
  .pg-pass { max-width: 560px; }

  /* The strips are wide enough for the name to read straight, as on desktop. */
  .pg-panel__text {
    left: 20px;
    right: 20px;
    bottom: 28px;
    flex-direction: column;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .pg-panel__name { font-size: calc(clamp(36px, 5.6vw, 52px) * var(--type-mid)); line-height: 0.86; white-space: normal; }
}

/* — Desktop: the photo behind, everything else on top — */
@media (min-width: 1024px) {
  .pg-chapter,
  .pg-test {
    position: relative;
    display: flex;
    overflow: hidden;
  }

  .pg-chapter { min-height: max(100svh, 820px); }
  .pg-test { min-height: max(100svh, 760px); }

  .pg-chapter__media,
  .pg-test__media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
  }

  .pg-test__img { object-position: 78% 40%; }

  /* The triptych at full height: the panels fill the section, the title runs across their light top. */
  .pg-hero { display: block; min-height: max(100svh, 760px); }

  .pg-hero__head {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    padding-block-start: calc(var(--header-top) + var(--header-h) + 16px);
    pointer-events: none;
  }

  /* Up high and one line: Tone's raised foot starts right under it. */
  .pg-hero__br { display: none; }

  .pg-hero__title {
    text-align: center;
    white-space: nowrap;
    font-size: calc(clamp(60px, 7.2vw, 116px) * var(--type-display));
  }

  .pg-hero__panels {
    position: absolute;
    inset: 0;
    height: auto;
    gap: 6px;
  }

  /* The title runs over the photos here: cream on the dark top veil, as the Home's «Three ways to refine». */
  .pg-hero__head { color: var(--text-on-photo); }
  .pg-hero__head .pg-meta { color: inherit; }

  /* The top veil reaches past the title (Fran, 2026-11-12): at 0.44 → 0 by 34 % the cream title measured 1.9:1 and
     the 12 px metas 2.7:1 over the light walls; this one gives 3.8:1 and 4.8:1 at 1440 px (AA: 3 and 4.5). */
  .pg-panel__link::before {
    background:
      linear-gradient(180deg, rgb(34 34 34 / 0.62) 0%, rgb(34 34 34 / 0.5) 20%, rgb(34 34 34 / 0) 42%),
      linear-gradient(180deg, rgb(34 34 34 / 0) 56%, rgb(34 34 34 / 0.68) 100%),
      rgb(34 34 34 / 0.12);
  }

  .pg-panel__text {
    left: clamp(24px, 2.5vw, 40px);
    right: clamp(24px, 2.5vw, 40px);
    bottom: clamp(32px, 4vw, 48px);
    flex-direction: column;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .pg-panel__meta { display: block; }
  .pg-panel__name { font-size: calc(clamp(48px, 4.4vw, 72px) * var(--type-mid)); line-height: 0.86; }

  /* Light veils, only on the text's side: the photo stays as it is where Julie is. */
  .pg-chapter::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .pg-chapter::after {
    background: linear-gradient(90deg, rgb(246 243 238 / 0.66) 0%, rgb(246 243 238 / 0.3) 42%, rgb(246 243 238 / 0) 64%);
  }

  /* Run's photo has the blurred trail on the left, where the text goes. */
  .pg-chapter[data-program="run-shape"]::after {
    background: linear-gradient(90deg, rgb(246 243 238 / 0.72) 0%, rgb(246 243 238 / 0.38) 42%, rgb(246 243 238 / 0) 64%);
  }

  .pg-chapter__content {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* the name sits on top of the pass, not at the top of the screen (Fran, 2026-11-11) */
  }

  /* The fixed header covers the top of each chapter when it reaches the top of the screen. */
  .pg-chapter__content {
    gap: 40px;
    padding: calc(var(--header-top) + var(--header-h) + clamp(24px, 3vw, 48px)) var(--gutter) clamp(56px, 5vw, 96px);
  }

  .pg-chapter[data-program] .pg-chapter__img { object-position: var(--focus, 50% 50%); }

  /* The text column only: the facts line used to run over Run's Julie. */
  .pg-chapter__head { max-width: min(100%, 720px); padding: 0; }

  .pg-pass,
  .pg-chapter[data-program="run-shape"] .pg-pass {
    max-width: 460px;
    margin: 0;
    padding: clamp(24px, 2.2vw, 32px);
  }

  .pg-compare__inner { gap: 32px; padding-block: clamp(80px, 8vw, 128px); }

  .pg-table th,
  .pg-table td { padding: 18px 24px; }

  /* The card on the empty wall on the left; Julie sits on the right (the test's own framing). */
  .pg-test__inner {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin: 0;
    padding: calc(var(--header-top) + var(--header-h) + clamp(24px, 3vw, 48px)) var(--gutter) clamp(56px, 5vw, 96px);
  }

  .pg-test__card { padding: clamp(28px, 2.6vw, 36px); }
}
