/* ==========================================================================
   About page (design system v3). Everything here is prefixed .about-
   The story reads in one column with a photo rail beside each chapter,
   a clickable timeline with a sticky side column, projects as cream cards,
   and a newsletter ask. One saturated moment: Nick on a yellow tile.
   ========================================================================== */

/* ---------- Intro ---------- */
.about-intro .split { align-items: center; }
.about-intro__copy > * + * { margin-top: 18px; }
.about-intro__copy .lede { margin-top: 14px; }
.about-intro__photo .photo { aspect-ratio: 4 / 3; }
.about-jump { display: flex; flex-wrap: wrap; gap: 6px 22px; padding-top: 6px; }
.about-jump a {
  color: var(--ink); font-weight: 600; font-size: 1rem; text-decoration: underline;
  text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 5px;
  transition: text-decoration-color 0.2s;
}
.about-jump a:hover { text-decoration-color: var(--ink); }

/* ---------- Story: a reading column with a photo rail beside it ---------- */
.about-story { padding-top: clamp(24px, 3vw, 40px); }
.about-chapter { display: grid; gap: 26px clamp(40px, 5vw, 72px); }
.about-chapter + .about-chapter { margin-top: clamp(32px, 4vw, 52px); }
.about-chapter__text > h2:first-child { margin-top: 0; }
.about-chapter__rail figcaption { margin-top: 12px; }
@media (min-width: 900px) {
  .about-chapter { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: start; }
  .about-chapter__rail { position: sticky; top: 100px; align-self: start; }
}
@media (max-width: 899px) {
  /* on phones the photo leads its chapter, so no screen is text only */
  .about-chapter__rail { order: -1; max-width: 460px; }
}
.about-story .photo { aspect-ratio: 4 / 3; }
.about-story .about-tesla { aspect-ratio: 3 / 2; }
.about-tesla img { object-position: 62% 50%; }
.about-turn { color: var(--ink); font-weight: 650; }
p.about-turn { margin-top: 1.4em; font-size: 1.2rem; }

/* Nick on a yellow tile: the page's one loud colour */
.about-me__tile {
  position: relative; overflow: hidden; aspect-ratio: 1; border-radius: var(--r-lg);
  background: var(--yellow);
}
.about-me__tile img { position: absolute; left: 0; right: 0; bottom: -4%; width: 100%; height: auto; }
.about-me figcaption { color: var(--ink); font-weight: 600; font-size: 1.05rem; }
@media (max-width: 899px) { .about-me { max-width: 300px; } }

/* Museum Hack: the line that lights up, beside the story (a cream card, not a slab) */
.about-mh {
  display: grid; gap: 24px clamp(36px, 5vw, 72px); align-items: center;
  margin-block: clamp(48px, 6vw, 84px);
  padding: clamp(26px, 4.5vw, 60px); border-radius: var(--r-lg); background: var(--cream);
}
@media (min-width: 900px) { .about-mh { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); } }
.about-mh__said {
  max-width: 24ch; margin: 0;
  font-size: clamp(1.9rem, 1.3rem + 1.9vw, 3rem); line-height: 1.1; letter-spacing: -0.02em;
}
.about-mh__said .is-fun {
  background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 90%, transparent 90%) no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.about-mh__text h2 { margin: 0 0 0.5em; }

