/* ============================================
   iPhone Timeline — Apple-inspired Dark Theme
   ============================================ */

/* Body background matches below-fold white; hero handles its own dark bg */
body:has(.timeline-page) {
  background: #ffffff;
}

body:has(.timeline-page) .site-header {
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body:has(.timeline-page) .site-header,
body:has(.timeline-page) .site-header a,
body:has(.timeline-page) .site-header .header__title {
  color: #f5f5f7;
}

body:has(.timeline-page) .site-header a:hover {
  color: #0a84ff;
}

.timeline-page {
  background: #ffffff;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Override footer to match white below-fold */
.timeline-page ~ footer,
body:has(.timeline-page) footer {
  background: #ffffff;
  color: #86868b;
  border-top: 1px solid #e8e8ed;
}

/* ---- Hero ---- */
.tl-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 2rem;
  background: radial-gradient(ellipse at 50% 80%, #1a1a2e 0%, #0a0a0a 70%);
}

.tl-hero__eyebrow {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #86868b;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: tl-fade-up 1s 0.2s forwards;
}

.tl-hero__title {
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 1.5rem;
  background: linear-gradient(135deg, #f5f5f7 0%, #a1a1a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  animation: tl-fade-up 1s 0.5s forwards;
}

.tl-hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.375rem);
  color: #86868b;
  max-width: 480px;
  margin: 0 auto 3rem;
  line-height: 1.5;
  opacity: 0;
  animation: tl-fade-up 1s 0.8s forwards;
}

.tl-hero__scroll-hint {
  opacity: 0;
  animation: tl-fade-up 1s 1.2s forwards;
}

.tl-hero__arrow {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  border-right: 2px solid #48484a;
  border-bottom: 2px solid #48484a;
  transform: rotate(45deg);
  animation: tl-bounce 2s infinite;
}

@keyframes tl-fade-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tl-bounce {
  0%, 20%, 50%, 80%, 100% { transform: rotate(45deg) translateY(0); }
  40% { transform: rotate(45deg) translateY(8px); }
  60% { transform: rotate(45deg) translateY(4px); }
}

/* ---- Light theme for below-the-fold ---- */
.tl-filter,
.tl-timeline,
.tl-closing {
  background: #ffffff;
  color: #1d1d1f;
}

/* ---- Filter Bar ---- */
.tl-filter {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.75rem 0;
}

.tl-filter__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tl-filter__btn {
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  border: 1px solid #d2d2d7;
  background: transparent;
  color: #86868b;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.tl-filter__btn:hover {
  color: #1d1d1f;
  border-color: #86868b;
}

.tl-filter__btn--active {
  background: #1d1d1f;
  color: #f5f5f7;
  border-color: #1d1d1f;
}

.tl-filter__btn:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 2px;
}

.tl-filter__count {
  margin-left: auto;
  font-size: 0.75rem;
  color: #86868b;
}

/* ---- Timeline ---- */
.tl-timeline {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem 8rem;
}

.tl-timeline__line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent 0%, #d2d2d7 5%, #d2d2d7 95%, transparent 100%);
  transform: translateX(-50%);
}

/* ---- Year Marker ---- */
.tl-year {
  position: relative;
  text-align: center;
  padding: 4rem 0 2rem;
  z-index: 2;
}

.tl-year__number {
  display: inline-block;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #d2d2d7;
  background: #ffffff;
  padding: 0 2rem;
  position: relative;
}

/* ---- Timeline Items ---- */
.tl-item {
  position: relative;
  padding: 2rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.tl-item__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #1d1d1f;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 5px #d2d2d7;
}

.tl-item__dot--event {
  width: 10px;
  height: 10px;
  background: #86868b;
}

/* Alternating layout */
.tl-item--device:nth-child(odd) .tl-item__image { grid-column: 1; grid-row: 1; }
.tl-item--device:nth-child(odd) .tl-item__content { grid-column: 2; grid-row: 1; }
.tl-item--device:nth-child(even) .tl-item__image { grid-column: 2; grid-row: 1; }
.tl-item--device:nth-child(even) .tl-item__content { grid-column: 1; grid-row: 1; text-align: right; }
.tl-item--device:nth-child(even) .tl-item__features { margin-left: auto; }
.tl-item--device:nth-child(even) .tl-item__specs { justify-content: flex-end; }

/* Device Item */
.tl-item--device {
  min-height: 400px;
  padding: 4rem 0;
}

.tl-item__image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.tl-item__image img {
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.12));
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.tl-item--device:hover .tl-item__image img {
  transform: scale(1.03);
}

.tl-item__date {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #86868b;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.tl-item__name {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.25rem;
  color: #1d1d1f;
}

