/* ── SHARED STYLES ──
   Loaded by every page except easter.html. Page-specific rules stay in each
   page's own <style> block.
   easter.html is deliberately standalone and does not use this file. */

/* ── FONTS ──
   Self-hosted, so rendering text costs no third-party request: no DNS lookup
   and TLS handshake to fonts.googleapis.com for a stylesheet, then another to
   fonts.gstatic.com for the files. It also keeps both origins out of the CSP
   and means no visitor request reaches Google.
   Licences and refresh instructions: assets/fonts/README.md */
@font-face {
  font-family: 'Share Tech Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/share-tech-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/vt323-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Sixtyfour Convergence';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/sixtyfour-convergence-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── RESET ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── VARIABLES ── */
:root {
  --bg: #0f0f0f;
  --bg2: #141414;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.15);
  --text: #e8e6e0;
  /* Contrast on --bg, WCAG AA wants 4.5:1 for text and 3:1 for UI graphics:
       --text    15.4:1   headlines and emphasis
       --muted2   6.7:1   article body copy
       --muted    4.9:1   secondary text: nav, labels, subtitles, footer
       --dim      3.3:1   decorative glyphs ONLY (the '//' marks, the '▾')
     --muted was #6b6b6b (3.6:1) and --dim was #2a2a2a (1.3:1), which made the
     footer and the service numbers effectively invisible. Anything that is a
     word now uses --muted or brighter; --dim is not for words. */
  --muted: #808080;
  --muted2: #999;
  --dim: #666666;
  --scan: rgba(0, 0, 0, 0.03);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='20' viewBox='0 0 16 20'%3E%3Cpolygon points='0,0 0,16 4,12 7,19 9,18 6,11 11,11' fill='white' stroke='black' stroke-width='1'/%3E%3C/svg%3E") 0 0, auto;
  overflow-x: hidden;
}

/* ── SCANLINE OVERLAY ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg,
      var(--scan) 0px,
      var(--scan) 1px,
      transparent 1px,
      transparent 3px);
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ── NOISE TEXTURE ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.025;
  pointer-events: none;
  z-index: 9998;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 128px;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(8px);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a,
.nav-links button {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--text);
}

.nav-logo-link {
  display: block;
}

.nav-logo {
  height: 28px;
  width: auto;
  display: block;
}

/* ── MOBILE MENU BUTTON ──
   display: none on desktop is load-bearing: it keeps <nav> at two flex children
   so justify-content: space-between lays out exactly as it always has. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 13px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--muted);
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s;
}

.nav-toggle:hover span {
  background: var(--text);
}

.nav-open .nav-toggle span {
  background: var(--text);
}

.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── TEXT SELECTION ──
   Inverse video, like a terminal highlighting a line: dark text on a block of
   the page's own cream. The headline glow is switched off inside it so it
   doesn't smear over the block. */
::selection {
  background: var(--text);
  color: var(--bg);
  text-shadow: none;
}

/* Pictures keep their own look when selected, instead of being buried under
   the block. */
img::selection {
  background: transparent;
}

/* ── HERO ──
   Each page sets its own .hero padding / height / alignment locally, plus the
   matching mobile padding - the landing heroes are full-height and the article
   heroes are a short banner. Everything below is common to all of them. */
.hero {
  position: relative;
  border-bottom: 0.5px solid var(--border);
}

.hero-content {
  max-width: 720px;
  margin: 0 auto;
}

.hero-kicker {
  font-family: 'Sixtyfour Convergence', sans-serif;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-kicker::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 0.5px;
  background: var(--muted);
}

.hero-headline {
  font-family: 'VT323', monospace;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(232, 230, 224, 0.4);
}

.hero-headline em {
  font-style: normal;
  color: var(--muted2);
}

.hero-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.8;
}

/* The portfolio pieces' hero: one layout for all five, so the kicker and the
   headline sit in the same place as you move between them. Articles (pz-mod,
   this-website) get the large headline; the three demos (.is-compact) a
   smaller one, so the thing to play is on screen sooner. */
