/* =========================================================
   PseudoConscious Inc. — landing site
   Black & white. High contrast. High tech.
   ========================================================= */

:root {
  --bg: #060606;
  --bg-2: #0d0d0d;
  --panel: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.14);
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --dim: #6e6e6e;
  --white: #ffffff;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--white); color: var(--bg); }

.mono { font-family: var(--mono); }
.dim { color: var(--dim); }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- background ---------- */

/* Slow sunrise: a monochrome sun fixed to the viewport (never moves
   with scrolling). It rises from below the horizon, holds, and sets
   again on a ~2 minute loop. Painted behind the grid and content. */
.sun {
  position: fixed;
  left: 62%;
  bottom: -150px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.06) 42%,
    rgba(255, 255, 255, 0) 70%
  );
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  animation: sunrise 130s ease-in-out infinite;
}
@keyframes sunrise {
  0%   { transform: translateX(-50%) translateY(0); opacity: 0.35; }
  38%  { transform: translateX(-50%) translateY(-44vh); opacity: 1; }
  62%  { transform: translateX(-50%) translateY(-44vh); opacity: 1; }
  100% { transform: translateX(-50%) translateY(0); opacity: 0.35; }
}

/* Horizon glow that brightens in sync with the sun */
.dawn {
  position: fixed;
  inset: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.05), transparent 38%);
  pointer-events: none;
  z-index: 0;
  animation: dawn-glow 130s ease-in-out infinite;
}
@keyframes dawn-glow {
  0%   { opacity: 0.3; }
  38%  { opacity: 1; }
  62%  { opacity: 1; }
  100% { opacity: 0.3; }
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, black 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, black 25%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.scrolled,
.nav.open {
  background: rgba(6, 6, 6, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--panel-border);
}
.nav-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo {
  width: 52px;
  height: 52px;
  display: block;
  border: 1px solid var(--panel-border);
  transition: border-color 0.2s;
}
.brand:hover .brand-logo { border-color: var(--white); }

.nav-links {
  display: flex;
  gap: 26px;
  margin-left: auto;
}
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active {
  color: var(--white);
  border-bottom-color: var(--white);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.25s;
}

/* ---------- sections ---------- */
.section {
  position: relative;
  padding: 150px 0 110px;
  z-index: 1;
  scroll-margin-top: 64px;
}
.section + .section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

h1, h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin-bottom: 16px;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 28px;
}

.abstract {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 42rem;
  margin-bottom: 34px;
}

.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 16px;
}

.slogan {
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  color: var(--white);
  border-top: 1px solid var(--panel-border);
  padding-top: 22px;
}

/* GitHub link row */
.section-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-top: 1px solid var(--panel-border);
  padding-top: 22px;
}
.section-foot .slogan {
  border-top: 0;
  padding-top: 0;
}
.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 8px 16px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}
/* pill sitting right under the subtitle */
.subtitle + .gh-link { margin-bottom: 30px; }
.gh-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.gh-link:hover {
  color: var(--white);
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- project index cards (Projects section) ---------- */
.project-index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 44px;
}
.index-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 26px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
}
.index-card:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-3px);
}
.index-num {
  font-size: 0.72rem;
  color: var(--dim);
  letter-spacing: 0.2em;
}
.index-name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}
.index-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-2);
  padding: 30px 0;
  position: relative;
  z-index: 1;
}
.footer-inner {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--dim);
  text-align: center;
}

/* ---------- meteor (just for fun) ---------- */
.meteor {
  position: fixed;
  width: var(--len, 120px);
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.85));
  border-radius: 2px;
  pointer-events: none;
  z-index: 0; /* behind the content blocks (sections are z-index 1) */
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
  animation: meteor-fly var(--dur, 0.9s) ease-in forwards;
}
.meteor::before {
  content: "";
  position: absolute;
  right: -2px;
  top: -1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
}
@keyframes meteor-fly {
  0% { transform: translate(0, 0) rotate(var(--ang)); opacity: 0; }
  8% { opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--ang)); opacity: 0; }
}

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .meteor { display: none; }
  .sun, .dawn {
    animation: none; /* rest as a static soft glow at the horizon */
  }
  .sun { bottom: -110px; opacity: 0.5; }
  .dawn { opacity: 0.5; }
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav.open .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    padding-bottom: 16px;
  }
  .nav.open .nav-links {
    display: flex;
    flex-direction: column;
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 2px;
    padding: 10px 0 4px;
    border-top: 1px solid var(--panel-border);
  }
  .nav.open .nav-link { padding: 10px 0; border-bottom: 0; }
  .section { padding: 120px 0 80px; }
  .project-index { grid-template-columns: 1fr; }
  .section-foot { flex-direction: column; align-items: stretch; }
  .section-foot .slogan {
    white-space: normal;
    letter-spacing: 0.22em;
    font-size: 0.85rem;
  }
  .gh-link { justify-content: flex-start; }
}
/* ---------- research directory and standalone research pages ---------- */
.research-list {
  border-top: 1px solid var(--panel-border);
}
.research-entry {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 26px 0;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text);
}
.research-page {
  display: block;
  color: var(--text);
  text-decoration: none;
}
.research-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 4px;
}
.research-repo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}
.research-repo:hover { color: var(--white); border-color: var(--white); }
.research-address {
  color: var(--muted);
  font-size: 0.78rem;
  flex-shrink: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}
.research-address:hover { color: var(--white); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 6px;
}
.project-main { min-height: calc(100svh - 83px); }
.project-support {
  margin-top: 44px;
  color: var(--muted);
  font-size: 0.85rem;
}
.project-support a { color: var(--text); text-underline-offset: 3px; }
@media (max-width: 480px) {
  .research-address { white-space: normal; overflow-wrap: anywhere; }
}

.abstract a { color: var(--text); text-underline-offset: 3px; }

/* Keep full repository addresses readable on narrow screens. */
.gh-link { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
