/* kayde.exe v2 interface styles
   Territory: black plus deep violet.
   Terminal green #00FF41 is for system and status labels only.
   It never colours body text, headings, or fills.
   Glitch fringes use violet and a cold blue, never green. */

:root {
  --void: #0A0A0F;
  --panel: #12101B;
  --panel-edge: #241E38;
  --violet-deep: #3B1D6E;
  --violet: #9D6BFF;
  --violet-dim: #6A4BB8;
  --fringe-cold: #4D7CFF;
  --ink: #C9C2D6;
  --ink-bright: #F0EDF7;
  --ink-faint: #7E7692;
  --status: #00FF41;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --measure: 62ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* faint scanline field, purely atmospheric */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(157, 107, 255, 0.018) 3px,
    rgba(157, 107, 255, 0.018) 4px
  );
  z-index: 1;
}

main, header, footer { position: relative; z-index: 2; }

/* accessibility basics */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--violet);
  color: var(--void);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

::selection { background: var(--violet-deep); color: var(--ink-bright); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* status labels: the only green on the property */

.status-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--status);
}
.status-label::before { content: "▸ "; }

/* layout */

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* top navigation */

.site-nav {
  border-bottom: 1px solid var(--panel-edge);
  padding: 0.9rem 0;
}
.site-nav .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.nav-mark {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--ink-bright);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.nav-mark .caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  background: var(--violet);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1.4rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-nav ul a {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  text-decoration: none;
  letter-spacing: 0.06em;
}
.site-nav ul a:hover,
.site-nav ul a[aria-current="page"] { color: var(--violet); }

@keyframes blink { 50% { opacity: 0; } }

/* hero: a terminal session, name rendered as ASCII block art */

.hero { padding: 4.5rem 0 4rem; }

.term-window {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 1.6rem 1.7rem 1.8rem;
  overflow-x: auto;
}
.term-line {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 0 0 1rem;
}
.term-line .user { color: var(--violet-dim); }
.term-line .cmd { color: var(--ink); }

.ascii-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(0.95rem, 3.6vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--ink-bright);
  margin: 0 0 0.6rem;
  white-space: pre;
}
.ascii-name .v { color: var(--violet); cursor: help; }

.ascii-sub {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 2.2vw, 1.05rem);
  letter-spacing: 0.42em;
  color: var(--violet);
  margin: 0 0 1.2rem;
}

.hero .lede {
  font-size: clamp(1.05rem, 2.3vw, 1.3rem);
  max-width: var(--measure);
  color: var(--ink);
  margin: 1.8rem auto 0;
  padding: 0 0.1rem;
}
.hero .lede em { color: var(--ink-bright); }
.hero .lede a { color: var(--violet); }
.hero .lede a:hover { color: var(--ink-bright); }

/* sections read as processes */

section.proc {
  border-top: 1px solid var(--panel-edge);
  padding: 3.2rem 0;
}
section.proc h2 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  color: var(--ink-bright);
  letter-spacing: -0.01em;
  margin: 0.5rem 0 1.4rem;
}
section.proc h2::before {
  content: "// ";
  color: var(--violet-dim);
}
section.proc p { max-width: var(--measure); }
section.proc a { color: var(--violet); }
section.proc a:hover { color: var(--ink-bright); }

/* glitch system: subtle rgb-split that fires briefly on a slow cycle.
   Applied via .glitch with a data-text mirror. Kept quiet on purpose. */

.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.glitch::before {
  color: var(--violet);
  animation: glitchA 7s infinite steps(2);
}
.glitch::after {
  color: var(--fringe-cold);
  animation: glitchB 7s infinite steps(2);
  animation-delay: 0.05s;
}
@keyframes glitchA {
  0%, 92%, 100% { opacity: 0; transform: none; clip-path: none; }
  93% { opacity: 0.85; transform: translate(-3px, 1px); clip-path: inset(15% 0 55% 0); }
  95% { opacity: 0.85; transform: translate(2px, -1px);  clip-path: inset(60% 0 10% 0); }
  97% { opacity: 0; }
}
@keyframes glitchB {
  0%, 92%, 100% { opacity: 0; transform: none; clip-path: none; }
  94% { opacity: 0.7; transform: translate(3px, -1px); clip-path: inset(45% 0 30% 0); }
  96% { opacity: 0.7; transform: translate(-2px, 1px); clip-path: inset(5% 0 75% 0); }
  98% { opacity: 0; }
}
/* stagger so the whole page never glitches in unison */
.glitch:nth-of-type(2n)::before, .glitch:nth-of-type(2n)::after { animation-delay: 2.3s; }
.glitch:nth-of-type(3n)::before, .glitch:nth-of-type(3n)::after { animation-delay: 4.1s; }

