/* ============================================================
   Ink & Cerulean — Eman Abd El Maksoud portfolio
   Palette:  paper #A5BCD6 · sceptre #5D1E33 · soil #351E28
   ============================================================ */

:root {
  --paper:        #A5BCD6;
  --paper-tint:   #B8CDE3;   /* raised card on paper */
  --paper-light:  #F4F7FA;   /* high-contrast surface */
  --sceptre:      #5D1E33;   /* headlines / brand */
  --soil:         #351E28;   /* body text / dark section */

  --line:         rgba(53, 30, 40, .14);
  --line-strong:  rgba(53, 30, 40, .28);
  --ink-70:       rgba(53, 30, 40, .78);
  --ink-50:       rgba(53, 30, 40, .55);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius:    .25rem;
  --radius-lg: .5rem;

  --shell:  1280px;
  --gutter: 24px;
  --margin: clamp(20px, 5vw, 64px);
  --section: clamp(56px, 8vw, 96px);
  --nav-h: 64px;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  background: var(--paper);
  color: var(--soil);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--sceptre);
  outline-offset: 3px;
  border-radius: 2px;
}

/* icon sizing — all inline SVGs are stroked line icons */
svg[viewBox="0 0 24 24"] {
  width: 1.15em; height: 1.15em;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

/* the WhatsApp mark is a solid glyph, not a line icon */
svg.icon-wa[viewBox] { fill: currentColor; stroke: none; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--soil); color: var(--paper);
  padding: 10px 16px; border-radius: var(--radius);
}
.skip-link:focus { left: 16px; }

/* ---------- layout primitives ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--margin);
}

.section { padding-block: var(--section); }
.section--tint { background: rgba(53, 30, 40, .05); }
.section--dark { background: var(--soil); color: var(--paper); }

/* the "shelf" — hairline burgundy rules stacking the page into rows */
.section + .section:not(.section--dark) { border-top: 1px solid var(--line-strong); }
.section--tint + .section:not(.section--dark) { border-top-color: var(--line); }

.shelf {
  border: 0; height: 1px;
  background: var(--line-strong);
  margin-block: clamp(40px, 6vw, 64px);
}
.shelf--onDark { background: rgba(165, 188, 214, .22); }

.section__title {
  font: 600 clamp(28px, 4vw, 40px)/1.2 var(--serif);
  color: var(--sceptre);
  letter-spacing: -.01em;
}
.section--dark .section__title { color: var(--paper); }

.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--gutter); margin-bottom: 40px; flex-wrap: wrap;
}
.rule { display: block; width: 96px; height: 1px; background: var(--sceptre); margin-top: 10px; }

.label {
  font: 600 12px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-50);
}
.label--accent { color: var(--sceptre); }
.label--muted  { color: var(--ink-50); }
.label--onDark { color: rgba(165, 188, 214, .65); margin-bottom: 10px; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(165, 188, 214, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .3s var(--ease);
}
.nav.is-stuck { box-shadow: 0 2px 14px rgba(53, 30, 40, .12); }

.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 16px; }

.nav__brand {
  font: italic 700 clamp(18px, 2.4vw, 24px)/1 var(--serif);
  color: var(--sceptre);
  white-space: nowrap;
}

.nav__links { display: flex; gap: 32px; }
.nav__links a {
  position: relative;
  font: 600 14px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--soil); opacity: .68;
  transition: opacity .25s var(--ease);
  padding-block: 6px;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--soil);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .32s var(--ease);
}
.nav__links a:hover { opacity: 1; }
.nav__links a:hover::after,
.nav__links a.is-active::after { transform: scaleX(1); }
.nav__links a.is-active { opacity: 1; }

.nav__contact { display: none; }

.nav__actions { display: flex; align-items: center; gap: 14px; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  color: var(--soil);
  transition: transform .25s var(--ease), background-color .25s var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { transform: translateY(-2px); background: rgba(53, 30, 40, .07); }
.icon-btn--onDark { color: var(--paper); }
.icon-btn--onDark:hover { background: rgba(165, 188, 214, .12); }

.nav__toggle {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: none; cursor: pointer;
  padding: 10px 8px;
  flex-direction: column; justify-content: space-between;
}
.nav__toggle span { display: block; height: 1.5px; background: var(--soil); transition: transform .3s var(--ease), opacity .2s; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding-top: calc(var(--nav-h) + var(--section));
  padding-bottom: var(--section);
}

.hero__portrait { position: relative; width: 240px; aspect-ratio: 1; }
.hero__portrait::after {   /* "stamped" offset frame */
  content: ""; position: absolute; inset: -6px -6px auto auto;
  width: 100%; height: 100%;
  border: 2px solid var(--sceptre); border-radius: var(--radius-lg);
  opacity: .35; z-index: -1;
  transform: translate(8px, 8px);
}
.hero__portrait img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper-light);
}

