/* ============================================================
   Enya Ferreira — Portfolio
   Minimal, content-first. Light/dark aware.
   ============================================================ */

:root {
  --max: 640px;          /* home + text column */
  --max-wide: 1040px;    /* image breakouts */
  --gutter: 24px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Blue colour ramp (base #0C6FFF = 500) */
  --blue-50:  #EEF5FF;
  --blue-100: #D9E8FF;
  --blue-200: #B5D2FF;
  --blue-300: #84B4FF;
  --blue-400: #4D92FF;
  --blue-500: #0C6FFF;
  --blue-600: #0059DB;
  --blue-700: #0046AD;
  --blue-800: #003580;
  --blue-900: #002457;

  /* Light theme (default) */
  --bg: #ffffff;
  --bg-soft: #f6f6f5;
  --surface: #ffffff;
  --text: #1b1b1a;
  --text-muted: #6f6f6c;
  --text-faint: #9a9a96;
  --line: #e8e8e5;
  --line-strong: #d8d8d4;
  --accent: var(--blue-500);       /* numbers, quote bar, menu line, EF monogram */
  --accent-text: var(--blue-600);  /* small text, e.g. link hovers (passes AA on white) */
  --accent-soft: var(--blue-100);  /* selection, highlighted words, monogram background */
  --shadow: 0 1px 2px rgba(20,20,20,.04), 0 8px 24px rgba(20,20,20,.06);
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg: #0f0f10;
  --bg-soft: #161617;
  --surface: #161617;
  --text: #ededec;
  --text-muted: #a3a3a0;
  --text-faint: #6e6e6b;
  --line: #262627;
  --line-strong: #343435;
  --accent: var(--blue-400);
  --accent-text: var(--blue-400);
  --accent-soft: var(--blue-900);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f10;
    --bg-soft: #161617;
    --surface: #161617;
    --text: #ededec;
    --text-muted: #a3a3a0;
    --text-faint: #6e6e6b;
    --line: #262627;
    --line-strong: #343435;
    --accent: var(--blue-400);
    --accent-text: var(--blue-400);
    --accent-soft: var(--blue-900);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (max-width: 480px) { body { font-size: 16px; } }

img { max-width: 100%; display: block; }

a {
  color: var(--text);
  text-decoration: none;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-text); }

::selection { background: var(--accent-soft); color: var(--text); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Shared headings ---------- */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-faint); margin: 0 0 10px;
}

/* ============================================================
   HOME
   ============================================================ */
.home { padding-top: 92px; padding-bottom: 72px; }
@media (max-width: 480px) { .home { padding-top: 56px; padding-bottom: 56px; } }

.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 20px; letter-spacing: .02em;
  border: 1px solid var(--line); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.home h1 { font-size: 26px; margin: 28px 0 4px; }
.home .role { color: var(--text-muted); margin: 0; font-size: 17px; }
.home .role a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--line-strong); }
.home .role a:hover { color: var(--accent-text); }

.section { margin-top: 48px; }
.section > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin: 0 0 16px; font-weight: 600; }

.about p { margin: 0 0 14px; color: var(--text); }
.about p:last-child { margin-bottom: 0; }
.about a { text-decoration: underline; text-decoration-color: var(--line-strong); }
.about a:hover { color: var(--accent-text); }

