/*
Theme Name:  TJ Portfolio
Theme URI:   https://telmojuliao.com
Author:      Telmo Julião
Author URI:  https://telmojuliao.com
Description: Personal portfolio theme for Telmo Julião — minimal, editorial, custom-built.
Version:     1.0.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tj-portfolio
*/


/* ============================================================
   DESIGN TOKENS — edit these to retheme the entire site
   ============================================================ */
:root {

  /* Colour */
  --colour-bg:              #F7F6F3;   /* warm off-white — never pure white */
  --colour-bg-alt:          #F0EFEb;   /* slightly deeper, used for subtle dividers */
  --colour-text:            #1C1C1A;   /* near-black — softer than #000 */
  --colour-text-secondary:  #6B6B67;   /* muted — descriptions, meta */
  --colour-text-muted:      #717170;   /* muted — index numbers, labels */
  --colour-border:          #E3E1DC;   /* warm light grey — lines, rules */
  --colour-border-strong:   #C4C2BC;   /* slightly darker — card hover state */
  --colour-hover:           #1C1C1A;   /* hover text colour (same as primary) */
  --colour-underline:       #C2C0BB;   /* dashed underline colour on links */

  /* Typography — families */
  --font-serif:   'Instrument Serif', Georgia, serif;
  --font-sans:    'Nunito Sans', Helvetica, Arial, sans-serif;

  /* Typography — weights */
  --weight-light:    400;
  --weight-regular:  400;
  --weight-semibold: 600;

  /* Typography — scale (rem, base 16px) */
  --text-xs:   0.6875rem;   /*  11px — index numbers, small labels */
  --text-sm:   0.8125rem;   /*  13px — footer, meta */
  --text-base: 0.9375rem;   /*  15px — body copy */
  --text-md:   1.125rem;    /*  18px — lead / intro paragraph */
  --text-lg:   1.5rem;      /*  24px — case study title on row */
  --text-xl:   2rem;        /*  32px — page headings */
  --text-2xl:  2.75rem;     /*  44px — hero statement, desktop */
  --text-3xl:  3.5rem;      /*  56px — hero statement, large screens */

  /* Typography — line height */
  --leading-tight:  1.15;
  --leading-normal: 1.55;
  --leading-relaxed: 1.75;

  /* Typography — letter spacing */
  --tracking-tight:  -0.02em;
  --tracking-normal:  0em;
  --tracking-wide:    0.08em;  /* small caps / labels */

  /* Spacing scale */
  --space-1:   0.25rem;   /*  4px */
  --space-2:   0.5rem;    /*  8px */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.5rem;    /* 24px */
  --space-6:   2rem;      /* 32px */
  --space-7:   3rem;      /* 48px */
  --space-8:   4rem;      /* 64px */
  --space-9:   6rem;      /* 96px */
  --space-10:  8rem;      /* 128px */

  /* Layout */
  --container-max:   1120px;
  --container-pad:   var(--space-6);  /* horizontal page padding */
  --nav-height:      4rem;

  /* Radius — applied consistently to all image containers */
  --radius:          6px;
}


/* ============================================================
   DARK MODE TOKENS
   Applied when: (a) user explicitly chose dark via the toggle,
   or (b) OS is set to dark and user hasn't overridden to light.
   ============================================================ */
html[data-theme="dark"] {
  --colour-bg:              #1A1A18;
  --colour-bg-alt:          #222220;
  --colour-text:            #F0EFE9;
  --colour-text-secondary:  #9A9A96;
  --colour-text-muted:      #8A8A88;
  --colour-border:          #2E2E2C;
  --colour-border-strong:   #444442;
  --colour-hover:           #F0EFE9;
  --colour-underline:       #3A3A38;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --colour-bg:              #1A1A18;
    --colour-bg-alt:          #222220;
    --colour-text:            #F0EFE9;
    --colour-text-secondary:  #9A9A96;
    --colour-text-muted:      #8A8A88;
    --colour-border:          #2E2E2C;
    --colour-border-strong:   #444442;
    --colour-hover:           #F0EFE9;
    --colour-underline:       #3A3A38;
  }
}


/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Fade only — no upward movement (used for bento cards) */
.reveal--fade {
  opacity: 0;
  transition: opacity 0.9s ease;
}

.reveal--fade.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--fade {
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0s !important; /* override any JS-applied inline delay */
  }
  html {
    scroll-behavior: auto;
  }
  .skip-link {
    transition: none; /* prevent skip link from animating its position on focus */
  }
  .bento-card,
  .bento-card:hover,
  .bento-grid > :nth-child(even):hover,
  .site-nav__logo,
  .work-item,
  .theme-toggle,
  .theme-toggle__track,
  .theme-toggle__knob {
    transition: none;
  }
  /* Note: the dark-mode knob rules further down the file have higher specificity
     and will still apply the correct translateX position — just without animation. */
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%; /* keeps rem relative to browser default (16px) */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--colour-bg);
  color: var(--colour-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}


