/* ==========================================================
   1. DESIGN TOKENS
   Brand guidelines v1.0. Change a value here and it updates
   everywhere it is used.
   ========================================================== */
:root {
  /* Brand palette (fixed, never changes with the theme) */
  --ink: #111111;
  --ink-800: #1C1C1C;
  --ink-700: #2A2A2A;
  --bone: #F4F1EA;
  --bone-400: #C4BFB4;
  --bone-300: #D8D4CB;
  --paper: #FFFFFF;
  --slate-700: #4A4A4A;
  --signal: #FF5A1F;
  --signal-600: #E64A12;
  --signal-700: #C23C0C;

  /* Semantic colors (light mode) */
  --color-bg: var(--bone);
  --color-surface: var(--paper);
  --color-text: var(--ink);
  --color-text-muted: var(--slate-700);
  --color-border: var(--bone-300);
  --color-accent: var(--signal);
  --color-accent-hover: var(--signal-600);
  --color-on-accent: var(--ink);
  --color-link: var(--signal-700);   /* the only orange approved for text on Bone */

  /* Fonts */
  --font-heading: "Space Grotesk", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;

  /* Type scale (from the guide: 56 / 40 / 28 / 22 / 18 / 14 / 12) */
  --text-h1: clamp(2.25rem, 5vw, 3.5rem);
  --text-h2: clamp(2rem, 4vw, 2.5rem);
  --text-h3: clamp(1.5rem, 2.5vw, 1.75rem);
  --text-h4: 1.375rem;
  --text-body: 1.125rem;
  --text-small: 0.875rem;
  --text-caption: 0.75rem;
  --tracking-caption: 0.12em;

  /* Spacing scale (rem: 1rem = 16px by default) */
  --space-1: 0.5rem;   /*  8px */
  --space-2: 1rem;     /* 16px */
  --space-3: 1.5rem;   /* 24px */
  --space-4: 2rem;     /* 32px */
  --space-6: 3rem;     /* 48px */
  --space-8: 4rem;     /* 64px */

  --radius: 8px;
  --max-width: 1600px;
}

/* Dark mode: Bone on Ink. JS adds data-theme="dark" to <html> */
[data-theme="dark"] {
  --color-bg: var(--ink);
  --color-surface: var(--ink-800);
  --color-text: var(--bone);
  --color-text-muted: var(--bone-400);
  --color-border: var(--ink-700);
  --color-link: var(--signal);
}

/* ==========================================================
   2. RESET + BASE
   ========================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;   /* padding stays INSIDE the width */
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

html {
  scroll-behavior: smooth;   /* animate jumps to #anchors */
}

/* Respect visitors who've asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

/* One focus style for every link and button */
:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1.5rem, 5vw, 5rem);   /* side space grows with screen width */
}

/* Skip link: off-screen until it receives keyboard focus */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  padding: var(--space-1) var(--space-2);
  background: var(--ink);
  color: var(--bone);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-2);
}

/* ==========================================================
   3. HEADER
   ========================================================== */
.site-header {
  position: relative;   /* anchors the dropdown menu below it */
  z-index: 10;           /* keeps the menu above the page content */
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;                  /* wraps instead of overflowing on very small phones */
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-3);
}

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

.brand {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1rem, 4.2vw, 1.5rem);
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* Circular icon button */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

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

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;   /* icon follows the button's text color */
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Light mode shows the moon; dark mode shows the sun */
.theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: block;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: none;
}

.nav-toggle {
  background: none;
  border: 2px solid var(--color-text);
  border-radius: var(--radius);
  color: var(--color-text);
  font: inherit;
  font-weight: 500;
  padding: 0.4rem 1rem;
  cursor: pointer;
}

/* Hidden by default; drops below the header when opened */
.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: var(--space-3);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-nav.is-open {
  display: block;   /* JS adds/removes this class */
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-body);
  font-weight: 500;
}

.nav-list a {
  text-decoration: none;
}

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

/* ==========================================================
   4. BUTTON
   ========================================================== */
.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  background: var(--color-accent);
  color: var(--color-on-accent);   /* Ink on Signal: 6.1:1, never Bone */
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}

