/* ==========================================================================
   pixelexmachina.com — page layout and site components.
   Only var(--ds-*) tokens; brand identity comes from brand.css and the SVG
   pixel marks (hero-mark.svg, mark.svg) drawn through CSS masks so they take
   the current ink/accent colour in light and dark mode.
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ds-bg);
  color: var(--ds-ink);
  font-family: var(--ds-font-sans);
  font-size: var(--ds-text-md);
  line-height: var(--ds-text-md-lh);
  font-weight: var(--ds-fw-regular);
  letter-spacing: var(--ds-tracking-tight);
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--ds-accent); }
a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--ds-focus-ring); border-radius: var(--ds-radius-sm); }

p, ul, ol { margin: 0 0 var(--ds-space-4); }
ul, ol { padding-left: var(--ds-space-5); }
li + li { margin-top: var(--ds-space-2); }
strong { font-weight: var(--ds-fw-semibold); }

.skip {
  position: absolute; left: var(--ds-space-4); top: calc(var(--ds-space-10) * -1);
  padding: 0 var(--ds-space-3); height: var(--ds-control);
  display: inline-flex; align-items: center;
  background: var(--ds-accent); color: var(--ds-on-accent);
  border-radius: var(--ds-radius-control); font-weight: var(--ds-fw-medium); z-index: var(--ds-z-sticky);
}
.skip:focus { top: var(--ds-space-4); }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--ds-space-6); }

/* ---- Pixel marks (SVG via mask → recolourable with tokens) ---- */
.pxmark {
  display: inline-block; flex: none;
  background-color: currentColor;
  mask: var(--mark) no-repeat center / contain;
  -webkit-mask: var(--mark) no-repeat center / contain;
}
.pxmark--x { --mark: url("mark.svg"); width: var(--ds-space-6); height: var(--ds-space-6); }
.pxmark--hero { --mark: url("hero-mark.svg"); width: 100%; max-width: 760px; aspect-ratio: 429 / 159; color: var(--ds-ink); }

/* ---- Buttons: links styled as buttons never underline ---- */
a.ds-btn { text-decoration: none; }
a.ds-btn--primary, a.ds-btn--primary:hover { color: var(--ds-on-accent); }
a.ds-btn:not(.ds-btn--primary):hover { color: var(--ds-ink); }

/* ---- Header ---- */
.site-header { box-shadow: 0 1px 0 var(--ds-line); background: var(--ds-bg); }
.site-header .wrap {
  display: flex; align-items: center; gap: var(--ds-space-4); flex-wrap: wrap;
  min-height: var(--ds-space-16); padding-block: var(--ds-space-3);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--ds-space-3);
  text-decoration: none; font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold);
  font-size: var(--ds-text-md); letter-spacing: var(--ds-tracking-tight); color: var(--ds-ink);
}
.brand:hover { color: var(--ds-ink); }
.brand:hover .pxmark { color: var(--ds-accent); }
.nav { display: flex; align-items: center; gap: var(--ds-space-1); flex-wrap: wrap; margin-left: auto; }
.nav a:not(.ds-btn) {
  display: inline-flex; align-items: center; height: var(--ds-control); padding: 0 var(--ds-space-3);
  border-radius: var(--ds-radius-control); text-decoration: none;
  font-size: var(--ds-text-sm); font-weight: var(--ds-fw-medium); color: var(--ds-ink-2);
}
.nav a:not(.ds-btn):hover { background: var(--ds-hover); color: var(--ds-ink); }
.nav a[aria-current="page"] { color: var(--ds-ink); background: var(--ds-active); }
.nav .ds-btn { margin-left: var(--ds-space-2); }

/* ---- Eyebrow ---- */
.eyebrow {
  display: flex; align-items: center; gap: var(--ds-space-3);
  font-family: var(--ds-font-mono); font-size: var(--ds-text-sm); line-height: var(--ds-text-sm-lh);
  font-weight: var(--ds-fw-medium); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ds-ink-3);
  margin: 0 0 var(--ds-space-4);
}
.eyebrow::before { content: ""; width: var(--ds-space-2); height: var(--ds-space-2); background: var(--ds-accent); flex: none; }

