/* ==========================================================================
   S · About, on the wall's thirds, kept short. A small stack of photos in the
   first third, sticky; the rest in the other two. On a phone: the hello, the
   photos, then the rest.
   ========================================================================== */

.ab {
  overflow-x: clip;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "stack intro  intro"
    "stack blocks blocks"
    "stack main   main";
  grid-template-rows: auto auto 1fr;
  column-gap: var(--gap);
  padding: var(--page-top) var(--gutter) 0;
}

.ab-intro { grid-area: intro; max-width: 640px; text-wrap: pretty; }
/* "I'm Pablo" is a label like the others; the words under every label are black. */
.ab-intro p { max-width: 560px; text-wrap: pretty; }

/* Beside "I'm Pablo", the way back to the iPod (/ipod): a small iPod, its words sliding out on hover.
   On a phone, with no hover, the words stay. */
.ab-hello { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.ab-hello .ab-label { margin-bottom: 0; }
.ab-ipod { display: inline-flex; align-items: center; gap: 6px; align-self: center; color: var(--muted); font-size: var(--t-body); transition: color 150ms ease-out; }
.ab-ipod svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: var(--hand-stroke); stroke-linecap: round; stroke-linejoin: round; transition: transform 300ms var(--ease-out); }
.ab-ipod span { white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .ab-ipod span { opacity: 0; translate: -4px 0; transition: opacity 200ms ease-out, translate 300ms var(--ease-out); }
  .ab-ipod:hover, .ab-ipod:focus-visible { color: var(--fg); }
  .ab-ipod:hover span, .ab-ipod:focus-visible span { opacity: 1; translate: 0 0; }
  .ab-ipod:hover svg { transform: rotate(-8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ab-ipod span, .ab-ipod svg { transition: none; }
}
.ab-intro p + p { margin-top: 0.75em; }

/* Who I am, how I work, what I do. */
/* The same space between every label and the words above it. */
.ab-blocks { grid-area: blocks; margin-top: 40px; }
.ab-blocks > div + div { margin-top: 40px; }
.ab-blocks p { max-width: 560px; text-wrap: pretty; }

.ab-main { grid-area: main; }
.ab-main > section { margin-top: 112px; }

.ab-label { margin-bottom: 12px; font-size: var(--t-body); color: var(--muted); }
.ab-main p { max-width: 560px; text-wrap: pretty; }

.ab-link {
  text-decoration: underline;
  text-decoration-color: rgb(0 0 0 / 0.2);
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease-out;
}

@media (hover: hover) {
  .ab-link:hover { text-decoration-color: currentColor; }
}

/* --- What I do: pills that lift a piece of work -------------------------------------- */

.ab-services { margin-top: 28px; gap: 8px; }

.page-s .ab-services .pill {
  position: relative;
  height: var(--pill-h);
  padding: 0 20px;
  background: var(--surface);
  color: var(--fg);
  font-size: var(--t-ui);
  font-weight: var(--strong);
  transition: background-color 150ms ease-out, scale 150ms ease-out;
}

.ab-peek {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 5;
  width: 176px;
  padding: 6px 6px 10px;
  border-radius: 20px;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06), 0 12px 32px rgb(0 0 0 / 0.12);
  font-size: var(--t-sm);
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: 24px 0;
  transition: opacity 120ms ease-in, transform 120ms ease-in;
}

.ab-peek img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 8px;
}

.ab-peek span { display: block; padding: 0 6px; }

@media (hover: hover) and (pointer: fine) {
  .page-s .ab-services a.pill:hover { background: var(--surface-hover); }
  .ab-service:hover .ab-peek {
    opacity: 1;
    transform: none;
    transition: opacity 180ms ease-out, transform 240ms var(--expo-out);
  }
}

.ab-service:focus-visible .ab-peek { opacity: 1; transform: none; }
.page-s .ab-services a.pill:active { scale: 0.97; }

/* --- Selected clients: one line; contact: pills ------------------------------------------- */

