/* KAOS Clinical Intelligence — kaosclinical.com */

:root {
  --bg: #070910;
  --bg-2: #111522;
  --silver: #D9DEE8;
  --white: #F5F6FA;
  --muted: #9BA9BC;
  --violet: #A64DFF;
  --cyan: #39D9F3;
  --magenta: #E44FE1;
  --line: rgba(217, 222, 232, 0.12);
  --line-strong: rgba(217, 222, 232, 0.24);
  --error: #FF8FA3;

  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

  --wrap: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section: clamp(6rem, 13vw, 11rem);
  --nav-h: 68px;

  --spectrum: linear-gradient(90deg, var(--cyan), var(--violet) 50%, var(--magenta));
  --metal: linear-gradient(178deg, #FFFFFF 0%, #E6E9F0 40%, #A7B0C0 72%, #DDE1E9 100%);
  --metal-btn: linear-gradient(180deg, #FFFFFF 0%, #E3E7EE 55%, #BAC2D0 100%);

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--silver);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 500; color: var(--white); }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--white); color: var(--bg);
  padding: .6rem 1rem; border-radius: 6px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 1rem); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  transition: background-color .4s ease, border-color .4s ease, backdrop-filter .4s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(7, 9, 16, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav__inner {
  max-width: 1320px; margin-inline: auto;
  padding-inline: var(--gutter);
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.brand__text {
  display: flex; flex-direction: column; gap: .3rem;
  font-family: var(--display); line-height: 1;
}
.brand__kaos {
  font-weight: 600; letter-spacing: .3em;
  font-size: 1rem; color: var(--white);
  margin-right: -.3em; /* balance trailing tracking */
}
.brand__sub {
  font-weight: 500; letter-spacing: .26em;
  font-size: .56rem; color: var(--muted);
  text-transform: uppercase; white-space: nowrap;
}
.nav__links { display: flex; align-items: center; gap: clamp(1rem, 2.6vw, 2.2rem); }
.nav__links a {
  text-decoration: none; font-size: .9rem; color: var(--muted);
  transition: color .2s ease;
}
.nav__links a:hover { color: var(--white); }
.nav__links .nav__cta {
  color: var(--white);
  padding: .5rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  white-space: nowrap;
  transition: border-color .2s ease, background-color .2s ease;
}
.nav__links .nav__cta:hover { border-color: var(--cyan); background: rgba(57, 217, 243, .08); }

@media (max-width: 760px) {
  .nav__links li:not(:last-child) { display: none; }
}
@media (max-width: 380px) {
  .brand { gap: .55rem; }
  .brand img { width: 32px; height: 32px; }
  .brand__kaos { font-size: .92rem; }
  .brand__sub { font-size: .5rem; letter-spacing: .16em; }
  .nav__inner { padding-inline: 1rem; }
  .nav__links .nav__cta { padding: .45rem .8rem; font-size: .85rem; }
}

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2.25rem; }
.btn {
  --h: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--h);
  padding: 0 1.6rem;
  border-radius: 999px;
  font-family: var(--display); font-size: .98rem; font-weight: 500; letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .3s ease, border-color .2s ease, background-color .2s ease;
}
.btn--primary {
  color: var(--bg);
  background: var(--metal-btn);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset, 0 10px 40px -12px rgba(166, 77, 255, .65);
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255,255,255,.5) inset, 0 14px 50px -10px rgba(57, 217, 243, .55);
}
.btn--ghost {
  color: var(--white);
  border-color: var(--line-strong);
  background: rgba(17, 21, 34, .4);
}
.btn--ghost:hover { border-color: var(--violet); background: rgba(166, 77, 255, .08); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  justify-items: center;
  padding: calc(var(--nav-h) + 2rem) var(--gutter) 5rem;
  text-align: center;
  isolation: isolate;
  overflow: hidden;
}
.hero__atmos {
  position: absolute; inset: -10%;
  z-index: -2;
  background:
    radial-gradient(38% 34% at 50% 34%, rgba(166, 77, 255, .22), transparent 70%),
    radial-gradient(30% 28% at 38% 44%, rgba(57, 217, 243, .12), transparent 70%),
    radial-gradient(26% 24% at 62% 42%, rgba(228, 79, 225, .12), transparent 70%);
  animation: breathe 14s ease-in-out infinite alternate;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}