/* ---------- Timeline: sticky side column + click a year to open it ---------- */
.about-timeline__grid { display: grid; gap: 34px clamp(40px, 5vw, 72px); }
@media (min-width: 900px) {
  .about-timeline__grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: start; }
}
/* the side column only pins when the screen is tall enough to show all of it */
@media (min-width: 900px) and (min-height: 1040px) {
  .about-timeline__side { position: sticky; top: 100px; align-self: start; }
}
.about-timeline__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; }
.about-timeline__head .note { margin: 0; color: var(--ink); font-size: 1.35rem; }
.about-timeline__sub { margin: 12px 0 0; color: var(--muted); }
.about-timeline__more { margin-top: 26px; }
.about-timeline__label { margin-bottom: 14px; color: var(--ink); font-weight: 600; }
@media (max-width: 899px) {
  /* phones: the timeline comes first, the blog cards follow it */
  .about-timeline__grid { row-gap: 0; }
  .about-timeline__side { display: contents; }
  .about-timeline__head, .about-timeline__sub { order: 0; }
  .about-years { order: 1; margin-top: 24px; }
  .about-timeline__more { order: 2; margin-top: 40px; }
}
.about-trips { display: grid; gap: 22px; margin-bottom: 10px; }
.about-trips .post { gap: 8px; }
.about-trips .post__img { aspect-ratio: 16 / 9; background: var(--white); }
.about-trips .post__img img { object-position: 50% 0; }
.about-trips .post h3 { font-size: 1.1rem; line-height: 1.3; }
.about-trips .post p { font-size: 0.98rem; }
@media (min-width: 560px) and (max-width: 899px) { .about-trips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.about-years { display: grid; gap: 8px; border-top: 0; }
.about-years li { display: block; padding: 0 18px; border: 0; border-radius: var(--r); background: var(--white); }
.about-years summary {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 11px 0; color: var(--ink); font-weight: 600; font-size: 1.08rem; line-height: 1.3;
  cursor: pointer; list-style: none;
}
.about-years summary::-webkit-details-marker { display: none; }
.about-years summary::after {
  content: "+"; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; font-size: 1.5rem; font-weight: 500; line-height: 1;
  transition: rotate 0.3s var(--bounce), background-color 0.2s;
}
.about-years summary:hover::after { background: var(--cream); }
.about-years details[open] > summary::after { rotate: 45deg; }
.about-years time {
  justify-self: start; margin-left: -8px; padding: 1px 8px; border-radius: 8px;
  transition: background-color 0.2s, rotate 0.3s var(--bounce);
}
.about-years summary:hover time { background: var(--yellow-soft); rotate: -3deg; }
.about-years details[open] time { background: var(--yellow); rotate: -4deg; }
.about-years cite { font-weight: inherit; }
.about-years__body { padding: 0 40px 20px 78px; }
.about-years details[open] .about-years__body { animation: pop-in 0.4s var(--bounce); }
.about-years__pic { width: min(100%, 360px); margin-top: 14px; border-radius: 10px; }
@media (min-width: 900px) {
  .about-years summary { grid-template-columns: 84px minmax(0, 1fr) auto; gap: 16px; font-size: 1.12rem; }
  .about-years time { font-size: 1.25rem; }
  .about-years__body { padding-left: 100px; }
}
@media (max-width: 480px) {
  .about-years li { padding-inline: 14px; }
  .about-years__body { padding: 0 0 18px; }
}

/* ---------- What I'm working on: cream cards in a grid ---------- */
.about-worksec .head--row p { max-width: 36ch; margin-top: 0; }
.about-work { display: grid; gap: 14px; }
@media (min-width: 640px) { .about-work { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .about-work { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.about-work a {
  position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%;
  padding: 22px 54px 22px 22px; border-radius: 16px; background: var(--cream);
  color: inherit; text-decoration: none;
  transition: background-color 0.2s, translate 0.3s var(--bounce);
}
.about-work a:hover { background: var(--yellow-soft); translate: 0 -3px; }
.about-work .list__title, .about-work .list__desc { align-self: stretch; }
.about-work a:hover .list__title { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 4px; text-underline-offset: 3px; }
.about-work__arrow {
  position: absolute; top: 20px; right: 20px; color: var(--ink); font-size: 1.4rem; line-height: 1;
  transition: translate 0.25s var(--bounce);
}
.about-work a:hover .about-work__arrow { translate: 4px -4px; }

/* ---------- Press ---------- */
.about-press { padding-top: 0; text-align: center; }
.about-press .muted { max-width: 46ch; margin: 10px auto 30px; }
.about-press__logos { max-width: 1000px; margin-inline: auto; }
.about-press__logos img { height: 22px; }
.about-press__logos img.is-short { height: 15px; }
@media (min-width: 760px) {
  .about-press__logos img { height: 26px; }
  .about-press__logos img.is-short { height: 17px; }
}

/* ---------- Newsletter: one wide card, two columns ---------- */
.about-news { display: grid; gap: 18px clamp(32px, 5vw, 64px); padding: clamp(26px, 4.5vw, 56px); }
@media (min-width: 900px) { .about-news { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; } }
.about-news__lead > *, .about-news__body > * { margin: 0; }
.about-news__lead > * + * { margin-top: 16px; }
.about-news__body > * + * { margin-top: 16px; }
.about-news__cta { color: var(--ink); font-weight: 650; }
.about-news__body > .about-news__end { margin-top: 22px; }

/* ==========================================================================
   Motion (page-specific). Same contract as motion.css: the styles above are
   the finished state; everything below only runs with
   prefers-reduced-motion: no-preference, and the scroll-driven parts only
   where animation-timeline: view() is supported. Individual translate /
   scale / opacity / clip-path properties only, so the hover and open
   states (year chips, arrows, cards) keep working.
   ========================================================================== */
@keyframes ab-sweep {
  0% { clip-path: inset(0 100% 0 0); }
  46%, 54% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 100%); }
}
@keyframes ab-photo { 0%, 33% { opacity: 0; scale: 1.22; } 34% { opacity: 1; scale: 1.22; } 100% { opacity: 1; scale: 1; } }
@keyframes ab-open { from { clip-path: inset(7% 9% round 44px); } to { clip-path: inset(0 round 22px); } }
@keyframes ab-pop { from { translate: 0 18%; scale: 0.9; } to { translate: 0 0; scale: 1; } }
@keyframes ab-chip { from { opacity: 0; translate: -72px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes ab-spine { to { scale: 1 1; } }
@keyframes ab-dot { from { top: 0%; } to { top: 100%; } }

@media (prefers-reduced-motion: no-preference) {
  /* Intro photo: a yellow block sweeps across and leaves the photo behind */
  .about-intro__photo .photo { position: relative; }
  .about-intro__photo .photo::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: var(--yellow); clip-path: inset(0 0 0 100%);
    animation: ab-sweep 1.15s 0.2s cubic-bezier(0.76, 0, 0.24, 1) both;
  }
  .about-intro__photo .photo img { animation: ab-photo 1.7s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .about-intro__photo figcaption { animation: rise 0.6s 1.1s var(--ease) both; }

  @supports (animation-timeline: view()) {
    /* Intro photo drifts up as you scroll into the story */
    .about-intro__photo { animation: m-drift linear both; animation-timeline: view(); animation-range: exit -10% exit 100%; }

    /* Story photos open up from a smaller frame (the image inside drifts via .parallax) */
    .about-story .photo { animation: ab-open linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; }

    /* Nick pops up out of his yellow tile */
    .about-me__tile { view-timeline-name: --me; }
    .about-me__tile img { animation: ab-pop linear both; animation-timeline: --me; animation-range: entry 10% cover 45%; transform-origin: 50% 100%; }

    /* Museum Hack line: words light up (motion.css .lit), and the highlighter draws under "more fun." */
    .about-mh__said .w.is-fun { background-size: 0% 100%; animation-name: m-lit, m-draw; }

    /* Timeline: each row rises in, then its year chip slides in from the left */
    .about-years.stagger > * { view-timeline-name: --yr; animation-range: entry 0% cover 24%; }
    .about-years time { animation: ab-chip linear both; animation-timeline: --yr; animation-range: entry 10% cover 34%; }
    @media (min-width: 900px) {
      /* a spine down the left that keeps pace with the middle of the screen */
      .about-years { position: relative; view-timeline-name: --years; }
      .about-years::before {
        content: ""; position: absolute; top: 0; bottom: 0; left: -36px; width: 3px; border-radius: 3px;
        background: var(--ink); transform-origin: 50% 0; scale: 1 0;
        animation: ab-spine linear both; animation-timeline: --years; animation-range: entry 50% exit 50%;
      }
      .about-years::after {
        content: ""; position: absolute; top: 0; left: -41.5px; width: 14px; height: 14px; margin-top: -7px;
        border: 2.5px solid var(--ink); border-radius: 50%; background: var(--yellow);
        animation: ab-dot linear both; animation-timeline: --years; animation-range: entry 50% exit 50%;
      }
    }

    /* What I'm working on: cards build up as you scroll */
    .about-work.stagger > * { animation-range: entry 0% cover 22%; }

    /* Press logos cascade in, left to right */
    .about-press__logos.stagger > * { animation-range: cover calc(var(--k, 0) * 2.4%) cover calc(16% + var(--k, 0) * 2.4%); }
    .about-press__logos > :nth-child(2) { --k: 1; }
    .about-press__logos > :nth-child(3) { --k: 2; }
    .about-press__logos > :nth-child(4) { --k: 3; }
    .about-press__logos > :nth-child(5) { --k: 4; }
    .about-press__logos > :nth-child(6) { --k: 5; }
    .about-press__logos > :nth-child(7) { --k: 6; }
    .about-press__logos > :nth-child(8) { --k: 7; }
    .about-press__logos > :nth-child(9) { --k: 8; }

    /* Newsletter: the highlighter draws itself under "Friends Newsletter" */
    .about-news .lede { view-timeline-name: --news; }
    .about-news .hl { background-repeat: no-repeat; animation: m-draw linear both; animation-timeline: --news; animation-range: entry 100% cover 55%; }
  }
}