/* Case study cards */
.cards { display: flex; flex-direction: column; gap: 18px; }
.card {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.card-media {
  aspect-ratio: 16 / 9; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.card-media.placeholder { color: var(--text-faint); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.card-body { padding: 16px 18px 18px; }
.card-body .k { font-size: 12px; color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.card-body h3 { font-size: 18px; margin: 6px 0 4px; }
.card-body p { margin: 0; color: var(--text-muted); font-size: 14.5px; }
.card .arrow { color: var(--text-faint); }

/* Connect */
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.links a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--line-strong); width: fit-content; }
.links a:hover { color: var(--accent-text); }

/* Footer */
.footer {
  margin-top: 64px; padding: 24px 0 48px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text-faint); font-size: 13.5px;
}

.theme-toggle {
  appearance: none; background: transparent; border: 1px solid var(--line);
  color: var(--text-muted); border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 13px; cursor: pointer; transition: border-color .2s, color .2s;
  display: inline-flex; align-items: center; gap: 7px;
}
.theme-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.theme-toggle svg { width: 15px; height: 15px; }

/* ============================================================
   CASE STUDY
   ============================================================ */
.cs { padding-top: 40px; }

.cs-back {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 14px; margin-bottom: 44px;
}
.cs-back .avatar { width: 34px; height: 34px; font-size: 13px; }
.cs-back:hover { color: var(--accent-text); }

.cs-header { margin-bottom: 36px; }
.cs-header h1 { font-size: 34px; margin: 0 0 14px; line-height: 1.12; }
@media (max-width: 480px) { .cs-header h1 { font-size: 27px; } }
.cs-lede { font-size: 19px; color: var(--text-muted); margin: 0 0 22px; line-height: 1.5; }

.cs-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.cs-meta .chip {
  font-size: 12.5px; color: var(--text-muted); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; white-space: nowrap;
}

/* media that breaks out wider than the text column */
/* images sit in the same column as the text */
.breakout { width: 100%; }

figure { margin: 40px 0; }
figure.breakout { margin: 48px auto; }
.frame {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-soft); box-shadow: var(--shadow); cursor: zoom-in;
}
.frame img { width: 100%; height: auto; }
figcaption { margin-top: 12px; font-size: 13.5px; color: var(--text-faint); text-align: center; }

/* before/after grid */
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .ba { grid-template-columns: 1fr; } }
.ba .tag { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 10px; }
.ba .tag.before { color: var(--text-muted); }
.ba .tag.after { color: var(--text); }
:root[data-theme="dark"] .ba .tag.before { color: var(--text-muted); }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .ba .tag.before { color:var(--text-muted); } }

/* text sections */
.cs-section { margin: 56px 0; }
.cs-section h2 { font-size: 20px; margin: 0 0 16px; scroll-margin-top: 90px; }
.cs-section h3 { font-size: 16.5px; margin: 28px 0 8px; }
.cs-section p { margin: 0 0 16px; }
.cs-section p:last-child { margin-bottom: 0; }
.cs-section strong, .cs-section b { font-weight: 600; }
.cs-section em { font-style: normal; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }

.cs-section ul { margin: 0 0 16px; padding: 0; list-style: none; }
.cs-section ul li { position: relative; padding-left: 22px; margin: 0 0 10px; }
.cs-section ul li::before {
  content: ""; position: absolute; left: 2px; top: 11px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--text);
}
.cs-section ul li b { font-weight: 600; }

/* definitions */
.defs { display: grid; gap: 8px; }
.def { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); }
.def dt { font-weight: 600; margin-bottom: 4px; }
.def dd { margin: 0; color: var(--text-muted); font-size: 15px; }

/* goals grid */
.goals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .goals { grid-template-columns: 1fr; } }
.goal { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg-soft); font-size: 15px; }