@keyframes breathe {
  from { opacity: .75; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.05); }
}

/* Light trails echo the diagonal streak cutting through the K */
.hero__trail {
  position: absolute;
  z-index: -1;
  left: 50%; top: 34%;
  width: 160vmax; height: 1px;
  transform-origin: center;
  transform: translate(-50%, -50%) rotate(-38deg) scaleX(0);
  opacity: 0;
  pointer-events: none;
}
.hero__trail--a {
  background: linear-gradient(90deg, transparent 0%, rgba(57,217,243,.0) 22%, rgba(57,217,243,.85) 42%, #fff 50%, rgba(228,79,225,.85) 58%, transparent 80%);
  box-shadow: 0 0 12px rgba(166, 77, 255, .6);
  animation: trail 1.8s cubic-bezier(.2,.7,.1,1) .25s forwards;
}
.hero__trail--b {
  top: 58%;
  background: linear-gradient(90deg, transparent 10%, rgba(166,77,255,.35) 40%, rgba(57,217,243,.3) 60%, transparent 85%);
  animation: trail-soft 2.4s cubic-bezier(.2,.7,.1,1) .7s forwards;
}
@keyframes trail {
  to { transform: translate(-50%, -50%) rotate(-38deg) scaleX(1); opacity: 1; }
}
@keyframes trail-soft {
  to { transform: translate(-50%, -50%) rotate(-38deg) scaleX(1); opacity: .6; }
}

.hero__mark {
  width: min(460px, 70vw, 46svh);
  margin-bottom: clamp(.5rem, 2vw, 1.5rem);
  will-change: transform;
}
.hero__mark img {
  width: 100%;
  filter: drop-shadow(0 0 40px rgba(166, 77, 255, .35));
  opacity: 0;
  transform: scale(.94);
  animation: resolve 1.6s cubic-bezier(.2,.7,.1,1) .55s forwards;
}
@keyframes resolve {
  0%   { opacity: 0; transform: scale(.94); filter: drop-shadow(0 0 0 rgba(166,77,255,0)) brightness(2.2); }
  40%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 40px rgba(166,77,255,.35)) brightness(1); }
}

.hero__copy {
  max-width: 62rem;
  opacity: 0;
  animation: copy-in 1.2s ease 1.3s forwards;
}
@keyframes copy-in { to { opacity: 1; } }

.hero__label {
  font-size: .72rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.6rem;
}
.hero__title {
  font-size: clamp(2.1rem, 5.6vw, 4.9rem);
  line-height: 1.02;
  letter-spacing: -.015em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--white);
  text-wrap: balance;
}
.metal {
  background: var(--metal);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hero__sub, .hero__support { text-wrap: balance; }
.hero__sub {
  margin: 1.6rem auto 0;
  max-width: 40rem;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--silver);
}
.hero__support {
  margin: .6rem auto 0;
  max-width: 40rem;
  color: var(--muted);
}
.hero .actions { justify-content: center; }

/* ---------- Shared section type ---------- */
.h2 {
  font-size: clamp(1.9rem, 4vw, 3.3rem);
  line-height: 1.06;
  letter-spacing: -.01em;
  text-transform: uppercase;
  text-wrap: balance;
}
.prose { max-width: 36rem; color: var(--muted); }
.prose p:last-child { margin-bottom: 0; }
.prose__lead {
  color: var(--white);
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1.35;
  padding-left: 1rem;
  border-left: 1px solid var(--violet);
}

/* ---------- Vision ---------- */
.vision { padding-block: var(--section) calc(var(--section) * .8); }
.vision__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: start;
}
.vision__body { padding-top: .5rem; }

