/* ============================================================
   ExDeDe design system
   tokens > reset > shell > windows > forms > pages > motion
   ============================================================ */

/* ---- self-hosted fonts (no third-party font CDN) ---- */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700; /* variable font, one file covers the range */
  font-display: swap;
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
}
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/silkscreen-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/silkscreen-700.woff2') format('woff2');
}

:root {
  --bg: #0e0a14;
  --layer: #171021;
  --layer-2: #1f1630;
  --pink: #ff6bb5;
  --violet: #9d7bff;
  --blue: #5bcefa;
  --text: #e8e3f0;
  --text-dim: #9a8fb0;
  --border: #2e2344;

  --font-pixel: 'Silkscreen', monospace;
  --font-mono: 'JetBrains Mono', monospace;

  --grid: 16px;
  --radius: 4px;
  --maxw: 960px;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
img { max-width: 100%; display: block; }
input, button, textarea { font: inherit; color: inherit; }

/* ---- base ---- */
html { color-scheme: dark; }

body {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 15% -10%, rgba(157, 123, 255, 0.13), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 110%, rgba(255, 107, 181, 0.09), transparent 60%),
    repeating-linear-gradient(0deg, rgba(157, 123, 255, 0.035) 0 1px, transparent 1px var(--grid)),
    repeating-linear-gradient(90deg, rgba(157, 123, 255, 0.035) 0 1px, transparent 1px var(--grid));
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-pixel);
  font-weight: 700;
  line-height: 1.25;
  color: var(--violet);
}
h1 { font-size: 2.6rem; color: var(--text); }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }
h3 { font-size: 1rem; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--pink); }

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

::selection { background: var(--violet); color: var(--bg); }

code { color: var(--pink); }

/* ---- header / nav ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(14, 10, 20, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* mono, not the pixel face: Silkscreen renders lowercase as small caps,
   which mangles the "ExDeDe" casing */
.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.2rem;
  color: var(--pink);
  text-decoration: none;
  user-select: none;
  cursor: pointer;
}
.logo:hover { color: var(--pink); text-shadow: 0 0 12px rgba(255, 107, 181, 0.6); }
.logo .cursor {
  color: var(--violet);
  animation: blink 1.2s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.nav a {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.2rem 0.1rem;
}
.nav a:hover { color: var(--pink); }
.nav a[aria-current='page'] {
  color: var(--text);
  border-bottom: 2px solid var(--pink);
}

/* ---- layout ---- */
.page {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
  flex: 1;
}

.section { margin-bottom: 3rem; }

/* ---- signature: OS window cards ---- */
.window {
  background: var(--layer);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  background: var(--layer-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.window-dots { display: flex; gap: 4px; }
.window-dots i {
  width: 8px;
  height: 8px;
  background: var(--border);
}
.window:hover .window-dots i:nth-child(1) { background: var(--pink); }
.window:hover .window-dots i:nth-child(2) { background: var(--violet); }
.window:hover .window-dots i:nth-child(3) { background: var(--blue); }

.window-title {
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-body { padding: 1rem 1.1rem; }

/* ---- cards grid ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ---- buttons ---- */
.btn {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  padding: 0.55rem 1.1rem;
  color: var(--bg);
  background: var(--pink);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--violet);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { color: var(--bg); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--violet); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--violet); }
.btn:disabled { background: var(--border); box-shadow: none; cursor: not-allowed; }

/* ---- tags / chips ---- */
.chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
}
.chip.pending { border-style: dashed; }

/* ---- forms ---- */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  color: var(--violet);
  margin-bottom: 0.3rem;
}
.field input,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 1px var(--pink);
}
.field textarea { resize: vertical; min-height: 110px; }
.field .hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.form-status {
  min-height: 1.5rem;
  font-size: 0.85rem;
  margin-top: 0.6rem;
}
.form-status.ok { color: var(--blue); }
.form-status.err { color: var(--pink); }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.site-footer .heart { color: var(--pink); }

/* ---- utility ---- */
.dim { color: var(--text-dim); }
.pink { color: var(--pink); }
.violet { color: var(--violet); }
.pixel { font-family: var(--font-pixel); }

/* visually hidden but available to screen readers / SEO */
.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;
}

/* ---- staggered load reveal ---- */
@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.reveal,
.stagger > * {
  opacity: 0;
  animation: reveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
/* CSP blocks inline styles, so stagger delays come from child position */
.stagger > *:nth-child(2) { animation-delay: 90ms; }
.stagger > *:nth-child(3) { animation-delay: 180ms; }
.stagger > *:nth-child(4) { animation-delay: 270ms; }
.stagger > *:nth-child(5) { animation-delay: 360ms; }
.stagger > *:nth-child(6) { animation-delay: 450ms; }
.stagger > *:nth-child(7) { animation-delay: 540ms; }
.stagger > *:nth-child(8) { animation-delay: 630ms; }
.stagger > *:nth-child(n + 9) { animation-delay: 720ms; }

/* ---- home: hero + odometer ---- */
.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  text-shadow: 4px 4px 0 rgba(157, 123, 255, 0.35);
}
.hero .name {
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
}
.hero .pronouns {
  border-color: var(--pink);
  color: var(--pink);
  vertical-align: middle;
}
.hero .tagline { margin-top: 1rem; max-width: 34rem; color: var(--text-dim); }

