/* ============================================================
   styles.css: loaded on every page
   1. Tokens         5. Type roles      9. Utilities
   2. Base           6. Shared components
   3. Layout         7. Header + footer
   4. Sections       8. Responsive, motion, print

   Page-type styles: home.css, about.css, work.css, blog.css
   Company themes:   work/<company>.css
   Rules: style with single classes, take every value from a
   token, and use a role class in the HTML instead of new CSS.
   ============================================================ */

/* ---------- 1. Tokens ------------------------------------- */
:root {
  /* Colour */
  --white: #fff;
  --black: #000;
  --ink: #1b1c1a;
  --ink-muted: #484b47;
  --ink-faint: #626660;
  --on-dark: #f4f2ec;
  --on-dark-muted: #b9b6ae;

  --paper: #f5f2eb;
  --paper-muted: #ece7dd;
  --surface: #f1eee7;
  --washed: #f8f8f8;
  --hair: #d4cec2;
  --hair-soft: #e6e1d8;

  --accent: #524ab7;
  --accent-dim: #40398f;
  --accent-tint: #f1eff9;
  --accent-wash: rgba(82, 74, 183, .08);
  --gold: #a47720;
  --mint: #397154;
  --positive: #039f03;
  --highlight: rgba(216, 240, 90, .72);

  --shadow: 0 30px 70px -34px rgba(20, 18, 16, .3);

  /* Type: major-third scale, 16px base */
  --display: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --step--2: .694rem;  /* 11px */
  --step--1: .833rem;  /* 13px */
  --step-0: 1rem;      /* 16px */
  --step-1: 1.2rem;    /* 19px */
  --step-2: 1.44rem;   /* 23px */
  --step-3: 1.728rem;  /* 28px */
  --step-4: 2.074rem;  /* 33px */
  --step-5: 2.488rem;  /* 40px */
  --step-6: 2.986rem;  /* 48px */
  --step-7: 3.583rem;  /* 57px */

  /* Space: 4px grid */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --gutter: clamp(1.25rem, 4vw, 2rem);
  --space-section: clamp(4rem, 8vw, 6rem);
  --space-block: clamp(1.5rem, 4vw, 3rem);     /* between blocks inside a section */
  --space-grid: clamp(1rem, 2.4vw, 1.5rem);    /* gaps in card grids */
  --space-split: clamp(2rem, 5vw, 4rem);       /* gaps between two columns */

  /* Shape + motion */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;
  --shell: 1200px;
  --header-height: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- 2. Base --------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.65;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-4);
  line-height: 1.2;
}

p {
  margin: 0 0 var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

figure,
blockquote {
  margin: 0;
}

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

a {
  color: inherit;
}

[id] {
  scroll-margin-top: calc(var(--header-height) + var(--space-6));
}

[hidden] {
  display: none !important;
}

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

/* ---------- 3. Layout ------------------------------------- */
.container {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Two columns that stack on tablets: text + image, copy + evidence */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: start;
  gap: var(--space-split);
}

/* Auto-filling grid of equal cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-grid);
  margin-block: var(--space-block);
}

/* Cards that share hairlines, e.g. stats and journey steps */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  margin-block: var(--space-block);
}

.tile-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ---------- 4. Sections ----------------------------------- */
.section {
  position: relative;
  padding: var(--space-section) 0;
  border-bottom: 1px solid var(--hair-soft);
}

.section:last-of-type {
  border-bottom: none;
}

/* Page heroes carry the accent bar on top */
.page-hero {
  position: relative;
  background: var(--paper);
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
}

.bg-paper {
  background-color: var(--paper);
}

.bg-paper-muted {
  background-color: var(--paper-muted);
}

.bg-washed {
  background-color: var(--washed);
}

.section-dark {
  background-color: var(--black);
  color: var(--white);
}

.section-dark .eyebrow,
.section-dark [class*="display-"],
.section-dark .caption {
  color: var(--on-dark);
}

.section-dark .lead,
.section-dark .small,
.section-dark p {
  color: var(--on-dark-muted);
}