.themes {
  margin-top: clamp(4rem, 9vw, 7rem);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.theme {
  position: relative;
  padding: 2rem 2rem 0 0;
  border-top: 1px solid var(--line);
}
.theme + .theme { padding-left: 2rem; border-left: 1px solid var(--line); }
.theme::before {
  content: "";
  position: absolute; top: -1px; left: 0;
  width: 56px; height: 1px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.theme + .theme::before { left: 2rem; }
.theme--cyan    { --accent: var(--cyan); }
.theme--violet  { --accent: var(--violet); }
.theme--magenta { --accent: var(--magenta); }
.theme h3 {
  font-size: 1.15rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: .7rem;
}
.theme p { color: var(--muted); margin: 0; max-width: 18rem; }

/* ---------- Philosophy ---------- */
.philosophy {
  position: relative;
  overflow: hidden;
  padding-block: var(--section);
  background:
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 50%, var(--bg) 100%);
  border-block: 1px solid var(--line);
  isolation: isolate;
}
.philosophy__watermark {
  position: absolute;
  z-index: -1;
  right: -12%;
  top: 50%;
  width: min(900px, 95vw);
  transform: translateY(-50%);
  opacity: .09;
  filter: blur(1px) saturate(1.3);
  pointer-events: none;
}
.statement {
  font-size: clamp(2.2rem, 6vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  text-transform: uppercase;
  max-width: 17ch;
  text-wrap: balance;
}
.statement > span { display: block; }
.statement > span + span {
  margin-top: .3em;
  padding-top: .3em;
  position: relative;
}
.statement > span + span::before {
  content: "";
  position: absolute; top: 0; left: 0;
  width: min(220px, 40%); height: 1px;
  background: var(--spectrum);
  box-shadow: 0 0 14px rgba(166, 77, 255, .7);
}
.philosophy__copy {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  margin-left: auto;
  max-width: 34rem;
}

.founder {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  margin-left: auto;
  max-width: 34rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  position: relative;
}
.founder::before {
  content: "";
  position: absolute; top: -1px; left: 0;
  width: 56px; height: 1px;
  background: var(--spectrum);
}
.founder h3 {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--silver);
  margin-bottom: .8rem;
}
.founder p { margin: 0; color: var(--muted); font-size: .98rem; }

/* ---------- Research ---------- */
.research { padding-block: var(--section); }
.research__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: end;
}
.research .h2 { margin-bottom: 2rem; }
.interests__title {
  font-size: .95rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1rem;
}
.interests li {
  position: relative;
  padding: 1.15rem 0 1.15rem 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--white);
  font-family: var(--display);
  font-size: 1.12rem;
}
.interests li:last-child { border-bottom: 1px solid var(--line); }
.interests li::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 7px; height: 7px;
  transform: translateY(-50%) rotate(45deg);
  border: 1px solid var(--cyan);
}

/* ---------- Contact ---------- */
.contact {
  padding-block: var(--section);
  background: radial-gradient(60% 50% at 80% 40%, rgba(166, 77, 255, .08), transparent 70%);
}
.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(3rem, 7vw, 6rem);
  align-items: start;
}
.contact .h2 { margin-bottom: 1.75rem; }
.phi-notice {
  margin-top: 2.25rem;
  padding: 1rem 1.15rem;
  max-width: 30rem;
  font-size: .92rem;
  color: var(--silver);
  border: 1px solid rgba(57, 217, 243, .28);
  border-radius: 10px;
  background: rgba(57, 217, 243, .05);
}

.panel {
  position: relative;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 21, 34, .82), rgba(17, 21, 34, .55));
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.panel::before {
  content: "";
  position: absolute; top: -1px; left: 12%; right: 12%;
  height: 1px;
  background: var(--spectrum);
  opacity: .8;
}

.form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: .45rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field label { font-size: .88rem; font-weight: 500; color: var(--silver); }
.opt { color: var(--muted); font-weight: 400; margin-left: .3rem; }

.field input[type="text"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--white);
  background: rgba(7, 9, 16, .6);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: .8rem .95rem;
  min-height: 48px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(217, 222, 232, .4); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(57, 217, 243, .18);
}
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--error); }

