/* =========================================================
   Portfolio · shared styles
   Tokens → base → header → layout → TOC → sections → blocks
   ========================================================= */

:root {
  /* Colors */
  --black: #101010;
  --white: #ffffff;
  --grey-white: #f6f6f6;
  --grey: #efefef;
  --grey-divider: #c5c5c5;
  --dark-grey: #595959;
  --accent: #3d00af;
  --accent-light: #f1effb;
  --cover-bg: #f5f5f5;
  --light-grey: #8c8c8c; /* eyebrows, short descriptions */
  --btn-stroke: #e0dfdd;
  --stroke: #f0efef;
  --stroke-hover: #e4e4e4;

  /* Shadows */
  --shadow-front: 0 8px 28px rgba(0, 0, 0, .10);
  --shadow-back: 0 2px 10px rgba(0, 0, 0, .06);

  /* Motion */
  --ease: cubic-bezier(.22, 1, .36, 1);

  /* Layout */
  --page-pad: 44px;
  --header-h: 72px;
  --toc-w: 200px;
  --section-pad: 32px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, video { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

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

.placeholder { color: var(--dark-grey); opacity: .7; }

/* Type */
.t-56 { font-size: 56px; line-height: 68px; font-weight: 700; }
.t-44 { font-size: 44px; line-height: 56px; font-weight: 700; }
.t-32 { font-size: 32px; line-height: 40px; font-weight: 700; }
.t-24 { font-size: 24px; line-height: 32px; }
.t-20 { font-size: 20px; line-height: 28px; }
.t-16 { font-size: 16px; line-height: 24px; }
.t-14 { font-size: 14px; line-height: 20px; }
/* Small label above a statement (Objective / Challenge / My role). Sentence case, same as "Focus areas" — no ALL CAPS */
.eyebrow { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--dark-grey); }
.muted { color: var(--dark-grey); }
.w-500 { font-weight: 500; }
.w-700 { font-weight: 700; }

/* ---------- Container ---------- */
.container { max-width: 1280px; margin: 0 auto; }

/* ---------- Header (sticky, contacts always reachable) ---------- */
.header-wrap {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 300ms var(--ease);
}
.header-wrap.is-scrolled { border-bottom-color: var(--stroke); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 16px var(--page-pad);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 4px;
  background: var(--grey);
  font-weight: 500;
  white-space: nowrap;
}
.status-badge__dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; position: relative; }
.status-badge__dot::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: .6; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}

/* case pages: breadcrumbs in place of the status badge — the name leads back to the main page */
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px; font-weight: 500; white-space: nowrap; }
.crumbs__sep { color: var(--grey-divider); }
.crumbs__current { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--light-grey); }

.header-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-weight: 500; }
.header-links a,
.crumbs a {
  position: relative;
  cursor: pointer;
  transition: color 250ms var(--ease);
}
.header-links a::after,
.crumbs a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 350ms var(--ease);
}
.header-links a:hover,
.header-links a:focus-visible,
.crumbs a:hover,
.crumbs a:focus-visible { color: var(--accent); }
.header-links a:hover::after,
.header-links a:focus-visible::after,
.crumbs a:hover::after,
.crumbs a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.header-links .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--black); }

/* ---------- Main row: TOC + content ---------- */
.main-row {
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr);
  padding: 0 var(--page-pad);
}

.content { min-width: 0; padding-bottom: 96px; }

/* Boxed sections: borders merge via -1px overlap */
.box {
  border: 1px solid var(--stroke);
  margin-top: -1px;
}
.box__head {
  display: grid;
  gap: 16px;
  padding: 96px var(--section-pad) 48px;
}
/* A heading is not separated from its own blocks (cards, lists, solutions, boards).
   The line stays only above a full-bleed grid of cells that hangs on it
   (Result metrics, problem columns, Initiatives, split blocks).
   Heading → line is always 32. */
.box__head:has(+ .rmetrics, + .cols, + .cols-3, + .problem-shot, + .problem-split, + .wl-ba) {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--stroke);
}
.box__body { padding: 32px var(--section-pad) 64px; }
.box__lead { max-width: 624px; }

[id] { scroll-margin-top: calc(var(--header-h) + 24px); }

/* ---------- Table of contents ---------- */
:root { --toc-ease: cubic-bezier(.65, .05, .36, 1); --toc-dur: 600ms; }

/* grey rail runs the full height of the main area, like the section lines */
/* overflow-y: clip (not hidden) keeps sticky working and trims the fill to the column */
.toc { position: relative; overflow-y: clip; }
.toc::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: var(--stroke);
}
.toc__inner {
  position: sticky;
  top: calc(var(--header-h) + 40px);
  padding: 0 16px 48px 0;
}
.toc__track { position: relative; padding: 24px 0; }
.toc__list { list-style: none; margin: 0; padding: 0; }

/* the fill starts far above the sticky block, so it always grows from the top of the column */
.toc__fill {
  position: absolute;
  top: -200vh;
  left: -0.5px;
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height var(--toc-dur) var(--toc-ease);
}
.toc__branch {
  position: absolute;
  left: -0.5px;
  top: 0;
  width: 22px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateY(var(--y, 0));
  transition: transform var(--toc-dur) var(--toc-ease), opacity 300ms;
  opacity: 0;
}
.toc.has-active .toc__branch { opacity: 1; }

