/* Same brand, two metros (site/snippets/blocks/twometros.php, the Regional
   tier page's signature demo; public/assets/js/twometros.js). A sample
   brand's site in a browser frame, with a two-way switch and a key beside
   it. Linked by the block itself (peanut_page_css), once per page. Every
   selector names a twometros class. Tokens only. The shared hint, progress
   bar and sample controls are industry.css's (linked on any page with a
   demo- class). The family look (frame, bar, Sample label, brand bar, faces,
   chips, ink footer) follows picklocation.css. */

@layer blocks {
  .twometros__head {
    max-width: 44rem;
    margin-block-end: var(--space-5);
  }

  .twometros__title {
    margin: 0;
  }

  .twometros__intro {
    margin: var(--space-3) 0 0;
  }

  /* the h3 over the demo, its paragraph, and the line under the demo */
  .twometros__over {
    max-width: 44rem;
    margin-block-end: var(--space-4);
  }

  .twometros__subtitle {
    margin: 0;
  }

  .twometros__subtext {
    margin: var(--space-2) 0 0;
  }

  .twometros__after {
    max-width: 44rem;
    margin: var(--space-4) 0 0;
  }

  /* ---------- the stage: under 64rem the controls, the frame, then the key;
     from 64rem the side (controls and key) on the left, the frame on the right ---------- */
  .twometros__demo {
    display: grid;
    grid-template-areas: "controls" "frame" "key";
    gap: var(--space-4);
    align-items: start;
  }

  .twometros__side {
    display: contents;
  }

  .twometros__controls {
    grid-area: controls;
    display: grid;
    gap: var(--space-2);
    max-width: 26rem;
  }

  .twometros__frame {
    grid-area: frame;
  }

  .twometros__key {
    grid-area: key;
  }

  @media (min-width: 64rem) {
    .twometros__demo {
      grid-template-areas: "side frame";
      grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
      gap: var(--space-5);
    }

    .twometros__side {
      display: grid;
      grid-area: side;
      gap: var(--space-4);
      align-content: start;
      padding-block-start: var(--space-3);
    }

    .twometros__controls,
    .twometros__key {
      grid-area: auto;
    }
  }

  /* ---------- the switch: two buttons on one pill track, a thumb behind the pressed one ---------- */
  .twometros__switch {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.25rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .twometros__switch[hidden] {
    display: none;
  }

  .twometros__switch::before {
    content: "";
    position: absolute;
    inset-block: 0.25rem;
    inset-inline-start: 0.25rem;
    width: calc(50% - 0.25rem);
    background: var(--color-brand);
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .twometros__switch[data-at="1"]::before {
    transform: translateX(100%);
  }

  .twometros__pick {
    position: relative;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--color-ink);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
  }

  .twometros__pick[aria-pressed="true"] {
    font-weight: 600;
  }

  .twometros__pick[aria-pressed="false"]:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

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

  /* ---------- the hub drawing (Hub drawing on): the tier diagrams' look
     (diagrams/regional.php): 1.5px ink lines at 0.55, dashed boundaries at
     0.4, ink-outlined circles. One website at the top, a fork down to the
     two hubs, each hub a button (a plain label without the script) with its
     cities as dots under it. The lines are pseudo-elements, so they carry
     their own opacity and nothing of them is read out. ---------- */
  .twometros__map {
    display: grid;
    justify-items: center;
    padding-block: var(--space-1);
    font-size: 0.75rem;
    line-height: 1.4;
  }

  .twometros__maptop {
    display: grid;
    gap: 0.375rem;
    justify-items: center;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: var(--weight-strong);
    letter-spacing: 0.02em;
    text-align: center;
  }

  .twometros__mapsite {
    width: 1.5rem;
    height: 1.5rem;
    background: var(--color-brand);
    border: 1.5px solid var(--color-ink);
    border-radius: 50%;
  }

  /* the stem down from the website and the bar across to both hubs; its
     ends sit over the two boundaries' centers */
  .twometros__fork {
    position: relative;
    display: block;
    justify-self: stretch;
    height: 1.75rem;
    margin-inline: calc((100% - var(--space-2)) / 4);
  }

  .twometros__fork::before,
  .twometros__fork::after,
  .twometros__maparea::after,
  .twometros__mapcities::before,
  .twometros__mapcities::after,
  .twometros__mapcity::before {
    content: "";
    position: absolute;
    opacity: 0.55;
    pointer-events: none;
  }

  .twometros__fork::before {
    inset-block: 0 50%;
    inset-inline-start: calc(50% - 0.75px);
    border-inline-start: 1.5px solid var(--color-ink);
  }

  .twometros__fork::after {
    inset-block: 50% 0;
    inset-inline: -0.75px;
    border: 1.5px solid var(--color-ink);
    border-block-end: 0;
  }

  .twometros__mapareas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    justify-self: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* one metro: its own dashed boundary, and no line to the other */
  .twometros__maparea {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: 1rem 0.5rem 0.75rem;
    text-align: center;
  }

  .twometros__maparea::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1.5px dashed var(--color-ink);
    border-radius: var(--radius-sm);
    opacity: 0.4;
    pointer-events: none;
  }

  .twometros__maparea::after {
    inset-block-start: 0;
    block-size: 1rem;
    inset-inline-start: calc(50% - 0.75px);
    border-inline-start: 1.5px solid var(--color-ink);
  }

  .twometros__maphub {
    position: relative;
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.5rem 0.875rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    color: var(--color-ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
  }

  .twometros__maphub[hidden] {
    display: none;
  }

  button.twometros__maphub {
    cursor: pointer;
  }

  /* without the script: a plain label, no outline, so it never looks pressable */
  .twometros__maphub--label {
    background: none;
    border-color: transparent;
  }

  .twometros__maphub[aria-pressed="true"] {
    background: var(--color-brand);
    font-weight: 600;
  }

  .twometros__maphub[aria-pressed="false"]:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }

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

  .twometros__hubmark {
    flex: none;
    width: 0.875rem;
    height: 0.875rem;
    background: var(--accent-mark, var(--accent));
    border: 1.5px solid var(--color-ink);
    border-radius: 50%;
  }

  /* the hub's cities: a stem down, a bar across, a drop to each dot */
  .twometros__mapcities {
    position: relative;
    display: flex;
    gap: 0.5rem;
    padding-block-start: 0.625rem;
  }

  .twometros__mapcities::before {
    inset-block-start: 0;
    block-size: 0.625rem;
    inset-inline-start: calc(50% - 0.75px);
    border-inline-start: 1.5px solid var(--color-ink);
  }

  .twometros__mapcities::after {
    inset-block-start: 0.625rem;
    inset-inline: 0.4375rem;
    border-block-start: 1.5px solid var(--color-ink);
  }

  .twometros__mapcity {
    position: relative;
    flex: none;
    box-sizing: border-box;
    width: 0.875rem;
    height: 0.875rem;
    margin-block-start: 0.625rem;
    background: var(--color-brand);
    border: 1.5px solid var(--color-ink);
    border-radius: 50%;
  }

  .twometros__mapcity:nth-child(even) {
    background: var(--color-gold-soft);
  }

  .twometros__mapcity::before {
    inset-block-end: 100%;
    block-size: 0.625rem;
    inset-inline-start: calc(50% - 0.75px);
    border-inline-start: 1.5px solid var(--color-ink);
  }

  .twometros__mapunder {
    margin-block-start: 0.375rem;
    font-weight: 500;
  }

  /* ---------- the key: what stays, what changes ---------- */
  .twometros__key {
    display: grid;
    gap: var(--space-3);
  }

  @media (min-width: 40rem) and (max-width: 63.99rem) {
    .twometros__key {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  .twometros__keytitle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0 0 0.5rem;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .twometros__swatch {
    flex: none;
    width: 1rem;
    height: 1rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: 0.25rem;
  }

  .twometros__keyset--changes .twometros__swatch {
    background: var(--color-mint-pale);
  }

  .twometros__keylist {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    font-size: var(--step--1);
    list-style: none;
  }

  .twometros__keylist li {
    padding-inline-start: 1.5rem;
  }

  /* ---------- the sample site ---------- */
  .twometros__frame {
    container-type: inline-size;
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-size: var(--step--1);
    line-height: 1.45;
  }

  .twometros__bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem var(--space-2);
    background: var(--color-paper);
    border-block-end: var(--border);
    font-size: 0.75rem;
  }

  .twometros__dots {
    flex: none;
    width: 0.4375rem;
    height: 0.4375rem;
    margin-inline-end: 1.75rem;
    background: var(--color-ink);
    border-radius: 50%;
    box-shadow: 0.75rem 0 0 var(--color-ink), 1.5rem 0 0 var(--color-ink);
    opacity: 0.35;
  }

  .twometros__url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 0.125rem 0.625rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* "Sample": the demo standard's label, in the bar, in every state */
  .twometros__sample {
    flex: none;
    padding: 0.0625rem 0.5rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  /* the brand's header: the same in both metros */
  .twometros__brandbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem var(--space-3);
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--color-white);
    border-block-end: var(--border);
  }

  .twometros__brand {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: 1.2;
  }

  .twometros__logo {
    display: grid;
    flex: none;
    place-items: center;
    width: 2rem;
    height: 2rem;
    background: var(--color-ink);
    border: var(--border);
    border-radius: 50%;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
  }

  :is(.twometros__brandmenu, .twometros__footmenu) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .twometros__brandmenu {
    font-size: 0.75rem;
    font-weight: 500;
  }

  /* ---------- one metro's hub: the light mint part that changes ---------- */
  .twometros__hub {
    background: var(--color-mint-pale);
  }

  .twometros__hub + .twometros__hub {
    border-block-start: var(--border);
  }

  .twometros__demo.is-live .twometros__hub + .twometros__hub {
    border-block-start: 0;
  }

  .twometros__demo.is-live .twometros__hubs {
    display: grid;
  }

  .twometros__demo.is-live .twometros__hub {
    grid-area: 1 / 1;
  }

  .twometros__demo.is-live .twometros__hub[data-off] {
    visibility: hidden;
  }

  .twometros__hubbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem var(--space-3);
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem var(--space-3);
    border-block-end: 1px solid var(--color-ink-line-faint);
  }

  .twometros__hubname {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  .twometros__mark,
  .twometros__noicon {
    flex: none;
  }

  .twometros__phone {
    margin: 0;
    font-weight: 500;
  }

  .twometros__body {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-3);
  }

  @container (min-width: 34rem) {
    .twometros__body {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .twometros__lead,
    .twometros__ask,
    .twometros__cta {
      grid-column: 1 / -1;
    }
  }

  .twometros__heading {
    margin: 0 0 0.375rem;
    font-family: var(--font-heading);
    font-size: var(--step-3);
    font-weight: var(--weight-heading);
    line-height: 1.15;
  }

  .twometros__opening {
    max-width: 36rem;
    margin: 0;
    font-size: var(--step-0);
  }

  .twometros__label {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .twometros__areas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .twometros__areas li {
    padding: 0.25rem 0.75rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
  }

  /* what never crosses over: a dashed note under the hub's cities */
  .twometros__note {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin: var(--space-2) 0 0;
    padding: 0.5rem 0.75rem;
    background: var(--color-butter);
    border: 1px dashed var(--color-ink);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.45;
  }

  .twometros__noicon {
    margin-block-start: 0.0625rem;
  }

  .twometros__team {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .twometros__person {
    display: flex;
    gap: 0.625rem;
    align-items: center;
  }

  .twometros__face {
    display: grid;
    flex: none;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .twometros__who {
    display: grid;
  }

  .twometros__pname {
    font-weight: 500;
  }

  /* the question families ask there: a white card */
  .twometros__ask {
    padding: var(--space-2) var(--space-3);
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .twometros__question {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: 1.3;
  }

  .twometros__answer {
    margin: 0.375rem 0 0;
  }

  .twometros__cta {
    margin: 0;
  }

  .twometros__btn {
    display: inline-block;
    padding: 0.75rem var(--space-3);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
  }

  /* the brand's footer: the same in both metros */
  .twometros__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem var(--space-3);
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--color-ink);
    color: var(--color-on-ink-text);
    font-size: 0.75rem;
  }

  .twometros__footbrand {
    margin: 0;
    font-family: var(--font-heading);
    font-size: var(--step-0);
    font-weight: var(--weight-heading);
    color: var(--color-white);
  }

  @media print {
    /* as specific as the live rule that hides it, and later, so it wins */
    .twometros__demo.is-live .twometros__hub[data-off] {
      visibility: visible;
    }

    .twometros__demo.is-live .twometros__hubs {
      display: block;
    }

    .twometros__switch {
      display: none;
    }

    /* the drawing's hubs print as plain labels: both metros stand */
    .twometros__maphub,
    .twometros__maphub[aria-pressed="true"] {
      background: none;
      border-color: transparent;
      font-weight: 500;
    }
  }
}

@layer motion {
  @media screen and (prefers-reduced-motion: no-preference) {
    html[data-fx~="diagrams"] .twometros__switch::before {
      transition: transform 300ms var(--ease-out);
    }

    html[data-fx~="diagrams"] button.twometros__maphub {
      transition: background-color 300ms var(--ease-out);
    }

    html[data-fx~="diagrams"] .twometros__demo.is-live .twometros__hub:not([data-off]) {
      animation: twometros-in 400ms var(--ease-out) both;
    }
  }

  @keyframes twometros-in {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }
}
