/* Industry doors (site/snippets/blocks/industrydoors.php, the Custom websites
   hub). The groups' layout and type are the Industry groups block's
   (home.css, classes indgroup*); this file draws the industries. Linked by
   the block itself (peanut_page_css), once per page. Every selector names an
   industrydoors class. Tokens only.

   One version (the owner chose version a, final home pass, 2026-11-30; the
   ?doors switch, version b and the old thumbnail rows are gone):
   - From 40rem: each industry a photo card (one link, 1px ink outline, the
     cards' corners, white), its hero photo on top at 3:2 with a 1px line
     under it, then the name, the line and the arrow at the foot, so a row's
     arrows line up. Equal heights in every row.
   - Phones: a compact row with the drawn icon in a mint tile, no photo.
   - Balanced rows: each list carries its count (industrydoors__items--n1 to
     --n6). Two: two across. Three: three across. Four: two by two on a
     tablet, four across on a computer. Five: three, then two centered (a
     six-column grid, each card two columns). Six: three by two. From 980px
     a group of three or more takes the full width (industrydoors__group--wide)
     and groups of one or two sit side by side, two by two.
   - Hover and keyboard focus: the study tiles' lift (the brand shadow
     --shadow-hard, a 4px rise up and left), the shadow alone under reduced
     motion, the movement only where hover exists; the name underlines and
     the arrow moves 4px. The phone rows have no outline, so no lift there.
   - The industry switch: ind-early.js sets <html data-ind> before the first
     paint; the card whose data-door matches turns mint, its tile white with
     a mint drawing (--tile-bg, --tile-fill). */