/* Focus styles — WCAG 2.4.7 */
:focus-visible {
  outline: 2px solid var(--colour-text);
  outline-offset: 3px;
  border-radius: 2px;
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */

/* Headings use the serif — let the font do the expressive work */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p {
  font-family: var(--font-sans);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  color: var(--colour-text);
}

/* Lead paragraph — used for hero statement and case study intros */
.text-lead {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
}

@media (min-width: 1024px) {
  .text-lead {
    font-size: var(--text-3xl);
  }
}

/* Label — index numbers, small caps, meta */
.text-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

/* Secondary / muted body text */
.text-muted {
  color: var(--colour-text-secondary);
  font-weight: var(--weight-light);
}


/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Prevent line breaks on inline elements e.g. proper names */
.nowrap {
  white-space: nowrap;
}

/* Visually hidden — accessible text for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ============================================================
   NAVIGATION
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background-color: var(--colour-bg);
  /* No shadow, no border — let the content breathe past it */
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Flex spacer that mirrors .theme-toggle__wrap so the menu stays centred */
.site-nav__logo-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}

/* TJ wordmark */
.site-nav__logo {
  position: relative;
  font-family: 'Oswald', sans-serif;
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--colour-text);
  text-decoration: none;
  line-height: 1;
}

.site-nav__logo:hover {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.site-nav__logo::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-normal);
  color: var(--colour-bg);
  background-color: var(--colour-text);
  padding: 4px 10px;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.site-nav__logo:hover::after,
.site-nav__logo:focus-visible::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .site-nav__logo::after {
    transition: none;
  }
}

/* Nav links */
.site-nav__menu,
.site-nav__menu ul {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

/* <li> wrappers are required for valid list semantics — display as flex items */
.site-nav__menu li {
  display: contents;
}

.site-nav__menu a {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-secondary);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--colour-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;
}

.site-nav__menu a:hover,
.site-nav__menu a[aria-current="page"] {
  color: var(--colour-text);
  text-decoration-style: solid;
  text-decoration-color: var(--colour-text);
}


/* ============================================================
   THEME TOGGLE — sliding pill switch
   Icon lives inside the knob; knob slides L → R for dark mode.
   ============================================================ */
/* Flex spacer that mirrors .site-nav__logo so the menu stays centred */
.theme-toggle__wrap {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0;
  cursor: pointer;
}

/* Re-apply focus ring tightly around the pill track. */
.theme-toggle:focus-visible {
  outline: none;
}

.theme-toggle:focus-visible .theme-toggle__track {
  outline: 2px solid var(--colour-text);
  outline-offset: 3px;
  border-radius: 999px;
}

/* Track — the pill container */
.theme-toggle__track {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--colour-border);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background-color 0.3s ease;
}

.theme-toggle:hover .theme-toggle__track {
  background-color: var(--colour-border-strong);
}

/* Knob — white circle that slides, contains the icon */
.theme-toggle__knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  background-color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

/* Dark active: slide knob right
   Travel = 44 − 16 − (4 × 2) = 20px */
html[data-theme="dark"] .theme-toggle__knob {
  transform: translateX(20px);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle__knob {
    transform: translateX(20px);
  }
}

/* Icons inside the knob */
.theme-toggle__icon {
  width: 10px;
  height: 10px;
  stroke-width: 2;
  flex-shrink: 0;
  position: absolute;
}

