/* ============================================================
   HIX — shared design system
   Premium, minimalist, obsidian. High-impact advertising.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,500&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ---------- Tokens ---------- */
:root {
  --bg:        #09090B;
  --bg-1:      #0E0E11;
  --bg-2:      #141418;
  --bg-3:      #1B1B21;
  --line:      rgba(255,255,255,0.09);
  --line-2:    rgba(255,255,255,0.16);
  --fg:        #F7F7F8;
  --fg-dim:    rgba(247,247,248,0.60);
  --fg-faint:  rgba(247,247,248,0.34);

  /* accent (overridable via Tweaks / localStorage) */
  --accent:     #3D6BFF;
  --accent-2:   #6E92FF;
  --accent-ink: #FFFFFF;     /* text that sits on the accent fill */
  --accent-glow: rgba(61,107,255,0.35);

  --maxw: 1240px;
  --gut: clamp(20px, 5vw, 64px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gut); }
.section { position: relative; padding-block: clamp(80px, 12vw, 180px); }
.divider { height: 1px; background: var(--line); border: 0; }

/* ---------- Type ---------- */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
}
.eyebrow.no-tick::before { display: none; }

h1, h2, h3 { font-weight: 800; line-height: 0.98; letter-spacing: -0.035em; text-wrap: balance; }

.display {
  font-size: clamp(52px, 10.5vw, 168px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.045em;
}
.h-xl { font-size: clamp(40px, 6.5vw, 92px); font-weight: 800; }
.h-lg { font-size: clamp(32px, 4.4vw, 60px); font-weight: 800; }
.h-md { font-size: clamp(24px, 2.6vw, 36px); font-weight: 700; letter-spacing: -0.03em; }

.lede { font-size: clamp(18px, 2vw, 24px); line-height: 1.5; color: var(--fg-dim); font-weight: 400; max-width: 44ch; }
.body-dim { color: var(--fg-dim); }
.accent-text { color: var(--accent); }
.measure { max-width: 62ch; }

/* ---------- Buttons ---------- */
.btn {
  --pad-y: 16px; --pad-x: 28px;
  display: inline-flex; align-items: center; gap: 12px;
  padding: var(--pad-y) var(--pad-x);
  font-family: 'Archivo', sans-serif;
  font-size: 15px; font-weight: 700; letter-spacing: 0.01em;
  border-radius: 100px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .4s var(--ease), background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), box-shadow .4s var(--ease);
  will-change: transform;
  white-space: nowrap;
}
.btn .arr { transition: transform .4s var(--ease); }
.btn:hover .arr { transform: translateX(5px); }

.btn-accent {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 18px 50px -12px var(--accent-glow); }

.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--fg); background: rgba(255,255,255,0.04); transform: translateY(-2px); }

.btn-lg { --pad-y: 20px; --pad-x: 36px; font-size: 16px; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gut);
  transition: background .4s var(--ease), backdrop-filter .4s var(--ease), border-color .4s var(--ease), padding .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(9,9,11,0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line);
  padding-block: 14px;
}
.brand {
  font-weight: 900; font-size: 22px; letter-spacing: -0.04em;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand .mark {
  width: 11px; height: 11px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: rotate(45deg);
}
.nav-links { display: flex; align-items: center; gap: clamp(18px, 3vw, 40px); }
.nav-links a.nlink {
  font-size: 14px; font-weight: 600; color: var(--fg-dim);
  position: relative; padding: 6px 0; transition: color .3s var(--ease);
}
.nav-links a.nlink::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--accent); transition: width .35s var(--ease);
}
.nav-links a.nlink:hover, .nav-links a.nlink[aria-current="page"] { color: var(--fg); }
.nav-links a.nlink:hover::after, .nav-links a.nlink[aria-current="page"]::after { width: 100%; }
.nav-cta { font-size: 14px !important; --pad-y: 11px; --pad-x: 20px; }

/* mobile hamburger + slide-down panel */
.nav-burger {
  display: none; width: 42px; height: 42px; border: 1px solid var(--line-2);
  background: transparent; border-radius: 11px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-burger span { display: block; width: 18px; height: 2px; background: var(--fg); border-radius: 2px; transition: transform .32s var(--ease), opacity .25s var(--ease); }
body.menu-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
body.menu-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-mobile {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99;
  background: rgba(9,9,11,0.97); backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line); padding: 86px var(--gut) 30px;
  display: flex; flex-direction: column;
  transform: translateY(-101%); transition: transform .42s var(--ease); visibility: hidden;
}
body.menu-open .nav-mobile { transform: translateY(0); visibility: visible; }
.nav-mobile a { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; color: var(--fg); padding: 16px 0; border-bottom: 1px solid var(--line); }
.nav-mobile a.m-cta { align-self: flex-start; margin-top: 22px; border: 0; padding: 16px 28px; }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
}
@media (min-width: 761px) {
  .nav-mobile { display: none; }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 72px 40px; background: var(--bg-1); }
.footer-top { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; align-items: flex-start; }
.footer-cta { max-width: 16ch; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px 32px; }
.footer-links a { font-size: 14px; color: var(--fg-dim); transition: color .3s var(--ease); }
.footer-links a:hover { color: var(--fg); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.footer-bottom small { color: var(--fg-faint); font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.04em; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }

/* word-by-word hero mask reveal */
.line-mask { overflow: hidden; display: block; }
.line-mask > span { display: block; transform: translateY(102%); transition: transform 1s var(--ease); }
.hero-ready .line-mask > span { transform: translateY(0); }
.hero-ready .line-mask:nth-child(2) > span { transition-delay: .09s; }
.hero-ready .line-mask:nth-child(3) > span { transition-delay: .18s; }

/* motion variants (Tweaks) */
.motion-cinematic .reveal { transform: translateY(56px) scale(0.985); transition-duration: 1.15s; }
.motion-cinematic .reveal.in { transform: none; }
.motion-cinematic .line-mask > span { transition-duration: 1.25s; }
.motion-minimal .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
.motion-minimal .line-mask > span { transform: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .line-mask > span { transform: none; }
}

/* ---------- Page hero (sub-pages) ---------- */
.page-hero { padding-top: clamp(150px, 20vh, 240px); padding-bottom: clamp(48px, 7vw, 96px); position: relative; }
.page-hero .display { max-width: 16ch; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(28px, 3vw, 40px);
  position: relative; overflow: hidden;
  transition: border-color .4s var(--ease), background .4s var(--ease), transform .4s var(--ease);
}
.card:hover { border-color: var(--line-2); transform: translateY(-4px); }
.card .idx {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--fg-faint);
  letter-spacing: 0.1em;
}
.card h3 { font-size: clamp(22px, 2.4vw, 28px); margin: 18px 0 12px; }
.card p { color: var(--fg-dim); font-size: 16px; line-height: 1.55; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 880px) { .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Background ornaments ---------- */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.glow {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(80px); opacity: 0.5;
}

/* content sits above ornaments */
.footer, .section, .page-hero, main { position: relative; z-index: 2; }