.hero__name {
  font: italic 700 clamp(36px, 6.2vw, 64px)/1.05 var(--serif);
  letter-spacing: -.02em;
  color: var(--sceptre);
  margin-block: 12px 8px;
}
.hero__role { font: 600 clamp(22px, 3.2vw, 36px)/1.2 var(--serif); color: var(--sceptre); }
.hero__bio  { margin-top: 16px; max-width: 46ch; color: var(--ink-70); }

.hero__contacts { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 28px; }
.hero__contacts a {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 15px/1 var(--sans);
  padding-block: 4px;
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease);
}
.hero__contacts a:hover { border-bottom-color: var(--soil); }
.hero__contacts svg { width: 17px; height: 17px; color: var(--sceptre); }

/* ---------- cards ---------- */
.card {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.about {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(32px, 5vw, 64px); align-items: start;
}
/* the heading sits inside the left column, not above the grid, so the
   "Published in" panel starts level with it instead of a block lower */
.about__text { max-width: 62ch; }
.about__text .section__title { margin-bottom: 28px; }
/* the heading carries more leading above its caps than the 12px label does,
   so nudge the panel down to put the two cap lines level */
.about .published { padding-top: calc(clamp(28px, 4vw, 40px) * .15 - 2px); }
.about__text p + p { margin-top: 18px; }
.about__text p { color: var(--ink-70); font-size: 1.08em; }

/* published in — the four mastheads, deep-linking into the filtered archive */
.published__list { margin-top: 18px; border-top: 1px solid var(--line-strong); }
.published__list li { border-bottom: 1px solid var(--line); }
.published__list a {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 16px 4px;
  transition: padding-left .3s var(--ease), background-color .3s var(--ease);
}
.published__list a:hover { padding-left: 12px; background: rgba(255, 255, 255, .28); }
.published__name { font: 600 clamp(18px, 2vw, 21px)/1.3 var(--serif); color: var(--sceptre); }
.published__meta {
  font: 600 11px/1.2 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-50); text-align: right;
}

/* ---------- journey timeline ---------- */
.timeline { position: relative; margin-top: 44px; padding-left: 0; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 1px; background: var(--line-strong);
}

.timeline__item {
  position: relative;
  display: grid; grid-template-columns: 200px 1fr;
  gap: 8px 32px;
  padding: 0 0 40px 40px;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {          /* node on the spine */
  content: ""; position: absolute; left: 0; top: 5px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--sceptre);
}
.timeline__item:first-child::before { background: var(--sceptre); }

.timeline__date { padding-top: 4px; }
.timeline__content h3 { font: 600 clamp(19px, 2.2vw, 23px)/1.3 var(--serif); color: var(--soil); }
.timeline__org {
  margin-top: 2px;
  font: 600 13px/1.4 var(--sans);
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--sceptre);
}
.timeline__content > p:last-child { margin-top: 10px; font-size: 15.5px; color: var(--ink-70); max-width: 62ch; }

/* the timeline runs long and reads as a wall of text on its own, so it shares
   the row with a still image that tracks the scroll */
.journey { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, .8fr); gap: clamp(32px, 5vw, 64px); }
.journey__figure {
  position: sticky; top: calc(var(--nav-h) + 28px);
  margin-top: 44px;                   /* meets the timeline's own top margin */
  align-self: start;
}
.journey__figure::after {             /* same stamped frame as the hero portrait */
  content: ""; position: absolute; inset: 0;
  border: 2px solid var(--sceptre); border-radius: var(--radius-lg);
  opacity: .35; z-index: -1;
  transform: translate(10px, 10px);
}
.journey__figure img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--paper-light);
}

/* ---------- carousel ---------- */
.carousel { position: relative; }

.carousel__track {
  --peek: 68px;                       /* sliver of the neighbouring cards left showing */
  scroll-padding-left: calc(var(--peek) + var(--gutter));   /* keeps the previous card peeking once you move */
  display: flex;
  gap: var(--gutter);
  overflow-x: auto;
  /* proximity, not mandatory: mandatory snapping fights programmatic scrolls
     and re-snaps mid-animation. The script aligns to the exact card at rest. */
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  padding-bottom: 8px;
  scrollbar-width: none;
  cursor: grab;
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__track.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
  user-select: none;
}