/* Sun shown in light mode */
.theme-toggle__icon--sun  { display: block; stroke: #B07800; }
.theme-toggle__icon--moon { display: none;  stroke: #4A4A48; }

/* Moon shown in dark mode */
html[data-theme="dark"] .theme-toggle__icon--sun  { display: none; }
html[data-theme="dark"] .theme-toggle__icon--moon { display: block; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle__icon--sun  { display: none; }
  html:not([data-theme="light"]) .theme-toggle__icon--moon { display: block; }
}

/* ── Small-screen fallback (< 360px) ────────────────────────
   Hide the pill and show a single icon instead so the nav
   stays on one row. The pill reappears at 360px and above.
   ---------------------------------------------------------- */
.theme-toggle__sm-icon {
  display: none; /* hidden at all sizes by default */
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
  flex-shrink: 0;
}

@media (max-width: 359px) {
  /* Hide the pill */
  .theme-toggle__track { display: none; }

  /* Light mode: show sun */
  .theme-toggle__sm-icon--sun  { display: block; stroke: #B07800; }
  .theme-toggle__sm-icon--moon { display: none; }

  /* Dark mode via data-theme attribute */
  html[data-theme="dark"] .theme-toggle__sm-icon--sun  { display: none; }
  html[data-theme="dark"] .theme-toggle__sm-icon--moon { display: block; stroke: var(--colour-text); }

  /* The normal focus ring targets .theme-toggle__track which is hidden here.
     Restore it directly on the button so keyboard focus is always visible. */
  .theme-toggle:focus-visible {
    outline: 2px solid var(--colour-text);
    outline-offset: 3px;
    border-radius: 2px;
  }
  .theme-toggle:focus-visible .theme-toggle__track {
    outline: none;
  }
}

/* Dark mode via system preference at small size */
@media (max-width: 359px) and (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle__sm-icon--sun  { display: none; }
  html:not([data-theme="light"]) .theme-toggle__sm-icon--moon { display: block; stroke: var(--colour-text); }
}


/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-6);
  z-index: 9999;
  padding: var(--space-2) var(--space-5);
  background-color: var(--colour-text);
  color: var(--colour-bg);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  text-decoration: none;
  border-radius: var(--radius);
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: var(--space-4);
}


/* ============================================================
   SITE WRAPPER — pushes content below fixed nav
   ============================================================ */
.site-main {
  padding-top: var(--nav-height);
}

/* ============================================================
   WORDPRESS ADMIN BAR
   When logged in, WP adds a 32px bar at the top. Offset the
   fixed nav so it sits below it rather than behind it.
   ============================================================ */
body.admin-bar .site-nav {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .site-nav {
    top: 46px;
  }
}

/* ============================================================
   WORK LIST SECTION HEADING
   ============================================================ */
.work-list__heading {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
  padding-top: var(--space-8);
  padding-bottom: var(--space-6);
}


/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding-block: var(--space-8);
  border-top: 1px solid var(--colour-border);
  margin-top: var(--space-10);
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.site-footer__copy {
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  font-weight: var(--weight-light);
}

.site-footer__socials {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-footer__menu {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .site-footer__menu {
    gap: var(--space-3) var(--space-5); /* tighter row gap when wrapping */
  }
}

.site-footer__menu a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--colour-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;
}

.site-footer__menu a:hover {
  color: var(--colour-text);
  text-decoration-style: solid;
  text-decoration-color: var(--colour-text);
}

.site-footer__icon {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  flex-shrink: 0;
}

.site-footer__link {
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--colour-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;
}

.site-footer__link:hover {
  color: var(--colour-text);
  text-decoration-style: solid;
  text-decoration-color: var(--colour-text);
}



/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  position: relative;       /* contains the absolute canvas overlay */
  padding-top: var(--space-9);
  padding-bottom: var(--space-7);
  min-height: calc(60vh - var(--nav-height));
  display: flex;
  align-items: center;
}

.hero .container {
  position: relative;       /* sits above the canvas */
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 390px;
  align-items: center;
  gap: var(--space-9);
  width: 100%;
}

.hero__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.hero__statement {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
}

@media (min-width: 1024px) {
  .hero__statement {
    font-size: var(--text-3xl);
  }
}

.hero__sub {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-light);
  color: var(--colour-text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* Photo / avatar placeholder */
.hero__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  background-color: var(--colour-bg-alt);
  overflow: hidden;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__photo-placeholder {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

@media (max-width: 768px) {
  .hero .container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-5);
  }

  .hero__photo {
    aspect-ratio: 4 / 3;
    max-width: 260px;
  }

  .hero {
    min-height: auto;
    padding-top: var(--space-8);
    padding-bottom: var(--space-6);
  }
}


/* ============================================================
   WORK LIST (case study rows)
   ============================================================ */
.work-list {
  border-top: 1px solid var(--colour-border);
}

.work-item {
  display: grid;
  grid-template-columns: 1fr 340px;
  align-items: center;
  gap: var(--space-7);
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--colour-border);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

@media (hover: hover) {
  .work-item:hover {
    opacity: 0.55;
  }
}

.work-list__items li:first-child .work-item {
  padding-top: 0;
}

.work-list__items li:last-child .work-item {
  border-bottom: none;
  padding-bottom: 0;
}

/* Left group — index, title, description stacked and centered as a unit */
.work-item__left {
  display: flex;
  flex-direction: column;
}

.work-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.work-item__index {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  color: var(--colour-text-muted);
}

.work-item__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-secondary);
  background-color: var(--colour-bg-alt);
  border: 1px solid var(--colour-border);
  border-radius: 999px;
  padding: 3px 8px 3px 6px;
}

.work-item__badge-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #E8A838;
  flex-shrink: 0;
}

/* Neutral variant — category label, no dot */
.work-item__badge-dot--neutral {
  display: none;
}

.work-item__title {
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--colour-text);
  margin-bottom: var(--space-4);  /* more room before description */
}