/* ---- Hero ---- */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero .wrap { position: relative; padding-block: var(--ds-space-16); display: grid; gap: var(--ds-space-8); }
.hero__grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--ds-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ds-line) 1px, transparent 1px);
  background-size: var(--ds-space-8) var(--ds-space-8);
  mask-image: radial-gradient(ellipse 80% 90% at 70% 20%, var(--ds-ink) 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 70% 20%, var(--ds-ink) 20%, transparent 75%);
}
.hero__bloom {
  position: absolute; z-index: -1; pointer-events: none; right: var(--ds-space-6); top: var(--ds-space-10);
  width: calc(var(--ds-space-16) * 5); aspect-ratio: 1; color: var(--ds-accent); opacity: 0.16;
  --mark: url("mark.svg");
}
.hero__pixels { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero__pixels span {
  position: absolute; width: var(--ds-space-3); height: var(--ds-space-3); background: var(--ds-accent);
  animation: blink 4s steps(2, jump-none) infinite; animation-delay: var(--d, 0s);
}
.hero__pixels span:nth-child(1) { left: 12%; top: 18%; --d: 0s; }
.hero__pixels span:nth-child(2) { left: 46%; top: 12%; --d: 1.3s; }
.hero__pixels span:nth-child(3) { left: 82%; top: 70%; --d: 2.1s; }
.hero__pixels span:nth-child(4) { left: 61%; top: 84%; --d: 0.7s; }
.hero__pixels span:nth-child(5) { left: 30%; top: 88%; --d: 2.9s; }
.hero__pixels span:nth-child(6) { left: 93%; top: 30%; --d: 1.7s; }
@keyframes blink { 0%, 60% { opacity: 0.9; } 61%, 100% { opacity: 0.15; } }

.hero__headline {
  margin: 0; max-width: 24ch;
  font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold);
  font-size: var(--ds-text-3xl); line-height: var(--ds-text-3xl-lh); letter-spacing: var(--ds-tracking-display);
  text-wrap: balance;
}
.hero__headline em { font-style: normal; color: var(--ds-accent); }
.hero__sub { margin: 0; max-width: 56ch; color: var(--ds-ink-2); font-size: var(--ds-text-lg); line-height: var(--ds-text-lg-lh); text-wrap: pretty; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-3); }

/* ---- Sections ---- */
.section { padding-block: var(--ds-space-16); box-shadow: 0 -1px 0 var(--ds-line); scroll-margin-top: var(--ds-space-6); }
.section--alt { background: var(--ds-surface); }
.section__head { display: grid; gap: var(--ds-space-3); margin-bottom: var(--ds-space-8); max-width: 60ch; }
.section__title {
  margin: 0; font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold);
  font-size: var(--ds-text-2xl); line-height: var(--ds-text-2xl-lh); letter-spacing: var(--ds-tracking-display); text-wrap: balance;
}
.lead { color: var(--ds-ink-2); max-width: 60ch; }
.lead:last-child { margin-bottom: 0; }
.section__note { margin: var(--ds-space-6) 0 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ds-space-5); }

/* ---- Service tiles ---- */
.tile { display: grid; gap: var(--ds-space-3); align-content: start; padding: var(--ds-space-6); }
.tile__num {
  font-family: var(--ds-font-mono); font-size: var(--ds-text-sm); font-weight: var(--ds-fw-medium); letter-spacing: 0.08em;
  color: var(--ds-accent);
}
.tile__title { margin: 0; font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold); font-size: var(--ds-text-lg); line-height: var(--ds-text-lg-lh); letter-spacing: var(--ds-tracking-display); }
.tile p { margin: 0; color: var(--ds-ink-2); font-size: var(--ds-text-base); line-height: var(--ds-text-base-lh); }
.tile p + p { margin-top: var(--ds-space-2); }
.tile ul { margin: 0; padding-left: var(--ds-space-4); color: var(--ds-ink-2); font-size: var(--ds-text-base); line-height: var(--ds-text-base-lh); }
.tile li { margin: 0; }
.tile li + li { margin-top: var(--ds-space-1); }
.tile li::marker { color: var(--ds-accent); }

/* ---- Process: numbered steps on a pixel rail ---- */
.process { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ds-space-5); counter-reset: step; }
.process li { margin: 0; counter-increment: step; display: grid; gap: var(--ds-space-3); align-content: start; position: relative; padding-top: var(--ds-space-5); }
.process li::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: var(--ds-space-1);
  background-image: linear-gradient(90deg, var(--ds-line-strong) 50%, transparent 50%);
  background-size: var(--ds-space-2) var(--ds-space-1);
}
.process li:first-child::before { background-image: linear-gradient(90deg, var(--ds-accent) 50%, transparent 50%); }
.process__num {
  display: inline-flex; align-items: center; justify-content: center; width: var(--ds-control); height: var(--ds-control);
  background: var(--ds-accent); color: var(--ds-on-accent); border-radius: var(--ds-radius-sm);
  font-family: var(--ds-font-mono); font-size: var(--ds-text-sm); font-weight: var(--ds-fw-medium);
}
.process__num::before { content: counter(step, decimal-leading-zero); }
.process__title { margin: 0; font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold); font-size: var(--ds-text-md); line-height: var(--ds-text-md-lh); letter-spacing: var(--ds-tracking-display); }
.process p { margin: 0; color: var(--ds-ink-2); font-size: var(--ds-text-base); line-height: var(--ds-text-base-lh); }

