/* Shared shell — nav, footer, building game, reveals.
   Used by the home page and every case-study page. Page-specific
   styling lives in home.css / case.css. */

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

:root {
  --bg: #F3F5F7;
  --ink-text: #1C1D1F;
  --muted: #475569;   /* slate-600 — 6.93:1 on the page background */
  --desc: #475569;    /* slate-600 — 7.58:1 on a white card */
  --meta: #64748b;    /* slate-500 — 4.76:1 on a white card */
  --credit: #475569;  /* slate-600 — 6.93:1 on the page background */
  --line: #E3E7EC;
  --night: #210B2C;
  /* Page gutters. Content stops growing once the window is wide enough:
     the cards cap at 1152px and the nav/hero column at 1104px, and every
     extra pixel of window goes into the gutter instead. At a 1440 laptop
     that lands on a 144px gutter; on a 1920 or 2560 display the elements
     are the same size, just further from the edge — so a clip is never
     scaled past its native width and never softens. */
  --content: 1152px;        /* card column */
  --content-text: 1104px;   /* nav + hero column, inset 24px further */
  --rail: max(32px, calc((100% - var(--content)) / 2));
  --pad-x: max(48px, calc((100% - var(--content-text)) / 2));
  --card-pad-x: 64px;       /* inside the footer card — not a page gutter */
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  font-family: Geist, system-ui, -apple-system, sans-serif;
  color: var(--ink-text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover { opacity: .75; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--night); color: #F3F5F7;
  padding: 12px 16px; border-radius: 0 0 8px 0;
  font: 500 14px Geist, sans-serif; text-decoration: none;
}
.skip-link:focus { left: 0; opacity: 1; }

.page {
  position: relative;
  min-height: 100vh;
  background: var(--bg);
  overflow: clip;
}

.halftone {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: .25;
  /* soft pixels: a light blur turns the square grid into grain */
  filter: blur(1.1px);
}

/* ── Nav ─────────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 15;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px var(--pad-x);
  font: 500 14px Geist, sans-serif;
}
.nav-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; white-space: nowrap; text-decoration: none;
}
.nav-avatar {
  flex: none; width: 36px; height: 36px;
  border-radius: 50%;
  /* the source is 109x145, so cover crops the sides; bias up to the face */
  object-fit: cover; object-position: center 25%;
  /* 36 -> 40px on hover. Done as a scale, not a width change, so the
     name beside it doesn't shift. 40/36 = 1.1111 */
  transition: transform .2s cubic-bezier(0, 0, .2, 1);
}
.nav-brand:hover .nav-avatar,
.nav-brand:focus-visible .nav-avatar { transform: scale(1.1111); }
/* the portrait growing is the hover cue, so skip the usual link fade --
   a photo at 75% opacity just looks washed out */
.nav-brand:hover { opacity: 1; }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { text-decoration: none; }
.nav-cta {
  padding: 9px 16px; border-radius: 999px;
  background: var(--night); color: var(--bg);
}

/* ── Mobile menu ─────────────────────────────────────────── */
/* Hidden above 720px; the tier below swaps the bar's contents. */

.nav-burger {
  display: none;
  /* 44px target, but the icon's left edge sits flush with the nav's
     padding so it mirrors the Get in touch pill's gap on the right */
  width: 44px; height: 44px;
  align-items: center; justify-content: flex-start;
  background: none; border: 0; padding: 0;
  color: inherit; cursor: pointer;
}
.nav-burger svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.mobile-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  display: none; flex-direction: column;
  padding: 8px;
  background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}
.nav.is-menu-open .mobile-menu { display: flex; }
.mobile-menu a {
  padding: 12px 16px; border-radius: 8px;
  font: 500 16px/20px Geist, sans-serif;
  color: var(--ink-text); text-decoration: none;
}
.mobile-menu a:hover { background: var(--bg); opacity: 1; }

/* Work opens the three case studies in place, rather than leaving for
   the home page */