.work-item__desc {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  color: var(--colour-text-secondary);
  line-height: var(--leading-relaxed);
}

/* External link indicator — ↗ after title */
.work-item__external-icon {
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  color: var(--colour-text-secondary);
  margin-left: 0.2em;
  vertical-align: middle;
  flex-shrink: 0;
}


/* ============================================================
   SIDE PROJECTS ("Made by me")
   ============================================================ */
/* ============================================================
   MADE BY ME — two-card layout
   ============================================================ */
.side-projects {
  border-top: 1px solid var(--colour-border);
  margin-top: 12rem;
}

.made-by-me__grid {
  display: flex;
  align-items: stretch;
  gap: var(--space-5);
  overflow: visible; /* allow scaled cards to bleed outside the grid bounds */
}

.made-by-me__card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--colour-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, background-color 0.2s ease;
  will-change: transform;
}

.made-by-me__card--featured { flex: 3; }
.made-by-me__card--secondary { flex: 2; }

.made-by-me__card--featured:hover {
  transform: scale(1.06) rotate(-2deg);
  background-color: var(--colour-bg-alt);
  z-index: 1;
}

.made-by-me__card--secondary:hover {
  transform: scale(1.06) rotate(2deg);
  background-color: var(--colour-bg-alt);
  z-index: 1;
}

/* Image */
.made-by-me__image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.made-by-me__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.4s ease;
}

.made-by-me__card:hover .made-by-me__image img {
  filter: grayscale(0%);
}

/* Content */
.made-by-me__content {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.made-by-me__content .work-item__badge {
  align-self: flex-start;
}

.made-by-me__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-serif);
  font-size: 1.25rem; /* 20px — same across both cards */
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--colour-text);
}

.made-by-me__icon {
  width: 16px;
  height: 16px;
  stroke: var(--colour-text-secondary);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.made-by-me__card:hover .made-by-me__icon {
  transform: translate(2px, -2px);
}

.made-by-me__desc {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-light);
  color: var(--colour-text-secondary);
  line-height: var(--leading-relaxed);
}

/* Responsive — stack vertically on tablet and below */
@media (max-width: 768px) {
  .made-by-me__grid {
    flex-direction: column;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .made-by-me__card,
  .made-by-me__image img,
  .made-by-me__icon {
    transition: none;
  }
  .made-by-me__card--featured:hover,
  .made-by-me__card--secondary:hover,
  .made-by-me__card:hover .made-by-me__icon {
    transform: none;
  }
}

/* Thumbnail — right column */
.work-item__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
}

.work-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (hover: hover) {
  .work-item:hover .work-item__thumb img {
    transform: scale(1.06);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .work-item__thumb img { transition: transform 0.4s ease; }
}

@media (prefers-reduced-motion: reduce) {
  .work-item__thumb img { transition: none; }
}

@media (max-width: 768px) {
  .work-item {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}


/* ============================================================
   MINI ABOUT — home page block above footer
   ============================================================ */
.mini-about {
  padding-top: 12rem;
  padding-bottom: var(--space-9);
  display: flex;
  flex-direction: column;
}

/* Same style as "Selected works" heading */
.mini-about__label {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
  padding-bottom: var(--space-6);
}

/* Lead paragraph — sans-serif, slightly larger than body */
.mini-about__bio {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  color: var(--colour-text-secondary);
  max-width: 640px;
  margin-bottom: var(--space-5);
}

.mini-about__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-1);
}

.contact-cta .mini-about__links {
  justify-content: center;
}

/* Identical to nav and footer links */
.mini-about__link {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-secondary);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--colour-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;
}

.mini-about__link:hover {
  color: var(--colour-text);
  text-decoration-style: solid;
  text-decoration-color: var(--colour-text);
}

.section-divider {
  border: none;
  border-top: 1px solid var(--colour-border);
  margin-top: var(--space-8);
  margin-bottom: 0;
}

.section-divider--lg {
  margin-top: var(--space-10);
}


/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-bio {
  padding-top: var(--space-10);
  padding-bottom: var(--space-9);
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-8);
  align-items: start;
}

.about-bio__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  transform: rotate(-4deg);
  transform-origin: center;
}

.about-bio__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-bio__text p {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  color: var(--colour-text-secondary);
  margin-bottom: var(--space-5);
}

.about-bio__text p:last-child {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .about-bio {
    grid-template-columns: 1fr;
  }

  .about-bio__photo {
    max-width: 200px;
  }
}

.about-bio p:last-child {
  margin-bottom: 0;
}

/* Résumé */
.resume {
  border-top: 1px solid var(--colour-border);
}

.resume__section {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-8);
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--colour-border);
}

.resume__label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-secondary);
  padding-top: 0.2em;
}

.resume__entries {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.resume__entry-title {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--colour-text);
  margin-bottom: var(--space-1);
}

