/* ============================================================
   BRAINSOURCE.DEV — cyber-classical / neo-Renaissance design system
   ============================================================ */

:root {
  --paper:        #f1eadd;
  --paper-2:      #e8dfcd;
  --ink:          #121212;
  --ink-2:        #1d1d1d;
  --ink-soft:     #2b2b2b;
  --cobalt:       #14339c;
  --cobalt-2:     #0b2170;
  --cobalt-ink:   #3b5bd6;
  --green:        #12e06a;
  --green-deep:   #0b9c4a;
  --muted:        #615c50;
  --grid:         rgba(18,18,18,0.055);
  --line:         rgba(18,18,18,0.16);
  --line-soft:    rgba(18,18,18,0.09);
  --white:        #f7f3e9;

  --serif: "Playfair Display", "Didot", "Bodoni MT", Georgia, serif;
  --mono:  "Space Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ease: cubic-bezier(.16,1,.3,1);
  --nav-h: 74px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}

body.is-loading { cursor: progress; }
body.is-loading main { opacity: 0; }

::selection { background: var(--cobalt); color: var(--white); }

/* ---------- typography helpers ---------- */
.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); }

em { font-style: italic; }

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

/* ---------- custom cursor ---------- */
.cursor, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 9999;
  pointer-events: none; border-radius: 50%;
  will-change: transform;
}
.cursor {
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  background: var(--green); mix-blend-mode: difference;
}
.cursor-ring {
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 1.5px solid var(--ink);
  transition: width .35s var(--ease), height .35s var(--ease),
              margin .35s var(--ease), background-color .35s var(--ease),
              border-color .35s var(--ease);
}
.cursor-ring.is-hover {
  width: 64px; height: 64px; margin: -32px 0 0 -32px;
  background: rgba(18,18,18,0.06);
}
@media (hover: none), (pointer: coarse) {
  .cursor, .cursor-ring { display: none; }
}

/* ============================================================
   BOOT / PRELOADER
   ============================================================ */
.boot {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--ink); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  transition: transform .9s var(--ease), opacity .9s var(--ease);
}
.boot.is-done { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.boot__inner { width: min(520px, 86vw); }
.boot__lines { font-size: 13px; line-height: 1.9; min-height: 7.6em; letter-spacing: .04em; }
.boot__lines .ln { white-space: pre; }
.boot__lines .ln i { font-style: normal; color: var(--ink-soft); }
.boot__bar { margin-top: 18px; height: 2px; background: rgba(18,225,106,.18); }
.boot__bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width .18s linear; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 40px;
  padding: 0 clamp(20px, 4vw, 56px);
  transition: background-color .4s var(--ease), backdrop-filter .4s var(--ease), border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(241,234,221,.82);
  backdrop-filter: blur(14px);
  border-color: var(--line-soft);
}
.nav__brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.nav__logo { height: 38px; width: 38px; object-fit: contain; filter: contrast(1.05); }
.nav__word { font-family: var(--serif); font-weight: 900; font-size: 19px; letter-spacing: .01em; }
.nav__tld, .tld { color: var(--cobalt); }
.nav__links { display: flex; gap: 30px; }
.nav__links a { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; position: relative; padding: 4px 0; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--ink); transition: width .35s var(--ease);
}
.nav__links a:hover::after { width: 100%; }

.btn {
  display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; padding: 14px 22px; border: 1px solid var(--ink);
  transition: transform .3s var(--ease), background-color .3s, color .3s;
}
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--cobalt); border-color: var(--cobalt); color: var(--white); }
.nav .btn { padding: 11px 18px; }

@media (max-width: 760px) {
  .nav__links { display: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden; isolation: isolate;
  padding: calc(var(--nav-h) + 20px) 0 60px;
}
.hero__grid {
  position: absolute; inset: 0; z-index: -3;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 40%, transparent 100%);
}
.hero__circuit {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2;
  color: var(--cobalt); opacity: .5;
}
.hero__circuit .trace path { stroke-dasharray: 6 8; animation: dash 14s linear infinite; }
.hero__circuit .core { fill: none; stroke: var(--cobalt); stroke-width: 1.2; }
@keyframes dash { to { stroke-dashoffset: -140; } }

.hero__side {
  position: absolute; left: 22px; top: 50%; z-index: 2;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl; font-size: 11px; letter-spacing: .42em;
  color: var(--muted); text-transform: uppercase;
}

/* --- halftone head --- */
.hero__head {
  position: absolute; inset: 0; z-index: -1;
  display: flex; align-items: center; justify-content: center;
  will-change: transform;
}
#headCanvas { width: min(60vh, 52vw); height: auto; display: block; }

