/* ==========================================================================
   EDITORIAL INK — 3. Components
   ========================================================================== */

/* ==========================================================================
   BUTTONS + LINKS
   ========================================================================== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 30px;
  border: 1px solid transparent;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  overflow: hidden;
  isolation: isolate;
  transition: color .35s var(--ease-out), border-color .35s var(--ease-out);
}
/* Fill wipes up from the bottom edge rather than cross-fading */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform .45s var(--ease-out);
}
.btn:hover::before { transform: scaleY(1); }
.btn__arrow { transition: transform .4s var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(5px); }

.btn--solid { background: var(--accent); color: var(--accent-ink); }
.btn--solid::before { background: var(--fg); }
.btn--solid:hover { color: var(--bg); }

.btn--ghost { border-color: var(--rule-strong); color: var(--fg); }
.btn--ghost::before { background: var(--fg); }
.btn--ghost:hover { color: var(--bg); border-color: var(--fg); }

.btn--sm { padding: 11px 20px; font-size: .68rem; }
.btn--full { width: 100%; justify-content: center; }

/* Underline that retracts out one side and grows back in from the other */
.link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: 100% 50%;
  transition: transform .45s var(--ease-out);
}
.link:hover::after { transform: scaleX(0); transform-origin: 0 50%; }
.link span { transition: transform .4s var(--ease-out); }
.link:hover span { transform: translate(3px, -3px); }

/* ==========================================================================
   MARQUEE  (speed + skew are driven by scroll velocity from JS)
   ========================================================================== */
.marquee {
  padding: 30px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  overflow: hidden;
}
.marquee__track {
  display: flex;
  align-items: center;
  gap: 30px;
  width: max-content;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
  font-weight: 400;
  white-space: nowrap;
  color: var(--fg-muted);
  will-change: transform;
}
.marquee__track i {
  font-style: normal;
  font-size: .42em;
  color: var(--coral);
  transform: translateY(-.15em);
}
.marquee__track span { transition: color .3s; }
.marquee__track span:hover { color: var(--coral); }

/* ==========================================================================
   ABOUT
   ========================================================================== */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(36px, 6vw, 96px);
  max-width: var(--maxw);
  margin: 0 auto;
}

.pull {
  font-size: clamp(1.5rem, 2.9vw, 2.5rem);
  font-weight: 400;
  line-height: 1.16;
  text-wrap: balance;
}

.about__body p {
  max-width: 54ch;
  margin-bottom: 22px;
  font-weight: 300;
  color: var(--fg-muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.chips--tight { margin-top: 0; }
.chips li {
  padding: 9px 17px;
  border: 1px solid var(--rule-strong);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  transition: .3s var(--ease-out);
}
.chips li:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}

/* ---------- Education card ----------
   Fills the run of empty column beneath the pull quote. Built from the same
   parts as the process cards — raised panel, hairline border, accent on hover
   — so it reads as part of the set rather than a transplant. */
.edu {
  margin-top: clamp(34px, 4.5vw, 62px);
  padding: clamp(24px, 2.6vw, 34px);
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-raised);
  transition: transform .5s var(--ease-out), border-color .4s var(--ease-out);
}
/* Both selectors are deliberate. The plain one states the intent; the
   .reveal one exists to outrank `.reveal.is-in { transform: none }` in
   motion.css, which loads after this file and at equal specificity would
   otherwise win and swallow the lift while leaving the border change working
   — a confusing half-hover. */
.edu:hover,
.edu.reveal:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
}

.edu__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.edu__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  background: var(--accent-wash);
  color: var(--accent);
}
.edu__icon svg { width: 22px; height: 22px; }
.edu__kind { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }

.edu__degree {
  margin-bottom: 7px;
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  font-weight: 500;
  color: var(--accent);
}
.edu__school { font-weight: 300; color: var(--fg); }

.edu__dates {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  color: var(--fg-subtle);
}
.edu__dates svg { flex-shrink: 0; width: 15px; height: 15px; }

.edu__note {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  font-size: .92rem;
  font-weight: 300;
  color: var(--fg-muted);
}

@media (max-width: 880px) {
  /* Single column. Flex + display:contents lifts the quote and the card out of
     their wrapper so the card can be ordered last — stacked as authored it
     would wedge a credential between the quote and the bio it introduces. */
  .about__grid { display: flex; flex-direction: column; }
  .about__lead { display: contents; }
  .pull        { order: 1; }
  .about__body { order: 2; margin-top: 28px; }
  .edu         { order: 3; margin-top: 8px; }
}

