/* Whitespace site styles. Colours, fonts and spacing live in :root. */

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #f6f5f1;
  --paper-raised: #ffffff;
  --ink: #131312;
  --ink-soft: #3b3b38;
  --muted: #696964;
  --line: #dcdad2;
  --accent: #2f54eb;
  --error: #b42318;
  --dot: rgb(19 19 18 / 0.1);
  --wordmark: #e8e6df;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 30px 60px -30px rgb(0 0 0 / 0.3);
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wrap: 74rem;
  --gutter: clamp(1rem, 5vw, 3rem);
  --radius: 24px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f0e;
    --paper-raised: #181816;
    --ink: #f2f1eb;
    --ink-soft: #cfcec7;
    --muted: #9a9992;
    --line: #2c2c29;
    --accent: #8fa3ff;
    --error: #ff8a7a;
    --dot: rgb(242 241 235 / 0.08);
    --wordmark: #1b1b19;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 30px 60px -30px rgb(0 0 0 / 0.8);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  overflow-x: clip;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul, ol { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }

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

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

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.45rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), opacity 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -12px rgb(0 0 0 / 0.5); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.btn svg { width: 1.05em; height: 1.05em; transition: transform 0.35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--small { padding: 0.6rem 1.05rem; font-size: 0.92rem; }

.text-link {
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-underline-offset 0.25s var(--ease);
}
.text-link:hover { text-underline-offset: 8px; }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(246 245 241 / 0.8);
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4.25rem;
}