/* ---------- 5. Type roles --------------------------------- */
/* Use these classes in HTML; don't restyle text inside components. */
.display-xl,
.display-l,
.display-m,
.display-s,
.card-title {
  font-family: var(--display);
  font-weight: 700;
  color: inherit;
  text-wrap: balance;
}

.display-xl {
  font-size: clamp(var(--step-4), 5.2vw, var(--step-7));
  line-height: 1.04;
  letter-spacing: -.035em;
  margin-bottom: var(--space-8);
}

.display-l {
  font-size: clamp(var(--step-4), 4.2vw, var(--step-6));
  line-height: 1.06;
  letter-spacing: -.025em;
  margin-bottom: var(--space-6);
}

.display-m {
  max-width: 46ch;
  font-size: clamp(var(--step-3), 3.4vw, var(--step-4));
  line-height: 1.12;
  letter-spacing: -.02em;
  margin-bottom: var(--space-6);
}

.display-s {
  font-size: var(--step-2);
  line-height: 1.25;
  letter-spacing: -.015em;
  margin-bottom: var(--space-4);
}

.card-title {
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.2;
  letter-spacing: -.012em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.subtitle {
  font-size: var(--step-2);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink-muted);
  max-width: 60ch;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.6;
  letter-spacing: -.012em;
  color: var(--ink-muted);
  max-width: 70ch;
}

/* Highlighted key phrases inside intros and lists */
.lead strong,
.list-arrow strong {
  color: var(--ink);
  font-weight: 800;
  background: linear-gradient(transparent 64%, var(--highlight) 64%);
}

.small {
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--ink-muted);
}

.stat-value {
  display: block;
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(var(--step-3), 3vw, var(--step-5));
  line-height: 1.05;
  letter-spacing: -.025em;
  color: var(--ink);
}

.label,
.label-sm,
.label-lg {
  font-family: var(--mono);
  font-weight: 400;
  line-height: 1.45;
  text-transform: uppercase;
}

.label {
  font-size: var(--step--1);
  letter-spacing: .075em;
}

.label-sm {
  font-size: var(--step--2);
  letter-spacing: .1em;
}

.label-lg {
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .12em;
  color: var(--accent);
  margin: var(--space-8) 0 var(--space-3);
}

/* Paragraph-length labels keep a reading measure */
p.label {
  max-width: 70ch;
}

.label--strong {
  font-weight: 600;
}

/* Section label with the accent dash */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  flex: none;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.eyebrow--plain::before {
  content: none;
}

/* ---------- 6. Shared components -------------------------- */
/* Link styled as a small button */
.link-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-3) 5px;
  border: 1px solid var(--accent-dim);
  background: var(--accent-tint);
  color: var(--ink);
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}

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

.link-button--plain {
  border-color: transparent;
  background: none;
}

.link-quiet {
  color: var(--accent);
  text-decoration: none;
}

/* Tags: small bordered labels in a wrapping row */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.tag {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--white);
  color: var(--ink-muted);
}

/* Card: bordered box for grouped content */
.card {
  padding: var(--space-6);
  border: 1px solid var(--hair);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink-muted);
  transition: transform .25s var(--ease);
}

.card > :last-child {
  margin-bottom: 0;
}

.card--lift:hover {
  transform: translateY(-3px);
}

.card__index {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--accent);
}

.card__heading {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--ink);
}

/* Tile: card inside a .tile-grid, sharing hairlines with its neighbours */
.tile {
  padding: var(--space-8) var(--space-6);
  background: var(--white);
  box-shadow: 0 0 0 1px var(--hair);
  color: var(--ink-muted);
}

/* Stat: value + label, inside a tile or a metric row */
.stat__icon {
  margin-bottom: var(--space-3);
  color: var(--positive);
  font-size: var(--step-1);
  font-weight: 700;
  line-height: 1;
}

.stat .stat-value {
  margin-bottom: var(--space-2);
}

.stat .label {
  color: var(--ink-faint);
}

/* Row of stats; --divided adds hairlines between them */
.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
  margin: var(--space-3) 0 var(--space-6);
}

.metric-row .label {
  color: var(--ink-muted);
}