.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 2.5rem; cursor: pointer; }
.select select:invalid { color: var(--muted); }
.select option { color: var(--white); background: var(--bg-2); }
.select::after {
  content: "";
  position: absolute; right: 1.1rem; top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.field__hint { margin: 0; font-size: .82rem; color: var(--muted); }
.field__error { margin: 0; font-size: .85rem; color: var(--error); min-height: 0; }
.field__error:empty { display: none; }

.field--check {
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: .8rem;
}
.field--check input {
  width: 20px; height: 20px; margin: .15rem 0 0;
  accent-color: var(--violet);
  cursor: pointer;
}
.field--check label { font-weight: 400; color: var(--muted); line-height: 1.5; }
.field--check label a { color: var(--silver); text-underline-offset: 3px; }
.field--check .field__error { grid-column: 2; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn--submit { width: 100%; margin-top: .25rem; letter-spacing: .14em; text-transform: uppercase; font-size: .9rem; }
.btn--submit[disabled] { opacity: .6; cursor: progress; transform: none; }

.form__status { margin: 0; font-size: .92rem; color: var(--error); }
.form__status:empty { display: none; }
.form__status a { color: inherit; text-underline-offset: 3px; }

.success { text-align: center; padding-block: 2rem; outline: none; }
.success img { width: 64px; margin: 0 auto 1.25rem; filter: drop-shadow(0 0 18px rgba(166, 77, 255, .5)); }
.success h3 { font-size: 1.6rem; margin-bottom: .75rem; }
.success p { color: var(--muted); max-width: 26rem; margin: 0 auto 1.75rem; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 3.5rem 2.5rem;
  background: var(--bg);
}
.footer__grid {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2rem;
}
.footer__brand { display: flex; align-items: center; gap: 1rem; }
.footer__brand img { width: 44px; height: 44px; opacity: .85; }
.footer__name {
  margin: 0;
  font-family: var(--display); font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase; font-size: .85rem;
  color: var(--white);
}
.footer__tag { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.footer__links { display: flex; flex-wrap: wrap; gap: 1.6rem; }
.footer__links a { text-decoration: none; color: var(--muted); font-size: .9rem; }
.footer__links a:hover { color: var(--white); }
.footer__legal {
  margin-top: 2.5rem; padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 3rem;
  font-size: .82rem; color: var(--muted);
}
.footer__legal p { margin: 0; max-width: 46rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .vision__grid, .research__grid, .contact__grid { grid-template-columns: 1fr; }
  .research__grid { align-items: start; }
  .themes { grid-template-columns: 1fr; }
  .theme, .theme + .theme { padding: 1.75rem 0; border-left: 0; }
  .theme + .theme::before { left: 0; }
  .philosophy__watermark { right: -35%; opacity: .07; }
}
@media (max-width: 560px) {
  :root { --section: 4.5rem; }
  body { font-size: 1rem; }
  .vision { padding-bottom: 3.5rem; }
  .themes { margin-top: 3rem; }
  .theme, .theme + .theme { padding: 1.25rem 0 1.4rem; }
  .theme h3 { margin-bottom: .45rem; }
  .vision__grid { gap: 1.75rem; }
  .footer__links { gap: .75rem 1.25rem; }
  .philosophy__copy { margin-top: 2rem; }
  .research .h2, .contact .h2 { margin-bottom: 1.25rem; }
  .research__grid, .contact__grid { gap: 2.5rem; }
  .phi-notice { margin-top: 1.5rem; }
  .field-row { grid-template-columns: 1fr; }
  .actions .btn { flex: 1 1 100%; }
  .hero__label { letter-spacing: .16em; font-size: .66rem; }
  .hero__label .dot { display: block; height: 0; overflow: hidden; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero__trail--a { transform: translate(-50%, -50%) rotate(-38deg) scaleX(1); opacity: 1; }
  .hero__trail--b { transform: translate(-50%, -50%) rotate(-38deg) scaleX(1); opacity: .6; }
  .hero__mark img, .hero__copy { opacity: 1; transform: none; }
}