.resume__entry-meta {
  font-size: var(--text-sm);
  color: var(--colour-text-secondary);
  font-weight: var(--weight-light);
  margin-bottom: var(--space-3);
}

.resume__entry-desc {
  font-size: var(--text-base);
  color: var(--colour-text-secondary);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
}

/* Skills list */
.resume__skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

.resume__skill {
  font-size: var(--text-sm);
  font-weight: var(--weight-light);
  color: var(--colour-text-secondary);
}

@media (max-width: 640px) {
  .resume__section {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}


/* Life Beyond Pixels */
.life-section {
  padding-top: var(--space-8);
  padding-bottom: var(--space-9);
}

.life-section__heading {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
  text-align: center;
  margin-bottom: var(--space-6);
}

.life-section__intro {
  max-width: 80ch;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-7);
  text-align: center;
}

.life-section__intro p {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
  color: var(--colour-text-secondary);
}

.life-section__intro p + p {
  margin-top: var(--space-4);
}

/* Bento grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  width: 100%;
  box-sizing: border-box;
}

.bento-card {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  border: 1px solid var(--colour-border);
  background-color: var(--colour-bg);
  position: relative;
  transition: transform 0.3s ease;
  will-change: transform;
}

.bento-card:hover {
  transform: scale(1.06) rotate(-4deg);
  z-index: 1;
}

.bento-grid > :nth-child(even):hover {
  transform: scale(1.06) rotate(4deg);
}

.bento-card--photo {
  padding: var(--space-3);
  display: flex;
}

.bento-card--photo img {
  flex: 1;
  min-width: 0;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  display: block;
}

.bento-card--text {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: background-color 0.2s ease, transform 0.3s ease;
}

.bento-card--text:hover {
  background-color: var(--colour-bg-alt);
}

/* Ensure label meets 4.5:1 on the hover background (--colour-bg-alt);
   text-secondary passes, text-muted does not */
.bento-card--text:hover .bento-card__label {
  color: var(--colour-text);
}

.bento-card__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-muted);
  margin-bottom: var(--space-2);
}

.bento-card__value {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: var(--weight-regular);
  color: var(--colour-text);
  line-height: var(--leading-tight);
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}


@media (max-width: 899px) {
  .bento-grid {
    gap: var(--space-4);
  }
}

@media (min-width: 608px) and (max-width: 891px) {
  /* Visual reorder for tablet — desktop DOM order untouched */
  .bento-grid > :nth-child(1) { order: 2; } /* text — Currently reading */
  .bento-grid > :nth-child(2) { order: 1; } /* photo life1 */
  .bento-grid > :nth-child(3) { order: 3; } /* text — Based in */
  .bento-grid > :nth-child(4) { order: 4; } /* text — I'm into */
  .bento-grid > :nth-child(5) { order: 5; } /* text — Currently obsessed with */
  .bento-grid > :nth-child(6) { order: 6; } /* photo life2 */
  .bento-grid > :nth-child(7) { order: 9; } /* photo life3 — centred at bottom */
  .bento-grid > :nth-child(8) { order: 7; } /* text — Currently shooting */
  .bento-grid > :nth-child(9) { order: 8; } /* text — I believe */

  .bento-card {
    aspect-ratio: 3 / 2;
  }

  .bento-card--photo {
    overflow: hidden;
  }

}

@media (max-width: 607px) {
  .bento-grid > :nth-child(7) { order: 9; } /* photo life3 — last on mobile */

  .bento-card {
    aspect-ratio: 3 / 2;
  }

  .bento-card--photo img {
    width: 100%;
    height: 100%;
  }

  .bento-card__value {
    font-size: clamp(20px, 5vw, 26px);
  }
}



/* ============================================================
   BENTO CARD — MUSIC (spinning CD)
   ============================================================ */

/* Spin keyframe — only plays when .is-playing is added */
@keyframes cd-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.bento-card--music {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  overflow: hidden;   /* clips the bottom of the disc */
  cursor: default;    /* JS upgrades to pointer when motion is allowed */
  user-select: none;
}

/* JS adds role=button — make it feel interactive */
.bento-card--music[role="button"] {
  cursor: pointer;
}

/* Track info sits at the top of the card */
.cd-track {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 0;                   /* no gap between song and artist */
  align-items: flex-start;
  text-align: left;
  flex-shrink: 0;
}

/* Override the global label bottom margin so it doesn't
   add too much space between "Currently playing" and the song title */
.cd-track .bento-card__label {
  margin-bottom: var(--space-1);
}

/* CD wrapper — in normal flex flow, always pushed to the bottom of
   remaining space by margin-top: auto. The negative margin-bottom
   crops a consistent slice of the disc at every breakpoint because
   CSS percentage margins are always relative to the containing
   block's WIDTH — so both the disc size and the crop scale together. */
