/* ============================================
   Kevin Redd — Modern UX Portfolio
   Design System: Dark-first, data-informed
   Accent: Refined warm red (Code REDD heritage)
   Fonts: Cabinet Grotesk (display) + Satoshi (body)
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Surfaces — DARK by default */
  --color-bg: #141312;
  --color-surface: #1c1b19;
  --color-surface-2: #201f1d;
  --color-surface-offset: #1d1c1a;
  --color-surface-dynamic: #2d2c2a;
  --color-divider: #262523;
  --color-border: #393836;

  /* Text */
  --color-text: #cdccca;
  --color-text-muted: #797876;
  --color-text-faint: #5a5957;
  --color-text-inverse: #2b2a28;

  /* Primary Accent — Logo Red */
  --color-primary: #e83838;
  --color-primary-hover: #f04848;
  --color-primary-active: #c82828;
  --color-primary-highlight: #3a1a1a;

  /* Secondary Accent — Data Teal */
  --color-secondary: #4f98a3;
  --color-secondary-hover: #227f8b;

  /* Success */
  --color-success: #6daa45;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'Cabinet Grotesk', 'Helvetica Neue', sans-serif;
  --font-body: 'Satoshi', 'Helvetica Neue', sans-serif;

  /* Type Scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(3rem, 0.5rem + 7vw, 8rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Section rhythm — SINGLE source of truth for all page sections.
     Every page uses these; do not override per-page. */
  --section-y: clamp(4rem, 8vw, 7rem);        /* top/bottom padding for full sections */
  --section-y-tight: clamp(2.5rem, 5vw, 4rem);/* smaller wells (e.g. footer, thin bands) */
  --subsection-gap: clamp(2.5rem, 4vw, 4rem); /* space between H2 blocks within a section */
  --subsection-gap-sm: clamp(1.5rem, 2.5vw, 2.25rem); /* space between H3 blocks */

  color-scheme: dark;
}

[data-theme='light'] {
  /* Surfaces — warm neutral */
  --color-bg: #f7f6f2;
  --color-surface: #f9f8f5;
  --color-surface-2: #fbfbf9;
  --color-surface-offset: #f3f0ec;
  --color-surface-dynamic: #e6e4df;
  --color-divider: #dcd9d5;
  --color-border: #d4d1ca;

  /* Text */
  --color-text: #28251d;
  --color-text-muted: #7a7974;
  --color-text-faint: #bab9b4;
  --color-text-inverse: #f9f8f4;

  /* Primary Accent — Logo Red (#C50B0B) */
  --color-primary: #c50b0b;
  --color-primary-hover: #a00909;
  --color-primary-active: #800707;
  --color-primary-highlight: #f5d9d9;

  /* Secondary Accent — Data Teal */
  --color-secondary: #01696f;
  --color-secondary-hover: #0c4e54;

  /* Success */
  --color-success: #437a22;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);

  color-scheme: light;
}

[data-theme='dark'] {
  /* Kept for explicit dark override; same as :root defaults */
  --color-bg: #141312;
  --color-surface: #1c1b19;
  --color-surface-2: #201f1d;
  --color-surface-offset: #1d1c1a;
  --color-surface-dynamic: #2d2c2a;
  --color-divider: #262523;
  --color-border: #393836;
  --color-text: #cdccca;
  --color-text-muted: #797876;
  --color-text-faint: #5a5957;
  --color-text-inverse: #2b2a28;
  --color-primary: #e83838;
  --color-primary-hover: #f04848;
  --color-primary-active: #c82828;
  --color-primary-highlight: #3a1a1a;
  --color-secondary: #4f98a3;
  --color-secondary-hover: #227f8b;
  --color-success: #6daa45;
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  color-scheme: dark;
}

/* --- Base Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100vw;
  line-height: 1.6;
  font-family: var(--font-body, sans-serif);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

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

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  text-wrap: balance;
  line-height: 1.15;
  font-weight: 700;
}

p,
li,
figcaption {
  text-wrap: pretty;
  max-width: 72ch;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-interactive);
}

a:hover {
  color: var(--color-primary-hover);
}

::selection {
  background: var(--color-primary-highlight);
  color: var(--color-text);
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

table {
  border-collapse: collapse;
  width: 100%;
}

a,
button,
[role='button'],
input,
textarea,
select {
  transition: color var(--transition-interactive), background var(--transition-interactive),
    border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Layout Utilities --- */
