/* Eighteen — studio site. Tokens first, then layout, then motion. */

:root {
  --bg: #FFFFFF;
  --fg: #121212;
  --muted: #6B6B6B;
  --card: #F5F5F5;
  --line: #E4E4E4;
  --btn: #2D2D2D;
  --btn-fg: #FFFFFF;
  --c1: #C8F03C; /* Mac apps: lime */
  --c2: #FF8A3D; /* web: tangerine */
  --c3: #B79CFF; /* libraries: lilac */
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --track: -0.022em;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gutter: clamp(12px, 1.2vw, 20px);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { display: block; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

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

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px var(--gutter) 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand__logo { display: block; flex: 0 0 auto; transition: transform .6s var(--ease); }
.brand:hover .brand__logo { transform: rotate(-20deg) scale(1.08); }

/* The links double as a key to the page: each kind of work carries its section's colour. */
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 28px; font-size: 15px; font-weight: 500; }

.site-nav__link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  text-decoration: none;
}

.site-nav__link span:last-child {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1.5px;
  padding-bottom: 2px;
  transition: background-size .3s var(--ease);
}

.site-nav__link:hover span:last-child { background-size: 100% 1.5px; }

.site-nav__key { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

.site-header__cta {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.site-header__cta span:first-child { padding-bottom: 2px; border-bottom: 2px solid var(--c1); transition: border-color .3s var(--ease); }
.site-header__cta:hover span:first-child { border-color: var(--fg); }

/* ---------- Shared microinteractions ---------- */

.press { transition: transform .2s var(--ease); }
.press:active { transform: scale(.97); }

.nudge { display: inline-block; transition: transform .3s var(--ease); }
.press:hover .nudge { transform: translateX(4px); }

.underline {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat left 100% / 100% 1px;
  transition: background-size .35s var(--ease);
}

.underline:hover { background-size: 0 1px; background-position: right 100%; }

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

.hero { padding: clamp(96px, 11vw, 168px) var(--gutter) 0; }

.hero__title {
  margin: 0;
  max-width: 1180px;
  font-size: clamp(30px, 3.6vw, 52px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: var(--track);
  text-wrap: pretty;
}

.hero__sub { color: var(--muted); }

/* Painted letters: main.js splits the hero into words and letters on pointer devices and
   colours the letters the pointer passes over. Words stay unbroken. */
.hero__word { white-space: nowrap; }

/* ---------- Work: one strip per kind ---------- */

.kind { padding: 64px var(--gutter) 0; }
.kind--first { padding-top: clamp(192px, 17vw, 256px); }

.kind__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 28px;
  padding: 12px 2px 14px;
}

.kind__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.kind__square { width: 10px; height: 10px; border-radius: 2px; }

.kind__blurb {
  flex: 0 1 520px;
  margin: 0 0 0 auto;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
  text-align: right;
  text-wrap: pretty;
}

.strip { display: flex; gap: 20px 4px; }

/* Pointing at a tile widens it; the others narrow. */
.tile {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  transition: flex-grow .65s var(--ease);
}

.tile.is-open { flex-grow: 2.6; }

.tile__frame {
  position: relative;
  display: block;
  height: clamp(260px, 36vw, 520px);
  border-radius: 3px;
  overflow: hidden;
}

.tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .9s var(--ease);
}

.tile:hover .tile__img { transform: scale(1.03); }

.tile__tag {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 2px;
  background: #FFFFFF;
  color: #121212;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s ease, transform .35s var(--ease);
}

.tile:hover .tile__tag,
.tile:focus-visible .tile__tag { opacity: 1; transform: translateY(0); }

.tile__caption { display: flex; align-items: baseline; gap: 12px; min-width: 0; padding: 0 2px; }
.tile__name { flex: 0 0 auto; font-size: 15px; font-weight: 600; white-space: nowrap; }

.tile__line {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .35s ease;
}

.tile.is-open .tile__line { opacity: 1; }

/* ---------- About ---------- */

.about { padding: 144px var(--gutter) 0; }

.about__text {
  margin: 0;
  max-width: 900px;
  font-size: clamp(24px, 2.3vw, 32px);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: var(--track);
  text-wrap: pretty;
}

.about__meta { margin: 28px 0 0; font-size: 22px; font-weight: 500; line-height: 1.2; letter-spacing: -0.018em; color: var(--muted); }

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

.contact { padding: clamp(176px, 17vw, 248px) var(--gutter) 0; }

/* Three stripes in the section colours, then the ask in plain black and grey. */
.contact__stripes { display: grid; grid-template-columns: 3fr 3fr 2fr; height: 16px; } /* same 3:3:2 split as the intro panels */

.contact__body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px 48px;
  padding: 44px 0 28px;
  border-bottom: 1px solid var(--line);
}

.contact__title {
  flex: 1 1 420px;
  margin: 0;
  max-width: 820px;
  font-size: clamp(30px, 3.6vw, 52px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: var(--track);
  text-wrap: pretty;
}

.contact__muted { color: var(--muted); }

.contact__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }

.contact__button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border: 1.5px solid var(--fg);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .3s var(--ease), transform .2s var(--ease);
}

.contact__button:hover { background: var(--c1); }

.contact__email { font-size: 15px; font-weight: 500; color: var(--muted); text-decoration: none; }
.contact__email:hover { color: var(--fg); }

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