.cd-wrap {
  position: relative;
  width: 80%;
  aspect-ratio: 1;
  /* margin auto on both sides centres it cross-axis regardless of parent align-items */
  margin-top: auto;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  /* Crop ~18% of disc from the bottom: 18% × 80% ≈ 14% of card width.
     Less aggressive than before so the disc centre + ring stays
     comfortably within the visible card at all aspect ratios.
     % margins are always relative to containing block WIDTH. */
  margin-bottom: -14%;
}

/* The disc itself — spins when .is-playing is on the card */
.cd-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  animation: cd-spin 4s linear infinite;
  animation-play-state: paused;
  will-change: transform;
  box-shadow: 0 0 0 1px var(--colour-border);
}

.bento-card--music.is-playing .cd-disc {
  animation-play-state: running;
}

/* Cover image fills the disc */
.cd-disc__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

/* Radial gradient overlay — creates the dark ring / label shine */
.cd-disc__overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50%,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.55) 18%,
    rgba(0,0,0,0.10) 28%,
    rgba(0,0,0,0.00) 50%,
    rgba(0,0,0,0.20) 75%,
    rgba(0,0,0,0.45) 100%
  );
}

/* Centre hole — sibling of .cd-disc so it never rotates.
   The hole sits over a dark disc image, so the ring uses a
   light/silver colour to be legible. Three-layer shadow:
   1. tight silver ring  — clearly visible on dark surface
   2. wider soft halo    — adds depth like a real pressed hub
   3. inset shadow       — gives the hole interior some depth */
.cd-disc__hole {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background-color: var(--colour-bg);
  border-radius: 50%;
  box-shadow:
    0 0 0 8px  rgba(230,230,230,0.90),  /* thick silver hub ring */
    0 0 0 14px rgba(210,210,210,0.30),  /* wide soft halo */
    inset 0 0 5px rgba(0,0,0,0.30);     /* inner depth */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Dark mode — the hole background darkens, so tone down the ring:
   a lighter-opacity silver keeps it visible without looking blown out */
html[data-theme="dark"] .cd-disc__hole {
  box-shadow:
    0 0 0 8px  rgba(180,180,180,0.55),
    0 0 0 14px rgba(150,150,150,0.18),
    inset 0 0 5px rgba(0,0,0,0.50);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .cd-disc__hole {
    box-shadow:
      0 0 0 8px  rgba(180,180,180,0.55),
      0 0 0 14px rgba(150,150,150,0.18),
      inset 0 0 5px rgba(0,0,0,0.50);
  }
}

/* Pause icon — hidden by default, fades in while playing */
.cd-disc__pause-icon {
  width: 45%;
  height: 45%;
  stroke: var(--colour-text-muted);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bento-card--music.is-playing .cd-disc__pause-icon { opacity: 0.4; }

.cd-track__song {
  font-family: var(--font-serif);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: var(--weight-regular);
  color: var(--colour-text);
  margin: 0;
  line-height: var(--leading-snug);
}

.cd-track__artist {
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  margin: 0;
}

/* Tablet — 3:2 card, two columns: smaller disc keeps the centre in view */
@media (min-width: 608px) and (max-width: 891px) {
  .bento-card--music .cd-wrap {
    width: 62%;
    margin-bottom: -8%;
  }
}

/* Mobile — 3:2 card, single column: disc must be noticeably smaller so
   the hole + its ring sit comfortably above the card bottom edge */
@media (max-width: 607px) {
  .bento-card--music .cd-wrap {
    width: 52%;
    margin-bottom: -6%;
  }
}

/* Reduced-motion: static card, no spin, no JS interactivity */
@media (prefers-reduced-motion: reduce) {
  .cd-disc {
    animation: none;
  }
  .bento-card--music.is-playing .cd-disc {
    animation: none;
  }
  .cd-disc__pause-icon {
    display: none;
  }
}


/* ============================================================
   CONTACT CTA (About page closing section)
   ============================================================ */
.contact-cta {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
  text-align: center;
}

.contact-cta__heading {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--colour-text);
  margin-bottom: var(--space-4);
}

.contact-cta__sub {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-light);
  color: var(--colour-text-secondary);
  margin-bottom: var(--space-5);
}


/* ============================================================
   CASE STUDY TEMPLATE
   ============================================================ */
/* Generic page fallback (page.php) */
.generic-page {
  padding-block: var(--space-10);
}

.generic-page__header {
  margin-bottom: var(--space-7);
  max-width: 720px;
}

.generic-page__body {
  margin-inline: 0;
}

.casestudy-header {
  padding-top: var(--space-10);
  padding-bottom: var(--space-7);
  max-width: 720px;
}

.casestudy-header__index {
  margin-bottom: var(--space-4);
}