.container {
  width: 100%;
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-wide {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-narrow {
  width: 100%;
  max-width: var(--content-narrow);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section {
  padding-block: var(--section-y);
}

.section-tight {
  padding-block: var(--section-y-tight);
}

/* Consecutive sections should not double-pad; collapse the seam. */
.section + .section,
.section + .section-tight,
.section-tight + .section,
.section-tight + .section-tight,
.case-hero + .case-body,
.case-hero + .section,
.case-body + .case-body,
.case-body + .section,
.section + .footer,
.section-tight + .footer,
.case-body + .footer,
.hero + .footer {
  padding-top: 10px;
}

/* First real section on any page gets a smaller, consistent top pad so it sits
   the same distance below the sticky header on every page.
   The header is a sibling; the first section immediately after it is what we target. */
:root { --section-y-first: clamp(2rem, 4vw, 3.5rem); }
.header + .section,
.header + .section-tight,
.header + .case-hero,
.header + .hero,
.section.section--first {
  padding-top: var(--section-y-first);
}

/* --- Header / Nav --- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.header--hidden {
  transform: translateY(-100%);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-text);
  text-decoration: none;
}

.logo:hover {
  color: var(--color-primary);
}

.logo__img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  display: inline-block;
}

.name-accent {
  color: var(--color-primary);
}

.logo__img--dark { display: none; }

[data-theme='dark'] .logo__img--light { display: inline-block; }
[data-theme='dark'] .logo__img--dark { display: none; }

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-interactive);
}

.nav__link:hover,
.nav__link[aria-current='page'] {
  color: var(--color-text);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.nav__toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

@media (max-width: 600px) {
  .nav__toggle {
    display: flex;
    margin-left: auto;
    margin-right: var(--space-1);
  }
  .nav {
    position: fixed;
    inset: 56px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    padding: var(--space-4);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-slow), opacity var(--transition-slow);
  }
  .nav--open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav__link {
    padding-block: var(--space-3);
    font-size: var(--text-base);
  }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--transition-interactive);
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.btn--ghost {
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

[data-theme='dark'] .btn--primary {
  color: #141312;
}

/* --- Hero --- */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-bottom: 0; /* next section provides its own top padding */
}

.hero__content {
  max-width: 720px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.hero__eyebrow::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--color-primary);
}

.hero__title {
  font-size: var(--text-hero);
  text-wrap: nowrap;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: var(--space-6);
}

.hero__title-accent {
  color: var(--color-primary);
}

.hero__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 56ch;
  margin-bottom: var(--space-8);
  line-height: 1.5;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.4;
}

.hero__bg svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  .hero {
    min-height: 70vh;
  }
}

/* --- Case Study Cards --- */
.case-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

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

.case-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text);
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive),
    border-color var(--transition-interactive);
}

.case-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
  color: var(--color-text);
}

.case-card__visual {
  display: block;
  position: relative;
  overflow: hidden;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--color-surface-offset, var(--color-surface));
}

.case-card__visual svg,
.case-card__visual img {
  width: 100%;
  height: auto;
  display: block;
}

.case-card__body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

.case-card__tag {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
}

.case-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.case-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex: 1;
}

.case-card__metric {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.case-card__metric-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
}

.case-card__metric-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- Case Study Page --- */
.case-hero {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y-tight);
  border-bottom: 1px solid var(--color-divider);
}



.case-hero__eyebrow {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: var(--space-3);
}

.case-hero__title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
  max-width: 20ch;
}