.site-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 28px var(--gutter) 32px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .strip { flex-direction: column; }
  .tile, .tile.is-open { flex: none; }
  .tile__line { opacity: 1; white-space: normal; }
  .kind__blurb { flex-basis: 100%; text-align: left; margin-left: 0; }
  .contact__stripes { height: 10px; }

  /* Phones: the header is just the logo, centred. The sections follow in one scroll
     and "Start a project" waits in the contact section at the end. */
  .site-header { justify-content: center; }
  .site-nav, .site-header__cta { display: none; }
  .hero { padding-top: 72px; }
}

/* ---------- Scroll reveal (only when JavaScript runs) ---------- */

.js .reveal { opacity: 0; transform: translateY(40px); transition: opacity .9s ease, transform 1s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Intro: roll call, then three colour panels lift ----------
   Timeline (seconds): "Kin" holds until 0.85; the names slide up, quick in the middle and
   easing into "Eighteen" by 3.04; "Eighteen" holds until 3.64, when the panels rise;
   they hold, then lift away by ~5.8; the page settles in from 5.54. */

.intro { display: none; }

[data-intro="on"]:not(.intro-unlocked) body { overflow: hidden; }
[data-intro="on"] .intro { display: block; }

.intro__white,
.intro__panels {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
}

.intro__white { z-index: 48; background: #FFFFFF; visibility: hidden; }
.intro__panels { z-index: 50; display: flex; pointer-events: none; }

.intro__row {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
}

.intro__window { display: block; overflow: hidden; flex: 0 0 auto; }
.intro__window--square { --s: clamp(28px, 3vw, 44px); width: var(--s); height: var(--s); border-radius: 3px; }
.intro__square { display: block; width: var(--s); height: var(--s); }

.intro__window--name {
  flex: 1 1 auto;
  min-width: 0;
  height: 1.25em; /* room for descenders, so "pipkins" never peeks in above "Eighteen" */
  font-size: clamp(44px, 7.4vw, 112px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.035em;
  white-space: nowrap;
  transform-origin: left center;
}

.intro__roll { display: block; transform: translateY(-88.889%); }

.intro__panel {
  flex: 3 1 0%;
  min-width: 0;
  position: relative;
  visibility: hidden;
  transform-origin: center bottom;
}

.intro__panel:last-child { flex-grow: 2; }

.intro__label {
  position: absolute;
  left: var(--gutter);
  right: 12px;
  bottom: 16px;
  font-size: clamp(20px, 2.3vw, 32px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: var(--track);
}

[data-intro="on"] .intro__white { animation: intro-white 4.49s linear; }
[data-intro="on"] .intro__row { animation: fade .5s ease .1s backwards; }
[data-intro="on"] .intro__roll { animation: intro-roll 2.19s linear .85s both; }
[data-intro="on"] .intro__window--name { animation: intro-land .6s var(--ease) 2.70s backwards; }
[data-intro="on"] .intro__panel { animation: intro-panel 2.8s linear calc(3.64s + var(--i) * .1s) backwards; }
[data-intro="on"] .intro__label { animation: intro-label 2.8s linear calc(3.64s + var(--i) * .1s) backwards; }

@keyframes intro-white { 0%, 99.9% { visibility: visible; } 100% { visibility: hidden; } }
@keyframes intro-roll {
  0.00% { transform: translateY(0.000%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  10.05% { transform: translateY(-11.111%); }
  16.44% { transform: translateY(-11.111%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  24.66% { transform: translateY(-22.222%); }
  29.68% { transform: translateY(-22.222%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  36.53% { transform: translateY(-33.333%); }
  40.64% { transform: translateY(-33.333%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  46.58% { transform: translateY(-44.444%); }
  50.23% { transform: translateY(-44.444%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  56.16% { transform: translateY(-55.556%); }
  59.82% { transform: translateY(-55.556%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  66.67% { transform: translateY(-66.667%); }
  70.78% { transform: translateY(-66.667%); animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  79.00% { transform: translateY(-77.778%); }
  84.47% { transform: translateY(-77.778%); animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  100% { transform: translateY(-88.889%); }
}
@keyframes intro-land { from { transform: scale(.94); } to { transform: scale(1); } }

@keyframes intro-panel {
  0% { visibility: visible; transform: translateY(0) scaleY(0); animation-timing-function: cubic-bezier(.7, 0, .2, 1); }
  20% { visibility: visible; transform: translateY(0) scaleY(1); }
  52% { visibility: visible; transform: translateY(0) scaleY(1); animation-timing-function: cubic-bezier(.76, 0, .24, 1); }
  78%, 100% { visibility: visible; transform: translateY(-101%) scaleY(1); }
}

/* The label fades in once its panel has grown, then rides out with it. */
@keyframes intro-label {
  0%, 17% { opacity: 0; transform: translateY(12px); }
  26%, 100% { opacity: 1; transform: translateY(0); }
}

/* Page elements settle in as the panels lift. Each sets its own delay with --d. */
[data-intro="on"] .enter--rise { animation: rise .9s var(--ease) var(--d, 0s) backwards; }
[data-intro="on"] .enter--fade { animation: fade .9s ease var(--d, 0s) backwards; }
[data-intro="on"] .enter--drop { animation: drop .7s var(--ease) var(--d, 0s) backwards; }
[data-intro="on"] .enter--wipe { animation: wipe 1s var(--ease) var(--d, 0s) backwards; }
[data-intro="on"] .enter--wipe .tile__img { animation: zoom 1.5s var(--ease) var(--d, 0s) backwards; }

@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drop { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes zoom { from { transform: scale(1.16); } to { transform: scale(1); } }

/* ---------- Reduced motion: no intro, no movement ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .intro { display: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
