/* ==========================================================================
   THE FIFTH — stylesheet
   Layout concept: a 12-column editorial grid. Small tracked labels sit in a
   narrow left column; oversized type takes the rest. Typography does the work.
   ========================================================================== */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-variable.woff2") format("woff2-variations"), url("../fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  /* Colour */
  --paper: #F3F3F1;          /* cool off-white, sits well beside a chrome logo */
  --ink: #0D0D0D;            /* near-black type */
  --mute: #686866;           /* secondary text (5:1 on paper) */
  --rule: rgba(13, 13, 13, 0.16);
  --ink-ghost: rgba(13, 13, 13, 0.3);

  /* Type */
  --f-display: "Instrument Serif", "Times New Roman", Times, serif;
  --f-sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --t-label: 0.6875rem;      /* 11px tracked uppercase */
  --t-small: 0.875rem;       /* 14px */
  --t-body: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  --t-lead: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem);
  --t-statement: clamp(2.5rem, 1.4rem + 4.6vw, 6.5rem);
  --t-mega: clamp(3.5rem, 1.2rem + 9.4vw, 12.5rem);

  /* Space */
  --gutter: clamp(16px, 2.6vw, 44px);
  --section: clamp(96px, 13vw, 208px);
  --header-h: 64px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0, 1);
  --fast: 0.3s;
  --slow: 0.95s;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--t-body);
  font-weight: 350;
  font-stretch: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
em { font-style: italic; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--ink); color: var(--paper); }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

[hidden] { display: none !important; }

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; font-size: var(--t-small);
}
.skip:focus { top: 12px; }

/* Shared gutter */
.header-inner,
.hero,
.section,
.site-footer,
.menu {
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* Small tracked label */
.sec-label,
.nav a,
.menu-toggle,
.hero-meta,
.c-label,
.contact-details dt,
.principles h3,
.site-footer {
  font-family: var(--f-sans);
  font-size: var(--t-label);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.5;
}

/* Underline that draws in from the left */
.u-link,
.nav a {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: background-size var(--fast) var(--ease), color var(--fast) var(--ease);
  padding-bottom: 2px;
}
.u-link:hover,
.nav a:hover,
.nav a[aria-current="true"] { background-size: 100% 1px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--paper);
  transition: transform 0.5s var(--ease), box-shadow var(--fast) ease;
}
.site-header.is-scrolled { box-shadow: 0 1px 0 var(--rule); }
.site-header.is-hidden { transform: translateY(-100%); }

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

.brand { display: inline-flex; align-items: center; gap: 12px; height: 100%; }
.brand-logo { display: none; height: 30px; width: auto; }
.brand.has-logo .brand-logo { display: block; }
.brand-word {
  font-size: 0.8125rem;
  font-weight: 500;
  font-stretch: 125%;
  letter-spacing: 0.08em;
}

.nav ul { display: flex; gap: clamp(20px, 3vw, 44px); }
.nav a { color: var(--mute); }
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); }

.menu-toggle { display: none; padding: 12px 0 12px 16px; }
.menu-toggle .mt-close { display: none; }
.menu-toggle[aria-expanded="true"] .mt-open { display: none; }
.menu-toggle[aria-expanded="true"] .mt-close { display: inline; }