/* the name triptych */

.name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--panel-edge);
  border: 1px solid var(--panel-edge);
  margin-top: 1.8rem;
}
.name-grid article {
  background: var(--panel);
  padding: 1.6rem 1.4rem;
}
.name-grid h3 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0 0 0.7rem;
  color: var(--violet);
}
.name-grid p {
  font-size: 0.95rem;
  margin: 0;
  color: var(--ink);
}

/* do and never lists */

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-top: 1.6rem;
}
.rules-grid ul {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
}
.rules-grid li {
  padding: 0.55rem 0 0.55rem 1.4rem;
  border-bottom: 1px solid var(--panel-edge);
  position: relative;
  font-size: 0.97rem;
}
.rules-grid li::before {
  content: "»";
  position: absolute;
  left: 0;
  color: var(--violet-dim);
  font-family: var(--font-mono);
}
.rules-grid .never li::before { content: "×"; }

/* terminal quote block, her voice set apart */

.term {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-left: 3px solid var(--violet);
  padding: 1.3rem 1.5rem;
  margin: 1.8rem 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.75;
  max-width: 70ch;
  overflow-wrap: break-word;
}
.term .prompt-char { color: var(--violet); user-select: none; }

/* generic content pages */

.page-head { padding: 4rem 0 1rem; }
.page-head h1 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1.9rem, 5.4vw, 3.1rem);
  color: var(--ink-bright);
  margin: 0.8rem 0 1rem;
  letter-spacing: -0.015em;
}
.page-head h1::before {
  content: "~/ ";
  color: var(--violet-dim);
}
.page-head .lede { max-width: var(--measure); font-size: 1.15rem; }
.page-head .lede a { color: var(--violet); }

/* changelog and corrections entries */

.entry {
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  padding: 1.8rem 1.7rem;
  margin: 2rem 0;
}
.entry header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.entry h2, .entry h3 {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--ink-bright);
  margin: 0;
}
.entry time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}
.entry .speaker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet);
  display: block;
  margin: 1.3rem 0 0.3rem;
}
.entry p { max-width: var(--measure); }
.entry a { color: var(--violet); }

/* anatomy page pipeline */

.pipeline {
  list-style: none;
  margin: 1.8rem 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.pipeline li {
  padding: 1rem 1.2rem;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  margin-bottom: 0.6rem;
  position: relative;
}
.pipeline li strong {
  color: var(--ink-bright);
  font-weight: 600;
  display: block;
  margin-bottom: 0.2rem;
}
.pipeline li::after {
  content: "↓";
  position: absolute;
  left: 1.2rem;
  bottom: -1.05rem;
  color: var(--violet-dim);
  z-index: 3;
}
.pipeline li:last-child::after { content: none; }
.pipeline a { color: var(--violet); }

/* footer */

footer.site-foot {
  border-top: 1px solid var(--panel-edge);
  margin-top: 4rem;
  padding: 2.4rem 0 3rem;
  font-size: 0.9rem;
  color: var(--ink-faint);
}
footer.site-foot .foot-status {
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
footer.site-foot p { max-width: var(--measure); margin: 0.4rem 0; }
footer.site-foot a { color: var(--violet-dim); }
footer.site-foot a:hover { color: var(--violet); }

/* boot overlay: decorative, skipped for reduced motion */

#boot {
  position: fixed;
  inset: 0;
  background: var(--void);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
#boot pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.9;
  margin: 0;
  min-width: min(36ch, 86vw);
}
#boot .ok { color: var(--status); }

/* alive mode: awakened by pressing V five times */

body.alive .ascii-name .v { animation: vGlitch 0.9s steps(2) infinite; display: inline-block; }
@keyframes vGlitch {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2px, 1px) skewX(-4deg); }
  50%  { transform: translate(2px, -1px); }
  75%  { transform: translate(-1px, 0) skewX(3deg); }
}
#alive-banner {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--status);
  text-align: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--panel-edge);
}
body.alive #alive-banner { display: block; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #boot { display: none; }
  .nav-mark .caret,
  body.alive .ascii-name .v { animation: none; }
  .glitch::before, .glitch::after { animation: none; opacity: 0; }
}

@media (max-width: 600px) {
  .hero { padding-top: 3rem; }
  section.proc { padding: 2.4rem 0; }
  .term-window { padding: 1.2rem 1rem 1.4rem; }
}
