/* Phantom Rainbow — site styles */

@font-face { font-family: "Bebas Neue"; src: url("assets/fonts/bebas-neue-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("assets/fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("assets/fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("assets/fonts/jetbrains-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #f4f2ec;
  --paper-2: #ebe8df;
  --ink: #111111;
  --ink-2: #1a1a1a;
  --muted: #5d5a53;
  --muted-dark: #a3a09a;
  --line: rgba(17, 17, 17, 0.14);
  --line-dark: rgba(255, 255, 255, 0.12);
  --red: #c1272d;
  --red-bright: #e0393f;

  --spectrum: linear-gradient(90deg, #ff5f6d, #ffb347, #f6e05e, #4fd1a5, #5b8cff, #a66cff);

  --display: "Bebas Neue", "Oswald", "Arial Narrow", Impact, sans-serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }

::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- Type ---------- */
.display {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(56px, 9.5vw, 144px);
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.display-md {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(46px, 6vw, 84px);
  line-height: 0.94;
  text-transform: uppercase;
  text-wrap: balance;
}
.ai { color: var(--red); }
.label, .eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.6; max-width: 38em; }
.section-lede { font-size: 18px; color: var(--muted); max-width: 38em; }

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 15px 24px;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-weight: 600; font-size: 16px; text-decoration: none;
  border: 1.5px solid var(--ink);
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn:hover { background: var(--red); border-color: var(--red); }
.btn:active { transform: translateY(1px); }
.btn-small { padding: 9px 16px; font-size: 14px; }
.btn-light { background: #fff; color: var(--ink); border-color: #fff; font-size: clamp(16px, 2vw, 20px); padding: 18px 28px; word-break: break-all; }
.btn-light:hover { background: var(--red-bright); border-color: var(--red-bright); color: #fff; }
.text-link { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 2px; }
.text-link:hover { border-bottom-color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand img { height: 44px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a:not(.btn) { text-decoration: none; font-weight: 500; font-size: 15px; position: relative; }
.site-nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
  background: var(--spectrum); transform: scaleX(0); transform-origin: left; transition: transform .25s;
}
.site-nav a:not(.btn):hover::after { transform: scaleX(1); }
.nav-toggle { display: none; }

/* ---------- Phantom rainbow glow ---------- */
.phantom {
  position: absolute; z-index: 0; pointer-events: none;
  width: min(900px, 120vw); aspect-ratio: 1;
  right: -18%; top: -30%;
  background: conic-gradient(from 200deg, #ff5f6d, #ffb347, #f6e05e, #4fd1a5, #5b8cff, #a66cff, #ff5f6d);
  border-radius: 50%;
  filter: blur(90px);
  opacity: .22;
  animation: drift 26s ease-in-out infinite alternate;
}
.phantom-dark { opacity: .28; left: -25%; right: auto; top: auto; bottom: -55%; }
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { transform: translate(-6%, 8%) rotate(60deg) scale(1.08); }
}

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; overflow-x: clip; padding: clamp(64px, 11vw, 144px) 0 clamp(56px, 8vw, 104px); }
.hero .phantom { z-index: -1; }
.hero-inner { position: relative; z-index: 1; display: grid; gap: 28px; }
.hero .display { max-width: 14ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 4px; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section-head { display: grid; gap: 20px; margin-bottom: clamp(40px, 6vw, 64px); }
.section-cta { margin-top: clamp(36px, 5vw, 56px); }

/* Services */
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.service, .product { position: relative; isolation: isolate; }
.service {
  background: #fff; border-radius: var(--radius);
  padding: clamp(26px, 3vw, 36px);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 1px 0 var(--line);
}
.service .num { font-family: var(--mono); color: var(--red); font-size: 14px; }
.service h3 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 3.2vw, 44px); line-height: .95; text-transform: uppercase; }
.service p { color: var(--muted); font-size: 16px; }
.service .for { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 500; }

/* Spectral edge that shows on hover: the "phantom" rainbow */
.service::before, .product::before {
  content: ""; position: absolute; inset: -1.5px; z-index: -1;
  border-radius: calc(var(--radius) + 1.5px);
  background: var(--spectrum);
  opacity: 0; transition: opacity .3s;
}
.service::after, .product::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: var(--radius); background: inherit;
}
.product::after { box-shadow: inset 0 0 0 1px var(--line-dark); }
.service:hover::before, .product:hover::before, .product:focus-visible::before { opacity: 1; }

/* Software (dark) */
.software { background: var(--ink); color: #f2f0ea; }
.software .label, .software .section-lede { color: var(--muted-dark); }
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.product {
  background: var(--ink-2); border-radius: var(--radius); padding: 30px 28px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  text-decoration: none; transition: transform .25s;
}
.product:hover { transform: translateY(-3px); }
.badge { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; }
.badge-live { background: rgba(79, 209, 165, .14); color: #7fe3c0; }
.badge-dev { background: rgba(224, 57, 63, .16); color: #ff8a8e; }
.product h3 { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: .95; text-transform: uppercase; margin-top: 6px; }
.product p { color: #c9c6bf; font-size: 16px; }
.product-link { margin-top: auto; padding-top: 8px; color: #fff; font-weight: 600; border-bottom: 2px solid var(--red-bright); }

/* About */
.about { background: var(--paper-2); }
.about-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: end; }
.about-grid > div:first-child { display: grid; gap: 20px; }
.about-copy { display: grid; gap: 18px; font-size: 18px; }
.about-copy a { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--red); }
.about-copy a:hover { border-bottom-color: var(--ink); }

/* Contact */
.contact { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: clamp(88px, 12vw, 160px) 0; }
.contact-inner { position: relative; z-index: 1; display: grid; gap: 26px; justify-items: start; }
.contact .display { max-width: 16ch; }
.contact .lede { color: #d8d5ce; }

/* Footer */
.site-footer { background: var(--ink); color: var(--muted-dark); border-top: 1px solid var(--line-dark); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; padding-top: 32px; padding-bottom: 32px; }
.footer-inner img { height: 40px; width: auto; }
.small { font-size: 14px; }
.spectrum-bar { height: 6px; background: var(--spectrum); }

/* ---------- Reveal on scroll (only when JS is running) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .phantom { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .service-grid, .products { grid-template-columns: 1fr; max-width: 640px; }
  .about-grid { grid-template-columns: 1fr; align-items: start; }
}

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  body { font-size: 16px; }
  .brand img { height: 38px; }
  .nav-toggle {
    display: inline-grid; place-items: center;
    width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; color: var(--ink);
  }
  .bars, .bars::before, .bars::after { display: block; width: 22px; height: 2px; background: currentColor; transition: transform .25s, opacity .25s; }
  .bars { position: relative; }
  .bars::before, .bars::after { content: ""; position: absolute; left: 0; }
  .bars::before { top: -7px; }
  .bars::after { top: 7px; }
  .nav-toggle[aria-expanded="true"] .bars { background: transparent; }
  .nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-7px) rotate(-45deg); }

  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav a:not(.btn) { padding: 14px 0; font-size: 18px; border-bottom: 1px solid var(--line); }
  .site-nav a:not(.btn)::after { display: none; }
  .site-nav .btn { margin-top: 16px; justify-content: center; padding: 14px; font-size: 16px; }

  .about-copy { font-size: 17px; }
  .phantom { width: 140vw; right: -50%; top: -20%; filter: blur(70px); }
}