.case-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.case-hero__meta-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.case-hero__meta-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.case-hero__meta-value {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.case-body {
  padding-block: var(--section-y);
}

.case-body h2 {
  font-size: var(--text-xl);
  margin-top: var(--subsection-gap);
  margin-bottom: var(--space-4);
}

.case-body > h2:first-child,
.case-body > *:first-child h2:first-child {
  margin-top: 0;
}

.case-body h3 {
  font-size: var(--text-lg);
  margin-top: var(--subsection-gap-sm);
  margin-bottom: var(--space-3);
}

.case-body p {
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.case-body p + p {
  margin-top: calc(-1 * var(--space-2));
}

.case-body ul,
.case-body ol {
  margin-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.case-body li {
  margin-bottom: var(--space-3);
  line-height: 1.6;
}

.case-body ul li::marker {
  color: var(--color-primary);
}

/* --- Metrics Strip --- */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-6);
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-top: var(--section-y-tight);
  margin-bottom: var(--space-8);
}

.metrics-strip__item {
  text-wrap: nowrap;
  text-align: center;
}

.metrics-strip__value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.metrics-strip__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (min-width: 1000px) {
  .metrics-strip {
    grid-template-columns: repeat(4, 1fr);
    margin-inline: -200px;
    max-width: calc(100% + 400px);
  }

  /* On the About page the metrics-strip lives inside a two-column grid cell,
     so the full-bleed stretch has to be neutralized to keep it inside its column. */
  .about-grid .metrics-strip {
    margin-inline: 0;
    max-width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Process Steps --- */
.process-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-block: var(--space-8);
}

.process-step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: var(--space-4);
  align-items: start;
}

.process-step__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  flex-shrink: 0;
}

.process-step__title {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.process-step__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* --- Process Step Image --- */
.process-step__image {
  margin-top: var(--space-4);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  /* Never wider than the intrinsic image content. */
  width: fit-content;
  max-width: 100%;
}

.process-step__image--multi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2px;
  width: 100%;
}

.process-step__image img {
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform var(--transition-slow);
}

.process-step__image--multi img {
  width: 100%;
}

.process-step__image > img:hover,
.process-step__image:not(.process-step__image--multi):hover img {
  transform: scale(1.03);
}

/* --- Training Manual Flipbook --- */
.tm-flipbook {
  margin-top: var(--space-4);
}

.tm-flipbook__viewport {
  position: relative;
  width: 100%;
  max-width: 310px;
  aspect-ratio: 310 / 400;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tm-flipbook__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.tm-flipbook__img.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.tm-flipbook__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  max-width: 310px;
}

.tm-flipbook__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 22px;
  line-height: 1;
  padding-bottom: 3px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  box-sizing: border-box;
}

.tm-flipbook__btn:hover {
  background: var(--color-primary-highlight);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tm-flipbook__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tm-flipbook__counter {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 60px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Callout --- */
.callout {
  background: var(--color-primary-highlight);
  border-left: 3px solid var(--color-primary);
  padding: var(--space-6);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-block: var(--space-6);
}

.callout__text {
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text);
  line-height: 1.5;
}

/* --- About Page --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: start;
}

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

.about-text h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  margin-top: var(--space-8);
}

.about-text h2:first-child {
  margin-top: 0;
}

.about-text p {
  margin-bottom: var(--space-4);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.skill-group h3 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.skill-tag {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
}

/* --- Timeline --- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item__date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

.timeline-item__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.timeline-item__company {
  font-size: var(--text-sm);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.timeline-item__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

@media (max-width: 600px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--color-divider);
  padding-top: 10px;
  padding-bottom: 10px;
  margin-top: 0;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.footer__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-text);
}

.footer__logo img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  display: inline-block;
}

.footer__links {
  display: flex;
  gap: var(--space-6);
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer__link:hover {
  color: var(--color-text);
}

.footer__copy {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* --- Section Header --- */
.section-header {
  margin-bottom: var(--space-10);
}

.section-header__eyebrow {
  font-size: var(--text-sm);
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.section-header__title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-header__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  max-width: 56ch;
}

/* --- Contact --- */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
}

.contact-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* --- Case Nav (prev/next) --- */
.case-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-10);
  padding-top: 0;
  margin-bottom: 0;
}

.case-nav__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-decoration: none;
  color: var(--color-text-muted);
  max-width: 48%;
}

.case-nav__link:hover {
  color: var(--color-primary);
}

.case-nav__link--next {
  text-align: right;
  margin-left: auto;
}

