/* ───────────────────────────────────────────────────────────────
   CODEHEAD SYSTEMS — landing page
   Aesthetic: dark editorial almanac × terminal phosphor
   Set in Fraunces (display serif) and JetBrains Mono.
   ─────────────────────────────────────────────────────────────── */

:root {
  --bg:        #0B0B0D;
  --bg-soft:   #131318;
  --fg:        #ECE6D9;
  --fg-dim:    #B4ADA0;
  --muted:     #6F6A60;
  --muted-2:   #4B4842;
  --line:      #26241F;
  --line-soft: #1A1815;
  --accent:    #C8FF4E;   /* phosphor lime */
  --accent-2:  #FF8A4C;   /* warm copper for accents */
  --max:       1280px;

  --serif:  "Fraunces", "Iowan Old Style", "Apple Garamond", "Georgia", serif;
  --mono:   "JetBrains Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;
}

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

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: #000; }

/* ── film grain & vignette ─────────────────────────────────── */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 190;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%);
}

/* ── shared atoms ──────────────────────────────────────────── */
.mono-tiny {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 500;
}
.muted { color: var(--muted); }

.rule {
  display: inline-block;
  height: 1px;
  width: 96px;
  background: var(--accent);
  vertical-align: middle;
}

/* ── topbar ────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-mark {
  width: 14px; height: 14px;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
  transform: rotate(45deg);
}
.topbar__nav { display: flex; gap: 28px; }
.topbar__nav a, .topbar__brand .mono-tiny {
  text-decoration: none;
  transition: color .25s ease;
}
.topbar__nav a:hover { color: var(--accent); }

/* ── layout shell ──────────────────────────────────────────── */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 40px;
}

/* ── HERO ─────────────────────────────────────────────────── */
.hero {
  padding: 120px 0 96px;
  position: relative;
}
.hero__meta {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 72px;
  animation: fadeUp .8s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: .05s;
}
.hero__title {
  font-family: var(--serif);
  font-weight: 340;
  font-style: normal;
  font-size: clamp(38px, 5.6vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.028em;
  margin: 0 0 48px;
  font-variation-settings: "opsz" 96, "SOFT" 50;
  max-width: 18ch;
  animation: fadeUp 1s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: .12s;
}
.hero__title-line { display: block; }
.hero__title-line:nth-child(2) { padding-left: 0.4em; }
.hero__title em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
}

.hero__split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr);
  gap: 56px;
  align-items: start;
  margin-bottom: 56px;
  animation: fadeUp 1s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: .28s;
}
.hero__lead {
  font-family: var(--serif);
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.55;
  font-weight: 350;
  color: var(--fg);
  margin: 0;
  max-width: 56ch;
  font-variation-settings: "opsz" 36;
}
.hero__lead a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--muted-2);
  transition: border-color .2s;
}
.hero__lead a:hover { border-bottom-color: var(--accent); }

.hero__sidecar {
  border: 1px solid var(--line);
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015), transparent),
    var(--bg-soft);
}
.hero__sidecar dl { margin: 0; }
.hero__sidecar > dl > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dotted var(--line);
  align-items: baseline;
}
.hero__sidecar > dl > div:last-child { border-bottom: none; }
.hero__sidecar dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__sidecar dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 24%, transparent);
  animation: pulse 2.2s ease-in-out infinite;
}

.hero__cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  animation: fadeUp 1s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: .42s;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  transition: all .25s ease;
  cursor: pointer;
}
.btn--primary {
  background: var(--accent);
  color: #08080A;
  border-color: var(--accent);
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--fg);
  border-color: var(--fg);
  transform: translateY(-1px);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ── section heads ─────────────────────────────────────────── */
.section-head {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 40px;
  align-items: baseline;
  padding: 72px 0 56px;
  border-top: 1px solid var(--line);
}
.section-head__title {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(30px, 4.2vw, 62px);
  line-height: 1.04;
  margin: 0;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 96;
}
.section-head__lede {
  grid-column: 2;
  margin: 16px 0 0;
  max-width: 56ch;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--fg-dim);
}

/* ── PROJECT ───────────────────────────────────────────────── */
.project {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 40px;
  padding: 72px 0;
  border-top: 1px dashed var(--line);
  position: relative;
}
.project:first-of-type { border-top: 1px solid var(--line); }

.project__rail {
  position: sticky;
  top: 92px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project__num {
  font-family: var(--serif);
  font-size: 96px;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  letter-spacing: -0.04em;
}
.project__rail-tag {
  color: var(--accent-2);
  margin-top: 8px;
}

.project__body { min-width: 0; }
.project__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.project__title {
  font-family: var(--serif);
  font-weight: 360;
  font-size: clamp(38px, 5.6vw, 76px);
  line-height: 0.98;
  margin: 0;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144;
}
.project__title-pre {
  font-style: italic;
  font-size: 0.55em;
  color: var(--muted);
  font-weight: 300;
  vertical-align: 0.4em;
  margin-right: 0.1em;
}
.project__kicker {
  color: var(--accent);
  text-align: right;
}

.project__lede {
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.35;
  font-weight: 320;
  margin: 0 0 28px;
  max-width: 28ch;
  font-style: italic;
  color: var(--fg);
  font-variation-settings: "opsz" 36;
}
.project__lede strong {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}
.project__lede em {
  color: var(--accent-2);
  font-style: italic;
}

.project__text {
  max-width: 62ch;
  color: var(--fg-dim);
  margin: 0 0 24px;
  font-size: 14.5px;
  line-height: 1.75;
}

.chips {
  list-style: none;
  padding: 0;
  margin: 28px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips li {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  background: var(--bg-soft);
  transition: all .25s ease;
}
.chips li:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* RFC block (project 02) */
.rfc-block {
  margin: 32px 0;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--bg-soft);
}
.rfc-block > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px dotted var(--line);
  align-items: baseline;
}
.rfc-block > div:last-child { border-bottom: none; }
.rfc-block__id { color: var(--accent); }
.rfc-block__name {
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  font-variation-settings: "opsz" 36;
}

