/* 15 Years of HappyCo timeline, card deck version. Site tokens (themes/happyco/tokens.css); the only literals are the two data-URI icon colors below, which cannot read tokens. */
.t15d {
  --deck-h: 420px;
  --stamp: 112px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: var(--space-40);
  align-items: center;
  margin: var(--space-64) 0;
  color: var(--color-on-surface);
  overflow: visible;
}
.t15d__head { align-self: center; }
.t15d h2.t15d__hook {
  margin: 0;
  font-family: var(--type-heading-family);
  font-weight: var(--type-heading-weight);
  font-size: var(--type-heading-32-size);
  line-height: var(--type-heading-32-line-height);
  letter-spacing: var(--type-heading-32-tracking);
  color: var(--color-primary);
}
.t15d__controls { display: flex; align-items: center; gap: var(--space-8); margin-top: var(--space-24); }
.t15d:not(.t15d--js) .t15d__controls { visibility: hidden; }
.t15d p.t15d__count {
  order: 3;
  margin: 0 0 0 var(--space-8);
  font-family: var(--type-text-bold-family);
  font-weight: var(--type-text-bold-weight);
  font-size: var(--type-label-14-size);
  line-height: var(--type-label-14-line-height);
  color: var(--color-on-surface-variant);
  font-variant-numeric: tabular-nums;
}
.t15d__btn {
  display: grid; place-items: center;
  width: var(--space-48); height: var(--space-48);
  padding: 0;
  border: var(--border-width-thin, 1px) solid var(--color-outline-strong);
  border-radius: var(--radius-round);
  background: transparent;
  color: var(--color-on-surface);
  cursor: pointer;
  transition: background var(--motion-duration-short) var(--motion-easing-standard), color var(--motion-duration-short) var(--motion-easing-standard), opacity var(--motion-duration-short);
}
.t15d__btn[data-t15d-next] { background: var(--color-on-surface); color: var(--color-surface); }
.t15d__btn svg { width: var(--space-24); height: var(--space-24); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.t15d__btn:hover:not([aria-disabled="true"]) { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-white); }
.t15d__btn:focus-visible, .t15d__track:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 4px; }
.t15d__btn[aria-disabled="true"] { opacity: .3; cursor: default; }

/* Track: a swipeable row of cards (the base rules here). The deck section below stacks them and is the default; with scripting off the row comes back. */
.t15d ol.t15d__track {
  display: flex;
  gap: var(--space-16);
  margin: 0;
  padding: var(--space-24) 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.t15d .t15d__track > .t15__item {
  position: relative;
  flex: 0 0 86%;
  height: var(--deck-h);
  margin: 0;
  padding: var(--space-24);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm), var(--shadow-lg);
}
.t15d .t15d__track > .t15__item::marker { content: none; }

/* Year stamp. */
.t15d p.t15__when {
  position: absolute;
  z-index: 2;
  top: calc(var(--space-24) * -1);
  right: calc(var(--space-16) * -1);
  width: var(--stamp);
  height: var(--stamp);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  border-radius: var(--radius-round);
  background: var(--color-green-500);
  color: var(--color-white);
  transform: rotate(10deg);
  box-shadow: var(--shadow-md);
}
.t15d .t15__year {
  font-family: var(--type-display-family);
  font-weight: var(--type-display-weight);
  font-size: var(--type-display-32-size);
  line-height: var(--type-display-32-line-height);
}
.t15d .t15__month {
  font-family: var(--type-text-bold-family);
  font-weight: var(--type-text-bold-weight);
  font-size: var(--type-label-12-size);
  line-height: var(--type-label-12-line-height);
  letter-spacing: .1em;
}
.t15d .t15__body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.t15d .t15__media {
  order: -1;
  flex: 1;
  min-height: 0;
  margin-bottom: var(--space-24);
  padding: var(--space-16);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}