.core-node { position: absolute; left: 0; top: 0; z-index: 3; }
.core-node__dot {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  background: var(--green); border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(18,225,106,.6);
  animation: pulse 2.6s var(--ease) infinite;
}
.core-node__pulse {
  position: absolute; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border: 1px solid var(--green-deep); border-radius: 50%;
  animation: ring 2.6s var(--ease) infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(18,225,106,.55);} 70% { box-shadow: 0 0 0 22px rgba(18,225,106,0);} 100% { box-shadow: 0 0 0 0 rgba(18,225,106,0);} }
@keyframes ring { 0% { transform: scale(.5); opacity: .9;} 80% { transform: scale(1.4); opacity: 0;} 100% { opacity: 0;} }

/* --- title block --- */
.hero__titleblock {
  position: relative; z-index: 2;
  padding: 0 clamp(20px, 5vw, 72px);
  text-align: left;
}
.hero__tagline {
  font-size: clamp(16px, 2.2vw, 26px); font-style: italic;
  letter-spacing: .01em; color: var(--ink-soft); margin-bottom: 6px;
  will-change: transform;
}
.hero__title {
  font-weight: 900; line-height: .86;
  font-size: clamp(64px, 15.5vw, 224px);
  letter-spacing: -.025em;
  color: var(--ink);
}
.hero__title .line { display: block; will-change: transform; }
.hero__title .tld { color: var(--cobalt); font-size: .55em; letter-spacing: -.02em; }

/* --- metadata --- */
.hero__meta {
  position: absolute; right: clamp(20px, 3vw, 40px); bottom: 84px; z-index: 2;
  text-align: right; font-size: 11px; letter-spacing: .1em; line-height: 2.1;
  color: var(--muted);
}
.hero__meta .meta__row { display: block; }
.hero__meta i { font-style: normal; color: var(--cobalt); }

/* registration marks */
.reg { position: absolute; z-index: 2; font-family: var(--mono); color: var(--muted); font-size: 20px; line-height: 1; }
.reg--tl { top: calc(var(--nav-h) + 18px); left: 20px; }
.reg--tr { top: calc(var(--nav-h) + 18px); right: 20px; }
.reg--bl { bottom: 20px; left: 20px; }
.reg--br { bottom: 20px; right: 20px; }

.hero__scroll {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; letter-spacing: .3em; color: var(--muted);
}
.hero__scrollline { display: block; width: 1px; height: 42px; background: var(--line); position: relative; overflow: hidden; }
.hero__scrollline::after {
  content: ""; position: absolute; left: 0; top: -100%; width: 100%; height: 100%;
  background: var(--cobalt); animation: scrolldrop 2s var(--ease) infinite;
}
@keyframes scrolldrop { 0% { top: -100%; } 60% { top: 100%; } 100% { top: 100%; } }

@media (max-width: 760px) {
  .hero__side { display: none; }
  #headCanvas { width: min(52vh, 92vw); }
  .hero__meta { bottom: 70px; font-size: 10px; }
  .hero__title { font-size: clamp(58px, 20vw, 120px); }
}

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee {
  background: var(--ink); color: var(--paper);
  padding: 14px 0; overflow: hidden;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.marquee__track {
  display: flex; align-items: center; gap: 34px; white-space: nowrap;
  font-family: var(--mono); font-size: 13px; letter-spacing: .18em;
  width: max-content; animation: marquee 30s linear infinite;
}
.marquee__track span { text-transform: uppercase; }
.marquee__track i { font-style: normal; color: var(--green); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============================================================
   SECTION LABELS
   ============================================================ */
.section-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: .28em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 12px; margin-bottom: 34px;
}
.section-label .idx { color: var(--cobalt); }
.section-label--light { color: rgba(247,243,233,.6); }
.section-label--light .idx { color: var(--green); }

/* ============================================================
   MANIFESTO
   ============================================================ */
.manifesto {
  padding: clamp(90px, 12vw, 170px) clamp(20px, 6vw, 96px);
  max-width: 1440px; margin: 0 auto;
}
.manifesto__title {
  font-weight: 700; line-height: .95;
  font-size: clamp(38px, 7vw, 96px); letter-spacing: -.02em; margin-bottom: 30px;
}
.manifesto__title em { font-style: italic; color: var(--cobalt); }
.manifesto__lead {
  max-width: 640px; font-size: clamp(17px, 2vw, 22px); color: var(--ink-soft);
  margin-bottom: clamp(60px, 8vw, 110px); line-height: 1.5;
}

.layers {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line);
}
.layer {
  background: var(--paper); padding: clamp(28px, 3.4vw, 48px);
  transition: background-color .5s var(--ease);
}
.layer:hover { background: var(--paper-2); }
.layer__num { font-family: var(--mono); color: var(--cobalt); font-size: 13px; letter-spacing: .2em; margin-bottom: 18px; }
.layer__title { font-weight: 700; font-size: clamp(24px, 2.6vw, 36px); margin-bottom: 14px; }
.layer p { font-size: 16px; color: var(--ink-soft); line-height: 1.6; }
.layer p strong { font-family: var(--mono); font-weight: 700; color: var(--cobalt); }
.layer p em { color: var(--ink); }

