/* ---------------------------------------------------------------- tokens */

:root {
  --bg: #f4f6f7;
  --surface: #fdfdfd;
  --text: #16202b;
  --muted: #51616f;
  --rule: #d8dfe4;
  --accent: #c74e07;
  --accent-graphic: #e8600a;
  --grid-dot: #c3ccd3;
  --node-fill: #ffffff;

  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo,
    Consolas, monospace;
  --max-width: 860px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1319;
    --surface: #131b24;
    --text: #e7ecf0;
    --muted: #93a4b3;
    --rule: #24303c;
    --accent: #ff8534;
    --accent-graphic: #ff8534;
    --grid-dot: #263341;
    --node-fill: #10161d;
  }
}

:root[data-theme="light"] {
  --bg: #f4f6f7;
  --surface: #fdfdfd;
  --text: #16202b;
  --muted: #51616f;
  --rule: #d8dfe4;
  --accent: #c74e07;
  --accent-graphic: #e8600a;
  --grid-dot: #c3ccd3;
  --node-fill: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #0d1319;
  --surface: #131b24;
  --text: #e7ecf0;
  --muted: #93a4b3;
  --rule: #24303c;
  --accent: #ff8534;
  --accent-graphic: #ff8534;
  --grid-dot: #263341;
  --node-fill: #10161d;
}

/* ------------------------------------------------------------------ base */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
}

.site-header,
main,
footer {
  width: min(var(--max-width), calc(100% - 2.5rem));
  margin: 0 auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3,
p,
ol,
ul,
pre {
  margin-top: 0;
}

h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2.4rem, 7vw, 4.1rem);
  font-weight: 780;
  line-height: 1.03;
  letter-spacing: -0.035em;
  text-wrap: balance;
  max-width: 16em;
}

h2 {
  margin-bottom: 1.75rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}

p {
  margin-bottom: 1rem;
  max-width: 66ch;
}

.mono {
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------------- header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}

.home-link {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.home-link .prompt {
  color: var(--accent);
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.4rem;
}

nav a {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---------------------------------------------------------------- shared */

section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  margin: 0 0 1.1rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "// ";
  color: var(--muted);
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: 0 0;
}

.hero > * {
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, var(--bg));
  pointer-events: none;
}

.lede {
  max-width: 34em;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  line-height: 1.55;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.75rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* -------------------------------------------------------------- diagram */

.diagram-scroll {
  margin-top: 3rem;
  overflow-x: auto;
}

.diagram {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

.diagram .node {
  fill: var(--node-fill);
  stroke: var(--rule);
  stroke-width: 1.5;
}

.diagram .node-in {
  fill: transparent;
  stroke: var(--muted);
  stroke-dasharray: 0.018 0.014;
}

.diagram .node-out {
  stroke: var(--accent-graphic);
}

.diagram .wire {
  fill: none;
  stroke: var(--accent-graphic);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}

.diagram .chev {
  fill: none;
  stroke: var(--accent-graphic);
  stroke-width: 1.5;
}

.diagram .t {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.diagram .s {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
}

.diagram .n {
  fill: var(--accent-graphic);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

/* -------------------------------------------------------------- services */

.phases {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.phases li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}

.phases li:last-child {
  padding-bottom: 0;
}

.phase-num {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding-top: 0.3rem;
}

.phases p {
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.deliverable {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}

.deliverable::before {
  content: "→ ";
  color: var(--accent);
}

/* ------------------------------------------------------------------ work */

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.entry {
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.entry .tag {
  display: inline-block;
  margin-bottom: 0.9rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.entry p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------- contact */

.brief {
  margin: 1.5rem 0 1rem;
  padding: 1.4rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text);
}

.brief .c {
  color: var(--muted);
}

.brief .k {
  color: var(--accent);
}

.cta {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.75rem 1.4rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 4px;
}

.cta:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

/* -------------------------------------------------------------- colophon */

footer {
  padding: 2.5rem 0 3.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.colophon {
  max-width: 62ch;
  margin-bottom: 1.5rem;
}

.sysline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.sysline .ok {
  color: var(--accent);
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  .hero .eyebrow,
  .hero h1,
  .hero .lede,
  .hero .links {
    opacity: 0;
    translate: 0 14px;
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }

  .hero h1 {
    animation-delay: 0.08s;
  }

  .hero .lede {
    animation-delay: 0.16s;
  }

  .hero .links {
    animation-delay: 0.24s;
  }

  .diagram .node {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 0.9s ease forwards;
  }

  .diagram .g1 .node { animation-delay: 0.3s; }
  .diagram .g2 .node { animation-delay: 0.55s; }
  .diagram .g3 .node { animation-delay: 0.8s; }
  .diagram .g4 .node { animation-delay: 1.05s; }

  .diagram text,
  .diagram .chev {
    opacity: 0;
    animation: appear 0.5s ease forwards;
  }

  .diagram .g1 text { animation-delay: 0.6s; }
  .diagram .g2 text { animation-delay: 0.85s; }
  .diagram .g3 text { animation-delay: 1.1s; }
  .diagram .g4 text { animation-delay: 1.35s; }
  .diagram .chev { animation-delay: 1.2s; }

  .diagram .wire {
    opacity: 0;
    animation: appear 0.5s ease 1.2s forwards, flow 1.4s linear infinite;
  }
}

@keyframes rise {
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes appear {
  to {
    opacity: 1;
  }
}

@keyframes flow {
  to {
    stroke-dashoffset: -10;
  }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .site-header {
    display: block;
  }

  nav {
    justify-content: flex-start;
    margin-top: 0.65rem;
    gap: 1.1rem;
  }

  section {
    padding: 3rem 0;
  }

  .hero {
    padding-top: 3.25rem;
  }

  .phases li {
    grid-template-columns: 3rem 1fr;
  }
}
