/* ============================================================
   DESIGN TOKENS  —  source of truth for the entire site
   ============================================================ */
:root {
  /* Colours (confirmed from Figma Visual Kit) */
  --off-white:   #F6F6F6;
  --dark:        #222222;
  --blue:        #2129C8;

  /* Defaults for light pages (Work, Case study) */
  --bg:          var(--off-white);
  --fg:          var(--dark);
  --muted:       rgba(34, 34, 34, 0.30);   /* placeholder / faded text */
  --border:      rgba(34, 34, 34, 0.15);

  /* Typography
     Adobe Fonts kit: oqs3zvb  →  neue-haas-grotesk-text (weight 500) */
  --font:        "neue-haas-grotesk-text", Helvetica, Arial, sans-serif;
  --font-weight: 500;
  --tracking:    -0.03em;   /* consistent -3% across all sizes */

  /* Type scale — fluid via clamp().
     Matches Figma at viewport ≥1400px (the design canvas width),
     scales down on narrower viewports, never grows beyond the cap. */
  --h1:  clamp(30px, 3.589vw, 50px);   /* H1  — scaled ×0.75 from Figma 67px */
  --h2:  clamp(24px, 2.679vw, 38px);   /* H2  — scaled ×0.75 from Figma 50px */
  --b1:  clamp(16px, 1.5vw,   21px);   /* B1  — scaled ×0.75 from Figma 28px */
  --b2:  clamp(13px, 1.179vw, 17px);   /* B2  — scaled ×0.75 from Figma 22px */

  /* Layout */
  --pad-h:       88px;     /* horizontal content margin — from Figma x=88 */
  --pad-mobile:  24px;
  --nav-h:       48px;     /* nav bar height — Figma: h-[48px] */
  --hero-gap:    184px;    /* gap from nav bottom to hero text — Figma: hero top 287px − nav bottom 103px */
  --section-gap: 160px;   /* gap between major sections */
  --grid-gap:    4px;
  --max-w:       min(1400px, 70vw);   /* fluid: 70vw gives 1058px on MacBook 14" matching 75%-zoom proportions */
}

[data-theme="dark"] {
  --bg:    var(--dark);
  --fg:    var(--off-white);
  --muted: rgba(246, 246, 246, 0.30);
  --border: rgba(246, 246, 246, 0.15);
}

[data-theme="blue"] {
  --bg:    var(--blue);
  --fg:    var(--off-white);
  --muted: rgba(246, 246, 246, 0.30);
  --border: rgba(246, 246, 246, 0.15);
}


/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* Override browser default bold on heading elements */
h1, h2, h3, h4, h5, h6 { font-weight: inherit; }

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: var(--font-weight);
  font-size: var(--b2);
  line-height: 1.23;
  letter-spacing: var(--tracking);
  -webkit-font-smoothing: antialiased;
}

img, video { 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-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: inherit;
}


/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-h);
}

/* Full-bleed: stretches to page edges, no horizontal padding */
.full-bleed {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
}


/* ============================================================
   NAV  —  exact Figma values
   nav: h=48px, positioned at y=55 in frame, x=88 content margin
   ============================================================ */
#site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background-color: var(--bg);
  display: flex;
  align-items: flex-end;   /* links sit at the bottom of the padded space */
  justify-content: space-between;
  /* Top padding = half nav-h. Horizontal padding matches .container on all widths. */
  padding: calc(var(--nav-h) / 2) max(var(--pad-h), calc((100% - var(--max-w)) / 2 + var(--pad-h))) 24px;
}

.nav-name {
  font-size: var(--b1);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;   /* measured from Figma node positions */
}

.nav-links a {
  font-size: var(--b1);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  white-space: nowrap;
}

/* Active state — Figma: decoration-[10.5%] decoration-solid, text-decoration-skip-ink:none */
.nav-links a.active {
  text-decoration: underline;
  text-decoration-thickness: 10.5%; /* ~4px at 38px font size */
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;   /* underline runs through descenders, as in Figma */
}

.nav-links a:not(.active):hover { opacity: 0.5; }
.nav-name:hover { opacity: 0.5; }

/* Mobile hamburger (hidden on desktop) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--fg);
}


/* ============================================================
   PAGE TOP OFFSET  (clears fixed nav)
   ============================================================ */
.page-top {
  padding-top: 81px;   /* = nav-h/2 (24) + line-height (33) + bottom pad (24) */
}


/* ============================================================
   HERO SECTIONS
   Gap from nav bottom to hero text = 184px (from Figma).
   ============================================================ */
.hero {
  padding-top: var(--hero-gap);
  padding-bottom: var(--section-gap);
}

/* H1 hero — Work, Services */
.hero-text {
  font-size: var(--h1);
  line-height: 1.164;   /* Figma: 78px / 67px */
  letter-spacing: var(--tracking);
  max-width: 750px;
}

/* About hero — two H1 paragraphs */
.about-hero {
  padding-top: 145px;   /* Figma: hero top 248px − nav bottom 103px = 145px */
  padding-bottom: 0;
}