/* ==========================================================================
   IMPACT  (hairline grid via 1px gap over a ruled background)
   ========================================================================== */
/* Sits directly under the ink About block, so it keeps a normal top gap
   rather than butting the hairline grid against the colour change. */
.impact { padding-top: clamp(64px, 8vh, 104px); }
.impact__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  max-width: var(--maxw);
  margin: 0 auto;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.impact__cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(28px, 3.4vw, 46px);
  background: var(--bg);
  transition: background .4s var(--ease-out);
}
.impact__cell:hover { background: var(--bg-raised); }
.impact__num {
  font-size: clamp(2.4rem, 4.6vw, 3.9rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.impact__label { color: var(--accent); }
.impact__note { font-size: .88rem; font-weight: 300; color: var(--fg-subtle); }

@media (max-width: 880px) { .impact__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .impact__grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   SERVICES  (big list rows; hovering one dims the rest and floats a preview)
   ========================================================================== */
.services { position: relative; }
.svc { max-width: var(--maxw); margin: 0 auto; border-top: 1px solid var(--rule); }

.svc__row {
  position: relative;
  display: grid;
  grid-template-columns: 70px minmax(0, 1.05fr) minmax(0, 1fr) 240px;
  align-items: center;
  gap: 24px;
  padding: clamp(24px, 3vw, 38px) 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: opacity .4s var(--ease-out), padding .5s var(--ease-out);
}
/* Accent wash sweeping in from the left on hover */
.svc__row::before {
  content: '';
  position: absolute;
  inset: 0 -24px;
  z-index: -1;
  background: var(--accent-wash);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .55s var(--ease-out);
}
.svc__row:hover::before { transform: scaleX(1); }
.svc__row:hover { padding-left: 24px; }

/* Everything that isn't hovered recedes */
.svc.is-hovering .svc__row { opacity: .38; }
.svc.is-hovering .svc__row:hover { opacity: 1; }

.svc__num { color: var(--accent); }
.svc__name { font-size: clamp(1.5rem, 3.1vw, 2.6rem); font-weight: 400; }
.svc__desc { font-size: .95rem; font-weight: 300; color: var(--fg-muted); }
.svc__meta { color: var(--fg-subtle); white-space: nowrap; text-align: right; }

/* The line that ties the three services together */
.svc__loop {
  max-width: 30ch;
  margin: clamp(48px, 6vw, 76px) 0 0 auto;   /* sits right, opposite the list */
  font-size: clamp(1.3rem, 2.3vw, 1.95rem);
  font-weight: 400;
  line-height: 1.18;
  text-wrap: balance;
}

/* Floating image preview that trails the cursor */
.svc__peek {
  position: fixed;
  top: 0; left: 0;
  z-index: 700;
  width: 260px;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.85) rotate(-4deg);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
  box-shadow: var(--shadow);
}
.svc__peek.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-4deg); }
.svc__peek img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 880px) {
  /* minmax(0,1fr), not 1fr: a plain fr track has min-width:auto and refuses to
     shrink below its content, and .svc__meta is nowrap — which forced the row
     wider than a 320px screen. */
  .svc__row { grid-template-columns: 46px minmax(0, 1fr); row-gap: 8px; }
  .svc__desc { grid-column: 2; }
  .svc__meta { grid-column: 2; white-space: normal; text-align: left; }
  .svc__peek { display: none; }
  .svc__loop { max-width: none; margin-left: 0; }
}

/* ==========================================================================
   WORK  (sticky visual stage beside a scrolling list of cases)
   ========================================================================== */
.work__layout {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(36px, 6vw, 92px);
  max-width: var(--maxw);
  margin: 0 auto;
}

.work__stage { position: relative; }
.work__stage-inner {
  position: sticky;
  top: 18vh;
  aspect-ratio: 4 / 5;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-sunken);
  box-shadow: var(--shadow);
}
.work__shot {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity .7s var(--ease-out), transform .9s var(--ease-out);
}
.work__shot.is-active { opacity: 1; transform: none; }

.work__stage-idx {
  position: absolute;
  left: 18px; bottom: 16px;
  padding: 7px 13px;
  border-radius: 100px;
  background: rgba(12, 10, 9, .62);
  backdrop-filter: blur(6px);
  color: var(--paper);
  font-size: .66rem;
}
.work__stage-idx b { color: var(--accent); font-weight: 500; }

.work__cases { display: flex; flex-direction: column; }