/* 3 full cards + a peek on desktop, 2 on tablet, 1 on phone */
.carousel__card {
  flex: 0 0 calc((100% - var(--gutter) * 4 - var(--peek) * 2) / 3);
  scroll-snap-align: start;
  display: flex;
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
/* opacity only animates after the first paint, so the initial edge fade is instant */
.carousel__track.is-ready .carousel__card {
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), opacity .35s var(--ease);
}
.carousel__card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(93, 30, 51, .22);
}
/* partly-visible cards sit back so the three in view read as the main row */
.carousel__card.is-edge { opacity: .38; }
.carousel__card.is-edge:hover { opacity: .72; transform: none; box-shadow: none; }
.carousel__card img { pointer-events: none; }   /* keeps native image drag out of the way */
.carousel__card-link { display: flex; flex-direction: column; width: 100%; }

.carousel__media {
  display: block; position: relative;
  aspect-ratio: 1200 / 630;
  border-bottom: 1px solid var(--line);
  background: #d7dadd;
  overflow: hidden;
}
.carousel__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.carousel__meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 24px 0; }
.carousel__tag {
  display: inline-block;
  font: 600 10px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--sceptre);
  background: rgba(93, 30, 51, .1);
  padding: 7px 10px; border-radius: var(--radius);
}
.carousel__card h3 {
  font: 600 clamp(18px, 1.9vw, 22px)/1.35 var(--serif);
  color: var(--sceptre);
  padding: 14px 24px 0;
}
.carousel__title-ar {
  display: block;
  padding: 10px 24px 0;
  font: 400 15px/1.8 "Noto Naskh Arabic", var(--serif);
  color: var(--ink-70);
}
.carousel__pub {
  display: block; padding: 14px 24px 0;
  font: 600 12px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-50);
}
.carousel__link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: auto; padding: 22px 24px 24px;
  font: 600 11px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--sceptre);
}
.carousel__link svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.carousel__card:hover .carousel__link svg { transform: translateX(4px); }

.carousel__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-top: 28px; flex-wrap: wrap;
}
.textlink {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 13px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--sceptre);
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
}
.textlink:hover { border-bottom-color: var(--sceptre); }
.textlink svg { width: 16px; height: 16px; }

.carousel__nav { display: flex; gap: 10px; }
.carousel__btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .38);
  color: var(--soil);
  cursor: pointer;
  transition: background-color .25s var(--ease), opacity .25s var(--ease);
}
.carousel__btn svg { width: 20px; height: 20px; }
.carousel__btn:hover:not(:disabled) { background: var(--paper-light); }
.carousel__btn:disabled { opacity: .3; cursor: default; }

.carousel__progress {
  flex: 1 1 180px; max-width: 320px;
  height: 3px; border-radius: 999px;
  background: rgba(53, 30, 40, .18);
  overflow: hidden;
}
.carousel__progress span {
  display: block; height: 100%;
  background: var(--sceptre);
  transform-origin: left center;
  transform: scaleX(.06);
  transition: transform .2s var(--ease);
}

/* ---------- expertise (dark) ---------- */
.expertise { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 6vw, 72px); align-items: start; }

.chips { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.chips li {
  border: 1px solid rgba(165, 188, 214, .32);
  border-radius: 999px;
  padding: 9px 16px;
  font: 500 13px/1 var(--sans);
  letter-spacing: .02em;
}

.toolbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 26px 22px; margin-top: 28px; }
.toolbox p:last-child { font-size: 15px; color: rgba(244, 247, 250, .82); line-height: 1.55; }

.skills__group { margin-top: 28px; }
.expertise .section__title + .skills__group { margin-top: 28px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.tags li {
  background: var(--sceptre);
  color: var(--paper-light);
  padding: 7px 11px;
  border-radius: var(--radius);
  font: 600 10.5px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
}

/* ---------- footer ---------- */
.footer { background: var(--soil); color: var(--paper); padding-top: var(--section); }
.footer__inner {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 32px;
}
.footer__name { font: 600 clamp(24px, 3.4vw, 36px)/1.15 var(--serif); }
.footer__social { display: flex; justify-content: flex-end; gap: 10px; }

.btn {
  display: inline-block;
  background: var(--paper);
  color: var(--soil);
  font: 600 18px/1 var(--serif);
  padding: 16px 32px;
  border-radius: var(--radius);
  transition: transform .25s var(--ease), background-color .25s var(--ease);
}
.btn:hover { transform: translateY(-2px); background: var(--paper-light); }

.footer__legal {
  margin-top: 56px; padding-block: 24px;
  border-top: 1px solid rgba(165, 188, 214, .14);
  text-align: center;
}
.footer__legal p {
  font: 600 12px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .12em;
  opacity: .45;
}

/* ============================================================
   Article archive  (work/index.html)
   ============================================================ */
.archive { padding-top: calc(var(--nav-h) + var(--section)); }

.backlink {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 32px;
  font: 600 12px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-50);
}
.backlink:hover { color: var(--sceptre); }
.backlink svg { width: 16px; height: 16px; }

