/* ditherapps — one dark theme, two inks, one signal colour.
   --ink / --bone / --signal are mirrored in scripts/build_assets.py and assets/js/site.js. */
:root {
  --ink: #0c0c0b;
  --ink-2: #161614;
  --line: #2a2a27;
  --bone: #ece9e0;
  --mute: #8d8b84;
  --signal: #ff5c28;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1440px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, canvas { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.025em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
::selection { background: var(--signal); color: var(--ink); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.eyebrow { color: var(--mute); }

.skip {
  position: absolute; left: var(--gutter); top: 12px; z-index: 20;
  background: var(--bone); color: var(--ink); padding: 8px 12px; text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 32px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.02em; font-size: 17px; }
.brand-mark { width: 18px; height: 18px; fill: var(--bone); shape-rendering: crispEdges; transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(90deg); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  text-decoration: none; color: var(--mute); padding: 8px 10px; transition: color .2s;
}
.nav a:hover { color: var(--bone); }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--mute); }
.status i { width: 6px; height: 6px; background: var(--signal); animation: blink 1.6s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (max-width: 640px) {
  .status { display: none; }
  .nav a { padding: 8px 6px; }
}
/* Four nav links fit a phone only next to the bare mark. */
@media (max-width: 440px) {
  .top { gap: 16px; }
  .brand span { display: none; }
  .nav a { padding: 8px 4px; }
}

/* ---------- hero ---------- */
.hero {
  position: relative; isolation: isolate;
  min-height: min(calc(100svh - 64px), 880px);
  display: grid; align-content: end; gap: 56px;
  padding: 96px var(--gutter) 32px;
  max-width: var(--max); margin: 0 auto;
}
.hero-field {
  position: absolute; z-index: -1; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
}
.hero-copy { max-width: 760px; display: grid; gap: 24px; }
.hero h1 { font-size: clamp(42px, 6.6vw, 92px); line-height: .96; }
.lede { font-size: clamp(17px, 1.6vw, 20px); color: color-mix(in srgb, var(--bone) 78%, var(--ink)); max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 18px; text-decoration: none;
  font-family: var(--mono); font-size: 13px; letter-spacing: .03em;
  background: var(--bone); color: var(--ink); border: 1px solid var(--bone);
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--signal); border-color: var(--signal); }
.btn-ghost { background: transparent; color: var(--bone); border-color: var(--line); }
.btn-ghost:hover { background: transparent; border-color: var(--bone); }
.facts {
  background: var(--ink);
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: 0; border-top: 1px solid var(--line);
}
.facts div { padding: 16px 0 0; display: grid; gap: 6px; }
.facts dt { color: var(--mute); }
.facts dd { margin: 0; font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -0.02em; color: var(--bone); text-transform: none; }
@media (max-width: 760px) {
  .hero { padding-top: 0; gap: 32px; min-height: 0; }
  .hero-field {
    position: relative; z-index: 0;
    width: calc(100% + 2 * var(--gutter)); max-width: none; height: auto; aspect-ratio: 1.15;
    margin: 0 calc(-1 * var(--gutter)) -24px;
  }
  .facts { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
}

/* ---------- sections ---------- */
.showcase, .studio, .agency, .contact { max-width: var(--max); margin: 0 auto; padding: clamp(72px, 10vw, 160px) var(--gutter) 0; }
.section-head {
  display: grid; grid-template-columns: 1fr 2fr; gap: 12px 32px; align-items: end;
  padding-bottom: 32px; margin-bottom: clamp(32px, 4vw, 56px); border-bottom: 1px solid var(--line);
}
.section-head .eyebrow { grid-column: 1 / -1; }
.section-head h2 { font-size: clamp(40px, 6vw, 88px); line-height: .95; }
.section-note { color: var(--mute); max-width: 420px; justify-self: end; }
@media (max-width: 760px) {
  .section-head { grid-template-columns: 1fr; }
  .section-note { justify-self: start; }
}

/* ---------- showcase ---------- */
.apps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(40px, 5vw, 72px) clamp(16px, 2vw, 28px);
}
/* Every third card spans the row so the grid breathes. */
.apps li:nth-child(3n + 1) { grid-column: 1 / -1; }
.apps li:nth-child(3n + 1) .media { aspect-ratio: 2.1; }
@media (max-width: 760px) {
  .apps { grid-template-columns: 1fr; }
  .apps li:nth-child(3n + 1) .media { aspect-ratio: 1.6; }
}