@media (max-width: 680px) { .layers { grid-template-columns: 1fr; } }

/* ============================================================
   SERVICES
   ============================================================ */
.services {
  padding: clamp(90px, 12vw, 170px) clamp(20px, 6vw, 96px);
  max-width: 1440px; margin: 0 auto;
}
.services__title {
  font-weight: 700; font-size: clamp(38px, 7vw, 96px); letter-spacing: -.02em;
  line-height: .95; margin-bottom: clamp(50px, 6vw, 90px);
}
.services__title em { font-style: italic; color: var(--cobalt); }

.services__list { display: flex; flex-direction: column; }
.service {
  display: grid; grid-template-columns: 80px 1fr 1fr;
  gap: 24px; align-items: start;
  padding: clamp(30px, 4vw, 52px) 0;
  border-top: 1px solid var(--line);
  transition: padding-left .45s var(--ease), background-color .45s var(--ease);
  will-change: transform;
}
.service:last-child { border-bottom: 1px solid var(--line); }
.service:hover { padding-left: 20px; }
.service__num { font-family: var(--mono); color: var(--cobalt); font-size: 14px; letter-spacing: .15em; padding-top: 6px; }
.service__name { font-weight: 700; font-size: clamp(28px, 4vw, 56px); line-height: 1; }
.service__desc { color: var(--ink-soft); font-size: 16px; line-height: 1.55; max-width: 480px; }
.service__tags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.service__tags li {
  list-style: none; font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  border: 1px solid var(--line); padding: 6px 12px; color: var(--muted);
  transition: color .3s, border-color .3s;
}
.service:hover .service__tags li { color: var(--cobalt); border-color: rgba(20,51,156,.4); }

@media (max-width: 760px) {
  .service { grid-template-columns: 44px 1fr; }
  .service__tags { grid-column: 1 / -1; }
  .service__desc { grid-column: 1 / -1; }
}

/* ============================================================
   ECOSYSTEM
   ============================================================ */
.ecosystem {
  padding: clamp(90px, 12vw, 170px) clamp(20px, 6vw, 96px);
  max-width: 1440px; margin: 0 auto;
}
.ecosystem__title { font-weight: 700; font-size: clamp(38px, 7vw, 96px); letter-spacing: -.02em; line-height: .95; margin-bottom: 24px; }
.ecosystem__title em { font-style: italic; color: var(--cobalt); }
.ecosystem__lead { max-width: 640px; color: var(--ink-soft); font-size: clamp(17px, 2vw, 21px); margin-bottom: clamp(50px, 6vw, 80px); }