.archive__intro { margin-top: 20px; max-width: 62ch; color: var(--ink-70); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 32px 0 40px; }
.filter {
  font: 600 12px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--soil);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.filter:hover { background: rgba(255, 255, 255, .45); }
.filter.is-active { background: var(--sceptre); border-color: var(--sceptre); color: var(--paper-light); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gutter); }

.tile {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.tile:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 rgba(93, 30, 51, .22); }
.tile__link { display: flex; flex-direction: column; height: 100%; }
.tile__media {
  position: relative; aspect-ratio: 1200 / 630;
  background: #d7dadd; overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.tile__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile__body { padding: 22px 24px 26px; display: flex; flex-direction: column; flex: 1; }
.tile__meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.tile__body h2 { font: 600 19px/1.35 var(--serif); color: var(--sceptre); }
.tile__title-ar { margin-top: 10px; font: 400 15px/1.8 "Noto Naskh Arabic", var(--serif); color: var(--ink-70); }
.tile__pub {
  margin-top: auto; padding-top: 18px;
  font: 600 11px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-50);
}

/* ============================================================
   Single article page  (work/<slug>.html)
   ============================================================ */
.article { padding-top: calc(var(--nav-h) + var(--section)); padding-bottom: var(--section); }
.article .shell { max-width: 900px; }

.article__head { margin-bottom: 36px; }
.article__title {
  margin-top: 20px;
  font: 700 clamp(30px, 4.6vw, 46px)/1.15 var(--serif);
  letter-spacing: -.02em; color: var(--sceptre);
}
.article__title-ar {
  margin-top: 14px;
  font: 600 clamp(19px, 2.6vw, 25px)/1.75 "Noto Naskh Arabic", var(--serif);
  color: var(--soil);
}
.article__meta {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--line-strong);
  font: 600 13px/1 var(--sans); color: var(--ink-50);
}
.article__meta li { display: flex; align-items: center; gap: 14px; }
.article__meta li + li::before { content: "·"; color: var(--line-strong); }

.article__cover { margin: 0 0 40px; }
.article__cover img {
  width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.article__cover figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-50); }

.article__lede { font-size: 1.15em; line-height: 1.7; color: var(--soil); }

.article__excerpt {
  margin: 36px 0;
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sceptre);
  border-radius: var(--radius);
  padding: 26px 28px;
}
.article__excerpt blockquote {
  margin: 14px 0 0;
  font: 400 17px/2 "Noto Naskh Arabic", var(--serif);
  color: var(--soil);
}
.article__note { font-size: 15px; color: var(--ink-70); margin-bottom: 32px; }

.btn--dark {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--sceptre); color: var(--paper-light);
  font: 600 15px/1 var(--sans); letter-spacing: .01em;
}
.btn--dark:hover { background: var(--soil); }
.btn--dark svg { width: 17px; height: 17px; }

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter);
  margin-top: 64px; padding-top: 32px;
  border-top: 1px solid var(--line-strong);
}
.pager__link {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 22px;
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.pager__link:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 rgba(93, 30, 51, .18); }
.pager__link--next { text-align: right; }
.pager__title { font: 600 16px/1.4 var(--serif); color: var(--sceptre); }

/* ============================================================
   Motion
   ============================================================ */
/* Everything below only hides content on the `js` class, which the inline script
   in <head> sets. No script, stale script, script error: content stays visible. */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* children of a revealed block come in one after another */
