/* ============================================================
   PETER GALILEE — petergalilee.com
   Acid-on-carbon. Space Grotesk display / JetBrains Mono labels.
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
}

:root {
  --bg: #060707;
  --bg-raise: #0b0d0c;
  --ink: #e9efe6;
  --ink-dim: #8b948a;
  --acid: #bfff38;
  --acid-dim: rgba(191, 255, 56, 0.14);
  --cyan: #6be8ff;
  --line: rgba(233, 239, 230, 0.1);
  --font-display: 'Space Grotesk', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1.25rem, 4vw, 4rem);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--acid); color: #0a0c05; }

.mono { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; }

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

/* On pointer devices we replace the cursor entirely */
@media (hover: hover) and (pointer: fine) {
  body.custom-cursor, body.custom-cursor a, body.custom-cursor button,
  body.custom-cursor input, body.custom-cursor textarea, body.custom-cursor label {
    cursor: none;
  }
}

/* ---------- Boot sequence ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-inner { width: min(420px, 80vw); }
.boot-log {
  font-family: var(--font-mono);
  font-size: 0.7rem; line-height: 1.9; letter-spacing: 0.05em;
  color: var(--ink-dim); min-height: 8.5em; white-space: pre-wrap;
}
.boot-log .ok { color: var(--acid); }
.boot-bar {
  height: 2px; background: var(--line); margin-top: 1rem; overflow: hidden;
}
#boot-fill {
  display: block; height: 100%; width: 0%;
  background: var(--acid);
  transition: width 0.2s linear;
}

/* ---------- Shader canvas & grain ---------- */
#gl {
  position: fixed; inset: 0; z-index: -2;
  width: 100vw; height: 100vh; display: block;
}
.grain {
  position: fixed; inset: -50%; z-index: 50;
  pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%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");
  animation: grain-shift 0.6s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ---------- Custom cursor ---------- */
#cursor-dot, #cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 90;
  pointer-events: none; border-radius: 50%;
  opacity: 0; transform: translate(-50%, -50%);
}
#cursor-dot {
  width: 6px; height: 6px; background: var(--acid);
}
#cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(191, 255, 56, 0.5);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              border-color 0.25s, background 0.25s;
}
body.cursor-active #cursor-dot, body.cursor-active #cursor-ring { opacity: 1; }
body.cursor-hover #cursor-ring {
  width: 56px; height: 56px;
  border-color: var(--acid);
  background: rgba(191, 255, 56, 0.08);
}