.brand {
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav__links { display: flex; align-items: center; gap: 2rem; }
.nav__links a:not(.btn) {
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s;
}
.nav__links a:not(.btn):hover { color: var(--ink); }

@media (max-width: 40rem) {
  .nav__hide { display: none; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(4.5rem, 13vw, 10rem) clamp(1.5rem, 5vw, 3.5rem);
}

/* Faint dot grid that drifts slowly behind the headline. */
.hero::before {
  content: "";
  position: absolute;
  inset: -4.25rem 0 0;
  z-index: -1;
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 65% 70% at 72% 35%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 65% 70% at 72% 35%, #000 15%, transparent 72%);
  animation: drift 90s linear infinite;
}
@keyframes drift { to { background-position: 240px 240px; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.eyebrow::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #22a559;
  box-shadow: 0 0 0 4px rgb(34 165 89 / 0.16);
}

.hero__title {
  margin-top: 1.75rem;
  font-family: var(--display);
  font-size: clamp(2.75rem, 9.4vw, 8rem);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.025em;
}
.nowrap { white-space: nowrap; }
.hero__title em { display: block; font-style: italic; color: var(--ink-soft); }

.caret {
  display: inline-block;
  width: 0.055em;
  height: 0.78em;
  margin-left: 0.08em;
  vertical-align: -0.05em;
  background: var(--accent);
  animation: blink 1.1s steps(1) 7;
}
@keyframes blink { 50% { opacity: 0; } }

.hero__lede {
  max-width: 34rem;
  margin-top: 2rem;
  color: var(--ink-soft);
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 2.5rem;
}

.js [data-enter] {
  animation: rise 1s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms + 60ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---------- Sections ---------- */

.section { padding-block: clamp(4.5rem, 10vw, 8rem); }
.section + .section { padding-top: 0; }

.section__head {
  display: grid;
  gap: 1.1rem;
  max-width: 42rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.kicker {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h2 {
  font-family: var(--display);
  font-size: clamp(2.5rem, 5.6vw, 4.25rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
h2 em { font-style: italic; }

.section__intro { color: var(--ink-soft); font-size: 1.125rem; }

/* ---------- Services ---------- */

.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.service { padding: 2.25rem 2.25rem 0.5rem; border-left: 1px solid var(--line); }
.service:first-child { padding-left: 0; border-left: 0; }
.service:last-child { padding-right: 0; }

.service__num {
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.35rem;
  font-style: italic;
}
.service h3 {
  margin: 0.9rem 0 0.7rem;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  font-weight: 400;
  line-height: 1.05;
}
.service p { color: var(--ink-soft); }

@media (max-width: 52rem) {
  .services { grid-template-columns: 1fr; }
  .service,
  .service:first-child,
  .service:last-child { padding: 1.9rem 0; border-left: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- Work ---------- */

.work { display: grid; gap: clamp(1.25rem, 3vw, 2rem); }

.project {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding: clamp(1.4rem, 4.5vw, 4rem);
  border-radius: var(--radius);
}
.project::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
}

.project--roam { background: #110c0b; color: #f5efe9; }
.project--roam::before { right: -18%; bottom: -55%; background: #ff3b30; opacity: 0.32; }

.project--pdf { background: #e9eefc; color: #0f1729; }
.project--pdf::before { left: -20%; bottom: -60%; background: #4f7cff; opacity: 0.28; }
.project--pdf .project__media { order: -1; }

@media (prefers-color-scheme: dark) {
  .project--pdf { background: #0f1830; color: #e7ecfb; }
  .project--pdf::before { opacity: 0.4; }
}

.project__name {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0.8rem 0 1.1rem;
  font-family: var(--display);
  font-size: clamp(2.4rem, 4.8vw, 3.7rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
}
.project__icon { width: 52px; height: 52px; border-radius: 13px; flex: none; }
.project .kicker { color: inherit; opacity: 0.65; }
.project__text p { max-width: 31rem; opacity: 0.86; }
.project__meta { margin-top: 1.1rem; font-size: 0.92rem; opacity: 0.65; }

.project__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.75rem;
}
.play-badge { display: inline-block; margin-left: -9px; }
.play-badge img { height: 62px; width: auto; }

.project__media { transition: transform 0.7s var(--ease); }
.project:hover .project__media { transform: translateY(-6px); }

/* Landscape phone frame */
.phone {
  padding: clamp(5px, 0.9vw, 10px);
  border-radius: clamp(16px, 2.6vw, 30px);
  background: #000;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 40px 80px -30px rgb(0 0 0 / 0.9);
  transform: rotate(-1.2deg);
}
.phone img { border-radius: clamp(11px, 1.9vw, 21px); }

/* Browser window frame */
.browser {
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(15 23 41 / 0.08), 0 40px 80px -36px rgb(15 23 41 / 0.55);
  transform: rotate(1deg);
}
.browser__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #e6e8ee;
  background: #f4f5f8;
}
.browser__bar i { width: 10px; height: 10px; border-radius: 50%; background: #d5d8df; }
.browser__url {
  flex: 0 1 15rem;
  margin-left: 10px;
  padding: 3px 12px;
  border: 1px solid #e6e8ee;
  border-radius: 999px;
  background: #fff;
  color: #5b6170;
  font-size: 12px;
  line-height: 1.5;
}

.work__note { margin-top: 1.5rem; color: var(--muted); font-size: 0.95rem; }

@media (max-width: 56rem) {
  .project { grid-template-columns: minmax(0, 1fr); }
  .project .project__media { order: -1; }
}

/* ---------- Contact ---------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: start;
  gap: clamp(2.5rem, 6vw, 5.5rem);
}

.next { display: grid; gap: 1.4rem; margin-top: 2.75rem; counter-reset: step; }
.next li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 1rem;
}
.next li::before {
  counter-increment: step;
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.85rem;
}
.next strong { font-weight: 600; }
.next span { color: var(--ink-soft); }

.form {
  display: grid;
  gap: 1.35rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}
.form__fields { display: grid; gap: 1.35rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.35rem; }

.field { display: grid; gap: 0.5rem; min-width: 0; }
.field > label,
.field > legend { font-size: 0.92rem; font-weight: 500; }
.field .optional { color: var(--muted); font-weight: 400; }

.input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(47 84 235 / 0.18);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea.input { min-height: 9.5rem; resize: vertical; }

fieldset.field { border: 0; padding: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chip span:hover { border-color: var(--ink-soft); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; }
.form__status { color: var(--ink-soft); font-size: 0.95rem; }
.form__status:empty { display: none; }
.form__status.is-error { color: var(--error); }

.form__done { display: none; padding: 1.5rem 0.25rem; }
.form__done:focus { outline: none; }
.form__done h3 { font-family: var(--display); font-size: 2.4rem; font-weight: 400; line-height: 1.05; }
.form__done p { margin-top: 0.75rem; color: var(--ink-soft); }
.form.is-sent .form__fields { display: none; }
.form.is-sent .form__done { display: block; }

@media (max-width: 56rem) {
  .contact { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 30rem) {
  .form__row { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */

.footer { overflow: hidden; padding-top: clamp(3rem, 8vw, 5rem); border-top: 1px solid var(--line); }
.footer .wrap { container-type: inline-size; }
.footer__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer__row a { text-decoration: none; }
.footer__row a:hover { color: var(--ink); }
.footer__legal { margin-top: 0.6rem; color: var(--muted); font-size: 0.78rem; }
.footer__mark {
  margin-top: clamp(2rem, 6vw, 3.5rem);
  margin-bottom: -0.06em;
  color: var(--wordmark);
  font-family: var(--display);
  font-size: clamp(4.5rem, 20.5vw, 19rem);
  font-size: 28.9cqw; /* fills the content width exactly */
  line-height: 0.9;
  letter-spacing: -0.035em;
  white-space: nowrap;
  user-select: none;
}

/* ---------- Simple pages (thanks, 404) ---------- */

.simple {
  display: grid;
  min-height: calc(100vh - 4.25rem);
  min-height: calc(100svh - 4.25rem);
  place-content: center;
  padding-block: 4rem;
}
.simple h1 {
  font-family: var(--display);
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.simple p { max-width: 30rem; margin-top: 1.25rem; color: var(--ink-soft); font-size: 1.15rem; }
.simple .btn { margin-top: 2rem; }

/* ---------- Scroll reveal ---------- */

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero::before,
  .caret,
  .js [data-enter] { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .btn svg, .project__media { transition: none; }
}
