@layer base {
/* ─────────────────────────────────────────────────────────────────────────
   THE PROGRAMME BY DAY — `programme_by_day.html` and its partials in
   `view/includes/programme/` (METIS-pub#468), and its pinned bar
   (METIS-pub#616).

   Built to iteration 3 of the design canvas (`specs/future/programme-by-day/`,
   boards Before-Phone and Before-Desktop). Phone first: one column, each day a
   chapter — its label, its date in the serif, what the day holds, a row of
   hexagons, its cards. From 720px the cards sit in a grid; from 1100px the
   chapter's intro takes a 300px column beside them, as on the desktop board.

   The bands, the content column (`.fp-wrap`), the mono kicker and the faces
   are front.css's; the brand's vocabulary (`.tg-title`, `.tg-eyebrow`,
   `.tg-hex`, `.tg-button`, `.tg-tickets`, `.tg-dark`) is gathering's theme.
   That theme is `@layer components` and this file `@layer base`, so a
   property the theme sets on a `.tg-*` element is not overridden here: a
   title's size goes through `--tg-fs-title`, a hexagon is sized, never
   positioned (ui-guide.md, "Two things that bite").

   The mockups colour each camp; camps have no colour of their own, so here a
   camp is its logo in a hexagon, or its initials on the olive one.

   No literal colour, size, radius, shadow or duration: tokens only.
   ───────────────────────────────────────────────────────────────────────── */

  /* ── Hero ───────────────────────────────────────────────────────────── */
  .pd-hero__grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .pd-hero__main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    min-width: 0;
  }

  .pd-hero__lede {
    max-width: 36rem;
    font-size: var(--text-lg);
    line-height: 1.5;
    color: var(--color-text-muted);
  }

  /* ── The pinned bar (METIS-pub#616): the days, then the filters ─────── */
  /* Its height, for a day jump to land below it: one row of 44px controls
     on a desktop, two on a phone, each row's padding the bar's. */
  .pd-main {
    --pd-control-h: 44px;
    --pd-bar-height: calc(var(--pd-control-h) + 2 * var(--space-2));
  }

  .pd-bar {
    position: sticky;
    top: var(--view-nav-height);
    /* Below the fixed site header, above the cards' stretched links. */
    z-index: 900;
    background: color-mix(in oklab, var(--country-main) 4%, var(--color-bg));
    border-block: 1px solid var(--color-border);
  }

  .pd-bar__row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-block: var(--space-2);
    min-width: 0;
  }

  /* One chip per day: weekday and date, and "Opening" / "8 on" where it
     fits. The days take what the dropdowns leave and scroll sideways when
     they outrun it (Portugal 2024 has eleven), but never get less than a few
     days' width: past that the dropdowns shrink instead. */
  .pd-days {
    flex: 1 1 0;
    display: flex;
    min-width: 10rem;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .pd-days__tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-1);
    min-height: var(--pd-control-h);
    align-content: center;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: var(--text-md);
    font-weight: var(--tg-w-semibold);
    white-space: nowrap;
    text-decoration: none;
    transition: background-color var(--dur-fast) var(--ease-out);
  }

  .pd-days__tab:hover { background: var(--color-surface-2); }

  .pd-days__tab.is-current {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-bg);
  }

  .pd-days__month,
  .pd-days__note {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: normal;
    letter-spacing: var(--tg-ls-eyebrow);
    text-transform: uppercase;
    opacity: 0.8;
  }

  .pd-days__note { display: none; }

  /* What an open search, and on a phone an open list, lies over. */
  .pd-bar__filters {
    flex: 0 1 auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
  }

  /* A dropdown with its icon inside, at the start. The icon is in the row,
     its negative end margin laying it over the dropdown's start padding, so
     no wrapper here positions anything and a phone's open list can be set
     against the whole row (below). */
  .pd-pick {
    flex: 0 1 auto;
    display: inline-flex;
    align-items: center;
    min-width: 0;
  }

  .pd-pick__icon {
    position: relative;
    z-index: 1;
    flex: none;
    width: var(--space-4);
    height: var(--space-4);
    margin-inline: var(--space-3) calc(-1 * (var(--space-3) + var(--space-4)));
    color: var(--color-text);
    pointer-events: none;
  }

  .pd-pick .d1-select { min-width: 0; }

  .pd-pick .d1-filter-select,
  .pd-pick .d1-select-trigger {
    height: var(--pd-control-h);
    min-width: 0;
    max-width: 14rem;
    padding-left: calc(var(--space-3) + var(--space-4) + var(--space-2));
    font-family: var(--font-ui);
    font-weight: var(--tg-w-semibold);
  }

  /* Chosen: the country tint the controls take on hover. */
  .pd-pick.is-set .pd-pick__icon { color: var(--country-main); }
  .pd-pick.is-set .d1-filter-select,
  .pd-pick.is-set .d1-select-trigger,
  .pd-bar__search-toggle.is-set {
    border-color: var(--country-main);
    background-color: color-mix(in oklab, var(--country-main) 10%, var(--color-bg));
    color: var(--country-dark);
  }

  .pd-bar__search-toggle,
  .pd-bar__search-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: var(--pd-control-h);
    height: var(--pd-control-h);
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
  }

  .pd-bar__search-toggle svg,
  .pd-bar__search-close svg {
    width: var(--space-4);
    height: var(--space-4);
  }

  .pd-bar__search-toggle:focus-visible,
  .pd-bar__search-close:focus-visible {
    outline: var(--focus-ring-width) solid var(--country-main);
    outline-offset: var(--focus-ring-width);
  }

  /* Without the script the field is simply in the row, and the toggle,
     which only the script can work, is not drawn. With it, the field lies
     over the dropdowns' row while a search is open. */
  .pd-bar__search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .pd-bar__search .d1-filter-search {
    flex: 1 1 auto;
    min-width: 0;
    height: var(--pd-control-h);
  }

  .pd-bar__search-toggle,
  .pd-bar__search-close { display: none; }

  .pd-bar.is-enhanced .pd-bar__search-toggle,
  .pd-bar.is-enhanced .pd-bar__search-close { display: grid; }

  .pd-bar.is-enhanced .pd-bar__search {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    background: color-mix(in oklab, var(--country-main) 4%, var(--color-bg));
  }

  .pd-bar.is-enhanced.is-searching .pd-bar__search { display: flex; }

  /* The dropdowns' part of the row is at least this wide while a search is
     open, so the field has room to type in however few dropdowns there are;
     the days give way, down to their minimum. Never narrower than it was. */
  .pd-bar.is-searching .pd-bar__filters { min-width: min(28rem, 60%); }

  /* ── Under 760px: two rows, the days on top, every control a thumb's
     width; a dropdown with nothing chosen shows only its icon ─────────── */
  @media (max-width: 759.98px) {
    .pd-main {
      --pd-bar-height: calc(2 * var(--pd-control-h) + 3 * var(--space-2));
    }

    /* A camp's page: the days alone, one row. */
    .pd-main--days-only {
      --pd-bar-height: calc(var(--pd-control-h) + 2 * var(--space-2));
    }

    .pd-bar__row { flex-wrap: wrap; }

    .pd-days { flex-basis: 100%; }

    .pd-bar__filters { flex: 1 1 100%; }

    .pd-bar__search-toggle { margin-left: auto; }

    .pd-pick:not(.is-set) .d1-filter-select,
    .pd-pick:not(.is-set) .d1-select-trigger {
      width: calc(var(--space-12) + var(--space-4));
      color: transparent;
    }

    .pd-pick:not(.is-set) .d1-select-trigger-label { visibility: hidden; }

    .pd-pick .d1-select-trigger { max-width: 11rem; }

    /* An open list spans the filters row, not one icon-wide dropdown:
       with the dropdown unpositioned, the row is what it is set against. */
    .pd-bar .d1-select { position: static; }
    .pd-bar .d1-select-menu { right: 0; min-width: 0; max-width: none; }
  }

  @media (min-width: 760px) {
    .pd-days__note { display: inline; }
  }

  /* ── A day ──────────────────────────────────────────────────────────── */
  .d1-section.pd-chapter {
    padding-block: var(--space-8) var(--space-12);
    /* A day jump lands below the fixed header and the pinned bar. */
    scroll-margin-top: calc(var(--view-nav-height) + var(--pd-bar-height) + var(--space-4));
  }

  .pd-chapter__grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .pd-chapter__intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .pd-chapter__title { --tg-fs-title: clamp(var(--tg-t-heading), 5vw, var(--tg-t-title-sm)); }

  .pd-chapter__holds {
    font-size: var(--text-lg);
    line-height: 1.45;
    color: var(--color-text-muted);
  }

  .pd-chapter__holds strong { color: var(--color-text); font-weight: var(--tg-w-semibold); }

  .pd-chapter__empty {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
  }

  /* The day's pictures as one row of hexagons, every other one a half-step
     down so the row reads as a honeycomb. Decoration, `aria-hidden`. */
  .pd-comb {
    --pd-comb-w: 3.25rem;
    display: flex;
    gap: var(--space-1);
    padding-top: var(--space-2);
    padding-bottom: calc(var(--pd-comb-w) * 0.5);
  }

  .pd-comb__cell {
    flex: none;
    width: var(--pd-comb-w);
    background: linear-gradient(155deg, var(--country-dark, var(--green-900)), var(--country-main, var(--olive-600)));
  }

  .pd-comb__cell:nth-child(even) { transform: translateY(50%); }

  .pd-comb__initial {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: var(--text-xl);
    color: color-mix(in oklab, var(--white) 85%, transparent);
  }

  /* An opened card grows down in its own column (METIS-pub#474): nothing moves
     sideways, and its neighbours keep their height instead of stretching. */
  .pd-chapter__cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    align-content: start;
    align-items: start;
  }

  /* "See all 7 on Saturday": always a link to that day's own page. */
  .pd-more {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--space-12);
    border: 1px dashed color-mix(in oklab, var(--color-text) 35%, transparent);
    border-radius: var(--radius-lg);
    font-family: var(--font-ui);
    font-size: var(--text-md);
    font-weight: var(--tg-w-semibold);
    color: var(--color-text);
    text-decoration: none;
  }

  .pd-more:hover { background: var(--color-surface); }

  /* Past a phone's share of the day (`PHONE_PER_DAY`, marked per card by the
     template): behind "See all" on a phone. */
  @media (max-width: 719.98px) {
    .pd-card--phone-hidden { display: none; }
  }

  /* ── A card: its experience's link, "Read more" opening in place ────── */
  .pd-card {
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--elev-2);
  }

  .pd-card__face {
    display: flex;
    flex-direction: column;
  }

  .pd-card__art {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(155deg, var(--country-dark, var(--green-900)) 0%, var(--country-main, var(--olive-600)) 130%);
  }

  .pd-card__art img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--dur-slow) var(--ease-out);
  }

  /* Hover only where there is hover: a tap on "Read more" does not leave the
     page, so on a touch screen a :hover it set would stick. */
  @media (hover: hover) {
    .pd-card:hover .pd-card__art img { transform: scale(1.03); }
    .pd-card:hover .pd-card__title a { color: var(--tg-link); }
  }

  .pd-card__head {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: 0 var(--space-4) var(--space-4);
  }

  /* Only the camp's hexagon rides up over the picture's edge; the name stays
     on the white, at most two lines — a long name wrapping upward ran grey
     over the dark picture. */
  .pd-card__camp {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .pd-card__mark {
    flex: none;
    width: 2.75rem;
    margin-top: calc(var(--space-6) * -1);
    background: var(--olive-600);
  }

  .pd-card__initials {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-ui);
    font-size: var(--text-md);
    font-weight: var(--tg-w-semibold);
    color: var(--white);
  }

  .pd-card__camp-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    padding-top: var(--space-2);
    font-size: var(--text-md);
    font-weight: var(--tg-w-semibold);
    color: var(--color-text-muted);
  }

  /* The face's time (METIS-pub#482), inside the title's heading, on a line
     of its own above the name. */
  .pd-card__when {
    display: block;
    margin-bottom: var(--space-2);
    line-height: 1.4;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    letter-spacing: var(--tg-ls-eyebrow);
    text-transform: uppercase;
    color: color-mix(in oklab, var(--color-accent) 70%, var(--color-text));
  }

  /* The place beside the time links to its page (METIS-pub#606); shared.css
     lifts it above the card's stretched link. */
  .pd-card__when a { color: inherit; }

  /* A place's heading on the On now page links to its page. */
  .pd-chapter__title a { color: inherit; }

  .pd-card__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--tg-t-subheading);
    font-weight: inherit;
    line-height: 1.1;
    color: var(--color-text);
  }

  .pd-card__title a {
    color: inherit;
    text-decoration: none;
  }

  .pd-card__blurb {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font-size: var(--text-lg);
    line-height: 1.45;
    color: var(--color-text-muted);
  }

  /* "Read more" is the fold's summary: its own control, the full width of
     the card and 48px tall, so a near miss toggles rather than navigates. */
  .pd-card__more {
    display: flex;
    align-items: center;
    min-height: var(--space-12);
    padding-inline: var(--space-4);
    list-style: none;
    cursor: pointer;
    font-size: var(--text-md);
    font-weight: var(--tg-w-semibold);
    color: color-mix(in oklab, var(--color-accent) 75%, var(--color-text));
  }

  .pd-card__more::-webkit-details-marker { display: none; }

  .pd-card__more:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: calc(var(--focus-ring-width) * -1);
  }

  .pd-card__more-close { display: none; }
  .pd-card__fold[open] .pd-card__more-open { display: none; }
  .pd-card__fold[open] .pd-card__more-close { display: inline; }

  .pd-card:has(.pd-card__fold[open]) .pd-card__blurb { display: none; }

  .pd-card__story {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: 0 var(--space-4) var(--space-4);
  }

  .pd-card__text {
    font-size: var(--text-lg);
    line-height: 1.55;
    color: var(--color-text);
  }

  .pd-card__hosts {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .pd-card__people {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .pd-card__person { font-size: var(--text-md); }

  /* The opened story does not animate. Opacity, transform and the like
     paint an element as a layer of its own, above the card's link overlay:
     its text stops being part of the link (seen with the original open
     animation, motion on only). Raising the overlay to cover it buries the
     story's own links instead. Guarded by web/view/tests_lift.py. */

  /* ── The ticket bar ─────────────────────────────────────────────────── */
  .pd-ticketbar {
    position: fixed;
    inset-inline: var(--space-3);
    bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
    z-index: 20;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 40rem;
    margin-inline: auto;
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    box-shadow: var(--elev-3);
  }

  .pd-ticketbar__facts {
    flex: 1;
    min-width: 0;
    font-size: var(--text-md);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pd-ticketbar .tg-tickets { margin-left: auto; }

  /* So the last card is never under the bar. */
  .pd-main--with-bar {
    padding-bottom: calc(var(--space-16) + var(--space-8) + env(safe-area-inset-bottom));
  }

  /* ── 720px and up: the cards in a grid; an open card grows in its column ─ */
  @media (min-width: 720px) {
    /* Three to a row, the middle one of each a half-step down. */
    .pd-comb { --pd-comb-w: 4rem; flex-wrap: wrap; max-width: calc(var(--pd-comb-w) * 3 + var(--space-1) * 2); row-gap: var(--space-2); }
    .pd-comb__cell:nth-child(even) { transform: none; }
    .pd-comb__cell:nth-child(3n+2) { transform: translateY(50%); }

    .pd-chapter__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
    .pd-more--phone { display: none; }
  }

  /* ── 1100px and up: the desktop board — intro column beside the cards ─ */
  @media (min-width: 1100px) {
    /* The text keeps the board's column (up to 44rem). */
    .pd-hero__main { max-width: 44rem; }

    .pd-chapter__grid {
      display: grid;
      grid-template-columns: 300px minmax(0, 1fr);
      gap: var(--space-8) var(--space-12);
    }

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