.about-h1 p + p {
  margin-top: 1.164em; /* one blank-line gap between the two H1 paragraphs */
}

.about-h1 {
  font-size: var(--h1);
  line-height: 1.164;
  letter-spacing: var(--tracking);
  max-width: 750px;
  text-wrap: balance;
}

.about-body {
  font-size: var(--b1);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  max-width: 525px;
  margin-top: 80px;
}

.about-body p + p {
  margin-top: 1.25em;
}


/* ============================================================
   PROJECT COLLAGE  —  absolute-positioned free-form layout
   Coordinates from Figma canvas: 1400px wide × 1663px tall.
   Container uses padding-top: 118.79% (= 1663/1400) to set height.
   Each item's left/width are % of container width (1400px).
   Each item's top/height are % of container height (1663px).
   z-index matches Figma layer order (higher = in front).
   ============================================================ */
.project-collage-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-bottom: var(--section-gap);
}

.project-collage {
  position: relative;
  width: 100%;
  padding-top: 118.79%; /* creates 1663px height at 1400px width */
}

.collage-item {
  position: absolute;
  display: block;
}

.collage-item img {
  width: 100%;
  height: auto;
  object-fit: initial;
  display: block;
  transition: transform 0.45s ease, filter 0.3s ease, opacity 0.3s ease;
}

/* Hover behaviour: only when a linked image tile is hovered, sibling images desaturate.
   Hovering empty space (gaps between images) restores all to full colour.
   Wireframe-only items (no <img>) never trigger the effect. */
.project-collage:has(a.collage-item:hover) a.collage-item:not(:hover) img {
  filter: grayscale(1);
  opacity: 0.9;
}
.project-collage a.collage-item:hover img {
  transform: scale(1.03);
}
a.collage-item:hover { z-index: 50 !important; }


/* ============================================================
   SERVICES PAGE
   Column positions from Figma:
   Left col starts x=85, right col starts x=608, gap ≈ 109px
   ============================================================ */
.services-body {
  padding-bottom: var(--section-gap);
}

.services-category {
  padding-top: 80px;
  padding-bottom: 0;
}

.services-category__title {
  font-size: var(--h2);
  line-height: 1.20;
  letter-spacing: var(--tracking);
  margin-bottom: 0;
}

.services-category__subtitle {
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  opacity: 0.6;
  margin-top: 4px;
  margin-bottom: 48px;
}

.services-tiers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 80px;
  padding-bottom: 80px;
}

.services-tier__name {
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  margin-bottom: 8px;
}

.services-tier__items li {
  font-size: var(--b2);
  line-height: 1.23;   /* Figma B2 spec: 27px / 22px = 1.227 */
  letter-spacing: var(--tracking);
}


/* ============================================================
   CASE STUDY PAGE
   ============================================================ */

/* Hero image: full-bleed, 787px at 1400px canvas = 56.2vh-ish */
.cs-hero {
  position: relative;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  aspect-ratio: 1400 / 787;
  overflow: hidden;
}

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

/* Title block: top=1145 in Figma, hero bottom=290+787=1077, gap=68px */
.cs-title-block {
  padding-top: 68px;
}

.cs-title {
  font-size: var(--h1);
  line-height: 1.164;
  letter-spacing: var(--tracking);
}

.cs-category {
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  margin-top: 30px;   /* Figma: 30px gap from title bottom to category */
  opacity: 0.55;
}

/* Context/Challenge — H2 (50px) — Figma: text-[50px] */
.cs-section {
  padding-top: 50px;   /* Figma: 50px from category to first section */
}

.cs-section-label {
  font-size: var(--b2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-bottom: 16px;
}

.cs-section-body--h2 {
  font-size: var(--h2);
  line-height: 1.20;
  letter-spacing: var(--tracking);
  max-width: 675px;
}

.cs-section-body--b1 {
  font-size: var(--b1);
  line-height: 1.25;   /* 35px / 28px */
  letter-spacing: var(--tracking);
  max-width: 525px;
}

/* Full-bleed image (visual system overview) */
.cs-fullbleed {
  width: 100%;
  max-width: var(--max-w);
  margin: 80px auto 0;
}
.cs-fullbleed img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1400 / 787;
  object-fit: cover;
}

/* Gallery wrapper — full width within max-w, matches hero/style-guide image edges */
.gallery-wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-top: 80px;
}

/* Gallery — masonry columns, no fixed row height, images at natural height */
.gallery-grid {
  columns: 2;
  column-gap: var(--grid-gap);
}

.gallery-grid__item {
  break-inside: avoid;
  margin-bottom: var(--grid-gap);
  cursor: zoom-in;
}

.gallery-grid__item img {
  width: 100%;
  height: auto;
  display: block;
}

/* Outcome section */
.cs-outcome {
  padding-top: 80px;
  padding-bottom: var(--section-gap);
}

/* Next project navigation */
.cs-next {
  padding-top: 80px;
  padding-bottom: var(--section-gap);
}

.cs-next-label {
  font-size: var(--b2);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  opacity: 0.45;
  margin-bottom: 16px;
}