.metric-row--divided {
  gap: var(--space-3);
  padding-top: var(--space-6);
  border-top: 1px solid var(--hair);
}

.metric-row--divided .stat {
  flex: 1 1 0;
  padding-right: var(--space-6);
}

.metric-row--divided .stat + .stat {
  padding-left: var(--space-6);
  border-left: 1px solid var(--hair);
}

/* Callout: quoted decision or hypothesis */
.callout {
  max-width: 73ch;
  margin-block: var(--space-block);
  padding: var(--space-6) var(--space-8);
  border: 1px solid var(--hair);
  border-left: 3px solid var(--accent);
  background: var(--washed);
  color: var(--ink-muted);
}

.callout .label-sm {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--accent);
}

/* Formula / code-like block */
.formula {
  max-width: 84ch;
  margin-block: var(--space-block);
  padding: var(--space-4) var(--space-6);
  border: 1px dashed var(--hair);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-family: var(--mono);
  font-size: var(--step--1);
  line-height: 1.7;
  overflow-x: auto;
}

/* Lists */
.list-arrow,
.list-dot {
  max-width: 70ch;
  margin: var(--space-4) 0;
  padding: 0;
  list-style: none;
  color: var(--ink-muted);
}

.list-arrow > li,
.list-dot > li {
  position: relative;
  margin-bottom: var(--space-2);
}

.list-arrow > li {
  padding-left: 2.25rem;
  font-size: var(--step-1);
  line-height: 1.6;
}

.list-arrow > li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: .25em;
  width: 24px;
  line-height: 24px;
  text-align: center;
  color: var(--accent);
  font-size: var(--step-0);
}

.list-dot > li {
  padding-left: var(--space-5);
  line-height: 1.6;
}

.list-dot > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 5px;
  height: 5px;
  background: var(--accent);
}

/* Media: framed images and captions */
.frame {
  overflow: hidden;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--surface);
}

.frame img {
  width: 100%;
  margin-inline: auto;
}

.frame--padded {
  padding: clamp(var(--space-4), 3vw, 2.5rem);
}

.frame--padded img {
  max-width: 500px;
  margin-inline: auto;
}

.screenshot {
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--white);
}

.caption {
  display: block;
  margin: var(--space-3) auto;
  text-align: center;
  color: var(--ink-faint);
}

figcaption.caption:first-child {
  margin-top: 0;
}

/* Row of phone screens or mockups */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-grid);
  margin-top: var(--space-block);
}

.gallery img {
  width: 100%;
  max-width: 300px;
  margin-inline: auto;
  border-radius: var(--radius-lg);
}

.gallery .caption {
  max-width: 300px;
}

/* Before/after or control/variant pairs */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: var(--space-4);
}

.compare--single {
  grid-template-columns: 1fr;
}

.compare img {
  width: 100%;
  margin-inline: auto;
}

/* Feature row: copy beside media (home page, app case study) */
.case-row {
  padding: clamp(var(--space-12), 7vw, 4.75rem) 0;
  border-top: 1px solid var(--hair-soft);
}

.case-row:first-of-type {
  border-top: none;
}

.case-row__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-split);
}

.case-row--reverse .case-row__copy {
  order: 2;
}

.case-row__media .screenshot {
  padding: 10px;
}

/* Two phone screens side by side; figures add captions */
.device-pair {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
}

.device-pair figure {
  flex: 0 1 230px;
}

.device-pair img {
  width: 46%;
  max-width: 230px;
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.device-pair figure img {
  width: 100%;
}

/* ---------- 7. Header + footer ---------------------------- */




.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--black);
}

/* Reading meter along the header's bottom edge (scroll-driven, no JS) */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 5px;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--gold));
  animation: meter linear both;
  animation-timeline: scroll(root block);
}

@keyframes meter {
  to {
    transform: scaleX(1);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: var(--header-height);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  color: var(--white);
  text-decoration: none;
}

.logo > img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border: 2px solid var(--hair);
}

.logo .names {
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  font-size: var(--step--2);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* Nav: a row of links; on phones (with JS) a Menu button opens them as a panel */
.nav-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1) clamp(var(--space-4), 3vw, var(--space-8));
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-toggle {
  display: none;
}