.eco__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.eco-card {
  background: var(--paper); padding: clamp(26px, 3vw, 40px);
  display: flex; flex-direction: column; gap: 20px; min-height: 200px;
  transition: background-color .45s var(--ease);
}
.eco-card:hover { background: var(--paper-2); }
.eco-card__mark {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.eco-card__mark img { width: 100%; height: 100%; object-fit: contain; }
.eco-card__mark--text { font-weight: 900; font-size: 22px; color: var(--cobalt); }
.eco-card__body h3 { font-weight: 700; font-size: 24px; margin-bottom: 4px; }
.eco-card__body p { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.eco-card__arrow { margin-top: auto; font-size: 20px; color: var(--cobalt); transition: transform .35s var(--ease); }
.eco-card:hover .eco-card__arrow { transform: translateX(6px); }

@media (max-width: 900px) { .eco__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .eco__grid { grid-template-columns: 1fr; } }

/* ============================================================
   PROOF (dark cobalt section)
   ============================================================ */
.proof {
  position: relative; background: var(--cobalt-2); color: var(--white);
  padding: clamp(100px, 14vw, 190px) clamp(20px, 6vw, 96px);
  overflow: hidden; isolation: isolate;
}
.proof__grid {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, #000 30%, transparent 100%);
}
.proof__quote {
  font-weight: 700; font-style: italic;
  font-size: clamp(30px, 5.6vw, 76px); line-height: 1.02; letter-spacing: -.01em;
  margin: 30px 0 40px;
}
.proof__quote em { color: var(--green); }
.proof__meta { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; font-size: 13px; letter-spacing: .08em; }
.proof__link { color: var(--green); border-bottom: 1px solid var(--green); padding-bottom: 2px; transition: opacity .3s; }
.proof__link:hover { opacity: .7; }

/* ============================================================
   PARTNERS
   ============================================================ */
.partners {
  padding: clamp(90px, 12vw, 170px) clamp(20px, 6vw, 96px);
  max-width: 1440px; margin: 0 auto;
}
.partners__title { font-weight: 700; font-size: clamp(38px, 7vw, 96px); letter-spacing: -.02em; line-height: .95; margin-bottom: 24px; }
.partners__title em { font-style: italic; color: var(--cobalt); }
.partners__lead { color: var(--ink-soft); max-width: 640px; font-size: clamp(17px, 2vw, 21px); margin-bottom: clamp(50px, 6vw, 80px); }

.partners__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.partner { background: var(--paper); padding: clamp(26px, 3vw, 40px); transition: background-color .45s var(--ease); }
.partner:hover { background: var(--paper-2); }
.partner h3 { font-weight: 700; font-size: 26px; margin-bottom: 8px; }
.partner p { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); }
.partner--cta { display: flex; flex-direction: column; justify-content: space-between; background: var(--ink); color: var(--paper); }
.partner--cta .serif { font-weight: 700; font-size: 30px; }
.partner--cta a { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--green); margin-top: 20px; }

@media (max-width: 900px) { .partners__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .partners__grid { grid-template-columns: 1fr; } }

/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  border-top: 1px solid var(--line);
  padding: clamp(100px, 14vw, 190px) clamp(20px, 6vw, 96px);
  text-align: center;
}
.contact__inner { max-width: 1000px; margin: 0 auto; }
.contact__label { font-family: var(--mono); font-size: 12px; letter-spacing: .3em; color: var(--cobalt); margin-bottom: 26px; }
.contact__title { font-weight: 900; font-size: clamp(46px, 9vw, 130px); line-height: .92; letter-spacing: -.02em; margin-bottom: 50px; }
.contact__title em { font-style: italic; color: var(--cobalt); }
.contact__mail {
  display: inline-block; font-weight: 700; font-size: clamp(20px, 3.6vw, 42px);
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; letter-spacing: -.01em;
  transition: color .3s, border-color .3s;
}
.contact__mail:hover { color: var(--cobalt); border-color: var(--cobalt); }
.contact__row { margin-top: 60px; display: flex; justify-content: center; gap: 40px; font-size: 11px; letter-spacing: .2em; color: var(--muted); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { background: var(--ink); color: var(--paper); padding: clamp(60px, 8vw, 100px) clamp(20px, 6vw, 96px) 30px; }
.footer__top { display: flex; justify-content: space-between; gap: 60px; flex-wrap: wrap; padding-bottom: 60px; border-bottom: 1px solid rgba(247,243,233,.14); }
.footer__brand { display: flex; align-items: center; gap: 14px; font-weight: 900; font-size: 28px; }
.footer__brand .tld { color: var(--green); }
.footer__logo { height: 44px; width: 44px; filter: invert(1) brightness(1.2); }
.footer__cols { display: flex; gap: 70px; flex-wrap: wrap; }
.footer__col { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.footer__h { color: rgba(247,243,233,.45); font-size: 11px; letter-spacing: .2em; margin-bottom: 6px; }
.footer__col a { color: var(--paper); transition: color .3s; }
.footer__col a:hover { color: var(--green); }
.footer__bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  font-size: 11px; letter-spacing: .1em; color: rgba(247,243,233,.45); padding-top: 30px;
}
.footer__tag { color: var(--green); }

@media (max-width: 700px) {
  .footer__top { flex-direction: column; }
  .footer__cols { gap: 34px; }
}

/* ============================================================
   REVEAL ANIMATIONS (IntersectionObserver toggles .in-view)
   ============================================================ */
[data-reveal] {
  opacity: 0; transform: translateY(38px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].in-view { opacity: 1; transform: none; }

body.no-anim [data-reveal] { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .marquee__track, .hero__scrollline::after, .hero__circuit .trace path,
  .core-node__dot, .core-node__pulse { animation: none !important; }
}