/* impact stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 8px 0 28px; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; background: var(--surface); }
.stat .num { font-size: 38px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; color: var(--accent); }
.stat .lbl { margin-top: 10px; color: var(--text-muted); font-size: 14px; }

.pullquote {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 22px; margin: 32px 0;
  font-size: 20px; line-height: 1.45; letter-spacing: -0.01em;
}
.pullquote .cite { display: block; font-size: 14px; color: var(--text-muted); margin-top: 12px; }

.callout {
  border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: var(--radius); padding: 16px 18px; font-size: 14.5px; color: var(--text-muted); margin: 28px 0;
}
.callout b { color: var(--text); }

/* section nav (desktop, floating to the right of the text column) */
.cs-nav {
  position: fixed; top: 50%; transform: translateY(-50%); left: calc(50% + (var(--max) / 2) + 16px); z-index: 20;
  display: flex; flex-direction: column; gap: 3px;
}
.cs-nav a {
  font-size: 12.5px; color: var(--text-faint); padding: 4px 8px; border-radius: 6px;
  display: flex; align-items: center; gap: 9px; line-height: 1.2;
}
.cs-nav a::before { content: ""; width: 14px; height: 1.5px; background: var(--line-strong); transition: width .2s, background .2s; }
.cs-nav a:hover { color: var(--text); }
.cs-nav a.active { color: var(--text); }
.cs-nav a.active::before { width: 22px; background: var(--accent); }
@media (max-width: 1060px) { .cs-nav { display: none; } }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(10,10,10,.86); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 0; box-shadow: 0 30px 80px rgba(0,0,0,.6); }

