/* ==========================================================================
   Shared across every page: fonts, navigation, pill buttons, footer.
   Page-specific styles live in styles.css (home), case.css (case studies)
   and pages.css (About, Playground).
   ========================================================================== */

/* ---------- Fonts ---------- */
@font-face { font-family: "PP Mori"; src: url("assets/fonts/PPMori-ExtraLight.woff2") format("woff2"); font-weight: 200; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("assets/fonts/PPMori-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("assets/fonts/PPMori-Book.woff2") format("woff2"); font-weight: 350; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("assets/fonts/PPMori-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("assets/fonts/PPMori-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("assets/fonts/PPMori-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "PP Eiko"; src: url("assets/fonts/PPEiko-Thin.woff2") format("woff2"); font-weight: 100; font-display: swap; }
@font-face { font-family: "PP Eiko"; src: url("assets/fonts/PPEiko-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "PP Eiko"; src: url("assets/fonts/PPEiko-LightItalic.woff2") format("woff2"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Aston Script"; src: url("assets/fonts/AstonScript-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Raleway"; src: url("assets/fonts/Raleway-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("assets/fonts/SpaceMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Chivo Mono"; src: url("assets/fonts/ChivoMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* ---------- Brand tokens ---------- */
:root {
  /* Page paper: near-white with a fine grain on top. */
  --page: #fefefe;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E");
  --navy: #022161;
  --blue: #3373bd;
  --sky: #cae0fa;
  --mist: #f0f7ff;
  --cream: #fffdf8;
  --slate: #7d8c9f;
  --body: #7d8c9f;          /* body copy across the site: #5d6f87 lifted 20% toward white */

  --font-sans: "PP Mori", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "PP Eiko", "Iowan Old Style", Georgia, serif;
  --font-script: "Aston Script", "Snell Roundhand", cursive;
  --font-ui: "Raleway", "PP Mori", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Chivo Mono", Menlo, monospace;
}

/* ---------- Navigation ---------- */
.nav {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 40px;
  height: 91px;
  padding: 0 40px 0 80px;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -.01em;
  color: var(--navy);
}
.nav--over { position: absolute; inset: 0 0 auto; color: var(--mist); }

.nav a { color: inherit; text-decoration: none; }
.nav__logo { flex: none; display: block; }
.nav__logo img { display: block; width: 55px; height: auto; }

/* The bar itself only holds the space; the logo and links are pinned to the
   viewport so they stay visible while scrolling. Text colour follows the
   background underneath (site.js sets .is-on-dark / .is-on-light). */
.nav.is-on-dark { color: var(--mist); }
.nav.is-on-light { color: var(--navy); }

/* Once the page scrolls, a frosted bar runs the full width behind the logo
   and links. It, the logo and the links slide away while scrolling down and
   come back on any scroll up (site.js sets .is-scrolled / .is-hidden). */
.nav::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 90px;
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  background: rgba(255, 255, 255, .6);
  box-shadow: 0 1px 0 rgba(2, 33, 97, .06);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s, background-color .35s, box-shadow .35s, translate .4s cubic-bezier(.2, .7, .2, 1);
}
.nav.is-on-dark::before { background: rgba(6, 20, 66, .28); box-shadow: 0 1px 0 rgba(255, 255, 255, .08); }
.nav.is-scrolled::before { opacity: 1; }
.nav__logo,
.nav__links,
.nav__toggle { transition: color .35s, translate .4s cubic-bezier(.2, .7, .2, 1); }
.nav.is-hidden::before,
.nav.is-hidden .nav__logo,
.nav.is-hidden .nav__toggle { translate: 0 -120%; }
@media (min-width: 861px) {
  .nav.is-hidden .nav__links { translate: 0 -120%; }
}

@media (min-width: 861px) {
  /* Logo pinned on the left, menu pinned on the right. */
  .nav__logo {
    position: fixed;
    top: 20px;
    left: 80px;
  }
  .nav__links {
    position: fixed;
    top: 23px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 36px;
    padding: 10px 24px;
    border-radius: 12px;
  }
}
.nav__links a { font-family: var(--font-serif); font-weight: 100; font-size: 15px; letter-spacing: 0; opacity: .92; transition: opacity .2s; }
.nav__links a:hover { opacity: 1; }
.nav__links a[aria-current="page"] { font-style: italic; opacity: .55; }
.nav__links a[aria-current="page"]:hover { opacity: 1; }

.nav__toggle,
.nav__links .nav__mail { display: none; }

/* ---------- Pill button ---------- */
.pill {
  display: inline-grid;
  place-items: center;
  min-width: 128px;
  height: 40px;
  padding: 0 24px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
  text-decoration: none;
  color: var(--navy);
  transition: background-color .25s, color .25s, border-color .25s;
}
.pill:hover { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: var(--footer-gap, 0);
  padding: 150px 48px 58px;
  font-family: var(--font-sans);
  color: var(--navy);
}
.site-footer__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center 52%;
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
}
.site-footer__social {
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -.01em;
}
.site-footer__social a { color: var(--blue); text-decoration: none; transition: color .2s; }
.site-footer__social a:hover { color: var(--navy); }
.site-footer .pill { margin-top: 26px; }
.site-footer__cta { margin: -5px 0 0; text-align: right; }
.site-footer__script {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 42px;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.site-footer__connect {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 100;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -.03em;
}

/* ==========================================================================
   Small screens
   ========================================================================== */
@media (max-width: 860px) {
  .nav { height: 72px; padding: 0 20px; gap: 16px; }
  .nav::before { height: 72px; }
  .nav__logo { position: fixed; top: 14px; left: 20px; }
  .nav__logo img { width: 46px; }

  .nav__toggle {
    position: fixed;
    top: 14px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
  }
  .nav__toggle span {
    grid-area: 1 / 1;
    width: 22px;
    height: 1.5px;
    background: currentColor;
    transition: transform .3s cubic-bezier(.2, .6, .2, 1);
  }
  .nav__toggle span:first-child { transform: translateY(-4px); }
  .nav__toggle span:last-child { transform: translateY(4px); }
  .nav.is-open .nav__toggle span:first-child { transform: rotate(45deg); }
  .nav.is-open .nav__toggle span:last-child { transform: rotate(-45deg); }

  /* Open menu: a frosted sheet over the top half of the screen. The page
     shows through it, blurred; the links sit in a column and "Get in touch"
     is a wide pill at its foot. Tapping below it closes the menu. The logo
     and the close button stay on top. */
  .nav__links {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1;
    height: max(440px, 50vh);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(28px, 6vh, 56px);
    margin: 0;
    padding: 72px 24px 120px 38%;
    background: rgba(240, 247, 255, .4);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
    backdrop-filter: blur(26px) saturate(140%);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s;
  }
  .nav.is-open .nav__links { opacity: 1; visibility: visible; }
  .nav.is-on-dark .nav__links,
  .nav.is-on-light .nav__links {
    -webkit-backdrop-filter: blur(26px) saturate(140%);
    backdrop-filter: blur(26px) saturate(140%);
    background: rgba(240, 247, 255, .4);
    box-shadow: none;
  }
  .nav__links a {
    font-family: var(--font-sans);
    font-style: normal;
    font-weight: 400;
    font-size: 22px;
    letter-spacing: -.01em;
    color: #5d6f93;
    opacity: 1;
    transform: translateY(8px);
    transition: transform .4s cubic-bezier(.2, .7, .2, 1), opacity .3s;
  }
  .nav.is-open .nav__links a { transform: none; }
  .nav__links a[aria-current="page"] { font-style: normal; color: var(--navy); }
  .nav__links .nav__mail {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 28px;
    display: grid;
    place-items: center;
    height: 64px;
    border: 1.5px solid var(--navy);
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 20px;
    color: var(--navy);
  }
  .nav.is-open .nav__logo,
  .nav.is-open .nav__toggle { z-index: 2; translate: none; }
  .nav.is-open .nav__toggle { color: var(--blue); }
  html.menu-open { overflow: hidden; }

  .site-footer { padding: 96px 20px 66px; }
  .site-footer__inner { flex-direction: column-reverse; gap: 40px; }
  .site-footer__cta { margin: 0; text-align: left; }
  .site-footer__script { font-size: 36px; line-height: 1.2; }
  .site-footer__connect { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav__links, .nav__toggle span, .pill, .nav__logo, .nav__toggle, .nav::before { transition: none; }
}

/* ---------- Cursor ---------- */
/* With a mouse, the arrow becomes a single sparkle (site.js draws it and moves
   it with the pointer): blue on light areas, white on dark ones, and it turns
   when hovering anything clickable. The Beyond canvas keeps its grab hand. */
.cursor-sparkle { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.has-sparkle,
  html.has-sparkle * { cursor: none; }
  html.has-sparkle .beyond__stage,
  html.has-sparkle .beyond__stage * { cursor: grab; }
  html.has-sparkle .beyond__stage.is-dragging,
  html.has-sparkle .beyond__stage.is-dragging * { cursor: grabbing; }

  .cursor-sparkle {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    display: block;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    color: var(--blue);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s, color .25s;
  }
  .cursor-sparkle.is-shown { opacity: 1; }
  html.cursor-on-dark .cursor-sparkle { color: #fff; }
  .cursor-sparkle svg {
    display: block;
    width: 100%;
    height: 100%;
    transition: transform .5s cubic-bezier(.3, 1.4, .5, 1);
  }
  .cursor-sparkle.is-hovering svg { transform: rotate(90deg) scale(1.25); }

  /* Over a case study, a "See project" label opens out beside the sparkle. */
  .cursor-sparkle__label {
    position: absolute;
    top: 50%;
    left: 36px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--navy);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.2;
    letter-spacing: -.01em;
    white-space: nowrap;
    color: #fff;
    clip-path: inset(0 100% 0 0 round 999px);
    opacity: 0;
    transform: translate(-6px, -50%);
    transition: clip-path .45s cubic-bezier(.2, .8, .2, 1), opacity .25s, transform .45s cubic-bezier(.2, .8, .2, 1);
  }
  /* Over the dark footer the label turns white. */
  .cursor-sparkle.is-light .cursor-sparkle__label { background: #fff; color: var(--navy); }
  .cursor-sparkle.is-project .cursor-sparkle__label {
    clip-path: inset(0 0 0 0 round 999px);
    opacity: 1;
    transform: translate(0, -50%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cursor-sparkle svg, .cursor-sparkle__label { transition: none; }
}

/* Lightbox: a clicked piece opens large over the page. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 6vh 5vw;
  background: rgba(6, 14, 40, .72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__figure {
  display: grid;
  justify-items: center;
  gap: 16px;
  max-width: min(1100px, 100%);
  margin: 0;
  transform: scale(.94);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.lightbox.is-open .lightbox__figure { transform: none; }
.lightbox__figure img,
.lightbox__figure video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 78vh;
  border-radius: 10px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6);
}
.lightbox__caption {
  max-width: 60ch;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  color: #fff;
}
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, .26); }
.lightbox__nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, .26); }
.lightbox__nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__nav--prev { left: 20px; }
.lightbox__nav--next { right: 20px; }
@media (max-width: 640px) {
  .lightbox__nav { top: auto; bottom: 20px; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox__figure { transition: none; }
}

/* Page grain: sits under all content and fades out above the footer, so the
   page meets the footer's white edge cleanly. site.js keeps --footer-h in
   step with the footer's real height. */
body { position: relative; }
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grain);
  background-size: 200px 200px;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--footer-h, 346px) - 320px), transparent calc(100% - var(--footer-h, 346px)));
  mask-image: linear-gradient(to bottom, #000 calc(100% - var(--footer-h, 346px) - 320px), transparent calc(100% - var(--footer-h, 346px)));
}