/* ---- Band: short benefit line ---- */
.band { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-4) var(--ds-space-6); padding: var(--ds-space-6); border-radius: var(--ds-radius-card); background: var(--ds-accent-soft); box-shadow: var(--ds-ring); }
.band .pxmark { color: var(--ds-accent); }
.band p { margin: 0; flex: 1 1 32ch; font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold); font-size: var(--ds-text-lg); line-height: var(--ds-text-lg-lh); letter-spacing: var(--ds-tracking-display); text-wrap: balance; }
.band a:not(.ds-btn) { white-space: nowrap; font-size: var(--ds-text-base); font-weight: var(--ds-fw-medium); }

/* ---- Call to action ---- */
.cta { display: grid; gap: var(--ds-space-5); padding: var(--ds-space-10) var(--ds-space-8); border-radius: var(--ds-radius-panel); background: var(--ds-surface-inverse); color: var(--ds-ink-inverse); justify-items: start; }
.cta__title { margin: 0; max-width: 20ch; font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold); font-size: var(--ds-text-2xl); line-height: var(--ds-text-2xl-lh); letter-spacing: var(--ds-tracking-display); text-wrap: balance; }
.cta p { margin: 0; max-width: 56ch; opacity: 0.8; }
.cta a:not(.ds-btn) { color: inherit; }
.cta a:not(.ds-btn):hover { color: var(--ds-accent); }
.cta .ds-btn--primary { background: var(--ds-bg); color: var(--ds-ink); box-shadow: var(--ds-shadow-sm); }
.cta .ds-btn--primary:hover { background: var(--ds-surface); color: var(--ds-ink); }
.cta__mail { font-family: var(--ds-font-mono); font-size: var(--ds-text-sm); line-height: var(--ds-text-sm-lh); opacity: 0.8; }

/* ---- Legal / reading pages ---- */
.page { padding-block: var(--ds-space-12) var(--ds-space-16); }
.page .wrap { max-width: 760px; }
.page__title { margin: 0 0 var(--ds-space-2); font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold); font-size: var(--ds-text-2xl); line-height: var(--ds-text-2xl-lh); letter-spacing: var(--ds-tracking-display); }
.page__meta { font-family: var(--ds-font-mono); font-size: var(--ds-text-sm); line-height: var(--ds-text-sm-lh); color: var(--ds-ink-3); margin: 0 0 var(--ds-space-8); }
.prose h2 { margin: var(--ds-space-8) 0 var(--ds-space-3); font-family: var(--ds-font-display); font-weight: var(--ds-fw-semibold); font-size: var(--ds-text-lg); line-height: var(--ds-text-lg-lh); letter-spacing: var(--ds-tracking-display); }
.prose p, .prose li { color: var(--ds-ink-2); }
.prose p strong, .prose li strong { color: var(--ds-ink); }
.prose .ds-table { margin: var(--ds-space-4) 0; }
.prose .ds-table th { width: 30%; white-space: nowrap; vertical-align: top; height: auto; padding-block: var(--ds-space-3); }
.prose .ds-table td { height: auto; padding-block: var(--ds-space-3); color: var(--ds-ink-2); }
.prose .ds-table tbody tr:hover { background: transparent; }
.related { display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-4); padding: 0; margin: 0; list-style: none; }
.related li { margin: 0; }

/* ---- Footer ---- */
.site-footer { box-shadow: 0 -1px 0 var(--ds-line); padding-block: var(--ds-space-8); background: var(--ds-surface); font-size: var(--ds-text-sm); line-height: var(--ds-text-sm-lh); color: var(--ds-ink-2); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3) var(--ds-space-6); }
.site-footer .copyright { margin: 0; color: var(--ds-ink-3); }
.site-footer ul { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; flex-wrap: wrap; gap: var(--ds-space-2) var(--ds-space-5); }
.site-footer li { margin: 0; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .wrap { padding-inline: var(--ds-space-4); }
  .hero .wrap { padding-block: var(--ds-space-12); }
  .hero__headline { font-size: var(--ds-text-2xl); line-height: var(--ds-text-2xl-lh); }
  .hero__sub { font-size: var(--ds-text-md); line-height: var(--ds-text-md-lh); }
  .hero__bloom { width: calc(var(--ds-space-16) * 3); right: calc(var(--ds-space-8) * -1); top: var(--ds-space-4); }
  .hero__pixels { display: none; }
  .section { padding-block: var(--ds-space-12); }
  .section__title { font-size: var(--ds-text-xl); line-height: var(--ds-text-xl-lh); }
  .grid-2, .grid-3, .process { grid-template-columns: minmax(0, 1fr); }
  .tile { padding: var(--ds-space-5); }
  .cta { padding: var(--ds-space-8) var(--ds-space-6); }
  .cta__title { font-size: var(--ds-text-xl); line-height: var(--ds-text-xl-lh); }
  .band a:not(.ds-btn) { white-space: normal; }
  .prose .ds-table th { width: 36%; white-space: normal; }
  .site-footer ul { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__pixels span { animation: none; opacity: 0.6; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