.odometer-window { max-width: 300px; margin-top: 2.5rem; }
.odometer {
  font-family: var(--font-pixel);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--pink);
  text-shadow: 0 0 14px rgba(255, 107, 181, 0.55);
  padding: 0.4rem 0 0.2rem;
}
.odometer-label {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding-bottom: 0.5rem;
}

/* ---- home: live discord presence (Lanyard) ---- */
.discord-window { max-width: 480px; }
.discord-status {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
/* dot color per discord_status, all from the existing palette */
.status-dot { font-style: normal; }
.status-dot.dot-online { color: var(--pink); }
.status-dot.dot-idle { color: var(--violet); }
.status-dot.dot-dnd { color: color-mix(in srgb, var(--pink) 62%, var(--text-dim)); }
.status-dot.dot-offline,
.status-dot.dot-unknown { color: var(--text-dim); }

/* ---- about: fact lists ---- */
.fact-list { list-style: none; padding: 0; display: grid; gap: 0.45rem; }
.fact-list li { padding-left: 1.2rem; position: relative; }
.fact-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--pink);
}

/* ---- chaos mode (easter egg, toggled by logo clicks) ---- */
@keyframes wobble {
  0%, 100% { transform: rotate(-0.7deg); }
  50% { transform: rotate(0.7deg); }
}
body.chaos-mode .window,
body.chaos-mode .btn,
body.chaos-mode h1,
body.chaos-mode .logo {
  animation: wobble 0.35s ease-in-out infinite;
}
body.chaos-mode { cursor: crosshair; }

.cursor-heart {
  position: fixed;
  pointer-events: none;
  font-size: 12px;
  z-index: 999;
  animation: heart-fall 0.9s ease-in forwards;
}
@keyframes heart-fall {
  to { transform: translateY(40px); opacity: 0; }
}

/* ---- mobile ---- */
@media (max-width: 600px) {
  .page { padding: 2rem 1rem 3rem; }
  .site-header .inner { justify-content: center; text-align: center; }
  .nav { justify-content: center; gap: 0.9rem; }
  .hero { padding-top: 1.5rem; }
  .odometer { font-size: 1.5rem; letter-spacing: 0.25em; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ---- project cards: clickable, open a modal ---- */
.project-card { cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(157, 123, 255, 0.25);
}
.project-card:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* ---- modal / popup ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 10, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
  animation: reveal 0.2s ease forwards;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal .window-body { padding: 1.25rem 1.35rem 1.5rem; }
.modal-desc { color: var(--text); margin-bottom: 1rem; }
.modal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  line-height: 1;
  padding: 0 0.15rem;
}
.modal-close:hover { color: var(--pink); }

/* ---- visitor-counter easter egg: escalating shake + glitch ---- */
@keyframes eq-shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(calc(-1px * var(--amp)), calc(1px * var(--amp))); }
  50% { transform: translate(calc(1px * var(--amp)), calc(-1px * var(--amp))); }
  75% { transform: translate(calc(-1px * var(--amp)), calc(-1px * var(--amp))); }
}
body.eq-shake { animation: eq-shake 0.12s linear infinite; }
body.eq-1 { --amp: 2; }
body.eq-2 { --amp: 5; }
body.eq-3 { --amp: 9; }
body.eq-4 { --amp: 16; }

@keyframes eq-glitch {
  0%, 100% { text-shadow: 0 0 14px rgba(255, 107, 181, 0.55); transform: none; }
  33% { text-shadow: -2px 0 var(--blue), 2px 0 var(--pink); transform: translateX(-1px); }
  66% { text-shadow: 2px 0 var(--violet), -2px 0 var(--blue); transform: translateX(1px); }
}
.odometer.glitching { animation: eq-glitch 0.18s steps(2) infinite; }

/* level 4: whole page starts visually falling apart */
body.eq-breaking { animation: eq-shake 0.09s linear infinite; }
body.eq-breaking .window,
body.eq-breaking h1,
body.eq-breaking .odometer {
  animation: eq-glitch 0.12s steps(2) infinite;
  filter: hue-rotate(90deg) saturate(1.6);
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .stagger > * { animation: none; opacity: 1; }
  .logo .cursor { animation: none; }
  body.chaos-mode .window,
  body.chaos-mode .btn,
  body.chaos-mode h1,
  body.chaos-mode .logo { animation: none; }
  .btn { transition: none; }
  .modal-backdrop { animation: none; }
  body.eq-shake, body.eq-breaking,
  .odometer.glitching,
  body.eq-breaking .window,
  body.eq-breaking h1,
  body.eq-breaking .odometer { animation: none; }
}