.case {
  padding: clamp(40px, 7vw, 92px) 0;
  border-bottom: 1px solid var(--rule);
  opacity: .42;
  transition: opacity .6s var(--ease-out);
}
.case:first-child { padding-top: 0; }
.case:last-child { border-bottom: none; }
.case.is-active { opacity: 1; }

.case__tag { display: block; margin-bottom: 14px; color: var(--accent); }
.case__name { font-size: clamp(1.8rem, 3.6vw, 3rem); font-weight: 400; margin-bottom: 16px; }
.case__desc { max-width: 48ch; font-weight: 300; color: var(--fg-muted); }

.case__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 3vw, 44px);
  margin: 28px 0;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.case__metrics dt { margin-bottom: 5px; color: var(--fg-subtle); }
.case__metrics dd { font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; }

@media (max-width: 940px) {
  .work__layout { grid-template-columns: 1fr; }
  .work__stage { display: none; }
  .case { opacity: 1; padding: 40px 0; }
}

/* ==========================================================================
   RECEIPTS  (analytics gallery)
   ========================================================================== */
.shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 28px);
  max-width: var(--maxw);
  margin: 0 auto;
}

.shot { transform-style: preserve-3d; }
.shot__btn {
  display: block;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-sunken);
  box-shadow: var(--shadow);
  transition: transform .5s var(--ease-out);
}
.shot__btn img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform .8s var(--ease-out);
}
.shot__btn:hover img { transform: scale(1.05); }

.shot figcaption { display: flex; flex-direction: column; gap: 5px; padding-top: 16px; }
.shot__stat { font-size: 1.2rem; font-weight: 500; }
.shot__meta { color: var(--fg-subtle); }

/* Three panels go straight from three columns to one. A two-column step would
   strand the third on a row of its own, and at 4:5 that orphan reads as a
   mistake. The max-width stops the single column ballooning on a tablet; below
   it the cap never binds and the panels run full width. */
@media (max-width: 760px) {
  .shots { grid-template-columns: 1fr; max-width: 460px; }
}

/* ==========================================================================
   PROCESS RAIL  (horizontal scroll-snap; also draggable)
   ========================================================================== */
.process__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.process__nav { display: flex; gap: 10px; }

.rail-btn {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  font-size: 1.05rem;
  transition: .3s var(--ease-out);
}
.rail-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rail-btn:disabled { opacity: .3; cursor: not-allowed; }
.rail-btn:disabled:hover { background: none; border-color: var(--rule-strong); color: inherit; }

.rail {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Without this the first card snaps flush to the viewport edge: the snapport
     defaults to the padding box, so the gutter gets scrolled away. */
  scroll-padding-left: var(--gutter);
  scrollbar-width: none;
  cursor: grab;
  /* Bleed to the viewport edges so cards run off-screen */
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter) 8px;
}
.rail::-webkit-scrollbar { display: none; }
.rail.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.rail.is-dragging * { pointer-events: none; }

.rail__track { display: flex; gap: 20px; width: max-content; }

.step {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: clamp(250px, 30vw, 360px);
  padding: clamp(26px, 3vw, 40px);
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-raised);
  transition: transform .5s var(--ease-out), border-color .4s;
}
.step:hover { transform: translateY(-8px); border-color: var(--accent); }
.step__num {
  font-size: 3.2rem;
  font-weight: 500;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent);
}
.step__name { font-size: 1.35rem; font-weight: 600; }
.step p { font-size: .93rem; font-weight: 300; color: var(--fg-muted); flex-grow: 1; }
.step__time { color: var(--fg-subtle); }

/* ==========================================================================
   TESTIMONIALS
   ========================================================================== */
/* Left-aligned to the same gutter as every other section rather than centred,
   so the page keeps one consistent reading edge. The min-height reserves room
   for the tallest quote — the slides are absolutely positioned, so without it
   the section would jump height on every rotation. */
.quotes {
  position: relative;
  max-width: 62ch;
  min-height: 220px;
}
.quote {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  pointer-events: none;
}
.quote.is-active { opacity: 1; transform: none; pointer-events: auto; }

.quote p {
  font-size: clamp(1.3rem, 2.6vw, 2.1rem);
  font-weight: 400;
  line-height: 1.25;
  text-wrap: balance;
}
.quote p::before { content: '\201C'; color: var(--accent); }
.quote p::after  { content: '\201D'; color: var(--accent); }
.quote footer { margin-top: 26px; color: var(--fg-subtle); }
.quote footer b { color: var(--fg); font-weight: 500; }