/* sub-list (libraries) */
.sub-list {
  list-style: none;
  padding: 0;
  margin: 32px 0;
  counter-reset: sub;
}
.sub-list li {
  counter-increment: sub;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 24px;
  row-gap: 8px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  transition: background .25s ease;
}
.sub-list li:last-child { border-bottom: 1px solid var(--line); }
.sub-list li:hover { background: rgba(255,255,255,0.015); }
.sub-list li::before {
  content: counter(sub, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.12em;
  grid-row: 1;
}
.sub-list__row {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.sub-list__name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 380;
  font-variation-settings: "opsz" 36;
  line-height: 1.1;
}
.sub-list__note {
  grid-column: 2;
  margin: 0;
  color: var(--fg-dim);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 64ch;
}
.sub-list__link {
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
  transition: transform .2s ease;
}
.sub-list__link:hover { transform: translateX(3px); }

/* arrow links */
.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.link-arrow {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--fg);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--muted-2);
  transition: all .25s ease;
}
.link-arrow--lead { color: var(--accent); border-bottom-color: var(--accent); }
.link-arrow__icon { opacity: .85; transition: transform .25s ease; display: inline-block; }
.link-arrow:hover { color: var(--accent); border-bottom-color: var(--accent); }
.link-arrow:hover .link-arrow__icon { transform: translate(3px, -3px); }

/* ── PULL QUOTE ──────────────────────────────────────────── */
.pull {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 96px 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.pull__mark {
  font-family: var(--serif);
  font-size: 56px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  font-style: italic;
  font-variation-settings: "opsz" 144;
}
.pull__text {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.25;
  font-weight: 320;
  font-style: italic;
  margin: 0;
  max-width: 24ch;
  color: var(--fg);
  font-variation-settings: "opsz" 96;
}

/* ── CONTACT ─────────────────────────────────────────────── */
.contact { padding-bottom: 96px; }
.contact__grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.contact__grid li {
  padding: 32px 36px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background .25s ease;
  position: relative;
}
.contact__grid li:hover { background: var(--bg-soft); }
.contact__grid li::after {
  content: "↗";
  position: absolute;
  top: 28px;
  right: 28px;
  font-family: var(--mono);
  color: var(--muted);
  transition: all .25s ease;
}
.contact__grid li:hover::after { color: var(--accent); transform: translate(2px, -2px); }
.contact__grid a {
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 28px);
  text-decoration: none;
  color: var(--fg);
  font-variation-settings: "opsz" 36;
  transition: color .2s;
  line-height: 1.2;
  word-break: break-word;
}
.contact__grid a:hover { color: var(--accent); }

/* ── FOOTER ───────────────────────────────────────────────── */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px 40px 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  border-top: 1px solid var(--line);
}
.footer__col p {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.65;
  max-width: 36ch;
}
.footer__col em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--fg);
}

/* ── motion ───────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 24%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 0%,  transparent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero__split { grid-template-columns: 1fr; gap: 32px; }
  .section-head { grid-template-columns: 1fr; gap: 16px; padding: 48px 0 32px; }
  .section-head__lede { grid-column: 1; }
  .project { grid-template-columns: 1fr; gap: 24px; padding: 48px 0; }
  .project__rail { position: static; flex-direction: row; align-items: baseline; gap: 18px; }
  .project__num { font-size: 64px; }
  .project__rail-tag { margin-top: 0; margin-left: auto; }
  .footer { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 600px) {
  main, .topbar { padding-left: 22px; padding-right: 22px; }
  .topbar { padding-top: 14px; padding-bottom: 14px; }
  .topbar__nav { gap: 16px; }
  .hero { padding: 72px 0 56px; }
  .hero__meta { margin-bottom: 40px; gap: 16px; }
  .hero__meta .rule { width: 48px; }
  .hero__title-line:nth-child(2),
  .hero__title-line:nth-child(3),
  .hero__title-line:nth-child(4) { padding-left: 0; }
  .project__heading { flex-direction: column; align-items: flex-start; }
  .project__kicker { text-align: left; }
  .rfc-block > div { grid-template-columns: 1fr; gap: 4px; padding: 14px 18px; }
  .sub-list li { grid-template-columns: 28px minmax(0, 1fr); column-gap: 14px; }
  .contact__grid { grid-template-columns: 1fr; border-left: none; }
  .contact__grid li { padding: 24px; }
  .footer { padding: 40px 22px; }
  .pull { grid-template-columns: 1fr; gap: 16px; padding: 56px 0; }
}