.casestudy-header__title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}

@media (min-width: 1024px) {
  .casestudy-header__title {
    font-size: var(--text-3xl);
  }
}

.casestudy-header__intro {
  font-size: var(--text-md);
  color: var(--colour-text-secondary);
  font-weight: var(--weight-light);
  line-height: var(--leading-relaxed);
}

/* Metadata bar — Timeframe / Role / Scope */
.casestudy-meta {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
  padding-block: var(--space-6);
  border-top: 1px solid var(--colour-border);
  border-bottom: 1px solid var(--colour-border);
  margin-bottom: var(--space-8);
}

.casestudy-meta__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.casestudy-meta__label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.casestudy-meta__value {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-light);
  color: var(--colour-text);
}


/* Full-width image block */
.casestudy-image {
  width: 100%;
  margin-block: var(--space-8);
}

.casestudy-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Contained image (narrower) */
.casestudy-image--contained {
  max-width: 860px;
  margin-inline: auto;
}

.casestudy-image--contained img {
  border-radius: var(--radius);
}

/* Full-width image break — [cs_wide] shortcode
   Breaks out of the max-width body column to match the hero image width.
   left: calc(50% - 50vw) pulls back to the viewport edge from any centered container. */
.cs-wide {
  position: relative;
  left: calc(50% - 50vw);
  width: 100vw;
  margin-block: var(--space-6);
}

.cs-wide img {
  width: 100%;
  max-height: 90vh;
  height: auto;
  object-fit: cover;
  display: block;
}

/* lb-wrap inside cs-wide: inherit hero treatment (no border, no radius, no margin) */
.cs-wide .lb-wrap {
  margin-block: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Body text block */
.casestudy-body {
  max-width: 740px;
  margin-inline: auto;
  padding-block: var(--space-6);
}

.casestudy-body p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--colour-text-secondary);
  margin-bottom: var(--space-5);
}

.casestudy-body p:last-child {
  margin-bottom: 0;
}

.casestudy-body h2,
.casestudy-body h3 {
  font-family: var(--font-serif);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

/* Any h2 that follows other content gets extra breathing room as a section break.
   The first h2 (nothing above it) keeps the default --space-8. */
.casestudy-body * + h2 {
  margin-top: var(--space-10);
}

.casestudy-body h2 {
  font-size: var(--text-xl);
}

.casestudy-body h3 {
  font-size: var(--text-lg);
}

/* Links in WYSIWYG body content must be visually distinguishable from text */
.casestudy-body a {
  text-decoration: underline;
  text-decoration-color: var(--colour-underline);
  text-underline-offset: 3px;
}

.casestudy-body a:hover {
  text-decoration-style: solid;
  text-decoration-color: currentColor;
}

/* Images — cursor signals they're clickable (lightbox) */
.casestudy-body img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-block: var(--space-8);
  cursor: zoom-in;
}

/* ── Lightbox hover wrapper ──────────────────────────────────
   JS wraps every .casestudy-body img in <span class="lb-wrap">.
   The wrapper clips the image scale with overflow:hidden and
   hosts the darkening overlay + zoom icon via pseudo-elements. */
.lb-wrap {
  display: block;
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  border-radius: var(--radius);       /* standalone images: all corners */
  margin-block: var(--space-6);       /* takes over from the img */
  box-shadow: 0 0 0 1px var(--colour-border); /* standalone border */
}

/* Inside a captioned figure — top corners only, no border (figure handles it) */
.casestudy-body figure .lb-wrap,
.casestudy-body .wp-caption .lb-wrap {
  border-radius: var(--radius) var(--radius) 0 0;
  margin-block: 0;
  box-shadow: none;
}

/* Img inside the wrap — margin is on the wrapper now */
.lb-wrap img {
  margin-block: 0 !important;
}

/* Darkening overlay */
.lb-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: 1;
}

/* Zoom icon — magnifying glass with '+' as SVG data URI */
.lb-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 48px;
  height: 48px;
  background:
    rgba(255, 255, 255, 0.92)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3Cline x1='11' y1='8.5' x2='11' y2='13.5'/%3E%3Cline x1='8.5' y1='11' x2='13.5' y2='11'/%3E%3C/svg%3E")
    center / 20px no-repeat;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

/* Hover effects — only on pointer devices to avoid stuck states on touch */
@media (hover: hover) {
  .lb-wrap img       { transition: transform 0.4s ease; }
  .lb-wrap::after    { transition: background 0.25s ease; }
  .lb-wrap::before   { transition: opacity 0.2s ease, transform 0.2s ease; }

  .lb-wrap:hover::after  { background: rgba(0, 0, 0, 0.28); }
  .lb-wrap:hover::before { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  .lb-wrap:hover img     { transform: scale(1.04); }
}

/* WordPress wraps captioned images in <figure> — no overflow:hidden so caption is visible.
   .cs-wide is excluded — it has its own full-viewport rules. */
.casestudy-body figure:not(.cs-wide),
.casestudy-body .wp-caption {
  width: 100% !important; /* WP inlines a pixel width on .wp-caption */
  max-width: 100%;
  margin-block: var(--space-6);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--colour-border);
}

