/* ─── Tokens ─────────────────────────────────────────── */
:root {
  --sans: 'Geist', sans-serif;

  --color-bg:         #ffffff;
  --color-text:       #111111;
  --color-muted:      #666666;
  --color-border:     #e0e0e0;
  --color-tag-bg: rgba(6, 82, 221, 0.12);
  --color-accent:     #0652DD;

  --nav-height:       55px;
  --page-padding-x:   5vw;
  --content-max:      1800px;

    /* Typography */
    --text-base:        0.95rem;   /* body / paragraph text */
    --text-heading:     1.3rem;    /* section headings */
}

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: var(--sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

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

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

/* Hide the default cursor sitewide */
* { cursor: none; }

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background: #0652DD; /* match your accent colour */
  border-radius: 50%;
  pointer-events: none; /* lets clicks pass through to elements below */
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
  opacity: 0.9;
  z-index: 9999;
}

/* Grown state when hovering a link */
.cursor.is-hovering {
  width: 36px;
  height: 36px;
  opacity: 0.3;
}

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--color-bg);
  border-bottom: 0.5px solid var(--color-border);
}

/* Inner wrapper mirrors .page-content's max-width and padding */
.navbar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--page-padding-x);

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-size: var(--text-base);
  font-weight: 400;
}

.nav-links {
  font-size: var(--text-base);
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  font-weight: 400;
  color: var(--color-text);
  transition: opacity 0.15s;
}

.nav-link:hover {
  color: var(--color-accent);
}

/* ─── Page content ───────────────────────────────────── */
.page-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 3rem) var(--page-padding-x) 4rem;
}

/* ─── Intro ──────────────────────────────────────────── */
.intro {
  padding-bottom: 3rem;
}

.intro-text {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 400;
  line-height: 1.4;
  max-width: 820px;
  color: var(--color-text);
}

/* ─── Work section ───────────────────────────────────── */
.work-label {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: 1.25rem;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem 2rem;
}

/* ─── Project card ───────────────────────────────────── */
.project-card {
  display: flex;
  flex-direction: column;
}

.project-link {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-tag-bg);
  overflow: hidden;
  border-radius: 2px;
}

.project-image img {
  transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.02);
}

.project-title {
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text);
}

.video-container {
  background: #f1f2f6;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem 2rem 2rem; /* top | sides | bottom */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-family: var(--sans);
}

.video-container video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.case-study-video {
  width: 100%;
  border-radius: 2px;
}

/* ─── Tags ───────────────────────────────────────────── */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--color-accent);
  background: var(--color-tag-bg);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

/* ─── Footer ─────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem var(--page-padding-x);
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-muted);
}

.footer a {
  color: var(--color-muted);
  transition: opacity 0.15s;
}

.footer a:hover {
  color: var(--color-accent);
}

/* ─── Mobile ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .work-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}


/* ─── Case study layout ──────────────────────────────── */
.case-study-layout {
  display: grid;
  /* TOC in left margin | fixed-width centred content | matching right space */
  grid-template-columns: 1fr 800px 1fr;
  align-items: start;

  width: 100%;
  padding-top: calc(var(--nav-height) + 3rem);
  padding-bottom: 4rem;
}

/* ─── Sidebar ────────────────────────────────────────── */
.case-study-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 3rem);
  /* Align TOC to the right of its column, close to the content */
  padding-left: var(--page-padding-x);
  padding-right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.back-link {
  font-size: var(--text-base);
  color: var(--color-text);
  transition: opacity 0.15s;
}

.back-link:hover {
  color: var(--color-accent);
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.toc-link {
  font-size: var(--text-base);
  color: var(--color-muted);
  transition: color 0.15s;
}

.toc-link:hover,
.toc-link.active {
  color: var(--color-accent);
}

/* ─── Case study content ─────────────────────────────── */
.case-study-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  /* Left-align text within the centred content column */
  text-align: left;
}

.case-study-eyebrow {
  font-size: var(--text-base);
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.case-study-title {
  font-size: clamp(1.75rem, 3vw, 1.75rem);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 1.75rem;
}

/* Hero image */
.case-study-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-tag-bg);
  overflow: hidden;
  border-radius: 2px;
  margin-bottom: 2rem;
}

.case-study-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─── Meta table ─────────────────────────────────────── */
.case-study-meta {
  display: flex;
  justify-content: space-between; /* spreads items across full width */
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.meta-label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.meta-value {
  font-size: var(--text-base);
  color: var(--color-muted);
  line-height: 1.6;
}

/* ─── Sections ───────────────────────────────────────── */
.case-study-section {
  scroll-margin-top: calc(var(--nav-height) + 1rem);
  padding-top: 0.5rem;
  padding-bottom: 2.5rem;
  transition: opacity 0.3s ease;
}

.case-study-section.is-active {
  animation: sectionFadeIn 0.4s ease;
}

@keyframes sectionFadeIn {
  from { opacity: 0.5; transform: translateY(6px); }
  to   { opacity: 1;   transform: translateY(0); }
}

.section-heading {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 1.2rem;
}

.section-oneliner {
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 1.2rem;
}

.section-body {
  font-size: var(--text-base);
  color: var(--color-muted);
  line-height: 1.7;
}

p + .video-container {
  margin-top: 1rem;
}

/* ─── Mobile: collapse sidebar ───────────────────────── */
@media (max-width: 768px) {
  .case-study-layout {
    grid-template-columns: 1fr;
  }

  .case-study-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
  }

  .toc {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }
}

/* ─── Case study mobile overrides ────────────────────── */
@media (max-width: 768px) {
  .case-study-layout {
    grid-template-columns: 1fr;
    padding-left: var(--page-padding-x);
    padding-right: var(--page-padding-x);
  }

  .case-study-sidebar {
    padding: 0 0 1.5rem;
  }

  .case-study-content {
    padding: 0;
  }
}

@media (hover: none) {
  .cursor {
    display: none;
  }
  
  * {
    cursor: auto;
  }
}

/* Fade in when page loads */
body {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Fade out class triggered before navigation */
body.is-leaving {
  opacity: 0;
  transition: opacity 0.1s ease;
}