/* framewritten — ads made of code
   hand-written css. no frameworks were consulted. */

:root {
  --bg: #0a0a0c;
  --panel: #0e0f12;
  --panel-2: #131418;
  --line: #212329;
  --text: #f2f3ee;
  --dim: #9aa0a8;
  --acid: #d4ff3f;
  --acid-ink: #0a0a0c;
  --font-d: 'Space Grotesk', system-ui, sans-serif;
  --font-m: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-d);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--acid); color: var(--acid-ink); }

a { color: inherit; }
.mono { font-family: var(--font-m); font-size: 0.82em; }
.dim { color: var(--dim); }
.acid { color: var(--acid); }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.container { max-width: 1160px; margin: 0 auto; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }

.logo {
  font-family: var(--font-m); font-weight: 700; font-size: 17px;
  color: var(--text); text-decoration: none; letter-spacing: -0.02em;
}
.logo-caret { color: var(--acid); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a:not(.btn) {
  font-family: var(--font-m); font-size: 13px; color: var(--dim);
  text-decoration: none; transition: color .2s;
}
.nav-links a:not(.btn):hover { color: var(--acid); }

/* ---------- buttons & chips ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-m); font-size: 14px; font-weight: 500;
  padding: 13px 22px; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--text);
  transition: all .18s ease;
}
.btn-small { padding: 8px 14px; font-size: 12.5px; }
.btn-acid { background: var(--acid); border-color: var(--acid); color: var(--acid-ink); font-weight: 700; }
.btn-acid:hover { background: transparent; color: var(--acid); box-shadow: 0 0 24px rgba(212,255,63,.18); }
.btn-ghost:hover { border-color: var(--acid); color: var(--acid); }
.btn:disabled { opacity: .55; cursor: wait; }

.chip {
  font-family: var(--font-m); font-size: 11px; cursor: pointer;
  color: var(--dim); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px;
  transition: all .18s;
}
.chip:hover { color: var(--acid); border-color: var(--acid); }

/* ---------- panels (editor / render / ad frames) ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-width: 0;
}
.panel-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #2c2f36; }
.panel-bar .file {
  font-family: var(--font-m); font-size: 12px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.panel-bar .chip, .panel-bar .live-badge, .panel-bar .ad-bytes { margin-left: auto; flex: 0 0 auto; }

.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-m); font-size: 11px; font-weight: 700;
  color: var(--acid); letter-spacing: .08em;
}
.live-badge i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--acid);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  gap: 30px;
  padding: 92px 28px 48px;
  max-width: 1280px; margin: 0 auto;
}
.stage {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 18px;
  height: min(58vh, 560px);
}
.editor-body {
  flex: 1; display: flex; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.gutter {
  font-family: var(--font-m); font-size: 12.5px; line-height: 1.75;
  color: #3a3e47; text-align: right;
  padding: 14px 10px 14px 16px; user-select: none; flex: 0 0 auto;
}
.editor-body .code {
  font-family: var(--font-m); font-size: 12.5px; line-height: 1.75;
  padding: 14px 16px 14px 8px; white-space: pre-wrap; word-break: break-word;
  flex: 1; min-width: 0;
}
.tok-c { color: #6b7280; font-style: italic; }
.tok-s { color: var(--acid); }
.tok-n { color: #ffb057; }
.tok-k { color: #eef0ea; font-weight: 700; }
.tok-f { color: #8ad8ff; }

.caret {
  display: inline-block; width: 7px; height: 1.05em;
  background: var(--acid); vertical-align: text-bottom;
  animation: blink .9s steps(1) infinite;
}

.render-body { flex: 1; position: relative; min-height: 0; }
.render-body canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.replay { position: absolute; right: 12px; bottom: 12px; z-index: 2; }

.hero-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 36px; flex-wrap: wrap;
}
.hero-copy { max-width: 640px; font-size: 18px; color: var(--dim); }
.hero-copy strong { color: var(--text); }
.hero-copy em { font-style: normal; }
.hero-ctas { display: flex; gap: 14px; flex: 0 0 auto; }

/* ---------- marquee ---------- */
.marquee {
  overflow: hidden; white-space: nowrap;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 16px 0;
  background: var(--panel);
}
.marquee-track { display: inline-flex; animation: marquee 22s linear infinite; }
.marquee-track span {
  font-family: var(--font-m); font-size: 14px; font-weight: 700;
  letter-spacing: .14em; color: var(--dim); flex: 0 0 auto;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.section { padding: clamp(90px, 13vh, 150px) 28px; }
.section-alt { background: #0c0d10; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.kicker {
  font-family: var(--font-m); font-size: 13px; font-weight: 500;
  color: var(--acid); letter-spacing: .12em; margin-bottom: 18px;
}
h2 {
  font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.06; margin-bottom: 22px;
}
.lede { max-width: 680px; color: var(--dim); font-size: 18px; margin-bottom: 56px; }
.lede em { color: var(--text); font-style: normal; border-bottom: 2px solid var(--acid); }

/* ---------- what-we-do cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 72px;
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; transition: border-color .25s, transform .25s;
}
.card:hover { border-color: #34383f; transform: translateY(-3px); }
.card h3 { font-size: 17px; margin: 16px 0 8px; letter-spacing: -0.01em; }
.card p { font-size: 14.5px; color: var(--dim); }
.card p em { color: var(--text); font-style: italic; }

.card-demo {
  height: 120px; border-radius: 9px; background: var(--panel-2);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.card-demo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.demo-kinetic span {
  font-weight: 700; font-size: 30px; letter-spacing: -0.02em;
  display: inline-block;
}
.demo-kinetic span.swap { animation: word-in .5s cubic-bezier(.2,.9,.25,1.2); }
@keyframes word-in {
  0% { transform: translateY(120%) skewY(6deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

.demo-data { gap: 4px; }
.demo-data .big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.demo-data .dim { font-size: 11px; }

.glitch-word {
  font-weight: 700; font-size: 26px; letter-spacing: .02em; position: relative;
}
.glitching .glitch-word::before,
.glitching .glitch-word::after {
  content: attr(data-text);
  position: absolute; inset: 0;
}
.glitching .glitch-word::before {
  color: #ff3b5c; animation: gl-a .38s steps(3) infinite;
  clip-path: inset(12% 0 55% 0);
}
.glitching .glitch-word::after {
  color: #31d6ff; animation: gl-b .32s steps(4) infinite;
  clip-path: inset(58% 0 8% 0);
}
@keyframes gl-a { 0%{transform:translate(-4px,-2px)} 50%{transform:translate(3px,1px)} 100%{transform:translate(-2px,2px)} }
@keyframes gl-b { 0%{transform:translate(4px,1px)} 50%{transform:translate(-3px,-1px)} 100%{transform:translate(2px,-2px)} }

/* ---------- stats strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  border-top: 1px solid var(--line); padding-top: 40px;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num {
  font-size: clamp(2.2rem, 4.4vw, 3.4rem); font-weight: 700;
  letter-spacing: -0.04em; color: var(--acid);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-family: var(--font-m); font-size: 12px; color: var(--dim); letter-spacing: .06em; }

/* ---------- steps ---------- */
.steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  list-style: none; counter-reset: step; margin-top: 56px;
}
.step {
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  padding: 22px; transition: border-color .4s, background .4s;
}
.step-no {
  display: inline-block; font-family: var(--font-m); font-size: 12px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px;
  color: var(--dim); margin-bottom: 40px;
  transition: all .4s;
}
.step.active { border-color: var(--acid); }
.step.active .step-no { background: var(--acid); color: var(--acid-ink); border-color: var(--acid); }
.step h3 { font-family: var(--font-m); font-size: 15px; letter-spacing: .06em; margin-bottom: 8px; }
.step p { font-size: 14.5px; color: var(--dim); }
.footnote { margin-top: 22px; font-family: var(--font-m); font-size: 12px; color: var(--dim); }

/* ---------- work grid ---------- */
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.ad-frame {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
}
.ad-stage { position: relative; aspect-ratio: 16 / 10; background: #000; }
.ad-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.ad-source {
  position: absolute; inset: 0; overflow: auto;
  background: rgba(10,10,13,.97);
  padding: 16px 18px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.ad-source code {
  font-family: var(--font-m); font-size: 11.5px; line-height: 1.7;
  white-space: pre; color: var(--text);
}
.ad-frame.flipped .ad-source { opacity: 1; pointer-events: auto; }

.ad-meta {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.ad-client {
  font-family: var(--font-m); font-size: 11.5px; color: var(--dim);
  letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-flip { margin-left: auto; flex: 0 0 auto; }
.ad-fps { font-size: 11px; min-width: 48px; }

/* ---------- manifesto ---------- */
.manif-line {
  font-size: clamp(1.9rem, 5.4vw, 4.2rem); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.05;
}
.manif-body { max-width: 660px; color: var(--dim); font-size: 18px; margin: 30px 0 64px; }

.vs {
  display: grid; grid-template-columns: 110px 1fr 1.3fr; gap: 0;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  font-family: var(--font-m); font-size: 13.5px;
  max-width: 760px;
}
.vs > span { padding: 13px 18px; border-top: 1px solid var(--line); background: var(--panel); }
.vs > .vs-h { border-top: 0; background: var(--panel-2); font-weight: 700; letter-spacing: .05em; }
.vs > .vs-l { color: var(--dim); }

/* ---------- contact ---------- */
#briefForm { max-width: 720px; }
#briefForm label {
  display: block; font-family: var(--font-m); font-size: 12.5px;
  color: var(--dim); margin-bottom: 26px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: end; }
.form-row label { min-width: 0; }
#briefForm input, #briefForm textarea, #briefForm select {
  display: block; width: 100%; margin-top: 8px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); font-family: var(--font-d); font-size: 16.5px;
  padding: 9px 2px; outline: none; border-radius: 0;
  transition: border-color .2s;
}
#briefForm select { cursor: pointer; }
#briefForm select option { background: var(--panel); }
#briefForm textarea { resize: vertical; }
#briefForm input:focus, #briefForm textarea:focus, #briefForm select:focus { border-bottom-color: var(--acid); }
.form-submit { margin-bottom: 26px; }
.form-note { font-size: 12.5px; color: #ff6b81; min-height: 20px; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

.sent-block { display: none; max-width: 560px; padding: 28px 0; }
.sent-block .mono { font-size: 16px; margin-bottom: 10px; }
.sent-block p:last-child { color: var(--dim); }
.brief.sent #briefForm { display: none; }
.brief.sent .sent-block { display: block; }
.alt-contact { margin-top: 18px; font-size: 13px; }
.alt-contact a { color: var(--acid); text-decoration: none; }
.alt-contact a:hover { text-decoration: underline; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 44px 28px 60px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 40px; align-items: baseline; }
.footer .logo { text-decoration: none; }
.footer .mono { font-size: 12px; }

.noscript {
  position: fixed; inset: auto 0 0 0; z-index: 99;
  background: var(--acid); color: var(--acid-ink);
  font-family: var(--font-m); font-size: 14px; padding: 14px 24px; text-align: center;
}

/* ---------- make (entry points) ---------- */
.make-section { border-bottom: 1px solid var(--line); padding-top: 40px; }
.make-tabs { display: flex; gap: 10px; margin-bottom: 22px; }
.make-tab {
  font-family: var(--font-m); font-size: 13px; cursor: pointer;
  padding: 10px 18px; border-radius: 8px;
  background: transparent; color: var(--dim);
  border: 1px solid var(--line); transition: all .18s;
}
.make-tab.active { background: var(--acid); color: var(--acid-ink); border-color: var(--acid); font-weight: 700; }
.make-panel { max-width: 760px; }
.make-row { display: flex; gap: 12px; }
.make-row-end { justify-content: flex-end; margin-top: 12px; }
.make-row input[type="url"] {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-family: var(--font-m); font-size: 15px;
  padding: 13px 16px; outline: none; transition: border-color .2s;
}
.make-row input[type="url"]:focus { border-color: var(--acid); }
#makeBrief {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-family: var(--font-d); font-size: 16px;
  padding: 13px 16px; outline: none; resize: vertical; transition: border-color .2s;
}
#makeBrief:focus { border-color: var(--acid); }
.make-hint { font-size: 12px; margin-top: 14px; }

/* shared flow ui (pitch / dashboard) */
.flow-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .25s, transform .25s;
}
.flow-card:hover { border-color: #34383f; }
.goal-chip {
  align-self: flex-start; font-family: var(--font-m); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line);
}
.goal-attention   { color: #ff9d3b; border-color: #ff9d3b44; }
.goal-trust       { color: #6db9ff; border-color: #6db9ff44; }
.goal-conversions { color: var(--acid); border-color: #d4ff3f44; }
.cost-chip {
  font-family: var(--font-m); font-size: 12px; font-weight: 700;
  color: var(--acid); border: 1px solid #d4ff3f44; border-radius: 6px; padding: 4px 10px;
}
.status-chip {
  font-family: var(--font-m); font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 6px; text-transform: uppercase;
}
.st-queued, .st-processing { color: #ff9d3b; border: 1px solid #ff9d3b44; }
.st-awaiting_review { color: #6db9ff; border: 1px solid #6db9ff44; }
.st-delivered { color: var(--acid); border: 1px solid #d4ff3f44; }
.st-failed, .st-rejected { color: #ff6b81; border: 1px solid #ff6b8144; }

.pack-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 720px; }
.pack-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.pack-card .pack-n { font-size: 34px; font-weight: 700; color: var(--acid); letter-spacing: -0.03em; }
.pack-card .pack-p { font-family: var(--font-m); font-size: 14px; color: var(--dim); }
@media (max-width: 640px) {
  .make-row { flex-direction: column; }
  .pack-grid { grid-template-columns: 1fr; }
}

/* ---------- reveals ---------- */
html.js [data-reveal] {
  opacity: 0; transform: translateY(26px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--d, 0s);
}
html.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- system glitch easter egg ---------- */
body.sys-glitch { animation: sysgl .45s steps(6); }
@keyframes sysgl {
  0% { filter: invert(1) hue-rotate(90deg); transform: translateX(-6px); }
  30% { filter: none; transform: translateX(4px) skewX(-1.5deg); }
  60% { filter: invert(1); transform: none; }
  100% { filter: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .cards, .steps, .stats { grid-template-columns: repeat(2, 1fr); }
  .work-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { padding: 84px 18px 40px; gap: 24px; }
  .stage {
    grid-template-columns: 1fr; height: auto;
  }
  .render { order: -1; }
  .render-body { aspect-ratio: 16 / 11; }
  .editor-body { max-height: 240px; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 22px; }
  .nav { padding: 12px 18px; }
  .nav-links { gap: 16px; }
  .nav-links a[href="#why"] { display: none; }
  .section { padding: 80px 18px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .vs { grid-template-columns: 84px 1fr 1.2fr; font-size: 11.5px; }
  .vs > span { padding: 10px 10px; }
  .marquee-track { animation-duration: 14s; }
}

@media (max-width: 520px) {
  .cards, .steps { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 26px 16px; }
  .hero-ctas { width: 100%; flex-direction: column; }
  .hero-ctas .btn { text-align: center; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track { animation: none; }
  .logo-caret, .live-badge i, .caret { animation: none; }
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .card:hover { transform: none; }
  body.sys-glitch { animation: none; }
  .demo-kinetic span.swap { animation: none; }
}