/* Top corners rounded on the image, bottom flat against the caption */
.casestudy-body figure:not(.cs-wide) img,
.casestudy-body .wp-caption img {
  margin-block: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block;
  width: 100%;
}

/* Caption text — bottom corners complete the rounded shape */
.casestudy-body figcaption,
.casestudy-body .wp-caption-text {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-light);
  color: var(--colour-text-secondary); /* text-muted fails 4.5:1 on bg-alt; secondary passes */
  text-align: center;
  padding: var(--space-3) var(--space-5) var(--space-4);
  background-color: var(--colour-bg-alt);
  border-radius: 0 0 var(--radius) var(--radius);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* Two images side by side — use in the WYSIWYG Text tab:
   <div class="casestudy-cols">
     <figure><img src="…" alt="…"><figcaption>Caption</figcaption></figure>
     <figure><img src="…" alt="…"><figcaption>Caption</figcaption></figure>
   </div> */
.casestudy-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-block: var(--space-6);
}

.casestudy-body .casestudy-cols figure,
.casestudy-body .casestudy-cols .wp-caption {
  width: 100% !important; /* override WP's inline width on .wp-caption */
  max-width: 100%;
  margin-block: 0;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--colour-border);
  display: flex;
  flex-direction: column;
}

.casestudy-body .casestudy-cols figure img,
.casestudy-body .casestudy-cols .wp-caption img {
  margin-block: 0;
  border-radius: var(--radius) var(--radius) 0 0; /* top corners; caption rounds the bottom */
  display: block;
  width: 100%;
  height: auto;
}

.casestudy-body .casestudy-cols figcaption,
.casestudy-body .casestudy-cols .wp-caption-text {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-light);
  color: var(--colour-text-muted);
  text-align: center;
  padding: var(--space-3) var(--space-4) var(--space-4);
  background-color: var(--colour-bg-alt);
  border-radius: 0 0 var(--radius) var(--radius);
  line-height: var(--leading-relaxed);
  margin: 0;
  flex: 1; /* stretch to match the taller caption in the sibling column */
}

/* Bold title in captions — wrap the title in <strong> inside the WP caption field:
   e.g. "<strong>Blinkist</strong> — Onboarding flow comparison" */
.casestudy-body figcaption strong,
.casestudy-body .wp-caption-text strong {
  font-weight: var(--weight-semibold);
  color: var(--colour-text);
}

/* Consecutive [cs_cols] blocks — match the column gap.
   Uses ~ (general sibling) so the rule fires even when TinyMCE
   leaves an empty element between the two blocks. */
.casestudy-cols ~ .casestudy-cols {
  margin-top: var(--space-4);
}
.casestudy-cols:has(~ .casestudy-cols) {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .casestudy-cols {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: default;
}

/* Ensure the hidden attribute overrides display:flex — without this the
   lightbox covers the page even when closed, blocking all interactions */
.lightbox[hidden] {
  display: none !important;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(90vh - 3rem); /* leave room for caption */
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  background-color: var(--colour-bg);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: zoom-out;
  transform: scale(0.96);
  opacity: 0;
}

.lightbox.is-open .lightbox__img {
  transform: scale(1);
  opacity: 1;
}

.lightbox__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
}

.lightbox__caption {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: var(--space-3) var(--space-4) 0;
  line-height: var(--leading-relaxed);
  pointer-events: none;
}

.lightbox__caption strong {
  font-weight: var(--weight-semibold);
  color: rgba(255, 255, 255, 0.9);
}

.lightbox__close {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox__close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox__img {
    transition: none;
  }
  .lightbox__img {
    transform: none;
    opacity: 1;
  }
  .lb-wrap img, .lb-wrap::before, .lb-wrap::after { transition: none; }
  .lb-wrap:hover img     { transform: none; }
  .lb-wrap:hover::before { transform: translate(-50%, -50%) scale(1); }
}

/* Next / Prev navigation */
.casestudy-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: var(--space-8);
  border-top: 1px solid var(--colour-border);
  margin-top: var(--space-9);
  gap: var(--space-5);
}

.casestudy-nav__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.casestudy-nav__link:hover {
  opacity: 0.55;
}

.casestudy-nav__link--prev {
  align-items: flex-start;
}

.casestudy-nav__link--next {
  align-items: flex-end;
  text-align: right;
}

.casestudy-nav__direction {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.casestudy-nav__title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
  color: var(--colour-text);
}