@layer blocks {
  .industrydoors__card {
    position: relative;
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    border-radius: var(--radius-sm);
    background: var(--color-white);
    color: var(--color-ink);
    text-decoration: none;
  }

  a.industrydoors__card:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
  }

  a.industrydoors__card:is(:hover, :focus-visible) .indgroup__name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
  }

  .industrydoors__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
  }

  .industrydoors__card .indgroup__name {
    margin-block-start: 0;
  }

  .industrydoors__body .indgroup__text {
    flex-grow: 1;
  }

  /* the photo: 3:2, the photo's Focus as its centre, a cream panel while empty */
  .industrydoors__photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 3 / 2;
    border-block-end: var(--border);
    background: var(--color-paper);
  }

  .industrydoors__photo picture {
    display: block;
    width: 100%;
    height: 100%;
  }

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

  /* the drawn icon in a mint tile (the Industry groups block's drawings): phones only */
  .industrydoors__tile {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: var(--border);
    border-radius: var(--radius-sm);
    background: var(--tile-bg, var(--color-brand));
  }

  .industrydoors__tile svg {
    display: block;
    width: 70%;
    height: 70%;
  }

  .industrydoors__tile .ic-fill {
    fill: var(--tile-fill, var(--color-white));
  }

  .industrydoors__tile .ic-line {
    fill: none;
    stroke: var(--color-ink);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .industrydoors__tile .ic-dash {
    stroke-dasharray: 2 3;
  }

  /* ---------- From 40rem: photo cards in balanced rows ---------- */

  @media (min-width: 40rem) {
    .indgroups.industrydoors .industrydoors__items {
      grid-auto-rows: 1fr;
      gap: var(--space-3);
    }

    /* two half-width groups side by side: each group fills the row, so their
       cards end at the same line (owner, 2026-11-30: equal heights) */
    .indgroups.industrydoors .indgroup {
      display: flex;
      flex-direction: column;
    }

    .indgroups.industrydoors .indgroup > .industrydoors__items {
      flex: 1 1 auto;
    }

    .industrydoors .industrydoors__items > li {
      display: flex;
      flex-direction: column;
    }

    .industrydoors__card {
      overflow: hidden;
      border: var(--border);
    }

    .industrydoors__tile {
      display: none;
    }

    .industrydoors__body {
      padding: var(--space-3);
    }

    a.industrydoors__card:focus-visible {
      box-shadow: var(--shadow-hard);
    }

    .indgroups.industrydoors .industrydoors__items--n1 {
      grid-template-columns: minmax(0, 1fr);
    }

    .indgroups.industrydoors :is(.industrydoors__items--n2, .industrydoors__items--n4) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .indgroups.industrydoors :is(.industrydoors__items--n3, .industrydoors__items--n6) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* five: three, then two centered */
    .indgroups.industrydoors .industrydoors__items--n5 {
      grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .industrydoors .industrydoors__items--n5 > li {
      grid-column: span 2;
    }

    .industrydoors .industrydoors__items--n5 > li:nth-child(4) {
      grid-column: 2 / span 2;
    }

    .industrydoors .industrydoors__items--n5 > li:nth-child(5) {
      grid-column: 4 / span 2;
    }
  }

  @media (min-width: 40rem) and (hover: hover) {
    a.industrydoors__card:hover {
      box-shadow: var(--shadow-hard);
    }
  }

  /* From 980px: a group of three or more across the full width, four in one row */
  @media (min-width: 61.25rem) {
    .indgroups.industrydoors .industrydoors__group--wide {
      grid-column: 1 / -1;
    }

    .indgroups.industrydoors .industrydoors__items--n4 {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  /* ---------- Phones: the compact row ---------- */

  @media (max-width: 39.9375rem) {
    .industrydoors__card {
      display: grid;
      grid-template-columns: 3rem minmax(0, 1fr) auto;
      align-items: start;
      column-gap: var(--space-2);
      padding: var(--space-1);
      background: transparent;
    }

    .industrydoors__photo {
      display: none;
    }

    .industrydoors__body {
      display: contents;
    }

    .industrydoors__tile {
      grid-column: 1;
      grid-row: 1 / 3;
      margin: 0;
    }

    .industrydoors .indgroup__name {
      grid-column: 2;
      grid-row: 1;
    }

    .industrydoors .indgroup__text {
      grid-column: 2;
      grid-row: 2;
    }

    .industrydoors .indgroup__more {
      grid-column: 3;
      grid-row: 1 / 3;
      align-self: center;
      margin: 0;
    }

    .industrydoors .indgroup__aside {
      margin-inline-start: 4rem;
    }
  }

  /* ---------- The industry switch: the matching card in mint ---------- */

  html[data-ind="nanny-agency"] .industrydoors__card[data-door="nanny-agency"],
  html[data-ind="household-staffing"] .industrydoors__card[data-door="household-staffing"],
  html[data-ind="childcare-center"] .industrydoors__card[data-door="childcare-center"],
  html[data-ind="play-cafe"] .industrydoors__card[data-door="play-cafe"],
  html[data-ind="therapist"] .industrydoors__card[data-door="therapist"],
  html[data-ind="doula"] .industrydoors__card[data-door="doula"],
  html[data-ind="midwife"] .industrydoors__card[data-door="midwife"],
  html[data-ind="healthcare-practice"] .industrydoors__card[data-door="healthcare-practice"],
  html[data-ind="med-spa"] .industrydoors__card[data-door="med-spa"],
  html[data-ind="holistic-wellness"] .industrydoors__card[data-door="holistic-wellness"],
  html[data-ind="coach"] .industrydoors__card[data-door="coach"],
  html[data-ind="nonprofit"] .industrydoors__card[data-door="nonprofit"],
  html[data-ind="ecommerce"] .industrydoors__card[data-door="ecommerce"] {
    --tile-bg: var(--color-white);
    --tile-fill: var(--color-brand);
    background: var(--color-brand);
  }
}

@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .industrydoors__img {
      transition: transform var(--duration) ease;
    }

    a.industrydoors__card:is(:hover, :focus-visible) .indgroup__arrow {
      transform: translateX(4px);
    }
  }

  /* the lift from 40rem (the phone rows have no outline) */
  @media screen and (hover: hover) and (prefers-reduced-motion: no-preference) and (min-width: 40rem) {
    a.industrydoors__card {
      transition: transform var(--motion-base, 320ms) var(--ease-out, ease-out), box-shadow var(--motion-base, 320ms) var(--ease-out, ease-out);
    }

    a.industrydoors__card:is(:hover, :focus-visible) {
      transform: translate(-4px, -4px);
    }
  }
}