.toc__link {
  display: flex;
  align-items: center;
  font-size: 14px;
  line-height: 20px;
  transition: color 400ms var(--ease);
}
/* Figma: Regular dark grey, active = Medium black. Text sits at 32px for every item,
   so the 22px branch keeps a 10px gap (as in Figma) without shifting the active label */
.toc__link--top { min-height: 36px; padding-left: 32px; color: var(--dark-grey); }
.toc__link--sub { min-height: 32px; padding-left: 48px; color: var(--dark-grey); }
.toc__link:hover { color: var(--black); }
.toc__link.is-active { color: var(--black); font-weight: 500; }
.toc__link.is-parent-active { color: var(--black); font-weight: 500; }

/* Floating bubble that replaces the TOC below 1024 */
.toc-bubble { display: none; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  line-height: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Round icon button (Figma: Icon button, Prev / Next) ---------- */
.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--btn-stroke);
  background: var(--white);
  color: var(--black);
  transition: background-color 250ms var(--ease), border-color 250ms var(--ease), color 250ms var(--ease), transform 250ms var(--ease);
}
.icon-btn--filled { background: var(--accent); border-color: var(--accent); color: var(--white); }
.icon-btn:disabled { cursor: default; }
.icon-btn:not(:disabled) { cursor: pointer; }
.icon-btn:not(:disabled):active { transform: scale(.94); }

/* ---------- Icons ---------- */
.icon { width: 16px; height: 16px; flex: none; }
.icon-20 { width: 20px; height: 20px; }

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Page-load stagger */
.js .load {
  opacity: 0;
  transform: translateY(var(--from-y, 16px)) scale(var(--from-s, 1));
  transition: opacity var(--dur, 600ms) var(--ease), transform var(--dur, 600ms) var(--ease);
  transition-delay: var(--delay, 0ms);
}
.js.is-loaded .load { opacity: 1; transform: none; }

/* ---------- Responsive: shared ---------- */
@media (max-width: 1279px) {
  :root { --page-pad: 32px; --toc-w: 176px; }
}

@media (max-width: 1023px) {
  .main-row { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }

  .toc-bubble {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: fixed;
    left: calc(16px + env(safe-area-inset-left));
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 70;
    width: min(320px, calc(100vw - 32px));
    transform: translateY(calc(100% + 32px));
    transition: transform 500ms var(--ease);
    pointer-events: none;
  }
  .toc-bubble.is-visible { transform: none; pointer-events: auto; }

  .toc-bubble__pill {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 48px;
    padding: 8px 16px 8px 10px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: var(--shadow-front);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 300ms var(--ease);
  }
  .toc-bubble__pill:active { transform: scale(.97); }
  .toc-bubble__ring { flex: none; width: 28px; height: 28px; transform: rotate(-90deg); }
  .toc-bubble__ring circle { fill: none; stroke-width: 2.5; }
  .toc-bubble__ring .track { stroke: var(--grey); }
  .toc-bubble__ring .bar {
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-dasharray: 69.12;
    stroke-dashoffset: calc(69.12 * (1 - var(--p, 0)));
  }
  .toc-bubble__current { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
  .toc-bubble__parent { color: var(--dark-grey); font-weight: 500; }
  .toc-bubble__parent::after { content: ' · '; }
  .toc-bubble__chev { flex: none; transition: transform 400ms var(--ease); }
  .toc-bubble.is-open .toc-bubble__chev { transform: rotate(180deg); }

  .toc-bubble__menu {
    position: absolute;
    left: 0; right: 0;
    bottom: calc(100% + 8px);
    padding: 8px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: var(--shadow-front);
    transform-origin: 24px 100%;
    transform: translateY(8px) scale(.96);
    opacity: 0;
    visibility: hidden;
    transition: transform 400ms var(--ease), opacity 250ms var(--ease), visibility 0s 400ms;
  }
  .toc-bubble.is-open .toc-bubble__menu {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: transform 400ms var(--ease), opacity 250ms var(--ease), visibility 0s;
  }
  .toc-bubble__menu ul { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
  .toc-bubble__menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--dark-grey);
    transition: background-color 200ms, color 200ms;
  }
  .toc-bubble__menu a.is-top { color: var(--black); font-weight: 500; }
  .toc-bubble__menu a.is-sub { padding-left: 28px; }
  .toc-bubble__menu a.is-active { color: var(--accent); background: var(--accent-light); }
}

/* case pages, tablet: breadcrumbs + contacts fit one line at 14px */
@media (min-width: 768px) and (max-width: 1023px) {
  .case .crumbs, .case .header-links { font-size: 14px; line-height: 20px; }
  .case .crumbs { flex: none; }
}

