/* ===========================================================================
   About — the long version of the story.
   Apple-clean base (alex эппл tokens) + strato's serif, used sparingly.
   Moments: photo table · terminal · first websites · route · globe · life table.
   Copy/visual rules: .claude/skills/de-slop
   =========================================================================== */

.ab { overflow-x: clip; }

/* Reveal on scroll (only once JS is ready) */
.reveal-ready .reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .8s cubic-bezier(.2,.8,.2,1); }
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.ab-hero {
  max-width: 980px;
  padding-block: clamp(72px, 13vh, 168px) clamp(16px, 4vw, 48px);
}
.ab-hero h1 {
  font-size: calc(clamp(46px, 8vw, 112px) * var(--text-scale, 1));
  line-height: .96; letter-spacing: -.058em; font-weight: 700;
}
.ab-hero h1 em {
  display: block; margin-top: .04em; color: var(--blue);
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.06em; letter-spacing: -.03em;
}
.ab-hero__lead {
  max-width: 600px; margin-top: 30px; color: var(--secondary);
  font-size: calc(clamp(16px, 1.5vw, 20px) * var(--text-scale, 1)); line-height: 1.7;
}

/* ── Photo tables (hero + life) ───────────────────────────────────────── */
.photo-table { position: relative; touch-action: pan-y; }
.photo-table--open { height: clamp(560px, 52vw, 720px); margin-top: clamp(28px, 4vw, 48px); }

.polaroid {
  --dx: 0px; --dy: 0px; --s: 1;
  position: absolute; left: var(--x); top: var(--y); width: var(--w); z-index: 1;
  margin: 0; padding: clamp(7px, .8vw, 12px) clamp(7px, .8vw, 12px) clamp(28px, 3.2vw, 46px); border-radius: 4px;
  background: #fff;
  box-shadow: 0 18px 40px #1b1f2a26, 0 2px 6px #1b1f2a14;
  transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(var(--s));
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  animation: polaroid-drop .8s cubic-bezier(.2,.9,.25,1.15) backwards;
  animation-delay: calc(var(--i, 0) * 110ms + 200ms);
}
.polaroid:hover { --s: 1.03; box-shadow: 0 26px 50px #1b1f2a30, 0 2px 6px #1b1f2a14; }
.polaroid:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.polaroid.is-dragging { --s: 1.07; cursor: grabbing; transition: box-shadow .3s; box-shadow: 0 34px 70px #1b1f2a3a; }
.polaroid img {
  display: block; width: 100%; aspect-ratio: var(--ar, 1); object-fit: cover; object-position: var(--op, 50% 40%);
  border-radius: 2px; pointer-events: none; -webkit-user-drag: none;
}
/* Tables further down drop their photos when they scroll into view */
.reveal-ready .reveal:not(.is-visible) .polaroid { animation: none; opacity: 0; }
@keyframes polaroid-drop {
  from { opacity: 0; transform: translate(var(--dx), calc(var(--dy) - 40px)) rotate(calc(var(--r) * 2.4)) scale(1.18); }
}

/* ── Years (chapters) ─────────────────────────────────────────────────── */
.ab-years { margin-top: clamp(40px, 6vw, 80px); }
.ab-year {
  display: grid; grid-template-columns: clamp(110px, 16vw, 240px) minmax(0, 1fr);
  gap: clamp(16px, 4vw, 64px);
  padding-block: clamp(52px, 7vw, 104px);
  border-top: 1px solid var(--line);
}
.ab-year__num {
  position: sticky; top: 40px; align-self: start;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(56px, 7.6vw, 120px); line-height: .8; letter-spacing: -.04em;
  font-variant-numeric: lining-nums;
}
.ab-year h2 {
  max-width: 22ch;
  font-size: calc(clamp(28px, 3.2vw, 46px) * var(--text-scale, 1));
  line-height: 1.06; letter-spacing: -.045em; font-weight: 650;
}
.ab-text p { max-width: 58ch; margin-top: 18px; color: var(--secondary); font-size: calc(clamp(15px, 1.25vw, 17px) * var(--text-scale, 1)); line-height: 1.78; }
.ab-text p:first-of-type { margin-top: 20px; }

.ab-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 4.5vw, 72px); align-items: center; }
.ab-split--flip > :first-child { order: 2; }