.t15d .t15__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.t15d .t15__media--photo, .t15d .t15__media--pair, .t15d .t15__item--finale .t15__media { padding: 0; }
.t15d .t15__media--photo img, .t15d .t15__media--pair img, .t15d .t15__item--finale .t15__media img { object-fit: cover; }
.t15d .t15__media--pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.t15d .t15__media--pair img { object-position: center 30%; }
.t15d .t15__media--logo { padding: var(--space-40) var(--space-48); }
/* JoyAI mark: a centred icon, not stretched to the tile. */
.t15d .t15__media--icon { display: flex; align-items: center; justify-content: center; }
.t15d .t15__media--icon img { width: 40%; max-width: 160px; height: auto; }
/* 1 million inspections and 1 million units: a type graphic instead of a photo. */
.t15d .t15__media--big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-16); background: var(--color-primary); }
.t15d .t15__big { font-family: var(--type-display-family); font-weight: var(--type-display-weight); font-size: var(--type-display-144-size); line-height: var(--type-display-144-line-height); color: var(--color-green-500); }
.t15d .t15__ticks { display: flex; gap: var(--space-8); }
.t15d .t15__ticks i { width: var(--space-24); height: var(--space-24); border-radius: var(--radius-round); background: var(--color-purple-200) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b3799' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 70% no-repeat; }
/* 2018 1 million units: the 1M type graphic with a row of HappyCo brand icons (Brand System chunk/building and chunk/city), no circle, in purple 200. The icon fill (#d0ceff, purple 200) is hard-coded because a data URI can't read tokens. */
.t15d .t15__units { display: flex; gap: var(--space-12); }
.t15d .t15__units i { width: var(--space-40); height: var(--space-40); background: center / contain no-repeat; }
.t15d .t15__units i.is-building { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' fill='%23d0ceff' d='M14 0H2V16H6V12H10V16H14V0ZM5 3H7V5H5V3ZM7 7H5V9H7V7ZM9 3H11V5H9V3ZM11 7H9V9H11V7Z'/%3E%3C/svg%3E"); }
.t15d .t15__units i.is-city { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' fill='%23d0ceff' d='M11 1H1V15H3V11H5V15H15V9H11V1ZM5 3H3V5H5V3ZM9 3H7V5H9V3ZM7 7H9V9H7V7ZM11 11H13V13H11V11Z'/%3E%3C/svg%3E"); }
.t15d .t15__media--big img { width: auto; height: 124px; max-width: 100%; flex: none; }
.t15d h3.t15__title {
  margin: 0 0 var(--space-8);
  font-family: var(--type-heading-family);
  font-weight: var(--type-heading-weight);
  font-size: var(--type-heading-24-size);
  line-height: var(--type-heading-24-line-height);
  letter-spacing: var(--type-heading-24-tracking);
  color: var(--color-on-surface);
}
.t15d h3.t15__stat { color: var(--color-primary); }
.t15d p.t15__line { margin: 0; font-size: var(--type-text-16-size); line-height: var(--type-text-16-line-height); color: var(--color-on-surface-variant); }
.t15d .t15__logotype { display: block; width: 112px; height: auto; }
.t15d__end { display: flex; align-items: center; justify-content: space-between; gap: var(--space-16); margin-top: var(--space-12); }
.t15d__restart {
  display: inline-flex; align-items: center; gap: var(--space-8);
  padding: var(--space-8) var(--space-16);
  border: 0;
  border-radius: var(--radius-round);
  background: var(--color-green-500);
  color: var(--color-on-surface);
  font-family: var(--type-text-bold-family);
  font-weight: var(--type-text-bold-weight);
  font-size: var(--type-label-14-size);
  line-height: var(--type-label-14-line-height);
  cursor: pointer;
  transition: background var(--motion-duration-short) var(--motion-easing-standard), color var(--motion-duration-short) var(--motion-easing-standard);
}
.t15d__restart[hidden] { display: none; }
.t15d__restart svg { width: var(--space-16); height: var(--space-16); fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.t15d__restart:hover { background: var(--color-primary); color: var(--color-white); }
.t15d__restart:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Deck. The stacked layout is the default, so the page lays out the same before and after the script runs (the
   script used to switch a card row into the deck after load, which shifted the page, CLS 0.57 at 390). data-pos is
   written into the markup (0 front, 1 and 2 behind, far hidden) and the script keeps it up to date; "gone" is set only
   by the script, when a card has been dealt. Scripting off, see the @media (scripting: none) block at the end. */
.t15d ol.t15d__track {
  display: block;
  position: relative;
  height: calc(var(--deck-h) + var(--space-48));
  padding: var(--space-24) var(--space-48) 0 0;
  overflow: visible;
}
/* Drag affordances only once the script is there to handle them. */
.t15d--js ol.t15d__track { touch-action: pan-y; cursor: grab; user-select: none; }
.t15d--js .t15d__track img { -webkit-user-drag: none; }
.t15d .t15d__track > .t15__item {
  position: absolute;
  top: var(--space-24);
  left: 0;
  right: var(--space-48);
  transform-origin: 50% 100%;
  transition: transform 550ms var(--motion-easing-standard), opacity 400ms var(--motion-easing-standard), background 300ms;
}
.t15d .t15__item > * { transition: opacity 250ms var(--motion-easing-standard); }
.t15d .t15__item[data-pos="0"] { z-index: 30; }
.t15d .t15__item[data-pos="1"] { z-index: 20; transform: translate(var(--space-16), var(--space-12)) rotate(3deg); background: var(--color-surface-warm); }
.t15d .t15__item[data-pos="2"] { z-index: 10; transform: translate(var(--space-32), var(--space-24)) rotate(6deg); background: var(--color-secondary-container); }
.t15d .t15__item[data-pos="far"] { z-index: 1; transform: translate(var(--space-32), var(--space-24)) rotate(6deg); opacity: 0; }
.t15d .t15__item[data-pos="gone"] { z-index: 40; transform: translate(-115%, 40px) rotate(-12deg); opacity: 0; pointer-events: none; }
.t15d .t15__item[data-pos="gone"][data-dir="r"] { transform: translate(115%, 40px) rotate(12deg); }
.t15d .t15__item.is-off { display: none; }
.t15d .t15__item[data-pos]:not([data-pos="0"]) > * { opacity: 0; }
.t15d .t15__item[data-pos]:not([data-pos="0"]) p.t15__when { display: none; }
.t15d--js .t15__item[data-pos="0"] p.t15__when { animation: t15d-stamp 500ms 200ms cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes t15d-stamp { from { transform: rotate(-20deg) scale(.4); } to { transform: rotate(10deg) scale(1); } }

/* Narrower screens: a tighter stack so the back cards stay inside the page, and the tablet type steps. */
@media (max-width: 1023px) {
  .t15d h2.t15d__hook { font-size: var(--type-heading-28-size); line-height: var(--type-heading-28-line-height); letter-spacing: var(--type-heading-28-tracking); }
  .t15d h3.t15__title { font-size: var(--type-heading-22-size); line-height: var(--type-heading-22-line-height); letter-spacing: var(--type-heading-22-tracking); }
  .t15d .t15__item[data-pos="1"] { transform: translate(var(--space-8), var(--space-8)) rotate(2deg); }
  .t15d .t15__item[data-pos="2"], .t15d .t15__item[data-pos="far"] { transform: translate(var(--space-16), var(--space-16)) rotate(4deg); }
}

@media (max-width: 767px) {
  .t15d { --deck-h: 388px; --stamp: 88px; grid-template-columns: 1fr; gap: var(--space-8); }
  .t15d h2.t15d__hook { font-size: var(--type-heading-24-size); line-height: var(--type-heading-24-line-height); letter-spacing: var(--type-heading-24-tracking); }
  /* Phone: heading, then deck, then the controls centred below as button, counter, button. */
  .t15d__head { display: contents; }
  .t15d__controls { order: 2; justify-content: center; gap: var(--space-16); margin-top: var(--space-8); }
  .t15d__btn[data-t15d-prev] { order: 0; }
  .t15d p.t15d__count { order: 1; margin: 0; min-width: 5ch; text-align: center; }
  .t15d__btn[data-t15d-next] { order: 2; }
  .t15d .t15__year { font-size: var(--type-display-24-size); line-height: var(--type-display-24-line-height); }
  .t15d h3.t15__title { font-size: var(--type-heading-20-size); line-height: var(--type-heading-20-line-height); letter-spacing: var(--type-heading-20-tracking); }
  .t15d .t15__media--logo { padding: var(--space-32); }
  .t15d .t15__media--big img { height: 92px; }
  .t15d .t15__units { gap: var(--space-8); }
  .t15d .t15__units i { width: var(--space-32); height: var(--space-32); }
  .t15d .t15__big { font-size: var(--type-display-96-size); line-height: var(--type-display-96-line-height); }
  .t15d .t15d__track > .t15__item { padding: var(--space-16); }
  .t15d .t15__logotype { width: 88px; }
}

/* Scripting off: back to the swipeable row of cards, every card in full. (The script never runs, so nothing deals the deck.)
   The selectors are one step more specific than the deck rules above, so they win at every width. */
@media (scripting: none) {
  .t15d ol.t15d__track { display: flex; position: static; height: auto; padding: var(--space-24) 0; overflow-x: auto; }
  .t15d .t15d__track > .t15__item[data-pos] { position: relative; top: auto; left: auto; right: auto; z-index: auto; transform: none; opacity: 1; background: var(--color-white); }
  .t15d .t15__item[data-pos]:not([data-pos="0"]) > * { opacity: 1; }
  .t15d .t15__item[data-pos]:not([data-pos="0"]) p.t15__when { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .t15d--js .t15d__track > .t15__item, .t15d--js .t15__item > * { transition: none; }
  .t15d--js .t15__item[data-pos="0"] p.t15__when { animation: none; }
}