@media (max-width: 767px) {
  :root { --page-pad: 16px; --section-pad: 16px; --header-h: 84px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .status-badge { padding: 4px 12px; font-size: 14px; line-height: 20px; }
  .crumbs { min-height: 28px; max-width: 100%; font-size: 14px; line-height: 20px; }
  .header-links { gap: 4px 10px; font-size: 14px; line-height: 20px; }
  .header-links .dot { width: 3px; height: 3px; }
  .t-56 { font-size: 36px; line-height: 44px; }
  .t-44 { font-size: 32px; line-height: 40px; }
  .box__head { padding-top: 64px; padding-bottom: 32px; }
  .box__body { padding-bottom: 48px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .load { opacity: 1; transform: none; }
}

/* =========================================================
   Wide layout (chosen 11.11.2026): from 1440 the page grows by 40px and all of it goes to
   the contents column (200 → 240); the 992 content column and every block stay the same.
   ========================================================= */
@media (min-width: 1440px) {
  .container { max-width: 1320px; }
  :root { --toc-w: 240px; }
}

/* Contents, Figma "TOC · B · Active in accent" (1504:2910): 16px, sections black Medium,
   sub-items grey Regular, the active item in Accent; 24px branch */
.toc__link { font-size: 16px; line-height: 24px; }
.toc__link--top { min-height: 40px; padding-left: 24px; color: var(--black); font-weight: 500; }
.toc__link--sub { min-height: 36px; padding-left: 40px; color: var(--dark-grey); font-weight: 400; }
.toc__link:hover { color: var(--accent); }
.toc__link.is-parent-active { color: var(--black); font-weight: 500; }
.toc__link.is-active { color: var(--accent); font-weight: 500; }
.toc__branch { width: 24px; }
.toc__branch { transition: transform var(--toc-dur) var(--toc-ease), width var(--toc-dur) var(--toc-ease), opacity 300ms; }

/* contents: height comes from padding, not min-height, so a wrapped item keeps its gap to the next one
   (lines inside an item 0 apart, items 12–16 apart) */
.toc__link--top { min-height: 0; padding-top: 8px; padding-bottom: 8px; }
.toc__link--sub { min-height: 0; padding-top: 6px; padding-bottom: 6px; }
.toc__link { align-items: flex-start; }
/* 1024–1439: the column is 200 (176 under 1280), so the text goes one step down to fit on one line */
@media (max-width: 1439px) {
  .toc__inner { padding-right: 8px; }
  .toc__link { font-size: 15px; line-height: 22px; }
}
@media (max-width: 1279px) {
  .toc__link { font-size: 14px; line-height: 20px; }
  .toc__link--sub { padding-left: 36px; }
}
/* the active sub-item looks Medium without changing its width (a real weight change re-wraps
   long labels in a narrow column): same font weight, a thin stroke in the text colour */
.toc__link--sub.is-active { font-weight: 400; -webkit-text-stroke: .45px currentColor; }

/* "Email copied" tip under the email link in the header */
.has-copy-tip { position: relative; }
.copy-tip {
  position: absolute; left: 50%; top: calc(100% + 10px);
  padding: 6px 10px; border-radius: 8px;
  background: var(--black); color: var(--white);
  font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap;
  transform: translate(-50%, -4px); opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.copy-tip.is-on { opacity: 1; transform: translate(-50%, 0); }

/* the header always has its bottom line (Figma, 11.11) */
.header-wrap, .header-wrap.is-scrolled { border-bottom-color: var(--stroke); }

/* ---------- Keyboard focus (Tab) ----------
   The ring follows each element's own radius (no forced 4px corners). Text links don't get a box:
   contents items get a soft accent pill behind the label (never over the rail), header links reuse their hover underline. */
.toc__link:focus-visible { outline: none; }
.toc__link:focus-visible .toc__label { color: var(--accent); background: var(--accent-light); border-radius: 6px; box-shadow: -6px 0 0 4px var(--accent-light), 6px 0 0 4px var(--accent-light); border-radius: 4px; }
.header-links a:focus-visible, .crumbs a:focus-visible { outline: none; }
.icon-btn:focus-visible { outline-offset: 2px; }

/* ---------- Modal (shared: home documents, case image viewer) ---------- */
.is-doc-open { overflow: hidden; }
.modal {
  flex-direction: column;
  width: min(var(--modal-w, 560px), calc(100vw - 32px));
  height: min(var(--modal-h, 880px), calc(100dvh - 64px));
  max-width: none; max-height: none;
  padding: 0; border: 0; border-radius: 16px;
  overflow: hidden;
  background: var(--white); color: var(--black);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .06);
}
.modal[open] { display: flex; animation: modal-in 320ms var(--ease); }
.modal::backdrop { background: rgba(16, 16, 16, .4); backdrop-filter: blur(2px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.modal__head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 16px 0 24px;
  border-bottom: 1px solid var(--stroke);
}
.modal__title { overflow: hidden; font-size: 16px; line-height: 24px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.modal__close {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--grey-white); color: var(--black); cursor: pointer;
  transition: background-color 200ms var(--ease);
}
.modal__close:hover { background: var(--grey); }
.modal__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

@media (max-width: 767px) {
  .modal { width: calc(100vw - 16px); height: calc(100dvh - 32px); }
  .modal__head { height: 56px; padding: 0 8px 0 16px; }
  .modal__close { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