.cs-next-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  font-size: var(--h2);
  line-height: 1.20;
  letter-spacing: var(--tracking);
  margin-bottom: 12px;
}
.cs-next-link:hover { opacity: 0.5; }

.cs-next-arrow {
  font-size: 1em;
  line-height: 1;
  transform: translateY(0.14em);   /* icon floats above baseline — nudge down to close the gap */
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.cs-next-meta {
  font-size: var(--b1);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  color: var(--muted);
  margin-bottom: 8px;
}

.cs-next-overview {
  font-size: var(--b1);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  max-width: 525px;
}


/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #111;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#lightbox.open { display: flex; }

.lightbox-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--pad-h) 16px;
  max-height: calc(100vh - 140px);
  width: 100%;
}

.lightbox-main img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px var(--pad-h) 32px;
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
}
.lightbox-strip::-webkit-scrollbar { display: none; }

.lightbox-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 54px;
  overflow: hidden;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.4;
  transition: filter 0.25s, opacity 0.25s;
}
.lightbox-thumb.active { filter: grayscale(0); opacity: 1; }
.lightbox-thumb img { width: 100%; height: 100%; object-fit: cover; }

.lightbox-close {
  position: fixed;
  top: 20px;
  right: var(--pad-h);
  font-size: var(--b1);
  color: var(--off-white);
  cursor: pointer;
  z-index: 201;
  opacity: 0.6;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-prev, .lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--b1);
  color: var(--off-white);
  cursor: pointer;
  opacity: 0.5;
  z-index: 201;
  padding: 20px;
  user-select: none;
}
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-prev:hover, .lightbox-next:hover { opacity: 1; }


/* ============================================================
   CONTACT SECTION
   Figma: form is 1232px wide, positioned at x=86
   "Let's work together" → H1 (90px)
   Subheading → H2 (50px)
   Labels + placeholders → B1 (38px)
   No visible input borders; very minimal.
   ============================================================ */
#contact {
  padding-top: var(--section-gap);
  padding-bottom: 80px;
}

.contact-headline {
  font-size: var(--h2);
  line-height: 1.20;
  letter-spacing: var(--tracking);
  margin-bottom: 16px;
}

.contact-subheading {
  font-size: var(--b1);
  line-height: 1.25;
  letter-spacing: var(--tracking);
  max-width: 525px;
  margin-bottom: 80px;
}

.contact-form {
  max-width: 480px;  /* about half the content width, left-aligned */
}

.form-field {
  margin-bottom: 32px;
}

.form-label {
  display: block;
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  margin-bottom: 4px;
}

.form-input,
.form-textarea {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: var(--font);
  font-weight: var(--font-weight);
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  padding: 4px 0 12px;
  outline: none;
  resize: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted);
}

.form-textarea { height: 5em; }

/* Checkbox group — options styled as plain text, no visible box */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-item {
  display: block;
  cursor: pointer;
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  color: var(--muted);
  transition: color 0.15s;
  user-select: none;
}

.checkbox-item:hover { color: var(--fg); }

.checkbox-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-item.checked { color: var(--fg); }

/* Submit */
.form-submit {
  margin-top: 24px;
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
  padding: 0;
  cursor: pointer;
  transition: opacity 0.2s;
}
.form-submit:hover { opacity: 0.5; }


/* ============================================================
   FOOTER
   Figma: links stack vertically at B1 (38px), copyright at B2 (22px)
   ============================================================ */
.site-footer {
  padding: 48px var(--pad-h) 48px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-direction: column;    /* stacked vertically — from Figma */
  gap: 0;
  margin-bottom: 48px;
}

.footer-links a {
  font-size: var(--b1);
  line-height: 1.18;
  letter-spacing: var(--tracking);
}

.footer-links a:hover { opacity: 0.5; }

.footer-copy {
  font-size: var(--b2);
  line-height: 1.23;
  letter-spacing: var(--tracking);
  opacity: 0.4;
}


/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  :root {
    --pad-h: 40px;
    --hero-gap: 100px;
    --section-gap: 100px;
  }

  .services-tiers {
    grid-template-columns: 1fr;
    gap: 40px 0;
  }
}

@media (max-width: 640px) {
  :root {
    --pad-h: var(--pad-mobile);
    --hero-gap: 64px;
    --section-gap: 60px;
  }

  #site-nav {
    flex-wrap: wrap;
    align-items: center;
    padding: 16px var(--pad-mobile);
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0 8px;
  }

  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .page-top { padding-top: 65px; }   /* mobile nav ≈ 16 + 33 + 16 */

  /* Collage → single-column stack on mobile */
  .project-collage {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: var(--grid-gap);
  }
  .collage-item {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    aspect-ratio: 4 / 3;
    z-index: auto !important;
  }
  .collage-item img {
    position: static;
    width: 100%;
    height: 100%;
  }

  .gallery-grid {
    columns: 1;
  }

  .lightbox-prev,
  .lightbox-next { display: none; }

  .footer-links a { font-size: var(--b2); }
}
