/* ==========================================================================
   Tesearis — landing page styles
   ========================================================================== */

:root {
  --bg: #08090d;
  --bg-raised: #0e1016;
  --border: #1e212b;
  --border-soft: #171a22;

  --text: #e7e9f0;
  --text-dim: #9aa0b4;
  --text-faint: #666c82;

  --blue: #4dabf7;
  --violet: #9775fa;
  --pink: #cc7ee6;

  --gradient: linear-gradient(120deg, var(--blue) 0%, var(--violet) 55%, var(--pink) 100%);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1100px;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }

img { max-width: 100%; display: block; }

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* Background grid ---------------------------------------------------- */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  opacity: 0.5;
}

/* Header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8, 9, 13, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
}

.brand-mark {
  border-radius: 6px;
  filter: drop-shadow(0 0 8px rgba(151, 117, 250, 0.45));
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.site-nav a:hover { color: var(--text); }

.nav-cta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text) !important;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.nav-cta:hover {
  border-color: var(--violet);
  background: rgba(151, 117, 250, 0.08);
}

/* Hero ------------------------------------------------------------------ */

.hero {
  padding: 96px 0 80px;
  text-align: center;
}

.hero-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Logo rig — the mark cut into its parts and reassembled with motion.
   Layout: one absolutely-positioned .piece per shard (position only),
   wrapping a .piece-intro (plays once: flies/settles into place, optionally
   shakes), wrapping a .piece-idle (infinite, mostly-still micro-motion).
   Position/size percentages below come from the shards' pixel offsets
   inside a shared 1387x1510 reference frame. */

.logo-rig {
  position: relative;
  width: clamp(150px, 20vw, 210px);
  aspect-ratio: 1387 / 1510;
  margin: 0 auto;
  filter: drop-shadow(0 0 40px rgba(151, 117, 250, 0.32)) drop-shadow(0 0 12px rgba(77, 171, 247, 0.22));
}

.piece {
  position: absolute;
}

.piece-intro,
.piece-idle {
  width: 100%;
  height: 100%;
}

.piece-intro img,
.piece-idle img {
  width: 100%;
  height: 100%;
  display: block;
}

.piece-vial     { left: 31.44%; top: 1.06%;  width: 36.05%; height: 97.88%; }
.piece-bracket-left  { left: 1.15%;  top: 40.53%; width: 20.19%; height: 32.32%; }
.piece-bracket-right { left: 78.73%; top: 40.53%; width: 20.12%; height: 32.32%; }

.piece-dash-left-1  { left: 16.22%; top: 50.79%; width: 11.10%; height: 4.04%; }
.piece-dash-left-2  { left: 14.13%; top: 54.70%; width: 11.61%; height: 3.97%; }
.piece-dash-left-3  { left: 18.39%; top: 58.61%; width: 8.94%;  height: 4.04%; }
.piece-dash-right-1 { left: 72.68%; top: 50.79%; width: 11.18%; height: 4.04%; }
.piece-dash-right-2 { left: 74.19%; top: 54.70%; width: 11.68%; height: 3.97%; }
.piece-dash-right-3 { left: 72.75%; top: 58.68%; width: 8.87%;  height: 4.04%; }

/* Intro: brackets + dashes fly in from outside toward the vial. */

.piece-intro {
  animation-name: fly-in;
  animation-duration: var(--intro-dur, 0.8s);
  animation-delay: var(--intro-delay, 0s);
  animation-timing-function: cubic-bezier(0.16, 0.8, 0.24, 1);
  animation-fill-mode: both;
}

@keyframes fly-in {
  0%   { opacity: 0; transform: translate(var(--fly-x, 0), var(--fly-y, 0)) rotate(var(--fly-r, 0deg)); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
}

/* The vial is the anchor: it settles in place, then takes a light shake
   once the incoming parts arrive around it. */

.piece-intro-vial {
  animation-name: vial-intro;
  animation-duration: 2.4s;
  animation-delay: 0s;
  animation-timing-function: ease-out;
  animation-fill-mode: both;
}

@keyframes vial-intro {
  0%   { opacity: 0; transform: scale(0.7); }
  15%  { opacity: 1; transform: scale(1.05); }
  25%  { transform: scale(0.98); }
  40%  { transform: scale(1) rotate(0deg); }
  73%  { transform: scale(1) rotate(-3deg); }
  80%  { transform: scale(1) rotate(2.5deg); }
  87%  { transform: scale(1) rotate(-1.5deg); }
  94%  { transform: scale(1) rotate(0.8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Idle: infrequent, barely-there drift — mostly at rest, a faint nudge
   partway through a long, per-piece-desynced loop. */

.piece-idle {
  animation-name: idle-drift;
  animation-duration: var(--idle-dur, 8s);
  animation-delay: var(--idle-delay, 1s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes idle-drift {
  0%, 82%, 100% { transform: translate(0, 0) rotate(0deg); }
  88%  { transform: translate(0.8px, -1.1px) rotate(0.4deg); }
  94%  { transform: translate(-0.6px, 0.6px) rotate(-0.3deg); }
}

.piece-idle-blink {
  animation-name: idle-drift, idle-blink;
  animation-duration: var(--idle-dur, 8s), calc(var(--idle-dur, 8s) * 1.35);
  animation-delay: var(--idle-delay, 1s), calc(var(--idle-delay, 1s) + 0.4s);
  animation-timing-function: ease-in-out, ease-in-out;
  animation-iteration-count: infinite, infinite;
}

@keyframes idle-blink {
  0%, 90%, 100% { opacity: 1; }
  95% { opacity: 0.92; }
}


.eyebrow {
  color: var(--text-faint);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.hero h1 {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 800;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-tagline {
  max-width: 640px;
  margin: 0 auto 12px;
  font-size: 1.25rem;
  color: var(--text);
}

.hero-sub {
  max-width: 560px;
  margin: 0 auto 36px;
  color: var(--text-dim);
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--gradient);
  color: #08090d;
}

.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg-raised);
}

/* Section shared --------------------------------------------------------- */

main section {
  padding: 72px 0;
  border-top: 1px solid var(--border-soft);
}

main section h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 1.6rem;
  margin: 0 0 8px;
}

main section h2 .mono {
  color: var(--violet);
  font-size: 0.95rem;
  font-weight: 600;
}

.section-lead {
  color: var(--text-dim);
  margin: 0 0 36px;
}

/* About ------------------------------------------------------------------ */

.about-inner p {
  max-width: 680px;
  color: var(--text-dim);
}

.about-inner p:not(:last-child) { margin-bottom: 16px; }

/* Ecosystem --------------------------------------------------------------- */

.registry-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.registry-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.registry-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
}

.registry-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.registry-ns {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--blue);
  background: rgba(77, 171, 247, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  width: fit-content;
}

.registry-note {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* Lab / projects ------------------------------------------------------- */

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--violet);
  transform: translateY(-2px);
}

.project-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.project-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.project-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--violet);
  border: 1px solid rgba(151, 117, 250, 0.35);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 0.85rem;
}

.footer-note { margin: 0; }

.footer-link {
  font-family: var(--font-mono);
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.footer-link:hover { color: var(--blue); }

.footer-copy { margin: 0; }

/* Reveal-on-scroll (progressive enhancement, see main.js) ----------------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-mark { animation: none; }
  .piece-intro, .piece-idle, .piece-idle-blink {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 640px) {
  .site-nav { gap: 16px; }
  .site-nav a:not(.nav-cta) { display: none; }
  .hero { padding: 64px 0 56px; }
  main section { padding: 56px 0; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