/* ---------- Mobile menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 40;
  background: var(--paper);
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 6vh);
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; justify-content: space-between;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.menu.is-open { opacity: 1; }
.menu ol { display: grid; gap: 4px; }
.menu li { overflow: hidden; }
.menu ol a {
  display: flex; align-items: baseline; gap: 14px;
  font-family: var(--f-display);
  font-size: clamp(2.75rem, 12vw, 4.5rem);
  line-height: 1.08;
  transform: translateY(100%);
  transition: transform 0.6s var(--ease);
}
.menu.is-open ol a { transform: none; }
.menu.is-open li:nth-child(2) a { transition-delay: 40ms; }
.menu.is-open li:nth-child(3) a { transition-delay: 80ms; }
.menu.is-open li:nth-child(4) a { transition-delay: 120ms; }
.menu ol a span {
  font-family: var(--f-sans); font-size: var(--t-label);
  letter-spacing: 0.16em; color: var(--mute); min-width: 2.2em;
}
.menu-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--rule); padding-top: 18px;
  font-size: var(--t-small);
}
body.menu-open { overflow: hidden; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + clamp(20px, 4vh, 48px));
  padding-bottom: clamp(16px, 2.4vw, 36px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  row-gap: clamp(24px, 3vw, 40px);
}

.hero-meta {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  color: var(--mute);
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}
.hero-meta p:nth-child(1) { grid-column: 1 / 4; }
.hero-meta p:nth-child(2) { grid-column: 4 / 10; }
.hero-meta p:nth-child(3) { grid-column: 10 / 13; text-align: right; font-variant-numeric: tabular-nums; }
.hm-coords span { margin-left: 1.2em; color: var(--ink-ghost); }

.hero-body {
  grid-row: 3;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: end;
}
.hero-tagline {
  grid-column: 1 / 9;
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(2.5rem, 1rem + 5.4vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.hero-desc {
  grid-column: 10 / 13;
  max-width: 30ch;
  font-size: var(--t-small);
  line-height: 1.6;
  color: var(--mute);
  padding-bottom: 0.4em;
}

.wordmark {
  grid-row: 4;
  margin: 0;
  font-family: var(--f-sans);
  font-weight: 300;
  font-stretch: 125%;
  font-size: 15.6vw; /* refined by JS to fill the width exactly */
  line-height: 0.76;
  letter-spacing: -0.035em;
  white-space: nowrap;
  overflow: hidden;
  padding-top: 0.04em;
  margin-left: -0.04em;
}
.wm-inner { display: inline-block; }
.wm-inner > span { display: inline-block; }
.wm-sp { width: 0.22em; }