/* Chapter photos */
.ab-photo { margin: 0; }
.ab-photo img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border: 1px solid #fff; border-radius: var(--radius);
  box-shadow: 0 18px 44px #1b1f2a1a;
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.ab-photo:hover img { transform: rotate(0) scale(1.01); }
.ab-photo--portrait { width: min(100%, 420px); justify-self: center; }
.ab-photo--portrait img { aspect-ratio: 4 / 5; }
[data-theme="dark"] .ab-photo img { border-color: #3c404a; box-shadow: 0 18px 44px #0005; }

/* Chapter 2010: server photo with the terminal tucked into its corner */
.ab-media-term { position: relative; padding-bottom: clamp(40px, 6vw, 72px); }
.ab-media-term .ab-photo img { aspect-ratio: 3 / 2; }

/* 2010: terminal */
.ab-term {
  margin: 0; padding-bottom: 18px;
  border: 1px solid #ffffff14; border-radius: 16px;
  background: #1b1c21; color: #e8e8ec;
  box-shadow: 0 30px 60px #0b0c1033;
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  transform: rotate(1.2deg);
}
.ab-media-term .ab-term {
  position: absolute; right: -5%; bottom: 0; z-index: 2; width: min(360px, 82%);
  transform: rotate(2deg);
}
.ab-term__bar { display: flex; gap: 7px; padding: 13px 15px 12px; }
.ab-term__bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.ab-term__bar i:nth-child(2) { background: #febc2e; }
.ab-term__bar i:nth-child(3) { background: #28c840; }
.ab-term__line { display: block; padding: 0 20px; white-space: pre-wrap; }
.ab-term__line--out { color: #b9bac4; padding-left: 36px; }
.ab-term .p { color: #30d158; }
.reveal-ready .ab-term__line { opacity: 0; transition: opacity .15s; transition-delay: calc(var(--n) * 320ms + 450ms); }
.reveal-ready .is-visible .ab-term__line { opacity: 1; }
.ab-term__cursor { display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -3px; background: #e8e8ec; animation: term-blink 1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }

/* 2014: first websites — the year is the label */
.ab-webs {
  --view-h: clamp(220px, 24vw, 380px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 30px);
  margin-top: clamp(32px, 4vw, 52px);
}
.webwin {
  position: relative; display: block; width: 100%; margin: 0; padding: 0;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: zoom-in;
  transform: rotate(var(--r, 0deg)) translateY(var(--ty, 0px));
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.webwin:nth-child(1) { --r: -2.5deg; --ty: 10px; }
.webwin:nth-child(2) { --r: 1.5deg; }
.webwin:nth-child(3) { --r: -1deg; --ty: 16px; }
.webwin:nth-child(4) { --r: 2deg; --ty: 4px; }
.webwin:nth-child(5) { --r: -1.5deg; --ty: 12px; }
.webwin:nth-child(6) { --r: 1.2deg; --ty: 6px; }
.webwin:hover, .webwin:focus-visible { z-index: 2; transform: rotate(0) translateY(-8px) scale(1.04); }
.webwin:focus-visible { outline: none; }
.webwin:focus-visible .webwin__frame { outline: 3px solid var(--blue); outline-offset: 3px; }
.webwin__frame {
  display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  box-shadow: 0 12px 30px #1b1f2a14; transition: box-shadow .4s;
}
.webwin:hover .webwin__frame { box-shadow: 0 26px 54px #1b1f2a29; }
[data-theme="dark"] .webwin__frame { background: #23262e; box-shadow: 0 12px 30px #0005; }
.webwin__bar { display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; background: #f2f2f5; border-bottom: 1px solid var(--line); }
[data-theme="dark"] .webwin__bar { background: #2b2e36; }
.webwin__bar i { width: 7px; height: 7px; border-radius: 50%; background: #d4d5db; }
.webwin__view { display: block; height: var(--view-h); overflow: hidden; background: #fafafa; }
.webwin__view img { display: block; width: 100%; height: auto; transition: transform .9s cubic-bezier(.2,.8,.2,1); }
.webwin:hover .webwin__view img { transform: translateY(calc(-100% + var(--view-h))); transition: transform var(--dur, 7s) linear; }
.webwin__year {
  display: block; margin-top: 12px;
  font-family: var(--serif); font-size: clamp(36px, 3.6vw, 54px); font-weight: 400; line-height: 1; letter-spacing: -.03em;
}

/* 2016: zaza.ae — paper to finished screen */
.ab-flow {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center;
  gap: clamp(8px, 1.4vw, 22px); margin-top: clamp(28px, 3.4vw, 44px);
}
.ab-flow__step { margin: 0; }
.ab-flow__frame {
  display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  box-shadow: 0 12px 30px #1b1f2a14; transition: box-shadow .4s, transform .4s cubic-bezier(.2,.8,.2,1);
}
.ab-flow__frame img { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: cover; object-position: center; }
.ab-flow__step:last-child .ab-flow__frame img { object-position: left center; }
.ab-flow__step:hover .ab-flow__frame, .ab-flow__step:focus-within .ab-flow__frame {
  transform: translateY(-6px); box-shadow: 0 26px 54px #1b1f2a29;
}
[data-theme="dark"] .ab-flow__frame { background: #23262e; box-shadow: 0 12px 30px #0005; }
.ab-flow__arrow { font-size: clamp(20px, 2.4vw, 30px); line-height: 1; color: var(--secondary); text-align: center; user-select: none; }
.ab-flow__note { margin-top: clamp(14px, 1.6vw, 20px); color: var(--secondary); font-size: calc(14px * var(--text-scale, 1)); }
@media (max-width: 760px) {
  .ab-flow { grid-template-columns: 1fr; justify-items: center; gap: 12px; }
  .ab-flow__step { width: min(100%, 460px); }
  .ab-flow__arrow { transform: rotate(90deg); }
}

/* 2016: mobile apps — phone screens */
.ab-apps__lead { margin-top: clamp(30px, 3.6vw, 48px); color: var(--secondary); font-size: calc(15px * var(--text-scale, 1)); }
.ab-apps {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.4vw, 20px);
  margin-top: clamp(16px, 2vw, 24px);
}
.ab-phone {
  margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff;
  box-shadow: 0 12px 30px #1b1f2a14;
  transform: rotate(var(--r, 0deg)) translateY(var(--ty, 0px));
  transition: box-shadow .4s, transform .4s cubic-bezier(.2,.8,.2,1);
}
.ab-phone:nth-child(1) { --r: -2deg; --ty: 10px; }
.ab-phone:nth-child(2) { --r: 1.4deg; }
.ab-phone:nth-child(3) { --r: -1.2deg; --ty: 8px; }
.ab-phone:nth-child(4) { --r: 1.8deg; --ty: 2px; }
.ab-phone:nth-child(5) { --r: -1.6deg; --ty: 12px; }
.ab-phone:hover { z-index: 2; transform: rotate(0) translateY(-8px) scale(1.04); box-shadow: 0 26px 54px #1b1f2a29; }
.ab-phone img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; object-position: top center; }
[data-theme="dark"] .ab-phone { background: #23262e; box-shadow: 0 12px 30px #0005; }
@media (max-width: 760px) {
  .ab-apps {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-inline: calc(var(--page-gutter) * -1); padding: 10px var(--page-gutter) 16px;
  }
  .ab-phone { flex: 0 0 min(46%, 190px); scroll-snap-align: center; --r: 0deg !important; --ty: 0px !important; }
}

/* Full-page viewer */
.ab-viewer {
  width: min(1100px, calc(100% - 32px)); height: calc(100svh - 48px); max-height: none;
  padding: 0; border: 0; border-radius: 20px; overflow: hidden;
  background: var(--paper); color: var(--ink); box-shadow: 0 40px 120px #0006;
}
.ab-viewer[open] { display: grid; grid-template-rows: auto 1fr; }
.ab-viewer::backdrop { background: #0f1115b8; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ab-viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px 8px 20px; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 26px; }
.ab-viewer__bar button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer; }
.ab-viewer__bar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ab-viewer__scroll { overflow: auto; overscroll-behavior: contain; }
.ab-viewer__scroll img { display: block; width: 100%; height: auto; }

/* 2018: the route, drawn when it scrolls into view (click to replay) */
/* 2018 route — a flat map in the globe's style on a transparent card */
.ab-route { position: relative; margin-top: clamp(28px, 4vw, 48px); cursor: pointer; }
.ab-route__map { position: relative; aspect-ratio: 16 / 7; }
.ab-route__map canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ab-route__place { position: absolute; transform: translate(-50%, 14px); text-align: center; pointer-events: none; }
.ab-route__place b { display: block; font-family: var(--serif); font-size: clamp(20px, 2.4vw, 32px); font-weight: 400; line-height: 1; white-space: nowrap; }
.ab-route__place span { display: block; margin-top: 3px; color: var(--secondary); font-size: 12px; }
.ab-route__place--to { opacity: .4; transition: opacity .4s; }
.ab-route.is-arrived .ab-route__place--to { opacity: 1; }
.ab-route__km {
  position: absolute; left: 50%; top: 2%; transform: translateX(-50%); z-index: 2; margin: 0;
  font-family: var(--serif); font-size: clamp(30px, 4vw, 60px); line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ab-route__km span { color: var(--secondary); font-size: .45em; margin-left: .2em; }

.ab-cta {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; margin-top: 30px; padding: 0 22px;
  border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 600;
  transition: transform .18s, opacity .18s;
}
.ab-cta:hover { transform: translateY(-2px); opacity: .9; }

/* ── Globe, then life ─────────────────────────────────────────────────── */
.ab-section { padding-top: clamp(56px, 8vw, 110px); border-top: 1px solid var(--line); }
.ab-section > h2 {
  text-align: center;
  font-size: calc(clamp(36px, 4.6vw, 68px) * var(--text-scale, 1)); line-height: 1; letter-spacing: -.055em; font-weight: 700;
}
.ab-section > p { margin-top: 16px; color: var(--secondary); font-size: calc(17px * var(--text-scale, 1)); text-align: center; }
.ab-section .travel-globe { margin-top: clamp(16px, 3vw, 32px); }
.ab-section + .ab-section { margin-top: clamp(40px, 6vw, 80px); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .ab-webs { grid-template-columns: repeat(2, minmax(0, 1fr)); --view-h: clamp(280px, 40vw, 460px); }
}
@media (max-width: 880px) {
  .ab-hero { grid-template-columns: 1fr; min-height: 0; }
  .photo-table--open { height: clamp(700px, 210vw, 860px); }
  .polaroid { left: var(--mx, var(--x)); top: var(--my, var(--y)); width: var(--mw, var(--w)); }
  .ab-year { grid-template-columns: 1fr; gap: 6px; }
  .ab-year__num { position: static; font-size: 56px; }
  .ab-split { grid-template-columns: 1fr; }
  .ab-split--flip > :first-child { order: 0; }
  .ab-photo--portrait { width: 100%; }
  .ab-media-term { padding-bottom: 0; }
  .ab-media-term .ab-term { position: static; width: 94%; margin: -36px 0 0 auto; }
  .ab-term { font-size: 12.5px; transform: none; }
  .ab-webs {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-inline: calc(var(--page-gutter) * -1); padding: 12px var(--page-gutter) 18px;
  }
  .webwin { flex: 0 0 min(64%, 280px); scroll-snap-align: center; --r: 0deg !important; --ty: 0px !important; }
}
/* Phones: keep the corner pouch above the bottom navigation */
@media (max-width: 600px) {
  :root .pouch-corner { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 72px); }
}
/* Phones: the corner pouch waits until the reader reaches "Outside work" */
@media (max-width: 880px) {
  .pouch-corner { transition: opacity .35s, visibility 0s .35s; }
  body:not(.pouch-near) .pouch-corner { opacity: 0; visibility: hidden; }
  body.pouch-near .pouch-corner { transition: opacity .35s; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-ready .reveal, .reveal-ready .ab-term__line { opacity: 1; transform: none; transition: none; }
  .polaroid { animation: none; transition: none; }
  .webwin, .webwin__view img { transition: none; }
  .webwin:hover .webwin__view img { transform: none; }
  .ab-term__cursor { animation: none; }
}
