.timeline { container: timeline-container / inline-size; &-group { display: grid; gap: 1rem; margin-top:25px; grid-template-areas: "point date" "point event"; margin-inline: 1rem; @container timeline-container (min-width: 80ch) { grid-template-areas: "date point event"; grid-template-columns: 8fr 1fr 8fr; place-content: center; &:nth-child(even) { grid-template-areas: "event point date"; .timeline-date { --translation: -100px; justify-content: flex-start; } .timeline-event { --translation: -100px; margin-inline-start: auto; } } } } &-event { --easing: cubic-bezier(0.34, 1.56, 0.64, 1); --range-start: contain 30%; --range-end: contain 50%; --translation: 100px; grid-area: event; > :not(figure) { padding-inline: 1rem; } @container timeline-container (min-width: 80ch) { margin-block: 2rem; width: 440px; position: relative; } @media (prefers-reduced-motion: no-preference) { @supports (animation-timeline: view(block)) { top:-20px; animation: slide-in var(--easing) both; animation-timeline: view(block); animation-range: var(--range-start) var(--range-end); transform-origin: center center; transform: translateX(var(--translation)); } } figure { margin: 0; width: 100%; aspect-ratio: 16/9; overflow: hidden; border-top-right-radius: var(--border-radius); border-top-left-radius: var(--border-radius); img { display: block; height: 100%; width: 100%; object-fit: cover; object-position: center; } } } &-point { display: grid; grid-area: point; place-content: baseline; position: relative; width: 100%; span { --point-size: 50px; --point-color: #FEC20D; --easing: cubic-bezier(0.34, 1.56, 0.64, 1); --translation: 100px; align-items: center; aspect-ratio: 1; height: var(--point-size); background: #FEC20D; border-radius: 100%; display: flex; flex-direction: column; padding-top: 5px; font-size: 20px; color: #fff; font-weight: 600; border: 5px solid #FFEFC2; @media (prefers-reduced-motion: no-preference) { @supports (animation-timeline: view(block)) { animation: scale-up var(--easing) both; animation-timeline: view(block); animation-range: var(--range-start) var(--range-end); transform-origin: center center; } } } &::after { background-image: url(../img/web/timeline-line.png); content: ""; display: block; height: 100%; position: absolute; left: calc(45% - (10px / 2)); margin-inline: auto; width: 1px; top: 0px; z-index: -1; } } &-date { --range-start: contain 0%; --range-end: contain 15%; --translation: -100px; grid-area: date; @container timeline-container (min-width: 80ch) { --translation: -100px; align-items: center; display: flex; justify-content: flex-end; } @media (prefers-reduced-motion: no-preference) { @supports (animation-timeline: view(block)) { animation: fade-in linear both; animation-timeline: view(block); animation-range: var(--range-start) var(--range-end); transform: translateY(var(--translation)); } } } } @keyframes slide-in { to { opacity: 1; transform: translateX(0); } } @keyframes scale-up { 0% { scale: 1; } 75% { scale: 1.2; } 100% { scale: 1; } } @keyframes fade-in { 75% { } 100% { opacity: 1; transform: translateY(0); } } .message { background: yellow; font-size: 1.5rem; padding-inline: 2rem; padding-block: 3rem; > * { width: 60ch; } @supports (animation-timeline: view()) { display: none; } }