.quotes__dots { display: flex; gap: 10px; margin-top: 36px; }
.quotes__dots button {
  width: 30px; height: 3px;
  background: var(--rule-strong);
  border-radius: 2px;
  transition: background .35s, transform .35s var(--ease-out);
}
.quotes__dots button.is-active { background: var(--accent); transform: scaleX(1.5); }

/* ==========================================================================
   CONTACT
   ========================================================================== */
.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .82fr);
  gap: clamp(40px, 7vw, 100px);
  max-width: var(--maxw);
  margin: 0 auto;
}

.contact__title {
  font-size: clamp(2.6rem, 6.6vw, 5.2rem);
  line-height: 1.04;
  margin-bottom: 26px;
}
.contact__pitch > p { max-width: 42ch; font-weight: 300; color: var(--fg-muted); }

.direct { margin-top: 44px; border-top: 1px solid var(--rule); }
.direct li { border-bottom: 1px solid var(--rule); }
.direct a,
.direct button {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 20px 0;
  text-align: left;
  transition: padding .4s var(--ease-out), color .3s;
}
.direct a:hover,
.direct button:hover { padding-left: 14px; color: var(--accent); }
.direct .mono { flex-shrink: 0; width: 96px; color: var(--fg-subtle); }
.copy__val { font-size: 1.05rem; }
.copy__hint {
  margin-left: auto;
  color: var(--fg-subtle);
  opacity: 0;
  transition: opacity .3s;
}
.copy:hover .copy__hint { opacity: 1; }
.copy.is-copied .copy__hint { opacity: 1; color: var(--accent); }

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }

.field { position: relative; }
.field input,
.field textarea {
  width: 100%;
  padding: 26px 0 12px;
  border-bottom: 1px solid var(--rule);
  background: none;
  font-size: 1rem;
  resize: vertical;
  transition: border-color .35s;
}
.field label {
  position: absolute;
  left: 0;
  top: 24px;
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--fg-subtle);
  pointer-events: none;
  transition: transform .35s var(--ease-out), color .35s, font-size .35s;
}
/* Float the label once the field has focus or content */
.field input:focus + label,
.field textarea:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:not(:placeholder-shown) + label {
  transform: translateY(-22px);
  font-size: .66rem;
  color: var(--accent);
}
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); }
.field.has-error input,
.field.has-error textarea { border-color: var(--coral); }

.form .btn { margin-top: 26px; }
.form__note { min-height: 1.4em; margin-top: 14px; color: var(--accent); }

@media (max-width: 880px) { .contact__grid { grid-template-columns: 1fr; } }

/* On a narrow screen the fixed 96px label + value + hint cannot share one
   line, and flex items refuse to shrink past their content — which pushed the
   whole page sideways. Drop the label onto its own row instead. */
@media (max-width: 560px) {
  .direct a,
  .direct button { flex-wrap: wrap; gap: 6px 14px; }
  .direct .mono { flex-basis: 100%; width: auto; }
  .copy__val { font-size: .98rem; overflow-wrap: anywhere; }
  .copy__hint { margin-left: 0; }
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 5vw;
  background: rgba(12, 10, 9, .93);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  /* See .modal — visibility must flip in immediately and out only after the
     fade, or focus() on open is dropped. */
  transition: opacity .45s var(--ease-out), visibility 0s linear .45s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .45s var(--ease-out), visibility 0s;
}
.lightbox img {
  max-width: 100%;
  max-height: 88vh;
  border-radius: 4px;
  transform: scale(.94);
  transition: transform .55s var(--ease-out);
}
.lightbox.is-open img { transform: none; }

.lightbox__close {
  position: absolute;
  top: 3vh; right: 4vw;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border: 1px solid rgba(247, 244, 239, .3);
  border-radius: 50%;
  color: var(--paper);
  font-size: 1.6rem;
  line-height: 1;
  transition: .3s var(--ease-out);
}
.lightbox__close:hover { background: var(--coral); border-color: var(--coral); transform: rotate(90deg); }


/* ==========================================================================
   EXPERIENCE  (timeline rows: dates | role | summary)
   ========================================================================== */
.xp { max-width: var(--maxw); margin: 0 auto; border-top: 1px solid var(--rule); }

.xp__row {
  position: relative;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: start;
  gap: 24px;
  padding: clamp(26px, 3vw, 40px) 0;
  border-bottom: 1px solid var(--rule);
  transition: padding .5s var(--ease-out);
}
/* Accent rule that grows down the left edge on hover */
.xp__row::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height .5s var(--ease-out);
}
.xp__row:hover::before { height: 100%; }
.xp__row:hover { padding-left: 22px; }