.nav a {
  position: relative;
  padding: 6px 0;
  color: var(--white);
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
  text-decoration: none;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .25s var(--ease);
}

.nav a:hover::after,
.nav a[aria-current]::after {
  transform: scaleX(1);
}

@media (max-width: 720px) {
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--white);
    font-family: var(--mono);
    font-size: var(--step--1);
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
    cursor: pointer;
  }

  /* Three bars that turn into a cross */
  .nav-toggle__icon,
  .nav-toggle__icon::before,
  .nav-toggle__icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    transition: transform .25s var(--ease), background-color .2s ease;
  }

  .nav-toggle__icon {
    position: relative;
  }

  .nav-toggle__icon::before,
  .nav-toggle__icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .nav-toggle__icon::before {
    top: -6px;
  }

  .nav-toggle__icon::after {
    top: 6px;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle__icon {
    background-color: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* The panel drops down under the sticky header */
  .js .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-2) var(--gutter) var(--space-6);
    background: var(--black);
    border-top: 1px solid rgba(255, 255, 255, .15);
  }

  .js .nav-toggle[aria-expanded="true"] + .nav-list {
    display: flex;
  }

  .js .nav-list a {
    display: block;
    padding: var(--space-4) 0;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    font-size: var(--step-0);
  }

  .js .nav-list a::after {
    display: none;
  }

  .js .nav-list a[aria-current] {
    text-decoration: underline 2px var(--accent);
    text-underline-offset: 6px;
  }
}

.contact {
  padding: var(--space-section) 0 var(--space-8);
  border-top: 1px solid var(--hair);
  background: var(--paper);
}

.contact-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: var(--space-8);
}

.contact-card .label-sm {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--accent);
}

.contact-card a {
  display: block;
  text-decoration: none;
}

.contact-card a:hover {
  text-decoration: underline;
}

.contact-card strong {
  font-weight: 500;
  color: var(--ink-muted);
  word-break: break-word;
}

.footer-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  color: var(--ink-faint);
}

/* ---------- 8. Responsive, motion, print ------------------ */
@media (max-width: 980px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .tile-grid--3 {
    grid-template-columns: 1fr 1fr;
  }

  .case-row__inner {
    grid-template-columns: 1fr;
  }

  .case-row--reverse .case-row__copy {
    order: 0;
  }
}

@media (max-width: 720px) {
  :root {
    --header-height: 56px;
  }

  .header-inner {
    gap: var(--space-3);
  }

  .tile-grid,
  .tile-grid--3 {
    grid-template-columns: 1fr;
  }

  .callout {
    padding: var(--space-5);
  }

  .compare,
  .device-pair {
    gap: var(--space-3);
  }

  .metric-row--divided {
    gap: var(--space-4) 0;
    border-top: none;
  }

  .metric-row--divided .stat {
    flex-basis: 100%;
    padding-right: 0;
  }

  .metric-row--divided .stat + .stat {
    padding: var(--space-3) 0 0;
    border-left: none;
    border-top: 1px solid var(--hair);
  }

  .footer-line {
    flex-direction: column;
    gap: var(--space-2);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .site-header {
    display: none;
  }

  .section {
    border-color: #ddd;
    break-inside: avoid;
  }

  a {
    text-decoration: underline;
  }
}

/* ---------- 9. Utilities ---------------------------------- */
/* One property each. Prefer a role or component class; use these for
   one-off adjustments only. */
.text-accent { color: var(--accent); }
.text-faint { color: var(--ink-faint); }
.text-left { text-align: left; }
.caps { text-transform: uppercase; }
.invisible { visibility: hidden; }
.dimmed { opacity: .5; filter: grayscale(20%); }

.mt-0 { margin-top: 0; }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.pt-0 { padding-top: 0; }
.maxw-300 { max-width: min(100%, 300px); }
.maxw-400 { max-width: min(100%, 400px); }
.maxw-500 { max-width: min(100%, 500px); }
.maxw-600 { max-width: min(100%, 600px); }