.hero.piece {
  padding: 8rem 2.5rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero.piece .hero-kicker {
  margin-bottom: 1.25rem;
}

.hero.piece .hero-headline {
  font-size: clamp(2.75rem, 7vw, 5rem);
  line-height: 1.05;
  margin-bottom: 1rem;
}

/* Tighter all round, so the whole device still fits on one laptop screen. */
.hero.piece.is-compact {
  padding: 6rem 2.5rem 1.25rem;
}

.hero.piece.is-compact .hero-kicker {
  margin-bottom: 0.9rem;
}

.hero.piece.is-compact .hero-headline {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  margin-bottom: 0.6rem;
}

@media (max-width: 720px) {
  .hero.piece {
    padding: 6.5rem 1.5rem 1.5rem;
  }
}

/* grid overlay */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* The swell that rolls across a hero grid now and then (wave.js, opt in with
   data-wave). The canvas sits exactly over .hero-grid; pages lift their hero
   text above it with position: relative. */
.hero-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── CTA BUTTON (hero, and closing call on case studies) ── */
.hero-cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  gap: 10px;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--text);
  padding: 12px 24px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: 1px solid var(--text);
}

.hero-cta:hover {
  background: transparent;
  color: var(--text);
}

.hero-cta::after {
  content: '→';
}

.cs-cta {
  margin-top: 2.5rem;
}

/* ── THE END OF A WRITE UP ──
   Every case study and portfolio piece closes the same way: a way to get in
   touch, back to the list, and on to the next one. On a case study the box
   comes from its <section> rule; a portfolio piece (.is-article) lines it up
   with its 720px column of text. */
.cs-more {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
  font-size: 14px;
  letter-spacing: 0.05em;
}

.cs-more a {
  color: var(--muted2);
  text-decoration: none;
}

.cs-more a:hover {
  color: var(--text);
}

.cs-more.is-article,
.piece-end {
  max-width: 768px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.cs-more.is-article {
  padding-bottom: 5rem;
  border-top: 0.5px solid var(--border);
}

.piece-end {
  padding-bottom: 1rem;
}

@media (max-width: 720px) {
  .cs-more {
    flex-direction: column;
    gap: 1rem;
  }
}

/* Headline numbers under a case study or portfolio title: no boxes, just
   figures and labels on one line. */
.cs-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.75rem;
  margin: 2rem 0 0;
  padding: 0;
}

.cs-stats li {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.cs-stats strong {
  display: block;
  font-size: 22px;
  font-weight: normal;
  color: var(--text);
  letter-spacing: 0;
}

/* ── SECTION LABEL ── */
.section-label {
  font-family: 'Sixtyfour Convergence', sans-serif;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 0.5px;
  background: var(--muted);
}

/* ── MENU CARDS ──
   The list of cards on portfolio.html and case-studies.html. One copy here so
   the two menus can't drift apart. (pf- = "portfolio", the page it came from.) */
.pf-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pf-item {
  position: relative;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.75rem;
  align-items: center;
  padding: 1rem;
  border: 0.5px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.pf-item:hover,
.pf-item:focus-visible {
  border-color: var(--border2);
  background: var(--bg2);
}

.pf-item:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 3px;
}

/* Muted until you point at it, like a screen warming up. */
.pf-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 0.5px solid var(--border);
  filter: grayscale(0.6);
  transition: filter 0.3s ease;
}

.pf-item:hover .pf-img,
.pf-item:focus-visible .pf-img {
  filter: none;
}

.pf-num {
  font-family: 'Sixtyfour Convergence', sans-serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.pf-title {
  font-size: 1.6rem;
  font-weight: normal;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0.35rem 0 0.6rem;
}

.pf-hook {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted2);
}