.xp__dates { padding-top: .45em; color: var(--fg-subtle); }
.xp__role { font-size: clamp(1.2rem, 2vw, 1.65rem); font-weight: 400; }
.xp__co { display: block; margin-top: 8px; color: var(--accent); }
.xp__sum { font-size: .96rem; font-weight: 300; color: var(--fg-muted); }

@media (max-width: 880px) {
  .xp__row { grid-template-columns: 1fr; gap: 12px; }
  .xp__dates { padding-top: 0; }
}

/* ==========================================================================
   SKILLS & TOOLS
   ========================================================================== */
/* Label-left rows rather than a card grid. A two-column grid of groups sizes
   every row to its tallest member, so a group with one line of chips next to
   one with three leaves a hole. Rows sidestep that entirely, and match the
   rhythm of the services list and experience timeline above. */
.tools { max-width: var(--maxw); margin: 0 auto; border-top: 1px solid var(--rule); }

.tools__group {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  padding: clamp(22px, 2.6vw, 32px) 0;
  border-bottom: 1px solid var(--rule);
}
.tools__label { padding-top: .5em; color: var(--accent); }

@media (max-width: 720px) {
  .tools__group { grid-template-columns: 1fr; gap: 14px; }
  .tools__label { padding-top: 0; }
}

/* ==========================================================================
   CASE STUDY MODAL
   The page carries a two-or-three sentence summary; the full write-up lives in
   a <template> inside each case and is cloned in here on demand. Panel is
   paper against the dark overlay — the write-up is long-form reading, and it
   is easier on the eye than light-on-dark at that length.
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 48px);
  background: rgba(12, 10, 9, .9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  /* visibility is delayed to the end of the fade on the way OUT, so the panel
     stays painted while it fades. On the way IN it must flip immediately —
     given a duration it animates instead, and the dialog spends its first
     frames unfocusable, which silently strands keyboard focus behind the
     overlay. Hence the 0s override in .is-open. */
  transition: opacity .4s var(--ease-out), visibility 0s linear .4s;
}
.modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .4s var(--ease-out), visibility 0s;
}

/* Column layout, not a single scrolling box: the head stays put so the title
   and close button never scroll out of reach on a long case. */
.modal__panel {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(86vh, 880px);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7);
  transform: translateY(20px) scale(.985);
  transition: transform .5s var(--ease-out);
}
.modal.is-open .modal__panel { transform: none; }

.modal__head {
  position: relative;
  flex-shrink: 0;
  padding: clamp(26px, 3.4vw, 42px) clamp(24px, 3.4vw, 46px) 22px;
  padding-right: 76px;                        /* clear of the close button */
  border-bottom: 1px solid var(--rule);
}
.modal__tag { display: block; margin-bottom: 12px; color: var(--accent); }
.modal__title { font-size: clamp(1.7rem, 3.4vw, 2.6rem); font-weight: 500; }

.modal__close {
  position: absolute;
  top: clamp(18px, 2.4vw, 30px);
  right: clamp(18px, 2.4vw, 30px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  transition: .3s var(--ease-out);
}
.modal__close:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: rotate(90deg);
}

.modal__body {
  overflow-y: auto;
  padding: clamp(24px, 3.4vw, 40px) clamp(24px, 3.4vw, 46px) clamp(30px, 4vw, 48px);
  overscroll-behavior: contain;               /* don't chain to the page */
}
.modal__body:focus-visible { outline-offset: -4px; }

/* Content injected from the template */
.modal__body h4 {
  margin: 32px 0 12px;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
}
.modal__body h4:first-child { margin-top: 0; }
.modal__body p { font-weight: 300; color: var(--fg-muted); }
.modal__body p + p { margin-top: 14px; }

/* Each lever as a left-ruled block with its label pulled out */
.modal__body ul { display: grid; gap: 20px; margin-top: 22px; }
.modal__body li {
  padding-left: 20px;
  border-left: 2px solid var(--accent-wash);
  font-weight: 300;
  color: var(--fg-muted);
}
.modal__body li b {
  display: block;
  margin-bottom: 5px;
  color: var(--fg);
  font-weight: 600;
}
.modal__body em { color: var(--accent); font-style: italic; }

@media (max-width: 560px) {
  .modal__panel { max-height: 92vh; }
  .modal__close { width: 40px; height: 40px; }
  .modal__head { padding-right: 66px; }
}
