/* Beacon Archive Time Machine — Threads-white, Apple-like time depth */

.atm-root {
  width: 100%;
  margin: 32px auto 0;
  text-align: left;
}

.atm {
  position: relative;
  display: grid;
  gap: 16px;
  width: 100%;
  color: var(--text);
}

.atm-chrome {
  display: grid;
  gap: 10px;
}

.atm-chrome__text {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.atm-chrome__text strong {
  min-width: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
}

.atm-chrome__text span {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.atm-month-picker {
  display: grid;
  gap: 10px;
  margin: 0 0 4px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.atm-month-picker__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.atm-month-picker__head strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.atm-month-picker__head span {
  color: var(--text-faint);
  font-size: 12px;
}

.atm-year-chips,
.atm-month-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.atm-year-chip,
.atm-month-chip {
  appearance: none;
  flex: 0 0 auto;
  min-width: 52px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0;
  line-height: 1;
  cursor: pointer;
}

.atm-month-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.atm-month-chip small {
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.atm-year-chip:hover,
.atm-month-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-subtle);
}

.atm-year-chip.is-active,
.atm-year-chip[aria-pressed="true"],
.atm-month-chip.is-active,
.atm-month-chip[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.atm-month-chip.is-active small,
.atm-month-chip[aria-pressed="true"] small {
  color: rgb(255 255 255 / 78%);
}

.atm-year-chip:focus-visible,
.atm-month-chip:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.atm-body {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  min-height: 470px;
  align-items: stretch;
}

.atm-stage {
  order: 2;
  position: relative;
  min-width: 0;
  min-height: 470px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  outline: none;
  touch-action: pan-y;
  user-select: none;
  contain: layout paint;
}

.atm-rail {
  order: 1;
}

.atm-stage:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.atm-stage__stack {
  position: relative;
  height: 100%;
  min-height: 470px;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.atm-layer {
  position: absolute;
  inset: 58px 38px 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 360px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgb(17 17 17 / 5%);
  filter: saturate(calc(1 - (var(--atm-depth, 0) * 0.08)));
  opacity: 1;
  pointer-events: none;
  transform:
    translate3d(
      var(--atm-drag-x, 0px),
      calc((var(--atm-depth, 0) * -13px) + var(--atm-drag-y, 0px)),
      calc(var(--atm-depth, 0) * -82px)
    )
    scale(calc(1 - (var(--atm-depth, 0) * 0.035)));
  transform-origin: top center;
  transition:
    transform 280ms cubic-bezier(0.2, 0.75, 0.25, 1),
    opacity 220ms ease,
    filter 220ms ease;
  will-change: transform, opacity;
}

.atm-layer::before {
  position: absolute;
  top: 15px;
  left: 18px;
  width: 46px;
  height: 3px;
  border-radius: 3px;
  background: var(--line-strong);
  content: "";
  opacity: calc(0.72 - (var(--atm-depth, 0) * 0.14));
}

.atm-layer[aria-hidden="true"] .atm-layer__cards {
  display: none;
}

.atm-layer.is-current {
  inset: 96px 18px 22px;
  min-height: 0;
  padding: 18px;
  opacity: 1 !important;
  filter: none;
  pointer-events: auto;
  transform:
    translate3d(var(--atm-drag-x, 0px), var(--atm-drag-y, 0px), 0)
    scale(1);
}

.atm-layer.is-current::before {
  display: none;
}

.atm-layer__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  color: var(--text-faint);
  font-size: 12px;
}

.atm-layer__meta time {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.atm-layer__cards {
  display: grid;
  align-content: center;
  min-height: 0;
}

.atm-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  min-height: 134px;
  padding: 14px 8px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition:
    background 150ms ease,
    transform 220ms cubic-bezier(0.2, 0.75, 0.25, 1),
    opacity 180ms ease;
}

.atm-card:first-child {
  border-top: 0;
}

.atm-card:hover {
  background: var(--surface-subtle);
}

.atm-card.is-active {
  box-shadow: none;
}

.atm-card:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: -3px;
}

.atm-card__cover {
  width: 96px;
  height: 112px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-subtle);
}

.atm-card__copy {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.atm-card__copy small {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.atm-card__copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.atm-card__copy > span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.atm-card__cta {
  width: max-content;
  color: var(--text);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

@media (min-width: 701px) {
  .atm-card:only-child {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 18px;
    min-height: 178px;
    padding: 20px 14px;
  }

  .atm-card:only-child .atm-card__cover {
    width: 118px;
    height: 142px;
  }

  .atm-card:only-child .atm-card__copy strong {
    font-size: 17px;
  }

  .atm-card:only-child .atm-card__copy > span {
    font-size: 13.5px;
  }
}

.atm-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 0;
  border-right: 0;
  background: transparent;
}

.atm-rail::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 1px;
  background: var(--line);
  content: "";
  transform: translateX(-50%);
  pointer-events: none;
}

.atm-rail > .atm-month-chips {
  display: none; /* month picker lives above stage now */
}

.atm-rail__track {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  gap: 0;
  height: 100%;
  max-height: 470px;
  padding: 8px 0;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
}

.atm-rail__track::-webkit-scrollbar {
  display: none;
}

.atm-rail__year {
  width: 100%;
  padding: 4px 0 8px;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.atm-rail__month {
  width: 100%;
  padding: 10px 0 2px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 650;
  text-align: center;
}

.atm-rail__tick {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  scroll-snap-align: center;
}

.atm-rail__tick::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  content: "";
  transform: translate(-50%, -50%);
}

.atm-rail__tick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.atm-rail__tick.is-dual::after {
  position: absolute;
  top: calc(50% - 10px);
  left: calc(50% + 6px);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-faint);
  content: "";
}

.atm-rail__tick:hover {
  color: var(--text);
}

.atm-rail__tick:hover::before {
  border-color: var(--text);
}

.atm-rail__tick.is-active {
  background: transparent;
  color: var(--text);
  font-weight: 750;
}

.atm-rail__tick.is-active::before {
  width: 10px;
  height: 10px;
  border-color: var(--text);
  background: var(--text);
}

.atm-rail__tick.is-active.is-dual::after {
  background: var(--text);
}

.atm-status {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 470px;
  padding: 32px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  text-align: center;
}

.atm-status strong {
  color: var(--text);
  font-size: 15px;
}

.atm-status p {
  max-width: 30ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.atm-stage.is-dragging,
.atm-stage.is-dragging * {
  cursor: grabbing;
}

.atm-stage.is-dragging .atm-layer {
  transition: none;
}

/* Reduced motion keeps the full archive but removes spatial displacement. */
.atm--reduced .atm-stage__stack,
.atm-stage.is-flat .atm-stage__stack {
  perspective: none;
}

.atm--reduced .atm-layer:not(.is-current),
.atm-stage.is-flat .atm-layer:not(.is-current) {
  display: none;
}

.atm--reduced .atm-layer.is-current,
.atm-stage.is-flat .atm-layer.is-current {
  transform: none !important;
  transition: opacity 120ms linear !important;
}

@media (max-width: 820px) {
  .atm-body {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
  }

  .atm-stage {
    order: 1;
  }

  .atm-rail {
    order: 2;
    border-top: 1px solid var(--line);
    border-right: 0;
    align-items: stretch;
  }

  .atm-rail::before {
    top: auto;
    bottom: 18px;
    left: 12px;
    right: 12px;
    width: auto;
    height: 1px;
    transform: none;
  }

  .atm-month-picker {
    order: 0;
    padding-bottom: 10px;
  }

  .atm-year-chips,
  .atm-month-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .atm-year-chips::-webkit-scrollbar,
  .atm-month-chips::-webkit-scrollbar {
    display: none;
  }

  .atm-year-chip,
  .atm-month-chip {
    min-height: 44px;
  }

  .atm-rail > .atm-month-chips {
    display: none;
  }

  .atm-rail__track {
    flex-direction: row;
    align-items: center;
    gap: 2px;
    width: 100%;
    height: 64px;
    max-height: none;
    padding: 10px 4px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .atm-rail__year,
  .atm-rail__month {
    flex: 0 0 auto;
    padding: 0 8px;
    white-space: nowrap;
  }

  .atm-rail__tick {
    flex: 0 0 40px;
    width: 40px;
    min-height: 44px;
    padding: 0;
  }

  .atm-rail__tick span {
    position: absolute;
    left: 50%;
    top: 2px;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 10px;
  }

  .atm-rail__tick::before {
    top: auto;
    bottom: 10px;
    left: 50%;
    width: 8px;
    height: 8px;
    transform: translateX(-50%);
  }

  .atm-rail__tick.is-active::before {
    width: 10px;
    height: 10px;
    border-color: var(--text);
    background: var(--text);
  }

  .atm-rail__tick.is-dual::after {
    top: 12px;
    left: calc(50% + 8px);
  }
}

@media (max-width: 700px) {
  .atm-root {
    width: 100%;
    margin-top: 28px;
    padding-bottom: 8px;
  }

  .atm {
    gap: 14px;
  }

  .atm-chrome__text {
    align-items: flex-start;
  }

  .atm-chrome__text strong {
    font-size: 16px;
  }

  .atm-chrome__text span {
    padding-top: 3px;
    font-size: 11px;
  }

  .atm-chrome__controls {
    gap: 4px;
  }

  .atm-nav-button {
    flex: 0 1 66px;
    min-width: 58px;
    padding-inline: 6px;
    font-size: 11.5px;
  }

  .atm-nav-button[data-atm-action="latest"] {
    flex: 0 1 76px;
    margin-left: 0;
  }

  .atm-date-picker {
    flex: 1 1 122px;
    min-width: 110px;
  }

  .atm-date-picker input[type="date"] {
    padding-inline: 8px;
    font-size: 11.5px;
  }

  .atm-stage,
  .atm-stage__stack {
    min-height: 372px;
  }

  .atm-layer {
    inset: 40px 24px 20px;
    min-height: 286px;
    padding: 14px;
    transform:
      translate3d(
        var(--atm-drag-x, 0px),
        calc((var(--atm-depth, 0) * -8px) + var(--atm-drag-y, 0px)),
        calc(var(--atm-depth, 0) * -58px)
      )
      scale(calc(1 - (var(--atm-depth, 0) * 0.025)));
  }

  .atm-layer.is-current {
    inset: 70px 10px 16px;
    padding: 14px;
    transform:
      translate3d(var(--atm-drag-x, 0px), var(--atm-drag-y, 0px), 0)
      scale(1);
  }

  .atm-layer__meta {
    min-height: 28px;
  }

  .atm-layer__meta time {
    font-size: 14px;
  }

  .atm-layer__cards {
    align-content: center;
  }

  .atm-card {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    min-height: 158px;
    padding: 14px 6px;
    background: var(--surface);
  }

  .atm-card__cover {
    width: 88px;
    height: 116px;
  }

  .atm-card__copy {
    gap: 5px;
  }

  .atm-card__copy strong {
    font-size: 14px;
    -webkit-line-clamp: 3;
  }

  .atm-card__copy > span {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .atm-layer__cards:has(.atm-card + .atm-card) {
    position: relative;
    display: block;
    min-height: 184px;
  }

  .atm-layer__cards:has(.atm-card + .atm-card) .atm-card {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-bottom: 1px solid var(--line-strong);
    opacity: 0.72;
    transform: translateY(13px) scale(0.965);
    transform-origin: top center;
  }

  .atm-layer__cards:has(.atm-card + .atm-card) .atm-card.is-active {
    position: relative;
    z-index: 2;
    border-bottom-color: transparent;
    opacity: 1;
    transform: none;
  }

  .atm-status {
    min-height: 372px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atm-layer,
  .atm-card {
    transition-duration: 0.01ms !important;
  }
}