.mm-work {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 12px 16px; border: 0; border-radius: 8px;
  background: none; color: var(--ink-text);
  font: 500 16px/20px Geist, sans-serif;
  text-align: left; cursor: pointer;
}
.mm-work:hover { background: var(--bg); }
.mm-arrow {
  margin-left: auto; width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s cubic-bezier(0, 0, .2, 1);
}
.mobile-menu.is-sub-open .mm-arrow { transform: rotate(180deg); }
.mm-sub { display: none; flex-direction: column; padding-left: 12px; }
.mobile-menu.is-sub-open .mm-sub { display: flex; }
.mm-sub .dd-link { font-size: 15px; padding: 11px 16px; }

/* Work dropdown — same behaviour as the case-study nav (hover on a
   pointer, click/tap otherwise), restyled in the redesign's language.
   css/nav-menu.css is left alone: the case-study pages share it. */
.work { position: relative; }
.work-btn {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 24px; padding: 8px; margin: -8px;
  background: none; border: 0; border-radius: 6px;
  font: 500 14px Geist, sans-serif; color: inherit;
  cursor: pointer;
  transition: opacity .15s cubic-bezier(0, 0, .2, 1);
}
.work-btn:hover, .work.is-open .work-btn { opacity: .75; }
.work-arrow {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s cubic-bezier(0, 0, .2, 1);
}
.work.is-open .work-arrow { transform: rotate(180deg); }

.work-dd { position: absolute; top: 100%; left: 0; display: none; padding-top: 8px; }
.work.is-open .work-dd { display: block; }
@media (hover: hover) and (pointer: fine) {
  .work:hover .work-dd { display: block; }
  .work:hover .work-btn { opacity: .75; }
  .work:hover .work-arrow { transform: rotate(180deg); }
}
.work-dd-inner {
  min-width: 190px; padding: 4px;
  background: #fff; border: 1px solid var(--line);
  /* 12px menu with 4px padding → 8px links: outer = inner + gap */
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
  display: flex; flex-direction: column;
  animation: dd-in .2s cubic-bezier(0, 0, .2, 1) both;
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
.dd-link {
  padding: 12px 16px; border-radius: 8px;
  /* 20px line + 24px padding = a 44px target */
  font: 400 14px/20px Geist, sans-serif; color: var(--ink-text);
  text-decoration: none; white-space: nowrap;
  transition: background .15s cubic-bezier(0, 0, .2, 1);
}
.dd-link:hover { background: var(--bg); opacity: 1; }
.dd-link { display: flex; align-items: center; gap: 10px; }
.dd-link::before {
  content: ''; flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot, transparent);
}
.dd--01 { --dot: #C4521E; }
.dd--02 { --dot: #266EDA; }
.dd--03 { --dot: #339989; }
.dd-link[aria-current] { font-weight: 600; background: var(--bg); }
.dd-link[aria-current]::before { width: 10px; height: 10px; }


/* ── Footer ──────────────────────────────────────────────── */

.footer {
  position: relative;
  padding: 56px var(--rail) 40px;
  display: flex; flex-direction: column; gap: 24px;
}
.foot-card {
  position: relative;
  background: var(--night); color: #F3F5F7;
  border-radius: 28px; overflow: hidden;
  display: flex; flex-direction: column;
}
.foot-top {
  position: relative;
  padding: 64px var(--card-pad-x) 56px;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px;
  align-items: start;
}
.foot-top h2 {
  margin: 0;
  font: 500 46px/1.08 Geist, sans-serif;
  letter-spacing: -.03em; text-wrap: pretty;
}
.foot-body {
  display: flex; flex-direction: column; gap: 20px;
  font: 400 16px/1.6 Geist, sans-serif; color: #AAB6C8;
}
.foot-body p { margin: 0; text-wrap: pretty; }
.foot-links {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px;
  font: 500 14px Geist, sans-serif;
}
.foot-pill {
  padding: 12px 20px; border-radius: 999px;
  border: 1px solid rgba(243, 245, 247, .24);
  background: none; color: #F3F5F7;
  font: 500 14px Geist, sans-serif;
  text-decoration: none; cursor: pointer;
}
.foot-pill--solid {
  background: #F3F5F7; color: var(--night); border-color: transparent;
}
.foot-pill:hover { opacity: .75; }

.foot-strip {
  position: relative;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--card-pad-x);
  border-top: 1px solid rgba(243, 245, 247, .1);
  font: 400 11px 'Geist Mono', monospace; color: #7F8BA0;
  letter-spacing: .04em;
}
.foot-strip-right { display: flex; gap: 18px; align-items: center; }
.foot-clear {
  background: none; border: 0; padding: 0;
  font: inherit; letter-spacing: inherit;
  color: #9FD356; cursor: pointer;
  /* 11px label, 24x24 minimum target — padded out, pulled back by margin
     so the strip sits exactly where it did. */
  min-height: 24px; padding: 8px 12px; margin: -8px -12px;
}

.site-plan {
  position: relative; height: 170px; overflow: hidden;
}
/* pixel noise behind the buildings, drawn by shared.js */
.plan-noise {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
  image-rendering: pixelated;   /* crisp square pixels, no blur */
}
.building {
  position: absolute; bottom: 18px;
  transform-origin: bottom;
  animation: rise .7s cubic-bezier(.3, 1.5, .5, 1) both;
  pointer-events: none;
}
.building svg { display: block; width: 100%; height: 100%; }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 18px;
  background: transparent;   /* the noise canvas shows through */
  border-top: 1.5px solid #F3F5F7;
}

.credit {
  display: flex; justify-content: center; gap: 10px;
  font: 400 13px Geist, sans-serif; color: var(--credit);
}


/* ── Reveal on scroll ────────────────────────────────────── */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition:
    opacity .35s cubic-bezier(0, 0, .2, 1),
    transform .4s cubic-bezier(0, 0, .2, 1),
    filter .35s cubic-bezier(0, 0, .2, 1);
}
.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }

/* ── Responsive tiers ────────────────────────────────────── */

@media (max-width: 1180px) {
  :root { --pad-x: 48px; --rail: 32px; --card-pad-x: 48px; }
  .foot-top { grid-template-columns: 1fr; gap: 40px; }
  .foot-top h2 { font-size: clamp(32px, 4.4vw, 46px); }
}

@media (max-width: 720px) {
  :root { --pad-x: 16px; --rail: 16px; --card-pad-x: 16px; }

  /* The bar carries two things on a phone: the burger and Get in touch.
     The name, Work and Resume move into the menu the burger opens. */
  .nav { padding: 12px var(--pad-x); gap: 12px; }
  .nav-burger { display: inline-flex; }
  .nav-brand { display: none; }
  .nav-links .work, .nav-links .nav-resume { display: none; }
  .nav-links a { white-space: nowrap; }

  .footer { padding: 32px var(--rail) 32px; }
  .foot-card { border-radius: 20px; }
  .foot-top { padding: 40px var(--card-pad-x) 32px; }
  .foot-strip { padding: 16px var(--card-pad-x); font-size: 10px; gap: 12px; }
  .site-plan { height: 130px; }
  .credit { flex-wrap: wrap; font-size: 12px; }
  .js [data-reveal] { transform: translateY(14px); }
}

@media (hover: none), (pointer: coarse) {
  /* the effect stays on touch screens as a single static patch (home.js) */
}

/* ── Focus + reduced motion ──────────────────────────────── */

:focus-visible {
  outline: 2px solid #266EDA;
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] {
    opacity: 1; transform: none; filter: none;
    transition: opacity .15s linear;
  }
  .building { animation: none; }
  .nav-avatar { transition: none; }
  .nav-brand:hover .nav-avatar { transform: none; }
}


/* ── Icons ───────────────────────────────────────────────── */
/* Lucide, 24x24 grid, 2px stroke at 24 (scales with the icon), round caps.
   16px inline with text; 24px in the larger buttons. Follows ux-guide icons.md. */
.ic, .lock {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.foot-pill { display: inline-flex; align-items: center; gap: 6px; }
.next-arrow .ic { width: 24px; height: 24px; }
.cmp-handle .ic { width: 20px; height: 20px; }