.tl-item__subtitle {
  font-size: 1rem;
  color: #86868b;
  margin: 0 0 0.75rem;
}

.tl-item__tagline {
  font-size: 1.125rem;
  color: var(--item-accent, #0a84ff);
  font-weight: 500;
  margin: 0 0 1.5rem;
  font-style: italic;
}

.tl-item__features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  max-width: 360px;
}

.tl-item__features li {
  padding: 0.4rem 0;
  font-size: 0.9375rem;
  color: #6e6e73;
  border-bottom: 1px solid #e8e8ed;
}

.tl-item__features li:last-child {
  border-bottom: none;
}

.tl-item__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tl-item__spec {
  padding: 0.25rem 0.75rem;
  background: #f5f5f7;
  border-radius: 100px;
  font-size: 0.75rem;
  color: #6e6e73;
  white-space: nowrap;
}

.tl-item__price {
  font-size: 0.9375rem;
  color: #1d1d1f;
  font-weight: 600;
  margin: 0;
}

/* Event Item */
.tl-item--event {
  display: block;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 0;
}

.tl-item__event-card {
  background: #f5f5f7;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e8e8ed;
  transition: border-color 0.3s;
}

.tl-item--event:hover .tl-item__event-card {
  border-color: #d2d2d7;
}

.tl-item__event-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.tl-item__event-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tl-item__event-body {
  padding: 1.5rem;
}

.tl-item__event-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #1d1d1f;
}

.tl-item__event-desc {
  font-size: 0.9375rem;
  color: #86868b;
  line-height: 1.6;
  margin: 0;
}

/* ---- Scroll Animations ---- */
.tl-animate {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.tl-animate.tl-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger for alternating items */
.tl-item--device.tl-animate .tl-item__image {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tl-item--device.tl-animate .tl-item__content {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tl-item--device:nth-child(even).tl-animate .tl-item__image {
  transform: translateX(40px);
}

.tl-item--device:nth-child(even).tl-animate .tl-item__content {
  transform: translateX(-40px);
}

.tl-animate.tl-visible .tl-item__image,
.tl-animate.tl-visible .tl-item__content,
.tl-item--device.tl-animate.tl-visible .tl-item__image,
.tl-item--device.tl-animate.tl-visible .tl-item__content,
.tl-item--device:nth-child(odd).tl-animate.tl-visible .tl-item__image,
.tl-item--device:nth-child(odd).tl-animate.tl-visible .tl-item__content,
.tl-item--device:nth-child(even).tl-animate.tl-visible .tl-item__image,
.tl-item--device:nth-child(even).tl-animate.tl-visible .tl-item__content {
  opacity: 1;
  transform: translateX(0);
}

/* Hidden items (filtered out) */
.tl-item--hidden {
  display: none !important;
}

/* ---- Closing ---- */
.tl-closing {
  text-align: center;
  padding: 8rem 2rem;
}

.tl-closing__text {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 600;
  color: #d2d2d7;
  letter-spacing: -0.02em;
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
  .tl-timeline__line {
    left: 24px;
  }

  .tl-item {
    display: block;
    padding-left: 56px;
  }

  .tl-item__dot {
    left: 24px;
    top: 2.5rem;
    transform: translateX(-50%);
  }

  .tl-item--device {
    min-height: auto;
    padding: 2rem 0 2rem 56px;
  }

  .tl-item__image {
    padding: 1rem 0;
  }

  .tl-item__image img {
    max-height: 280px;
  }

  .tl-item--device:nth-child(even) .tl-item__content {
    text-align: left;
  }

  .tl-item--device:nth-child(even) .tl-item__features {
    margin-left: 0;
  }

  .tl-item--device:nth-child(even) .tl-item__specs {
    justify-content: flex-start;
  }

  .tl-item--event {
    max-width: none;
    padding-left: 56px;
  }

  .tl-year {
    text-align: left;
    padding-left: 56px;
  }

  .tl-year__number {
    padding: 0;
    background: none;
  }

  .tl-hero__title {
    font-size: 2.5rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .tl-item--device {
    gap: 2rem;
  }

  .tl-item__image img {
    max-height: 320px;
  }
}

/* ---- Accessibility ---- */
@media (prefers-reduced-motion: reduce) {
  .tl-animate {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .tl-item--device.tl-animate .tl-item__image,
  .tl-item--device.tl-animate .tl-item__content {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .tl-hero__eyebrow,
  .tl-hero__title,
  .tl-hero__subtitle,
  .tl-hero__scroll-hint {
    opacity: 1;
    animation: none;
    transform: none;
  }

  .tl-hero__arrow {
    animation: none;
  }
}

/* Focus styles */
.tl-item:focus-within {
  outline: 2px solid #0a84ff;
  outline-offset: 4px;
  border-radius: 12px;
}