/* in-progress banner: same shape as the "In short" callout, in the butter yellow from the Transfer Package diagram */
.wip {
  border: 0; border-radius: 0; background: #fdf3c4;
  padding: 16px 18px; font-size: 16px; color: var(--text); margin: 0 0 32px;
}
.wip b { font-family: "Patrick Hand", "Comic Sans MS", cursive; font-weight: 400; font-size: 20px; line-height: 1; color: #7a5c00; }
:root[data-theme="dark"] .wip { background: #3d3514; }
:root[data-theme="dark"] .wip b { color: #f5d76e; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wip { background: #3d3514; }
  :root:not([data-theme="light"]) .wip b { color: #f5d76e; }
}

.cs-footer { margin-top: 72px; }

/* avatar: photo sits over the EF monogram, which shows if no photo exists */
.avatar { position: relative; }
.avatar img { position: absolute; inset: 0; }

/* case study cards that aren't published yet */
.card.soon { cursor: default; }
.card.soon:hover { transform: none; box-shadow: none; border-color: var(--line); }
.card.soon .card-media { aspect-ratio: 16 / 5; }
.card.soon h3 { color: var(--text-muted); }

/* hero image on case study pages */
.cs-hero { margin-top: 8px; }

/* before/after labels inside the goals grid */
.goal .tag { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 6px; }
.goal .tag.before { color: var(--text-muted); }
.goal .tag.after { color: var(--text); }
:root[data-theme="dark"] .goal .tag.before { color: var(--text-muted); }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .goal .tag.before { color:var(--text-muted); } }

/* homepage: subheadings in sentence case, same font as body text */
.home .section > h2 { font: inherit; text-transform: none; letter-spacing: inherit; color: var(--text); margin: 0 0 10px; }

/* homepage: slightly rounded case study cards */
.card { border-radius: 10px; }



/* homepage: intro text in the same grey as the role line */
.home .intro { color: var(--text-muted); margin: 20px 0 0; }


/* case study cards: stronger hover border (darker in light mode, lighter in dark mode) */
.card:hover { border-color: #a9a9a5; }
:root[data-theme="dark"] .card:not(.soon):hover { border-color: #66666a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card:not(.soon):hover { border-color: #66666a; } }
.card.soon:hover { border-color: var(--line); }

/* case study pages: header uses the same layout as the homepage header */
.cs { padding-top: 92px; }
@media (max-width: 480px) { .cs { padding-top: 56px; } }
.cs-intro h1 { font-size: 26px; margin: 28px 0 4px; line-height: 1.2; }
.cs-intro .role { color: var(--text-muted); margin: 0 0 22px; font-size: 17px; }
.cs-intro .avatar:hover { border-color: var(--line-strong); }

/* lightbox close (X) button, top right: plain white icon */
.lightbox-close {
  position: fixed; top: 20px; right: 20px; z-index: 101;
  width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: #fff; cursor: pointer;
}
.lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox-close svg { width: 24px; height: 24px; }

/* case study images: square corners */
.frame { border-radius: 0; }

/* definition icons: sit to the left of each definition; colours follow the theme */
.def { position: relative; padding-left: 96px; min-height: 96px; display: flex; flex-direction: column; justify-content: center; }
.def-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 60px; height: 60px; }
.def-icon .ic-ink { fill: var(--text); }
.def-icon .ic-accent { fill: var(--accent); }
@media (max-width: 480px) {
  .def { padding-left: 78px; }
  .def-icon { left: 14px; width: 48px; height: 48px; }
}

/* definition cards: no border or panel; icon lines up with the left edge of the text column */
.def { border: 0; background: none; border-radius: 0; padding: 10px 0 10px 78px; min-height: 80px; }
.def-icon { left: 0; }
@media (max-width: 480px) {
  .def { padding-left: 64px; }
  .def-icon { left: 0; }
}

/* case study body text: same grey as the homepage intro; headings and bold text stay black */
.cs-section p, .cs-section li, .goal, .pullquote { color: var(--text-muted); }
.cs-section strong, .cs-section b, .pullquote strong { color: var(--text); }


/* end-to-end diagram: inline SVG whose colours follow the theme */
.diagram-svg { display: block; width: 100%; height: auto; }
.diagram .ic-ink { fill: var(--text); }
.diagram .ic-accent { fill: var(--accent); }
.diagram .ic-accent-stroke { stroke: var(--accent); }
/* end-to-end diagram: same border and shadow as the case study images */
.diagram { border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); padding: 28px 24px; }
@media (max-width: 480px) { .diagram { padding: 16px 12px; } }

/* case study images and diagram: no shadow */
.frame, .diagram { box-shadow: none; }
.diagram .ic-ink-stroke { stroke: var(--text); }

/* bullet point dots: same grey as body text */
.cs-section ul li::before { background: var(--text-muted); }

/* definition descriptions: 14px */
.def dd { font-size: 14px; }

/* image captions: 14px */
figcaption { font-size: 14px; }

/* "In short" callout: square, blue-50 fill (navy in dark mode), no border, dark 16px text */
.callout { border-radius: 0; background: var(--blue-50); border: 0; color: var(--text); font-size: 16px; }
.callout b { color: var(--accent); }
:root[data-theme="dark"] .callout { background: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .callout { background: var(--blue-900); } }

/* Goals cards: same style as the "In short" callout, with black 14px text */
#goals .goal { border: 0; border-radius: 0; background: var(--blue-50); color: var(--text); font-size: 14px; padding: 16px 18px; }
:root[data-theme="dark"] #goals .goal { background: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #goals .goal { background: var(--blue-900); } }

/* Goals cards: large handwritten number to the left of each goal, centred on the first line of text */
#goals .goal { display: flex; align-items: flex-start; gap: 8px; }
#goals .goal-num {
  flex-shrink: 0; width: 17px; /* fits the widest number, "2." */
  font-family: "Patrick Hand", "Comic Sans MS", cursive; font-weight: 400; font-size: 24px;
  height: 22.4px; line-height: 22.4px; /* same height as one 14px line of goal text */
  color: var(--accent);
}

/* "In short" label: Patrick Hand (regular only, so no faux bold), sized up to visually match 16px Inter */
.callout b { font-family: "Patrick Hand", "Comic Sans MS", cursive; font-weight: 400; font-size: 20px; line-height: 1; }

/* line-art diagrams with transparent backgrounds: always shown on white (the artwork has its own margin) */
.frame-diagram { background: #fff; }
.lightbox img { background: #fff; }

/* case study icons: 48px on desktop, 32px on phones; text 16px to the right */
.def, .def:is(*) { padding-left: 64px; min-height: 68px; }
.def-icon { width: 48px; height: 48px; left: 0; }
@media (max-width: 480px) {
  .def, .def:is(*) { padding-left: 48px; min-height: 52px; }
  .def-icon { width: 32px; height: 32px; left: 0; }
}

/* case study icons: aligned to the top of each row, level with the title */
.def, .def:is(*) { justify-content: flex-start; }
.def-icon { top: 10px; transform: none; }

/* impact cards: same style as the callouts (pale blue fill, no border, square), handwritten blue numbers */
.stat { border: 0; border-radius: 0; background: var(--blue-50); padding: 16px 18px; }
:root[data-theme="dark"] .stat { background: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stat { background: var(--blue-900); } }
.stat .num {
  font-family: "Patrick Hand", "Comic Sans MS", cursive; font-weight: 400;
  font-size: 44px; /* Patrick Hand draws smaller than Inter, so sized up to keep the same visual weight */
  letter-spacing: 0; color: var(--accent);
}
.stat .lbl { color: var(--text); }

/* impact cards: 12px apart */
.stats { gap: 12px; }
.stats { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }

/* Impact extras: two callouts stacked 12px apart */
.callout-group { display: grid; gap: 12px; margin: 12px 0 0; }
.stats { margin-bottom: 12px; } /* 12px between the number cards and the cards below */
.callout-group .callout { margin: 0; }
.callout-group .callout b { font-family: inherit; font-size: inherit; line-height: inherit; font-weight: 600; color: var(--text); }

/* image placeholders: dashed box shown until the real image is added */
.img-placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; padding: 24px; border: 1.5px dashed var(--line-strong); background: var(--surface); color: var(--text-faint); font-size: 14px; text-align: center; }

/* Goals stacked in a single column (case study 2) */
.goals-stack { grid-template-columns: 1fr; }

/* screenshots that need breathing room inside their frame (always on white, like the source document) */
.frame-padded { padding: 12px; background: #fff; }
@media (max-width: 480px) { .frame-padded { padding: 8px; } }
.lightbox img.padded { padding: 16px; }


/* journey diagram (case study 2): extra theme-aware colours, and a tall layout on phones */
.diagram .ic-muted { fill: var(--text-muted); }
.diagram .ic-muted-stroke { stroke: var(--text-faint); }
.diagram .ic-line-fill { fill: var(--line); }  /* same colour as the diagram frame border */
.diagram .ic-accent-soft { fill: var(--blue-50); }
:root[data-theme="dark"] .diagram .ic-accent-soft { fill: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .diagram .ic-accent-soft { fill: var(--blue-900); } }
.diagram-tall { display: none; }
@media (max-width: 600px) {
  .diagram-wide { display: none; }
  .diagram-tall { display: block; }
  /* full width with 24px padding on every side */
  .diagram-journey { padding: 24px; }
}

/* impact cards: hand-drawn arrow between numbers, in the number colour */
.stat .num-arrow { display: inline-block; height: 0.42em; width: auto; margin: 0 0.25em; vertical-align: 0.12em; }

/* homepage card showing case study 2's hero diagram (inline SVG, follows the theme) */
.card-media.card-diagram { background: var(--surface); padding: 24px 32px; }
.card-diagram-svg { display: block; width: 100%; height: 100%; }
.card-diagram .ic-ink { fill: var(--text); }
.card-diagram .ic-accent { fill: var(--accent); }
.card-diagram .ic-ink-stroke { stroke: var(--text); }
.card-diagram .ic-accent-soft { fill: var(--blue-50); }
:root[data-theme="dark"] .card-diagram .ic-accent-soft { fill: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card-diagram .ic-accent-soft { fill: var(--blue-900); } }

/* case study pages: back button in place of the profile photo — hand-drawn arrow on light blue */
.avatar-back { background: var(--blue-50); color: var(--text); border: 0; }
:root[data-theme="dark"] .avatar-back { background: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar-back { background: var(--blue-900); } }
.avatar-back .back-arrow { width: 24px; height: auto; }
/* back button hover/focus: circle darkens slightly, arrow turns brand blue */
.avatar-back { transition: background-color .2s ease; }
.avatar-back .back-arrow { transition: color .2s ease; }
.avatar-back:hover, .avatar-back:focus-visible { background: #e0ecff; color: var(--blue-500); }
:root[data-theme="dark"] .avatar-back:hover, :root[data-theme="dark"] .avatar-back:focus-visible { background: #0a2f66; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar-back:hover, :root:not([data-theme="light"]) .avatar-back:focus-visible { background: #0a2f66; } }

/* theme toggle: same fill, colours and hover as the case study back button */
.theme-toggle { background: var(--blue-50); color: var(--text); border: 0; padding: 8px 14px; transition: background-color .2s ease, color .2s ease; }
:root[data-theme="dark"] .theme-toggle { background: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle { background: var(--blue-900); } }
.theme-toggle:hover, .theme-toggle:focus-visible { background: #e0ecff; color: var(--blue-500); }
:root[data-theme="dark"] .theme-toggle:hover, :root[data-theme="dark"] .theme-toggle:focus-visible { background: #0a2f66; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle:hover, :root:not([data-theme="light"]) .theme-toggle:focus-visible { background: #0a2f66; } }

/* homepage: section headings, cards and card text match the case study pages */
.home .section > h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); margin: 0 0 16px; }
.card, .card-media { border-radius: 0; }
.card-body h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.003em; line-height: 1.3; margin: 0 0 6px; }  /* swapped with the section heading size */
.card-body p { font-size: 14px; line-height: 1.6; color: var(--text-muted); }                                      /* same as the definition text in the case studies */

/* Transfer Package structure diagram (case study 1): page outlines and colour-coded sections */
.diagram .pk-page-fill { fill: var(--surface); }
.diagram .pk-page { stroke: var(--text); }  /* black page outlines (white in dark mode) */
.diagram .pk-text { fill: var(--text); }
/* palette built around the brand blue (#0C6FFF): blues, indigo and teal neighbours, with a warm peach complement */
.diagram .pk-blue   { fill: #d6f2ee; }  /* user details: soft teal */
.diagram .pk-pink   { fill: #e7e2ff; }  /* recipient pages: soft indigo */
.diagram .pk-green  { fill: #fdf3c4; }  /* personalised checklist: soft butter yellow (no brand blue in this diagram) */
.diagram .pk-yellow { fill: #ffe8d2; }  /* generic instructions: peach, the warm complement */
.diagram .pk-orange { fill: var(--line); }  /* legal disclaimers: the site's light grey */
.diagram .pk-rose   { fill: #fde2ee; }  /* personalised instructions: soft rose */
:root[data-theme="dark"] .diagram .pk-blue   { fill: #0f3d39; }
:root[data-theme="dark"] .diagram .pk-pink   { fill: #2c2660; }
:root[data-theme="dark"] .diagram .pk-green  { fill: #3d3514; }
:root[data-theme="dark"] .diagram .pk-yellow { fill: #4a311b; }
:root[data-theme="dark"] .diagram .pk-orange { fill: var(--line-strong); }
:root[data-theme="dark"] .diagram .pk-rose   { fill: #4a1f35; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .diagram .pk-blue   { fill: #0f3d39; }
  :root:not([data-theme="light"]) .diagram .pk-pink   { fill: #2c2660; }
  :root:not([data-theme="light"]) .diagram .pk-green  { fill: #3d3514; }
  :root:not([data-theme="light"]) .diagram .pk-yellow { fill: #4a311b; }
  :root:not([data-theme="light"]) .diagram .pk-orange { fill: var(--line-strong); }
  :root:not([data-theme="light"]) .diagram .pk-rose   { fill: #4a1f35; }
}

/* inline SVG diagrams that open in the lightbox */
[data-zoom] { cursor: zoom-in; }
[data-zoom]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox-diagram { display: none; width: 94vw; max-height: 92vh; overflow: auto; background: var(--surface); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.lightbox-diagram svg { display: block; width: 100%; height: auto; }
.lightbox.show-diagram img { display: none; }
.lightbox.show-diagram .lightbox-diagram { display: block; }
/* diagrams cropped on purpose at the right edge: no right padding, on the page or in the lightbox */
.diagram.crop-right, .diagram.diagram-journey.crop-right { padding-right: 0; }

/* theme toggle icon: moon offers dark mode, sun offers light mode */
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ic-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .ic-sun { display: block; }
}

/* footer "Back to all work": pill styled like the back button and theme toggle, with the hand-drawn arrow */
.footer-back {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 8px 14px;
  font-size: 13px; background: var(--blue-50); color: var(--text); transition: background-color .2s ease, color .2s ease;
}
.footer-back .back-arrow { width: 16px; height: auto; }
:root[data-theme="dark"] .footer-back { background: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer-back { background: var(--blue-900); } }
.footer-back:hover, .footer-back:focus-visible { background: #e0ecff; color: var(--blue-500); }
:root[data-theme="dark"] .footer-back:hover, :root[data-theme="dark"] .footer-back:focus-visible { background: #0a2f66; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer-back:hover, :root:not([data-theme="light"]) .footer-back:focus-visible { background: #0a2f66; } }


/* homepage case study cards: 2x2 grid, one column on phones */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }
.card-media.card-diagram { padding: 16px 20px; }

/* homepage case study cards: titles only, slightly smaller */
.card-body h3 { font-size: 16px; margin: 0; }

/* homepage case study cards: no divider between image and title */
.card-media { border-bottom: 0; }

/* homepage case study cards: pale blue tile like the callouts and buttons, image inset; hover deepens the fill and turns the title blue */
.card { border: 0; border-radius: 0; background: var(--blue-50); padding: 10px; transition: background-color .2s ease; }
.card:hover, .card:focus-visible { border-color: transparent; transform: none; box-shadow: none; background: #e0ecff; }
.card-media { background: var(--surface); }
.card-body { padding: 12px 6px 4px; }
.card-body h3 { transition: color .2s ease; }
.card:hover h3, .card:focus-visible h3 { color: var(--blue-500); }
:root[data-theme="dark"] .card { background: var(--blue-900); }
:root[data-theme="dark"] .card:hover, :root[data-theme="dark"] .card:focus-visible { background: #0a2f66; }
:root[data-theme="dark"] .card:hover h3, :root[data-theme="dark"] .card:focus-visible h3 { color: var(--text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card { background: var(--blue-900); }
  :root:not([data-theme="light"]) .card:hover, :root:not([data-theme="light"]) .card:focus-visible { background: #0a2f66; }
  :root:not([data-theme="light"]) .card:hover h3, :root:not([data-theme="light"]) .card:focus-visible h3 { color: var(--text); }
}

/* homepage cards: diagram images sit straight on the tile colour, with white transfer cards in case study 2's diagram */
.card-media.card-diagram { background: transparent; }
.card-diagram .ic-accent-soft { fill: #fff; }
:root[data-theme="dark"] .card-diagram .ic-accent-soft { fill: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card-diagram .ic-accent-soft { fill: var(--surface); } }


/* homepage case study tiles: slightly rounded corners, with a smaller matching radius on the inset image */
.card { border-radius: 10px; }
.card-media { border-radius: 4px; }

/* homepage card tag, e.g. "In delivery" */
.card-tag {
  display: inline-block; margin: 0 0 8px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
}

/* case study 3 card: image area is shorter by exactly the tag's height (18px line + 6px padding + 8px gap = 32px), so all cards match */
.card { container-type: inline-size; }
.card-tag { line-height: 18px; display: block; width: fit-content; border-radius: 0; }
.card-media.card-cart { aspect-ratio: auto; height: calc(100cqw * 9 / 16 - 32px); padding: 20px 36px; }

/* homepage card: the picture wrapper fills the image area like a plain img */
.card-media picture { display: block; width: 100%; height: 100%; }

/* case study 1 card: show the whole screenshot (no cropping), sitting on the blue tile */
.card.card-shot .card-media { background: transparent; }
.card.card-shot .card-media img { object-fit: contain; object-position: center; }

/* case study 3 card: butter yellow tile (as in the in-delivery note), with a brand blue tag */
.card.card-yellow { background: #fdf3c4; }
.card.card-yellow:hover, .card.card-yellow:focus-visible { background: #f8e8a2; }
:root[data-theme="dark"] .card.card-yellow { background: #3d3514; }
:root[data-theme="dark"] .card.card-yellow:hover, :root[data-theme="dark"] .card.card-yellow:focus-visible { background: #4d431a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card.card-yellow { background: #3d3514; }
  :root:not([data-theme="light"]) .card.card-yellow:hover, :root:not([data-theme="light"]) .card.card-yellow:focus-visible { background: #4d431a; }
}
.card-tag, :root[data-theme="dark"] .card-tag { background: var(--blue-500); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card-tag { background: var(--blue-500); color: #fff; } }

/* case study 1 card: grey tile matching the screenshot's background (#edf0f4); navy in dark mode like the other tiles */
.card.card-grey { background: #edf0f4; }
.card.card-grey:hover, .card.card-grey:focus-visible { background: #e3e5eb; }
:root[data-theme="dark"] .card.card-grey { background: var(--blue-900); }
:root[data-theme="dark"] .card.card-grey:hover, :root[data-theme="dark"] .card.card-grey:focus-visible { background: #0a2f66; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card.card-grey { background: var(--blue-900); }
  :root:not([data-theme="light"]) .card.card-grey:hover, :root:not([data-theme="light"]) .card.card-grey:focus-visible { background: #0a2f66; }
}

/* homepage case study tiles: square corners */
.card, .card-media { border-radius: 0; }

/* homepage section headings ("Case studies", "Connect"): same size as case study page section headings */
.home .section > h2 { font-size: 20px; }

/* case study 2 card: less side padding so the wide diagram fills more of the tile */
.card-media.card-diagram:not(.card-cart) { padding: 16px 12px; }

/* homepage case study tiles: image grows slightly on hover (and keyboard focus) */
.card-media > img, .card-media > picture, .card-media > svg { transition: transform .3s ease; }
.card:hover .card-media > img, .card:hover .card-media > picture, .card:hover .card-media > svg,
.card:focus-visible .card-media > img, .card:focus-visible .card-media > picture, .card:focus-visible .card-media > svg { transform: scale(1.05); }
@media (prefers-reduced-motion: reduce) {
  .card-media > img, .card-media > picture, .card-media > svg { transition: none; }
  .card:hover .card-media > *, .card:focus-visible .card-media > * { transform: none; }
}

/* case study 1 card: inset the screenshot so it has room to grow on hover without being cropped */
.card.card-shot .card-media { padding: 12px; }

/* homepage case study tiles: title keeps its colour on hover */
.card:hover h3, .card:focus-visible h3 { color: var(--text); }

/* "In delivery" tag: white with brand blue text, in both themes */
.card-tag, :root[data-theme="dark"] .card-tag { background: #fff; color: #1b1b1a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card-tag { background: #fff; color: #1b1b1a; } }

/* Light/dark mode switched off for now: pages are locked to light mode (data-theme="light" on <html>),
   and the toggle is hidden. Delete this block to bring the toggle back. */
.theme-toggle { display: none; }
.footer:not(.cs-footer) { display: none; }  /* homepage footer only holds the toggle */

/* homepage tiles: stop the hover flicker. The growing image and its clipping area stay on their own
   graphics layer all the time, instead of being moved onto one when the zoom starts and off again after. */
.card-media { transform: translateZ(0); }
.card-media > img, .card-media > picture, .card-media > svg { will-change: transform; backface-visibility: hidden; }