.js [data-stagger] > * {
  opacity: 0; transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.is-visible [data-stagger] > *, [data-stagger].is-visible > * { opacity: 1; transform: none; }
[data-stagger] > *:nth-child(1) { transition-delay: .06s; }
[data-stagger] > *:nth-child(2) { transition-delay: .14s; }
[data-stagger] > *:nth-child(3) { transition-delay: .22s; }
[data-stagger] > *:nth-child(4) { transition-delay: .30s; }
[data-stagger] > *:nth-child(5) { transition-delay: .38s; }
[data-stagger] > *:nth-child(6) { transition-delay: .46s; }
[data-stagger] > *:nth-child(7) { transition-delay: .54s; }

/* the short rule under a section title draws itself in */
.rule { transition: width .7s var(--ease) .15s; }
.js .reveal:not(.is-visible) .rule { width: 0; }

/* timeline nodes pop as each role scrolls in */
.js .timeline__item::before { transform: scale(.35); transition: transform .45s var(--ease) .12s; }
.timeline__item.is-visible::before { transform: scale(1); }

/* hero plays on load rather than on scroll */
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes portrait-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

.js .hero__portrait { animation: portrait-in .85s var(--ease) both; }
.js .hero__intro > * { animation: rise .75s var(--ease) both; }
.hero__intro > *:nth-child(1) { animation-delay: .10s; }
.hero__intro > *:nth-child(2) { animation-delay: .18s; }
.hero__intro > *:nth-child(3) { animation-delay: .26s; }
.hero__intro > *:nth-child(4) { animation-delay: .34s; }
.hero__intro > *:nth-child(5) { animation-delay: .42s; }

.btn:active, .carousel__btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }

/* ============================================================
   Responsive
   ============================================================ */
/* the image column narrows the timeline, so the date stacks above the role
   earlier than it otherwise would */
@media (max-width: 1180px) {
  .timeline__item { grid-template-columns: 1fr; gap: 6px; }
  .timeline__date { padding-top: 0; }
}

@media (max-width: 1024px) {
  .carousel__card { flex-basis: calc((100% - var(--gutter) * 3 - var(--peek) * 2) / 2); }
  .about, .expertise { grid-template-columns: 1fr; }
  .about__text { max-width: none; }
  .timeline__item { grid-template-columns: 1fr; gap: 6px; }
  .timeline__date { padding-top: 0; }
}

@media (max-width: 980px) {
  /* single column: the image stops tracking the scroll and simply closes the section */
  .journey { grid-template-columns: 1fr; gap: 40px; }
  .journey__figure { position: relative; top: auto; margin-top: 0; max-width: 380px; }
}

@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--margin) 20px;
    transform: translateY(-120%);
    transition: transform .35s var(--ease);
    box-shadow: 0 12px 24px rgba(53, 30, 40, .12);
  }
  .nav__links.is-open { transform: none; }
  .nav__links a { padding-block: 16px; border-bottom: 1px solid var(--line); }
  .nav__links a::after { display: none; }
  .nav__toggle { display: flex; }

  /* contact links move into the menu, where there's room for a real tap target */
  .nav__contact { display: flex; align-items: center; gap: 10px; color: var(--sceptre); }
  .nav__contact svg { width: 18px; height: 18px; }
  .nav__contact:first-of-type { margin-top: 4px; }

  .hero { grid-template-columns: 1fr; justify-items: start; }
  .hero__portrait { width: min(200px, 55vw); }

  .footer__inner { grid-template-columns: 1fr; justify-items: start; text-align: left; }
  .footer__social { justify-content: flex-start; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .carousel__track { --peek: 44px; scroll-padding-left: 0; }   /* one card at a time, peek on the right only */
  .carousel__card { flex-basis: calc(100% - var(--peek)); }
  .section__head { align-items: flex-start; }
  .carousel__foot { justify-content: center; }
  .carousel__progress { flex-basis: 140px; }
  .timeline__item { padding-left: 32px; padding-bottom: 32px; }
  .pager { grid-template-columns: 1fr; }
  .pager__link--next { text-align: left; }
  .article__meta { font-size: 12px; }

  /* the nav bar is tight at this width: icons live in the menu instead */
  .nav__actions .hide-sm { display: none; }
  .nav__brand { font-size: 17px; }

  .published__list a { padding-block: 18px; }          /* comfortable tap target */

  .hero__contacts { gap: 14px 20px; }
  .hero__contacts a { padding-block: 6px; }

  .footer__inner { gap: 24px; }
  .btn { display: block; text-align: center; }
  .filters { gap: 8px; }
  .filter { padding: 10px 14px; font-size: 11px; }
  .tiles { grid-template-columns: 1fr; }
  .archive__intro { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .carousel__track { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  /* these need the .js prefix too, or the rules above out-rank them */
  .js .reveal, .js [data-stagger] > * { opacity: 1; transform: none; transition: none; }
  .js .hero__portrait, .js .hero__intro > * { animation: none; }
  .js .timeline__item::before { transform: none; }
  .js .reveal:not(.is-visible) .rule { width: 96px; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .nav, .carousel__nav, .carousel__dots, .btn { display: none; }
  body { background: #fff; color: #000; }
}