.btn:hover {
  background: var(--color-accent-hover);
}

/* ==========================================================
   5. CAPTION STYLE
   One shared style for every small uppercase label
   ========================================================== */
.hero__eyebrow,
.hero__caption,
.card__tag,
.service__number {
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: var(--tracking-caption);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ==========================================================
   6. HERO (mobile-first: this is the phone layout)
   ========================================================== */
.hero__inner {
  display: grid;
  gap: var(--space-6);
  padding-block: clamp(3rem, 7vw, 6rem);
}

.hero__eyebrow {
  margin-bottom: var(--space-3);
}

.hero__title {
  font-size: var(--text-h1);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero__lead {
  margin-block: var(--space-4);
  max-width: 38rem;
  color: var(--color-text-muted);
}

/* Flat card with a thin border */
.hero__visual {
  margin: 0;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* Label row: category on the left, client on the right */
.hero__caption {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-2);
}

.hero__visual img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius) / 2);
}

/* ==========================================================
   7. SECTION BASICS (reused by every section)
   ========================================================== */
.section {
  padding-block: clamp(4rem, 8vw, 7rem);   /* generous margins */
}

.section__title {
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.section__intro {
  margin-top: var(--space-2);
  max-width: 44rem;
  color: var(--color-text-muted);
}

/* Dark sections: the tokens are redefined for everything inside.
   The footer shares the same treatment so the page closes in Ink. */
.section--dark,
.site-footer {
  --color-bg: var(--ink);
  --color-surface: var(--ink-800);
  --color-text: var(--bone);
  --color-text-muted: var(--bone-400);
  --color-border: var(--ink-700);
  --color-link: var(--signal);
  background: var(--color-bg);
  color: var(--color-text);
}

/* In dark mode the page is already Ink, so dark sections step up to Ink 800 */
[data-theme="dark"] .section--dark {
  --color-bg: var(--ink-800);
  --color-surface: var(--ink-700);
  --color-border: #3D3D3D;
}

/* ==========================================================
   8. WORK GRID + CARDS
   ========================================================== */
.work-grid {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

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

.card__link {
  display: block;
  text-decoration: none;
}

.card__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-border);   /* shows if the image is missing */
}

.card__body {
  padding: var(--space-3);
}

.card__title {
  margin-block: var(--space-1);
  font-size: var(--text-h4);
  font-weight: 600;
  line-height: 1.3;
}

.card__text {
  color: var(--color-text-muted);
  font-size: var(--text-small);
  line-height: 1.5;
}

/* ==========================================================
   9. SERVICES
   ========================================================== */
.services-grid {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.service {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-text);
}

.service__title {
  margin-block: var(--space-1);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.service__text {
  color: var(--color-text-muted);
}

/* ==========================================================
   10. ABOUT
   ========================================================== */
.about {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

.about__text p {
  margin-top: var(--space-3);
  max-width: 36rem;
  color: var(--color-text-muted);
}

.about__text .btn {
  margin-top: var(--space-4);
}

.about__image {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius);
}

/* ==========================================================
   11. CONTACT
   ========================================================== */
.contact__email {
  display: inline-block;
  margin-top: var(--space-4);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.25rem, 4.5vw, 1.75rem);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--color-accent);   /* the one orange on this screen */
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

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

.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.social-list a {
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.social-list a:hover {
  color: var(--color-link);
}

/* ==========================================================
   12. FOOTER
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-small);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ==========================================================
   13. FADE-IN ON SCROLL
   ========================================================== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--delay, 0) * 0.1s);   /* staggers cards */
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);   /* JS adds this class once in view */
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================
   14. TABLET / DESKTOP (applies from 768px wide and up)
   ========================================================== */
@media (min-width: 768px) {
  .theme-toggle {
    width: 3rem;
    height: 3rem;
  }

  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: block;
    position: static;
    padding: 0;
    background: none;
    border: 0;
  }

  .nav-list {
    flex-direction: row;
    gap: var(--space-3);
    font-size: var(--text-small);
  }

  .hero__inner {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }

  .about {
    grid-template-columns: 1.2fr 1fr;
  }

  .about__image {
    justify-self: end;
  }
}