/* Terminal-style prompt that types itself in on hover, one character per
   step. clip-path rather than width, so the text stays put as it is revealed. */
.pf-open {
  position: absolute;
  right: 1rem;
  bottom: 0.75rem;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  clip-path: inset(0 100% 0 0);
}

.pf-item:hover .pf-open,
.pf-item:focus-visible .pf-open {
  animation: pf-type 0.36s steps(6, end) forwards;
}

@keyframes pf-type {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* Thumbnails rest under a fine blue-noise veil in the page colour, like a
   screen not quite warmed up, and it dissolves in steps on hover. --veil is how
   strong it is at rest (0 = off); how much of the picture it covers is baked
   into dither-veil.png. */
.pf-thumb {
  --veil: 0.7;
  position: relative;
  display: block;
}

.pf-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: var(--veil);
  -webkit-mask-image: url(../images/dither-veil.png);
  mask-image: url(../images/dither-veil.png);
  -webkit-mask-size: 64px 64px;
  mask-size: 64px 64px;
  pointer-events: none;
  transition: opacity 0.45s steps(6, end);
}

.pf-item:hover .pf-thumb::after,
.pf-item:focus-visible .pf-thumb::after {
  opacity: 0;
}

@media (max-width: 720px) {
  .pf-item {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .pf-open {
    display: none;
  }
}

/* ── TOOL WORD POP ── */
.tool-word {
  cursor: default;
  /* Inline, not inline-block, so a line never breaks between a word and the
     separator after it, which left "·" or "+" at the start of a line. */
  display: inline;
  padding: 4px 3px;
  margin: -4px -3px;
}

.tool-pixel {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  border-radius: 1px;
}

/* ── FOOTER ── */
footer {
  padding: 2rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-copy,
.footer-mark {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-decoration: none;
}

/* ── FOCUS ──
   :focus-visible only, so a mouse click stays clean and only keyboard users
   get the ring. Phosphor glow to match the type rather than the UA default. */
:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 3px;
}

.nav-links a:focus-visible,
.footer-copy:focus-visible,
.footer-mark:focus-visible {
  color: var(--text);
  outline-offset: 2px;
  box-shadow: 0 0 8px rgba(232, 230, 224, 0.25);
}

/* ── ANIMATIONS ── */
/* Hidden only once a script in <head> has marked the page .js, so if main.js
   never loads, every section is still there to read, just without the fade. */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
  nav {
    padding: 1rem 1.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  /* The five links plus the logo need 410px of a 390px phone, so below the
     breakpoint the row becomes a panel under the bar. It is a disclosure, not a
     modal: it does not cover the page, so focus is deliberately NOT trapped. */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
    background: rgba(15, 15, 15, 0.98);
    border-bottom: 0.5px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  }

  .nav-open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 0.9rem 1.5rem;
  }

  footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* ── REDUCED MOTION ──
   The reveal transitions, the blinking terminal cursor and the glitch shakes
   are decoration. Honour the OS setting and drop them. .reveal needs the
   explicit opacity/transform reset: killing the transition on its own would
   leave the content stranded at opacity: 0.
   The scanline and noise overlays stay - they are static, not motion. */
@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Emphasis inside an italic aside, like (an editor's note), flips back to
   upright, as in print. Otherwise it would not stand out at all. */
em em,
em i,
i em,
i i {
  font-style: normal;
}

/* The pixel heart on the case studies' "Message me" button. */
/* Keeps the last word of a button label with the heart after it, so the
   heart is never left on a line of its own. */
.keep {
  white-space: nowrap;
}

.pixel-heart {
  vertical-align: -2px;
  margin-left: 4px;
  image-rendering: pixelated;
}

/* No one word last lines: headings balance their lines, and paragraphs avoid
   leaving a single word behind. Browsers without it just wrap as before. */
h1, h2, h3, .pf-title, .service-title, th {
  text-wrap: balance;
}

p, li {
  text-wrap: pretty;
}