.ab-more { margin-top: 20px; }

/* Contact: the same pills as What I do, no icons. The form first, in the black of Contact; the
   email copies itself, bounces and swaps to "Copied" with the fist bump, as the footer does. */
.ab-contact .pills { gap: 8px; }

.page-s .ab-contact .pill {
  height: var(--pill-h);
  padding: 0 20px;
  font-size: var(--t-ui);
  font-weight: var(--strong);
  transition: background-color 150ms ease-out, scale 150ms ease-out;
}

.page-s .ab-contact .pill--flat { background: var(--surface); color: var(--fg); }
.page-s .ab-contact .ab-cta { background: rgb(0 0 0 / 0.8); color: #fff; }
.page-s .ab-contact a.pill:active { scale: 0.97; }
.page-s .ab-mail[data-copied] { --squash: 0.94; animation: hi-boing 650ms; }
.ab-mail .s-footer__swap { justify-items: center; }

@media (hover: hover) {
  .page-s .ab-contact .ab-cta:hover { background: rgb(0 0 0 / 0.92); }
}

.ab-clients p { max-width: 720px; line-height: 1.6; }
.ab-clients a { text-decoration: underline; text-decoration-color: rgb(0 0 0 / 0.15); text-underline-offset: 3px; }

@media (hover: hover) {
  .ab-clients a:hover { text-decoration-color: currentColor; }
}

/* --- The photos: a small stack that shuffles --------------------------------------------------- */

.ab-stack {
  grid-area: stack;
  position: sticky;
  top: calc(var(--bar) + 40px);
  align-self: start;
  width: min(100%, 340px);
}

.ab-stack__cards {
  position: relative;
  margin: 12px 16px 0;
  aspect-ratio: 4 / 5;
  cursor: pointer;
}

.ab-stack__card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  user-select: none;
  -webkit-user-drag: none;
  --x: 0px; --y: 0px; --r: 0deg; --s: 1;
  transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s));
  transition: transform 520ms var(--expo-out), opacity 300ms ease-out;
}

.ab-stack__card[data-pos="0"] { z-index: 4; }
.ab-stack__card[data-pos="1"] { z-index: 3; --x: 8px; --y: -6px; --r: 3deg; --s: 0.97; }
.ab-stack__card[data-pos="2"] { z-index: 2; --x: -8px; --y: -10px; --r: -3deg; --s: 0.94; }
.ab-stack__card[data-pos="hidden"] { z-index: 1; --s: 0.92; opacity: 0; }

.ab-stack__card[data-pos="out"] {
  z-index: 5;
  --x: -70%; --y: 4%; --r: -12deg;
  opacity: 0;
  transition: transform 420ms var(--expo-out), opacity 160ms ease-in 180ms;
}

.ab-stack__caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 16px 0;
  font-size: var(--t-sm);
}

.ab-stack__caption button { color: var(--muted); }

@media (hover: hover) {
  .ab-stack__caption button:hover { color: var(--fg); }
}

/* One photo stands still, the same width as the stack would be. */
.ab-photo img {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px 0;
  object-fit: cover;
  border-radius: var(--radius);
}

/* The footer comes well after the contact. */
.page-s:has(.ab) { --foot-gap: clamp(160px, 22vh, 260px); }

@media (prefers-reduced-motion: reduce) {
  .ab-stack__card,
  .ab-stack__card[data-pos="out"],
  .ab-peek,
  .ab-contact .pill { transition: none; }
}

/* --- Phone ------------------------------------------------------------------------------------------ */

@media (max-width: 900px) {
  .ab {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "stack" "blocks" "main";
    grid-template-rows: none;
  }

  .ab-stack { position: static; width: min(100%, 320px); margin: 36px auto 0; }
  .ab-stack__card[data-pos="out"] { --x: -60%; }
  .ab-main > section { margin-top: 72px; }
  .ab-blocks { margin-top: 48px; }

  .ab-peek { display: none; }
}