.case-nav__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.case-nav__title {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

/* --- Visual Placeholder Blocks --- */
.visual-block {
  width: 100%;
  height: 280px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-block: var(--space-6);
  overflow: hidden;
}

.visual-block svg {
  width: 100%;
  height: 100%;
}

.visual-block--tall {
  height: 400px;
}

.visual-block--wide {
  height: 200px;
}

.visual-block--chart {
  height: auto;
  aspect-ratio: 640 / 280;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.visual-block--centered {
  height: auto;
  min-height: auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.visual-block--centered img {
  width: auto;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* --- Animations --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* --- Responsive Helpers --- */
@media (max-width: 600px) {
  .case-hero__meta {
    gap: var(--space-4);
  }
  /* Keep prev/next in a row on mobile — fits fine. */
  .case-nav__title {
    white-space: normal;
    font-size: var(--text-xs);
  }
}

@media (min-width: 601px) and (max-width: 1024px) {
  .case-nav__link {
    max-width: 45%;
  }
  .case-nav__title {
    font-size: var(--text-xs);
  }
}

/* --- Before/After Gallery --- */
.ba-gallery {
  margin: var(--space-8) 0;
}

.ba-section {
  margin-bottom: var(--space-4);
}

.ba-section__label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-2);
  padding-left: var(--space-1);
}

.ba-section__label--before {
  color: var(--color-text-muted);
}

.ba-section__label--after {
  color: var(--color-primary);
}

.ba-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.ba-thumb {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 400 / 227;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0;
  width: 100%;
}

.ba-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ba-thumb:hover img,
.ba-thumb:focus-visible img {
  transform: scale(1.05);
}

.ba-thumb:hover,
.ba-thumb:focus-visible {
  border-color: var(--color-primary);
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .ba-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Hero Collage (unused, kept for reference) --- */
.hero-collage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
}

.hero-collage__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  width: 100%;
  height: 100%;
}

.hero-collage__cell {
  position: relative;
  overflow: hidden;
}

.hero-collage__cell--featured {
  grid-row: span 2;
}

.hero-collage__cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.15);
  transition: filter var(--transition-slow), transform var(--transition-slow);
}

.hero-collage__cell:hover img {
  filter: grayscale(0);
  transform: scale(1.03);
}

.hero-collage__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in oklab, var(--color-primary) 30%, transparent), transparent 60%);
  pointer-events: none;
}

.hero-collage__label {
  position: absolute;
  bottom: var(--space-3);
  left: var(--space-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
  background: color-mix(in oklab, #000 75%, transparent);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(8px);
}

@media (max-width: 768px) {
  .hero-collage {
    aspect-ratio: 4 / 3;
  }
  .hero-collage__grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 1fr);
  }
  .hero-collage__cell--featured {
    grid-row: span 1;
  }
}

/* --- Iteration Rows (Case 4 storefronts) ---
   Thumb width and arrow width are computed by JS (see main.js) so 4 thumbs
   always fit. Height scales with breakpoint. */
:root {
  --iteration-thumb-h: 150px;
}

@media (max-width: 900px) {
  :root { --iteration-thumb-h: 110px; }
}

@media (max-width: 640px) {
  :root { --iteration-thumb-h: 80px; }
}

@media (max-width: 400px) {
  :root { --iteration-thumb-h: 64px; }
}

.iteration-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  margin: var(--space-6) 0 var(--space-8);
  width: 100%;
  max-width: 100%;
  min-height: var(--iteration-thumb-h);
  box-sizing: border-box;
  overflow: hidden;
}

.iteration-thumb {
  flex: 0 0 auto;
  min-width: 0;
  width: 100px; /* JS overrides at runtime */
  height: var(--iteration-thumb-h);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.iteration-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* On hover: overlay the full image on top, no layout push. */
.iteration-thumb:hover,
.iteration-thumb:focus-visible {
  border-color: var(--color-primary);
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  overflow: visible;
  z-index: 10;
}

/* Shared hover overlay — sized and positioned by JS, always clamped to viewport. */
.iteration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  border: 1px solid #ffffff;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease;
  z-index: 1000;
  overflow: hidden;
  box-sizing: border-box;
}

.iteration-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.iteration-overlay img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.iteration-arrow {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  width: 18px; /* JS overrides at runtime */
  height: var(--iteration-thumb-h);
}

.iteration-arrow svg {
  width: 100%;
  height: auto;
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 4vh 4vw;
  cursor: zoom-out;
}

.lightbox.is-open {
  display: flex;
}

.lightbox__img {
  max-width: 100%;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lightbox__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-base);
}

.lightbox__close:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