.app { display: grid; gap: 16px; text-decoration: none; }
.media {
  position: relative; overflow: hidden;
  aspect-ratio: 1.6;
  background: var(--ink-2);
}
.media img, .media canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media img { transform: scale(1.001); transition: transform 1.2s var(--ease); }
.media canvas { image-rendering: pixelated; pointer-events: none; }
.js .media:not(.ready) img { opacity: 0; }
.app:hover .media img, .app.is-active .media img { transform: scale(1.03); }
.media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border: 1px solid var(--line);
}

.app-meta { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.app-icon { width: 44px; height: 44px; border-radius: 10px; outline: 1px solid var(--line); }
.app-meta h3 { font-size: 20px; letter-spacing: -0.015em; display: inline-flex; gap: 8px; align-items: baseline; }
.app-meta h3::after { content: "↗"; font-size: 15px; color: var(--mute); transition: transform .3s var(--ease), color .3s; }
.app:hover .app-meta h3::after { transform: translate(3px, -3px); color: var(--signal); }
.app-meta p { color: var(--mute); font-size: 15px; }
.app-tag { color: var(--mute); white-space: nowrap; align-self: start; padding-top: 4px; }
@media (max-width: 480px) {
  .app-meta { grid-template-columns: auto 1fr; row-gap: 6px; align-items: start; }
  .app-icon { grid-row: span 2; }
  .app-tag { grid-column: 2; grid-row: 2; padding-top: 0; }
}

/* ---------- studio ---------- */
.feature {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(24px, 5vw, 96px); align-items: center;
  padding: clamp(24px, 3vw, 40px) 0;
}
.feature + .feature { border-top: 1px solid var(--line); }
.feature:nth-of-type(even) .art { order: 2; }
.art { margin: 0; background: var(--ink); }
.art img { width: 100%; height: auto; image-rendering: pixelated; }
.feature-copy { display: grid; gap: 18px; max-width: 520px; }
.feature-copy h3 { font-size: clamp(28px, 3.4vw, 48px); line-height: 1.02; }
.feature-copy p:not(.eyebrow) { color: color-mix(in srgb, var(--bone) 72%, var(--ink)); font-size: 17px; }
@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; }
  .feature:nth-of-type(even) .art { order: 0; }
}

/* ---------- agency ---------- */
.services {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px clamp(16px, 2vw, 28px);
}
.services li { display: grid; align-content: start; gap: 14px; padding-top: 20px; border-top: 2px solid var(--signal); }
.services h3 { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.05; }
.services p:not(.eyebrow) { color: color-mix(in srgb, var(--bone) 72%, var(--ink)); }
.agency-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
  margin-top: clamp(40px, 5vw, 72px); padding-top: 32px; border-top: 1px solid var(--line);
}
.agency-cta p { color: var(--mute); max-width: 420px; }
@media (max-width: 960px) { .services { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .services { grid-template-columns: 1fr; } }

/* ---------- contact & footer ---------- */
.contact { display: grid; gap: 24px; padding-bottom: clamp(72px, 10vw, 140px); }
.contact h2 { font-size: clamp(32px, 4.6vw, 64px); line-height: 1; max-width: 900px; }
.mail {
  justify-self: start;
  font-size: clamp(28px, 5.6vw, 80px); letter-spacing: -0.03em; font-weight: 500;
  text-decoration: none; border-bottom: 2px solid var(--line);
  transition: border-color .3s, color .3s;
  overflow-wrap: anywhere;
}
.mail:hover { color: var(--signal); border-color: var(--signal); }
.foot {
  display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between;
  padding: 24px var(--gutter); border-top: 1px solid var(--line); color: var(--mute);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--bone); }
