/* Year calendar (site/snippets/blocks/yearcal.php, public/assets/js/yearcal.js;
   the Partnership page, final uplift 3.2), and the same page's dated client
   relationships (site/snippets/uplift/b/years.php, prefix yearcal-years).
   Linked by the snippets themselves (peanut_page_css). Every selector names
   a yearcal class. Tokens only.

   Without scripting (@media (scripting: none)) and in print: no months, key
   or hint, every stretch one under the other. With scripting the tappable
   layout is there from the first paint: the panels share one cell (the
   tallest sets the height; the server marks all but one data-off, visibility
   hidden) and the months keep their space, invisible until the script adds
   .is-live, so nothing moves when it starts and nothing is a dead control.
   - Months: six across on phones (two rows), twelve across from 48rem; each
     at least 44px tall, its stretch's color as a bar at its foot; the
     pressed month ink with white text, the rest of its stretch outlined.
   - Panel: the four lanes stacked on phones, two by two from 48rem, in one
     row from 64rem.
   - From 64rem (bulk fixes A1): the head and the closing line centered, the
     frame and the lanes under it the container's full width. */

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

  .yearcal__title {
    margin: 0;
  }

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

  /* ---------- the frame ---------- */
  .yearcal__demo {
    max-width: 68rem;
    padding: var(--space-3);
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
  }

  .yearcal__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin: 0 0 var(--space-3);
    font-size: var(--step--1);
    font-weight: 600;
    line-height: 1.4;
  }

  .yearcal__label {
    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 months (visible once the script runs) ---------- */
  .yearcal__demo:not(.is-live) .yearcal__nav {
    visibility: hidden;
  }

  .yearcal__nav {
    display: grid;
    gap: var(--space-2);
    margin-block-end: var(--space-4);
  }

  .yearcal__months {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.375rem;
  }

  .yearcal__month {
    display: grid;
    grid-template-rows: 1fr auto;
    justify-items: center;
    gap: 0.25rem;
    min-width: 0;
    min-height: 3.25rem;
    padding: 0.375rem 0.25rem 0.3125rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font: inherit;
    cursor: pointer;
  }

  .yearcal__num {
    align-self: center;
    font-family: var(--font-heading);
    font-weight: var(--weight-display);
    font-size: var(--step-2);
    line-height: 1;
  }

  .yearcal__bar {
    display: block;
    width: 100%;
    height: 0.5rem;
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .yearcal__month.is-near {
    background: var(--color-paper);
  }

  .yearcal__month[aria-pressed="true"] {
    background: var(--color-ink);
    color: var(--color-white);
  }

  .yearcal__month[aria-pressed="true"] .yearcal__bar {
    border-color: var(--color-white);
  }

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

  /* the stretches' colors: the month bars, the key and the panels' marks */
  .yearcal__month--build .yearcal__bar,
  .yearcal__swatch--build {
    background: var(--color-butter);
  }

  .yearcal__month--launch .yearcal__bar,
  .yearcal__swatch--launch {
    background: var(--color-accent-2);
  }

  .yearcal__month--monthly .yearcal__bar,
  .yearcal__swatch--monthly {
    background: var(--color-brand);
  }

  .yearcal__month--review .yearcal__bar,
  .yearcal__swatch--review {
    background: var(--color-gold-soft);
  }

  .yearcal__month--year .yearcal__bar,
  .yearcal__swatch--year {
    background: var(--color-ink);
  }

  .yearcal__month--year[aria-pressed="true"] .yearcal__bar {
    background: var(--color-white);
  }

  .yearcal__key {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--step--1);
    line-height: 1.4;
  }

  .yearcal__keyitem {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
  }

  .yearcal__swatch {
    display: inline-block;
    flex: none;
    width: 0.875rem;
    height: 0.875rem;
    border: var(--border);
    border-radius: 50%;
  }

  /* ---------- the panels: one cell, one shown ---------- */
  .yearcal__panels {
    display: grid;
  }

  .yearcal__panel {
    grid-area: 1 / 1;
  }

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

  /* without scripting: no months, every stretch one under the other */
  @media (scripting: none) {
    .yearcal__nav {
      display: none;
    }

    .yearcal__panels {
      display: block;
    }

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

    .yearcal__panel + .yearcal__panel {
      margin-block-start: var(--space-4);
      padding-block-start: var(--space-4);
      border-block-start: var(--border);
    }
  }

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

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

  .yearcal__rows {
    display: grid;
    gap: var(--space-2);
    margin: 0;
  }

  .yearcal__row {
    padding: var(--space-2) var(--space-3);
    background: var(--color-paper);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

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

  .yearcal__line {
    margin: 0;
    font-size: var(--text-body);
    line-height: var(--leading-body);
  }

  .yearcal__note {
    margin: var(--space-3) 0 0;
    padding-block-start: var(--space-3);
    border-block-start: var(--border);
    font-size: var(--step--1);
    line-height: 1.6;
  }

  /* ---------- the four lanes, under the frame ---------- */
  .yearcal__lanes {
    display: grid;
    gap: var(--space-4);
    max-width: 68rem;
    margin: var(--space-5) 0 0;
    padding: 0;
    list-style: none;
  }

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

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

  .yearcal__lanetext > * {
    margin: 0;
  }

  .yearcal__lanetext > * + * {
    margin-block-start: var(--space-2);
  }

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

  @media (min-width: 48rem) {
    .yearcal__demo {
      padding: var(--space-4);
    }

    .yearcal__months {
      grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .yearcal__rows {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .yearcal__lanes {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-5) var(--space-6);
    }
  }

  /* Desktop (bulk fixes A1, 2026-11-29): a single-column section, so the head
     is centered, the frame and the four lanes use the container's width, the
     panel's four lanes sit in one row, and the closing line is centered.
     Phones and tablets keep the layout above. */
  @media (min-width: 64rem) {
    .yearcal__head {
      margin-inline: auto;
      text-align: center;
    }

    .yearcal__demo {
      max-width: none;
      padding: var(--space-4) var(--space-5);
    }

    .yearcal__rows {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .yearcal__lanes {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: var(--space-5);
      max-width: none;
    }

    .yearcal__outro {
      margin-inline: auto;
      text-align: center;
    }
  }

  /* ---------- the dated client relationships (uplift/b/years.php) ---------- */
  .yearcal-years__head {
    max-width: 44rem;
    margin-block-end: var(--space-5);
  }

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

  .yearcal-years__chart {
    max-width: 68rem;
    margin: 0 0 var(--space-6);
    padding: var(--space-3);
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
  }

  .yearcal-years__axis {
    display: none;
  }

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

  .yearcal-years__item {
    display: grid;
    gap: 0.375rem;
  }

  .yearcal-years__item + .yearcal-years__item {
    padding-block-start: var(--space-3);
    border-block-start: var(--border);
  }

  .yearcal-years__name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem var(--space-2);
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 600;
    line-height: 1.4;
  }

  .yearcal-years__since {
    display: inline-block;
    padding: 0.0625rem 0.625rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-size: var(--pill-font-size);
    font-weight: var(--pill-weight);
    letter-spacing: var(--pill-tracking);
  }

  .yearcal-years__track {
    position: relative;
    display: block;
    height: 0.875rem;
    background: var(--color-paper);
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .yearcal-years__span {
    position: absolute;
    inset-block: 2px;
    inset-inline-start: calc(var(--from) * 100%);
    inset-inline-end: 2px;
    min-width: 0.5rem;
    background: var(--color-brand);
    border: var(--border);
    border-radius: var(--radius-pill);
  }

  .yearcal-years__line {
    margin: 0;
    font-size: var(--text-body);
    line-height: var(--leading-body);
  }

  .yearcal-years__closest {
    margin: var(--space-6) 0 0;
  }

  .yearcal-years__closest[hidden] {
    display: none;
  }

  .yearcal-years__closest .study-list {
    margin-block-start: var(--space-2);
  }

  @media (min-width: 48rem) {
    .yearcal-years__chart {
      padding: var(--space-4);
    }

    .yearcal-years__axis {
      display: grid;
      grid-template-columns: 16rem 1fr;
      gap: var(--space-3);
      margin: 0 0 var(--space-2);
      font-size: var(--step--1);
      font-weight: 600;
    }

    .yearcal-years__ticks {
      display: flex;
      justify-content: space-between;
    }

    .yearcal-years__item {
      grid-template-columns: 16rem 1fr;
      grid-template-areas: "name track" "name line";
      column-gap: var(--space-3);
      align-items: center;
    }

    .yearcal-years__name {
      grid-area: name;
      align-self: start;
    }

    .yearcal-years__track {
      grid-area: track;
    }

    .yearcal-years__line {
      grid-area: line;
    }
  }
}

@layer utilities {
  @media print {
    .yearcal__nav {
      display: none;
    }

    .yearcal__panels {
      display: block;
    }

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

    .yearcal__panel + .yearcal__panel {
      margin-block-start: var(--space-4);
      padding-block-start: var(--space-4);
      border-block-start: var(--border);
    }
  }
}