/* Load sequence: letters rise, then tagline and description settle */
@media (prefers-reduced-motion: no-preference) {
  .js .wm-inner > span {
    animation: rise 1.05s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 45ms + 80ms);
  }
  .js .hero-tagline,
  .js .hero-desc,
  .js .hero-meta { animation: fade 0.9s var(--ease) both; }
  .js .hero-tagline { animation-delay: 0.45s; }
  .js .hero-desc { animation-delay: 0.6s; }
  .js .hero-meta { animation-delay: 0.7s; }
}
@keyframes rise { from { transform: translateY(102%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.section {
  padding-top: var(--section);
  padding-bottom: var(--section);
  border-top: 1px solid var(--rule);
}

.sec-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: start;
}
.sec-label { grid-column: 1 / 4; color: var(--mute); }
.sec-label span { color: var(--ink); margin-right: 0.6em; }
.sec-content { grid-column: 4 / 13; min-width: 0; }

/* Who we are */
.who .sec-label { position: sticky; top: calc(var(--header-h) + 24px); }
.statement {
  font-family: var(--f-display);
  font-size: var(--t-statement);
  line-height: 1.0;
  letter-spacing: -0.012em;
  max-width: 15ch;
  text-wrap: balance;
}
.who-cols {
  margin-top: clamp(48px, 7vw, 112px);
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); column-gap: var(--gutter);
  row-gap: 24px;
}
.who-cols p { max-width: 40ch; color: var(--ink); }
.who-cols p:nth-child(1) { grid-column: 4 / 7; }
.who-cols p:nth-child(2) { grid-column: 7 / 10; color: var(--mute); }

/* What we do */
.sec-intro {
  grid-column: 4 / 13;
  font-family: var(--f-display);
  font-style: italic;
  font-size: var(--t-lead);
  color: var(--mute);
}
.svc-list { margin-top: clamp(48px, 6vw, 96px); border-bottom: 1px solid var(--rule); }
.svc {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: start;
  padding-block: clamp(24px, 3vw, 44px);
  border-top: 1px solid var(--rule);
  transition: opacity 0.45s var(--ease);
}
.svc-num {
  grid-column: 1 / 4;
  font-family: var(--f-display);
  font-size: var(--t-mega);
  line-height: 0.74;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums;
  transition: transform 0.6s var(--ease);
  transform-origin: left bottom;
}
.svc-head { grid-column: 4 / 9; min-width: 0; padding-top: 0.35em; }
.svc-title {
  font-family: var(--f-sans);
  font-weight: 400;
  font-stretch: 118%;
  font-size: clamp(1.375rem, 0.9rem + 1.9vw, 2.75rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.svc-line {
  margin-top: 12px;
  font-family: var(--f-display);
  font-style: italic;
  font-size: var(--t-lead);
  line-height: 1.2;
  color: var(--mute);
}
.svc-items { grid-column: 10 / 13; padding-top: 0.9em; font-size: var(--t-body); }
.svc-items li {
  padding-block: 6px;
  transition: transform 0.45s var(--ease), color var(--fast) ease;
}
.svc-items li + li { border-top: 1px solid var(--rule); }

@media (hover: hover) and (pointer: fine) {
  .svc-list:hover .svc { opacity: 0.28; }
  .svc-list .svc:hover { opacity: 1; }
  .svc:hover .svc-num { transform: translateX(0.06em); }
  .svc:hover .svc-items li { transform: translateX(8px); }
  .svc:hover .svc-items li:nth-child(2) { transition-delay: 30ms; }
  .svc:hover .svc-items li:nth-child(3) { transition-delay: 60ms; }
  .svc:hover .svc-items li:nth-child(4) { transition-delay: 90ms; }
}

/* Approach */
.ap-lines {
  margin-top: clamp(48px, 7vw, 112px);
  font-family: var(--f-display);
  font-size: clamp(2.6rem, 1rem + 6.6vw, 9rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
}
.ap-lines p { display: block; }
.ap-l2 { padding-left: 25%; color: var(--mute); }
.ap-l3 { text-align: right; }

.ap-body { margin-top: clamp(56px, 8vw, 128px); }
.ap-text { grid-column: 4 / 9; font-size: var(--t-lead); line-height: 1.45; max-width: 34ch; text-wrap: pretty; }

.principles {
  margin-top: clamp(56px, 7vw, 112px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 32px;
}
.principles li { border-top: 1px solid var(--ink); padding-top: 16px; grid-column: span 3; }
.principles li:nth-child(1) { grid-column: 4 / 7; }
.principles li:nth-child(2) { grid-column: 7 / 10; }
.principles li:nth-child(3) { grid-column: 10 / 13; }
.principles h3 { margin-bottom: 10px; }
.principles p { color: var(--mute); max-width: 28ch; }

/* Contact */
.contact { padding-bottom: clamp(72px, 9vw, 140px); }
.contact-head {
  margin-top: clamp(40px, 6vw, 96px);
  font-family: var(--f-display);
  font-size: clamp(3.4rem, 0.6rem + 11.6vw, 15rem);
  line-height: 0.9;
  letter-spacing: -0.025em;
}
.contact-grid {
  margin-top: clamp(48px, 7vw, 112px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 40px;
  align-items: end;
}
.contact-mail { grid-column: 1 / 9; min-width: 0; }
.c-label { color: var(--mute); margin-bottom: 14px; }
.mail-link {
  display: inline-block;
  font-family: var(--f-sans);
  font-weight: 300;
  font-stretch: 112%;
  font-size: clamp(1.5rem, 0.6rem + 3.6vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  background-image: linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--rule), var(--rule));
  background-repeat: no-repeat;
  background-position: 0 100%, 0 100%;
  background-size: 0 1px, 100% 1px;
  padding-bottom: 0.12em;
  transition: background-size 0.6s var(--ease);
}
.mail-link:hover { background-size: 100% 1px, 100% 1px; }

.contact-details { grid-column: 10 / 13; display: grid; gap: 22px; }
.contact-details dt { color: var(--mute); margin-bottom: 4px; }
.contact-details dd { font-size: var(--t-body); }

/* ---------- Footer ---------- */
.site-footer {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  padding-top: 22px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
  color: var(--mute);
}
.site-footer .f-mid { text-align: center; }
.site-footer .f-logo { grid-column: 1 / -1; justify-self: start; padding-block: clamp(32px, 5vw, 72px) clamp(20px, 3vw, 40px); }
.f-logo img { width: clamp(96px, 10vw, 150px); height: auto; }
.site-footer a { justify-self: end; color: var(--ink); }

/* ---------- Reveal on scroll ---------- */
.w { display: inline-block; overflow: hidden; vertical-align: top;
     padding: 0 0.06em 0.1em 0; margin: 0 -0.06em -0.1em 0; }
.wi { display: inline-block; transition: transform var(--slow) var(--ease); transition-delay: calc(var(--i, 0) * 22ms); }
.js [data-split].is-pending .wi { transform: translateY(108%); }

[data-reveal] { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js [data-reveal].is-pending { opacity: 0; transform: translateY(18px); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .sec-label { grid-column: 1 / -1; margin-bottom: 32px; }
  .who .sec-label { position: static; }
  .sec-content, .sec-intro { grid-column: 1 / -1; }
  .who-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .who-cols p:nth-child(1) { grid-column: 1; }
  .who-cols p:nth-child(2) { grid-column: 2; }
  .svc-num { grid-column: 1 / 3; }
  .svc-head { grid-column: 3 / 9; }
  .svc-items { grid-column: 9 / 13; }
  .ap-text { grid-column: 1 / 9; }
  .principles li:nth-child(n) { grid-column: span 4; }
  .contact-mail { grid-column: 1 / -1; }
  .contact-details { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-desc { grid-column: 9 / 13; }
}

@media (max-width: 760px) {
  :root { --header-h: 56px; }

  .nav { display: none; }
  .menu-toggle { display: block; }

  .hero { row-gap: 28px; }
  .hero-meta { grid-template-columns: 1fr auto; row-gap: 4px; }
  .hero-meta p:nth-child(1) { grid-column: 1; }
  .hero-meta p:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .hero-meta p:nth-child(3) { grid-column: 2; grid-row: 1; }
  .hm-coords span { display: none; }
  .hero-body { grid-template-columns: 1fr; row-gap: 20px; }
  .hero-tagline { grid-column: 1; font-size: clamp(2.6rem, 13vw, 4.5rem); }
  .hero-desc { grid-column: 1; max-width: 34ch; font-size: 0.9375rem; }

  .statement { max-width: none; }
  .who-cols { grid-template-columns: 1fr; margin-top: 40px; }
  .who-cols p:nth-child(n) { grid-column: 1; }

  .svc { grid-template-columns: clamp(64px, 19vw, 92px) minmax(0, 1fr); column-gap: 12px; row-gap: 20px; }
  .svc-num { grid-column: 1; grid-row: 1 / 3; font-size: clamp(3.4rem, 17vw, 5rem); }
  .svc-head { grid-column: 2; padding-top: 0.1em; }
  .svc-items { grid-column: 2; padding-top: 0; font-size: 0.9375rem; }

  .ap-lines { font-size: clamp(2rem, 9.6vw, 3.4rem); line-height: 1.04; }
  .ap-l2 { padding-left: 10%; }
  .ap-text { grid-column: 1 / -1; }
  .principles { grid-template-columns: 1fr; }
  .principles li:nth-child(n) { grid-column: 1; }

  .contact-details { grid-template-columns: 1fr 1fr; }

  .site-footer { grid-template-columns: 1fr auto; }
  .site-footer .f-logo { justify-self: start; }
  .site-footer .f-mid { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-split].is-pending .wi,
  .js [data-reveal].is-pending { transform: none; opacity: 1; }
}
