/**
 * Nonprofit page, final pass (2026-11-21): Everyone else who needs a door (visual p10x-doors). Loaded for its class prefix
 * (site/plugins/peanut-site/extensions/stylesheets.php); loads after ind-p10.css.
 *
 * One explorer: four door buttons (stacked beside the screen when there is
 * room, a wrapping row on phones), a progress bar while it plays, the
 * chosen door's explanation, and one sample screen in a browser frame that
 * changes with the door. The explanations share one cell, the screens
 * another, the addresses and the captions one each (the tallest sets the
 * height), so nothing moves when the script runs or a door changes. Under
 * it, the closing line as its own strip with a drawn subscribe field. The
 * HTML is the still (the first door). Tokens only. Layer blocks for the
 * static state, layer motion for what moves. Nothing loops.
 */

@layer blocks {
  /* the visual's own width decides the layout inside */
  .showcase__visual:has(> .p10x-doors) {
    min-width: 0;
    container: p10x-doors / inline-size;
  }

  .p10x-doors {
    display: grid;
    gap: var(--space-4);
    min-width: 0;
  }

  /* phones: the doors, the screen, then the explanation */
  .p10x-doors__explorer {
    display: grid;
    grid-template-areas: "pick" "screen" "texts";
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    align-items: start;
  }

  .p10x-doors__pick {
    display: grid;
    grid-area: pick;
    gap: 0.75rem;
    min-width: 0;
  }

  /* the hint is the shared one (snippets/demo/hint.php, industry.css); it
     keeps its space until the script makes the doors buttons */
  .p10x-doors:not(.is-live) .p10x-doors__hint {
    visibility: hidden;
  }

  /* phones: two by two, a label may take two lines */
  .p10x-doors__doors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .p10x-doors__doors > li {
    display: flex;
    min-width: 0;
  }

  .p10x-doors__door {
    display: inline-flex;
    gap: 0.625rem;
    align-items: center;
    width: 100%;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.375rem 0.875rem 0.375rem 0.375rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 1.4375rem;
    color: var(--color-ink);
    font: inherit;
    font-size: var(--step--1);
    font-weight: 500;
    line-height: 1.25;
    text-align: start;
  }

  button.p10x-doors__door {
    cursor: pointer;
  }

  /* chosen: the still (drawn) and the buttons once the script runs */
  .p10x-doors__door.is-chosen,
  .p10x-doors__door[aria-pressed="true"] {
    background: var(--color-brand);
  }

  .p10x-doors__door:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
  }

  .p10x-doors__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 2rem;
    height: 2rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 50%;
  }

  .p10x-doors__icon svg {
    width: 1.125rem;
    height: 1.125rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .p10x-doors__icon circle {
    fill: currentColor;
    stroke: none;
  }

  /* the progress while it plays: the shared bar (snippets/demo/progress.php,
     industry.css) */

  /* the explanations share one cell: the tallest sets the height */
  .p10x-doors__texts {
    display: grid;
    grid-area: texts;
    min-width: 0;
  }

  .p10x-doors__text {
    grid-area: 1 / 1;
    min-width: 0;
  }

  .p10x-doors__text[data-off] {
    visibility: hidden;
  }

  .p10x-doors__name {
    margin: 0 0 var(--space-1);
    font-size: var(--step-2);
  }

  .p10x-doors__say {
    margin: 0;
    max-width: var(--measure);
  }

  /* ---------- The sample screen: a picture, labelled Sample ---------- */

  .p10x-doors__screen {
    display: grid;
    grid-area: screen;
    gap: 0.75rem;
    min-width: 0;
    margin: 0;
  }

  .p10x-doors__frame {
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hard);
  }

  .p10x-doors__bar {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0.5rem 0.875rem;
    border-block-end: var(--border);
    font-size: 0.75rem;
  }

  /* three small dots, the browser frame's buttons */
  .p10x-doors__dots {
    flex: none;
    width: 0.375rem;
    height: 0.375rem;
    margin-inline-end: 1.25rem;
    background: var(--color-ink);
    border-radius: 50%;
    box-shadow: 0.625rem 0 0 var(--color-ink), 1.25rem 0 0 var(--color-ink);
    opacity: 0.45;
  }

  .p10x-doors__tag,
  .p10x-doors__fast {
    flex: none;
    padding: 0.0625rem 0.5rem;
    background: var(--color-brand);
    border-radius: var(--radius-pill);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .p10x-doors__urls,
  .p10x-doors__caps-row {
    display: grid;
    min-width: 0;
  }

  .p10x-doors__urls {
    flex: 1 1 auto;
  }

  .p10x-doors__url,
  .p10x-doors__cap {
    grid-area: 1 / 1;
    min-width: 0;
  }

  .p10x-doors__url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .p10x-doors__url[data-off],
  .p10x-doors__cap[data-off],
  .p10x-doors__panel[data-off] {
    visibility: hidden;
  }

  .p10x-doors__caps-row {
    font-size: 0.75rem;
  }

  /* the sample site's own header: a name, the menu, Donate on every page */
  .p10x-doors__site {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.625rem 0.875rem;
    border-block-end: var(--border);
    font-size: 0.75rem;
    font-weight: 600;
  }

  .p10x-doors__brand {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;
  }

  .p10x-doors__mark {
    width: 1rem;
    height: 1rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: 50%;
  }

  .p10x-doors__nav {
    display: flex;
    flex: 1 1 auto;
    gap: 0.5rem;
    justify-content: flex-end;
    min-width: 0;
    overflow: hidden;
  }

  .p10x-doors__nav > span {
    flex: 0 1 2.25rem;
    height: 0.25rem;
    background: var(--color-ink-track);
    border-radius: var(--radius-pill);
  }

  .p10x-doors__donate {
    flex: none;
    padding: 0.25rem 0.75rem;
    background: var(--color-accent-2);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.625rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  /* the four screens share one cell: the tallest sets the height */
  .p10x-doors__panels {
    display: grid;
  }

  .p10x-doors__panel {
    position: relative;
    display: grid;
    grid-area: 1 / 1;
    gap: 0.75rem;
    align-content: start;
    min-width: 0;
    padding: var(--space-3);
  }

  .p10x-doors__panel p {
    margin: 0;
  }

  .p10x-doors__caps {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .p10x-doors__h {
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: var(--weight-heading);
    line-height: 1.15;
  }

  .p10x-doors__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .p10x-doors__chip {
    padding: 0.375rem 0.875rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
  }

  .p10x-doors__chip.is-picked {
    background: var(--color-brand);
  }

  .p10x-doors__field {
    padding: 0.5rem 0.75rem;
    border: var(--border);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
  }

  .p10x-doors__key {
    display: block;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  /* the sample site's drawn button: a picture, not a control */
  .p10x-doors__btn {
    display: inline-block;
    padding: 0.4375rem 0.875rem;
    background: var(--color-ink);
    border-radius: var(--radius-pill);
    color: var(--color-white);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  /* Get help: a load bar already full, the list of links */
  .p10x-doors__load {
    position: absolute;
    inset: 0 0 auto;
    height: 0.1875rem;
    background: var(--color-brand);
    transform-origin: left;
  }

  .p10x-doors__head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    justify-content: space-between;
  }

  .p10x-doors__fast {
    border: var(--border);
  }

  .p10x-doors__links,
  .p10x-doors__tiles {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .p10x-doors__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
  }

  .p10x-doors__link:nth-child(odd) {
    background: var(--color-butter);
  }

  /* a small drawn arrow */
  .p10x-doors__arrow {
    flex: none;
    width: 0.4375rem;
    height: 0.4375rem;
    margin-inline: 0.5rem 0.125rem;
    border-block-start: 1.5px solid currentColor;
    border-inline-end: 1.5px solid currentColor;
    rotate: 45deg;
  }

  /* Both languages: the switch on Español, the name in both */
  .p10x-doors__switch {
    display: inline-flex;
    padding: 0.125rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.08em;
  }

  .p10x-doors__switch > span {
    padding: 0.1875rem 0.625rem;
    border-radius: var(--radius-pill);
  }

  .p10x-doors__switch > .is-on {
    background: var(--color-brand);
  }

  .p10x-doors__es {
    padding: 0.5rem 0.75rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: 0.5rem;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: 1.2;
  }

  .p10x-doors__pair {
    display: grid;
    gap: 0.25rem;
    font-size: 0.8125rem;
  }

  /* Partners: a tile per school, a logo, a name line and its page */
  .p10x-doors__tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .p10x-doors__tile {
    display: grid;
    gap: 0.5rem;
    justify-items: start;
    min-width: 0;
    padding: 0.5rem;
    border: var(--border);
    border-radius: 0.625rem;
  }

  .p10x-doors__logo {
    width: 2rem;
    height: 2rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 0.5rem;
  }

  .p10x-doors__logo--mint {
    background: var(--color-brand);
  }

  .p10x-doors__logo--butter {
    background: var(--color-butter);
  }

  .p10x-doors__line {
    width: 70%;
    height: 0.3125rem;
    background: var(--color-ink-track);
    border-radius: var(--radius-pill);
  }

  .p10x-doors__more {
    display: inline-flex;
    align-items: center;
    font-size: 0.625rem;
    white-space: nowrap;
    font-weight: 500;
  }

  /* ---------- Without the script: the other explanations as text ---------- */

  .p10x-doors__rest {
    display: grid;
    gap: var(--space-3) var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* ---------- News, photos and a list: the closing strip ---------- */

  .p10x-doors__news {
    display: grid;
    gap: var(--space-2) var(--space-4);
    align-items: center;
    padding: var(--space-3);
    background: var(--color-butter);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .p10x-doors__newstext {
    margin: 0;
    max-width: var(--measure);
  }

  .p10x-doors__subscribe {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    min-width: 0;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1;
  }

  .p10x-doors__email {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.625rem 1rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .p10x-doors__join {
    flex: none;
    padding: 0.625rem 1rem;
    background: var(--color-ink);
    border-radius: var(--radius-pill);
    color: var(--color-white);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  /* a wider screen: the four doors on one line, roomier tiles */
  @container p10x-doors (min-width: 34rem) {
    .p10x-doors__doors {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .p10x-doors__tile {
      padding: 0.75rem;
    }

    .p10x-doors__more {
      font-size: 0.6875rem;
    }
  }

  /* room for both: the doors and the explanation beside the screen */
  @container p10x-doors (min-width: 46rem) {
    .p10x-doors__explorer {
      grid-template-areas: "pick screen" "texts screen";
      grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
      grid-template-rows: auto 1fr;
      gap: var(--space-4) var(--space-5);
    }

    .p10x-doors__doors {
      grid-template-columns: minmax(0, 1fr);
    }

    .p10x-doors__texts {
      padding-block-start: var(--space-3);
      border-block-start: var(--border);
    }

    .p10x-doors__rest {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .p10x-doors__news {
      grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
      padding: var(--space-4);
    }
  }

  @container p10x-doors (min-width: 62rem) {
    .p10x-doors__explorer {
      grid-template-columns: minmax(0, 21rem) minmax(0, 1fr);
      gap: var(--space-4) var(--space-6);
    }

    .p10x-doors__panel {
      padding: var(--space-4);
    }
  }

  /* Print: every explanation, the screen as it stands, no hint or bar (the
     shared ones go in print, industry.css) */
  @media print {
    .p10x-doors__frame {
      box-shadow: none;
    }

    .p10x-doors__texts {
      gap: var(--space-2);
    }

    .p10x-doors__text {
      grid-area: auto;
    }

    .p10x-doors__text[data-off] {
      visibility: visible;
    }

    .p10x-doors__frame,
    .p10x-doors__text {
      break-inside: avoid;
    }
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    .p10x-doors.is-live .p10x-doors__door {
      transition: background-color 250ms var(--ease-out), scale 200ms var(--ease-out);
    }

    /* the auto-play's tap: a short press on the door before it opens */
    .p10x-doors__door.is-tapped {
      scale: 0.95;
    }

    .p10x-doors.is-live .p10x-doors__text {
      transition: opacity 350ms var(--ease-out), visibility 0s;
    }

    .p10x-doors.is-live .p10x-doors__text[data-off] {
      opacity: 0;
      transition: opacity 150ms var(--ease-out), visibility 0s 150ms;
    }

    /* a chosen door: its screen's parts come in one after another */
    .p10x-doors__panel.is-drawing > p,
    .p10x-doors__panel.is-drawing > ul > li {
      animation: p10x-rise 420ms var(--ease-out) both;
      animation-delay: calc(var(--i, 0) * 90ms);
    }

    .p10x-doors__panel.is-drawing > .p10x-doors__load {
      animation: p10x-load 500ms var(--ease-out) both;
    }

    .p10x-doors__panel.is-drawing .p10x-doors__chip.is-picked,
    .p10x-doors__panel.is-drawing .p10x-doors__switch > .is-on {
      animation: p10x-pick 400ms var(--ease-out) 700ms both;
    }

    @keyframes p10x-rise {
      from {
        opacity: 0;
        translate: 0 0.5rem;
      }
    }

    @keyframes p10x-load {
      from {
        transform: scaleX(0);
      }
    }

    @keyframes p10x-pick {
      from {
        background-color: var(--color-white);
      }
    }
  }
}