/* ---------- Scroll progress ---------- */
#progress {
  position: fixed; top: 0; left: 0; z-index: 80;
  height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--acid), var(--cyan));
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem var(--pad);
  mix-blend-mode: normal;
  background: linear-gradient(to bottom, rgba(6, 7, 7, 0.85), transparent);
  backdrop-filter: blur(2px);
}
.logo { display: inline-flex; align-items: baseline; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.logo-tld { color: var(--acid); font-size: 0.8rem; margin-left: 1px; }
.site-nav { display: flex; gap: 2rem; }
.site-nav a {
  font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim); transition: color 0.2s;
}
.site-nav a:hover { color: var(--acid); }
.header-right { display: flex; align-items: center; gap: 1.25rem; }
.clock { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.palette-btn {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 0.35rem 0.6rem; font-size: 0.7rem;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.palette-btn:hover { border-color: var(--acid); color: var(--acid); background: var(--acid-dim); }

@media (max-width: 720px) {
  .site-nav, .clock { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem var(--pad) 4rem;
  position: relative;
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  color: var(--ink-dim); margin-bottom: 2.5rem;
}
.hero-meta-divider { color: var(--acid); }
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--acid); margin-right: 0.5em;
  box-shadow: 0 0 8px var(--acid);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.hero-name {
  font-size: clamp(3.4rem, 14.5vw, 12.5rem);
  font-weight: 700; line-height: 0.88; letter-spacing: -0.045em;
  text-transform: uppercase;
}
.hero-line { display: block; overflow: hidden; }
.hero-line-indent { margin-left: clamp(1.5rem, 8vw, 9rem); }
.hero-word { display: inline-block; }

/* ---------- Hero avatar ---------- */
.hero-headline {
  display: flex; align-items: center; gap: clamp(1.5rem, 5vw, 4rem);
  flex-wrap: wrap;
}
.hero-headline .hero-name { flex: 1 1 auto; }
.hero-avatar {
  position: relative; flex: 0 0 auto;
  width: clamp(120px, 15vw, 210px); aspect-ratio: 1;
  transform-style: preserve-3d; will-change: transform;
}
.hero-avatar img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: 50% 28%; /* frame the face */
  border-radius: 50%;
  border: 1px solid rgba(191, 255, 56, 0.55);
  box-shadow:
    0 0 0 6px rgba(191, 255, 56, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 46px rgba(191, 255, 56, 0.16);
  filter: grayscale(0.35) contrast(1.02);
  transition: filter 0.5s var(--ease-out);
}
.hero-avatar:hover img { filter: grayscale(0) contrast(1.05); }
/* Rotating dashed halo */
.avatar-halo {
  position: absolute; inset: -10px; border-radius: 50%;
  border: 1px dashed rgba(191, 255, 56, 0.35);
  animation: halo-spin 18s linear infinite;
}
.avatar-halo::before {
  content: ''; position: absolute; top: -4px; left: 50%;
  width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: var(--acid); box-shadow: 0 0 10px var(--acid);
}
@keyframes halo-spin { to { transform: rotate(360deg); } }
.avatar-tag {
  position: absolute; bottom: 2px; right: -6px;
  display: inline-flex; align-items: center; gap: 0.4em;
  background: var(--bg-raise); color: var(--acid);
  border: 1px solid rgba(191, 255, 56, 0.35);
  border-radius: 999px; padding: 0.3rem 0.6rem; font-size: 0.6rem;
}
.avatar-tag .status-dot { width: 6px; height: 6px; margin: 0; }

@media (max-width: 640px) {
  .hero-headline { flex-direction: column; align-items: flex-start; gap: 1.75rem; }
  .hero-avatar { order: -1; width: clamp(96px, 30vw, 140px); }
  .avatar-tag { display: none; }
}

.hero-thesis {
  margin-top: 3rem; max-width: 40rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.thesis-label { color: var(--acid); }
.thesis-text {
  font-size: clamp(1.25rem, 2.6vw, 1.9rem);
  font-weight: 500; letter-spacing: -0.01em; line-height: 1.25;
}

.hero-row {
  margin-top: 3rem;
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 1.5rem;
}
.hero-role { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip {
  border: 1px solid rgba(191, 255, 56, 0.35);
  color: var(--acid); background: var(--acid-dim);
  border-radius: 999px; padding: 0.45rem 0.9rem;
}
.chip-ghost { border-color: var(--line); color: var(--ink-dim); background: transparent; }

.hero-ctas { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 500; font-size: 0.95rem; letter-spacing: 0.01em;
  padding: 0.85rem 1.5rem; border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.3s var(--ease-out), background 0.25s, color 0.25s, border-color 0.25s;
  will-change: transform;
}
.btn-solid { background: var(--acid); color: #0a0c05; }
.btn-solid:hover { background: #d6ff70; }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--acid); color: var(--acid); }
.btn-arrow { transition: transform 0.3s var(--ease-out); }
.btn:hover .btn-arrow { transform: translateX(4px); }

.scroll-hint {
  position: absolute; bottom: 2rem; right: var(--pad);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  color: var(--ink-dim); letter-spacing: 0.3em; font-size: 0.6rem;
  writing-mode: vertical-rl;
}
.scroll-hint-line {
  width: 1px; height: 56px; background: var(--line);
  position: relative; overflow: hidden;
}
.scroll-hint-line::after {
  content: ''; position: absolute; left: 0; top: -50%;
  width: 100%; height: 50%; background: var(--acid);
  animation: scroll-drip 1.8s var(--ease-out) infinite;
}
@keyframes scroll-drip { to { top: 110%; } }

/* ---------- Ticker ---------- */
.ticker {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; padding: 0.9rem 0;
  background: rgba(6, 7, 7, 0.6);
}
.ticker-track {
  display: inline-flex; align-items: center; gap: 2.5rem;
  white-space: nowrap; will-change: transform;
  color: var(--ink-dim); font-size: 0.72rem; letter-spacing: 0.22em;
}
.ticker-track i { color: var(--acid); font-style: normal; font-size: 0.55rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(5rem, 12vw, 10rem) var(--pad); position: relative; }
.section-head {
  display: flex; align-items: baseline; gap: 1.5rem; margin-bottom: 3rem;
}
.section-num { color: var(--acid); font-size: 0.9rem; }
.section-title {
  font-size: clamp(2.6rem, 8vw, 6.5rem);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  text-transform: uppercase;
}
.outline-text {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(233, 239, 230, 0.85);
  transition: color 0.6s var(--ease-out), -webkit-text-stroke-color 0.6s;
}
.section:hover .outline-text { color: var(--ink); -webkit-text-stroke-color: transparent; }

.section-sub { max-width: 44rem; color: var(--ink-dim); margin: -1.5rem 0 3rem; font-size: 1.05rem; }
.inline-link { color: var(--acid); border-bottom: 1px solid rgba(191, 255, 56, 0.4); }
.inline-link:hover { border-bottom-color: var(--acid); }

/* ---------- Thesis ---------- */
.thesis-lede {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 500; line-height: 1.35; letter-spacing: -0.015em;
  max-width: 56rem; margin-bottom: 4rem;
}
.thesis-lede em.acid { font-style: normal; color: var(--acid); }

.principles {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  background: var(--line);
  border: 1px solid var(--line);
}
.principle {
  background: var(--bg); padding: 2rem;
  position: relative; overflow: hidden;
  transition: background 0.3s;
}
.principle:hover { background: var(--bg-raise); }
.principle-num { color: var(--acid); display: block; margin-bottom: 1.25rem; }
.principle h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; letter-spacing: -0.01em; }
.principle p { color: var(--ink-dim); font-size: 0.92rem; }

/* ---------- Systems cards ---------- */
.systems-grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}
.sys-card {
  position: relative;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 1.9rem;
  background:
    radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(191, 255, 56, 0.07), transparent 45%),
    var(--bg-raise);
  transition: border-color 0.3s;
  transform-style: preserve-3d;
  will-change: transform;
}
.sys-card:hover { border-color: rgba(191, 255, 56, 0.45); }
.sys-card-wide { grid-column: 1 / -1; }
.sys-top {
  display: flex; justify-content: space-between;
  color: var(--ink-dim); margin-bottom: 1.5rem;
}
.sys-status { color: var(--acid); animation: pulse 2.6s ease-in-out infinite; }
.sys-card h3 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 0.7rem; }
.sys-card p { color: var(--ink-dim); font-size: 0.95rem; max-width: 52rem; }
.sys-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.5rem; }
.sys-tags span {
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0.25rem 0.55rem; font-size: 0.62rem; color: var(--ink-dim);
}

/* ---------- Operator ---------- */
.operator-lede {
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 500; line-height: 1.4; letter-spacing: -0.01em;
  max-width: 50rem; margin-bottom: 4rem;
}
.op-rows { border-top: 1px solid var(--line); }
.op-row {
  display: grid; grid-template-columns: 6rem 1fr; gap: 1.5rem;
  padding: 2.2rem 0; border-bottom: 1px solid var(--line);
  transition: padding-left 0.4s var(--ease-out);
}
.op-row:hover { padding-left: 1rem; }
.op-label { color: var(--acid); padding-top: 0.4rem; }
.op-body h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.op-body p { color: var(--ink-dim); max-width: 46rem; }
@media (max-width: 560px) {
  .op-row { grid-template-columns: 1fr; gap: 0.4rem; }
}

/* ---------- Contact ---------- */
.section-contact { padding-bottom: clamp(4rem, 8vw, 7rem); }
.contact-grid {
  display: grid; gap: 4rem;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  align-items: start;
}
.contact-big {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 700; line-height: 1.2; letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.contact-copy > p { color: var(--ink-dim); margin-bottom: 2.5rem; }
.contact-links { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.contact-link {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0; font-size: 0.85rem;
  color: var(--ink); border-bottom: 1px solid transparent;
  transition: color 0.2s;
}
.contact-link:hover { color: var(--acid); }

.contact-form { display: flex; flex-direction: column; gap: 1.6rem; }
.field { display: flex; flex-direction: column; gap: 0.55rem; }
.field label { color: var(--ink-dim); }
.field input, .field textarea {
  background: transparent; border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink); font-family: var(--font-display);
  font-size: 1.05rem; padding: 0.6rem 0.1rem;
  outline: none; resize: vertical;
  transition: border-color 0.25s;
}
.field input::placeholder, .field textarea::placeholder { color: rgba(139, 148, 138, 0.45); }
.field input:focus, .field textarea:focus { border-bottom-color: var(--acid); }
.field.invalid input, .field.invalid textarea { border-bottom-color: #ff5470; }
.btn-submit { align-self: flex-start; border: none; font-family: var(--font-display); font-size: 1rem; }
.form-note { color: var(--ink-dim); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
  padding: 2rem var(--pad);
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
}
@media (max-width: 720px) { .footer-mid { display: none; } }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 95; }
.palette[hidden] { display: none; }
.palette-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 5, 5, 0.7); backdrop-filter: blur(6px);
}
.palette-panel {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  margin: 14vh auto 0;
  background: var(--bg-raise);
  border: 1px solid rgba(191, 255, 56, 0.25);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 40px rgba(191, 255, 56, 0.06);
  animation: palette-in 0.25s var(--ease-out);
}
@keyframes palette-in {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
}
.palette-input-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--line);
}
.palette-chevron { color: var(--acid); }
#palette-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--ink); font-family: var(--font-mono); font-size: 0.9rem;
}
.palette-esc {
  color: var(--ink-dim); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.15rem 0.4rem; font-size: 0.6rem;
}
.palette-list { list-style: none; max-height: 320px; overflow-y: auto; padding: 0.4rem; }
.palette-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0.9rem; border-radius: 8px;
  font-size: 0.9rem; color: var(--ink);
}
.palette-list li .hint { font-family: var(--font-mono); font-size: 0.62rem; color: var(--ink-dim); letter-spacing: 0.08em; }
.palette-list li.active { background: var(--acid-dim); color: var(--acid); }
.palette-list li.active .hint { color: var(--acid); }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .grain { display: none; }
}
