:root {
  --bg: #05080a;
  --panel: rgba(8, 16, 12, 0.82);
  --green: #00ff9c;
  --green-dim: #0a8f5a;
  --text: #c8f7dc;
  --muted: #5f8a73;
  --border: rgba(0, 255, 156, 0.25);
  --red: #ff4d6d;
  --cyan: #00e5ff;
  --font: ui-monospace, "Cascadia Code", "Consolas", "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* scanlines */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px);
  z-index: 2;
}

#matrix {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  opacity: .18;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 16px 32px;
}

.dim { color: var(--muted); }

/* ---------- full-screen sections ---------- */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  scroll-snap-align: start;
}

h2 {
  font-size: 1.1rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .15em;
  margin-bottom: 20px;
}

/* ---------- scroll progress bar ---------- */
.progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 12px var(--green);
  z-index: 5;
}

/* ---------- side dots ---------- */
.dots {
  position: fixed;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 14px;
  z-index: 4;
}
.dots a {
  position: relative;
  width: 10px; height: 10px;
  border: 1px solid var(--green);
  border-radius: 50%;
  transition: background .3s, box-shadow .3s, transform .3s;
}
.dots a.active { background: var(--green); box-shadow: 0 0 10px var(--green); transform: scale(1.3); }
.dots a::before {
  content: attr(data-label);
  position: absolute; right: 20px; top: 50%;
  transform: translate(6px, -50%);
  font-size: .72rem; color: var(--green);
  opacity: 0; white-space: nowrap;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.dots a:hover::before { opacity: 1; transform: translate(0, -50%); }

/* ---------- hero screen ---------- */
.hero-screen { flex-direction: column; justify-content: center; }
.hero-inner { will-change: transform, opacity; }
.hero-inner .links { margin-top: 18px; }

.hero {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 0 40px rgba(0, 255, 156, .08);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 255, 156, .04);
}
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.term-bar span:first-child { background: var(--red); }
.term-bar span:nth-child(2) { background: #ffcc4d; }
.term-bar span:nth-child(3) { background: var(--green); }
.term-bar p { margin-left: 10px; color: var(--muted); font-size: .8rem; }

.term-body { padding: 28px 22px 32px; }
.prompt { color: var(--muted); }

.glitch {
  position: relative;
  font-size: clamp(2.6rem, 13vw, 5.5rem);
  line-height: 1.1;
  color: var(--green);
  letter-spacing: .06em;
  text-shadow: 0 0 18px rgba(0, 255, 156, .55);
  margin: 6px 0 10px;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  width: 100%;
  overflow: hidden;
}
.glitch::before { color: var(--cyan); animation: glitch 3s infinite steps(1); clip-path: inset(0 0 60% 0); }
.glitch::after  { color: var(--red); animation: glitch 2.4s infinite reverse steps(1); clip-path: inset(55% 0 0 0); }

@keyframes glitch {
  0%, 88%, 100% { transform: translate(0); opacity: 0; }
  90% { transform: translate(-3px, 1px); opacity: .8; }
  93% { transform: translate(3px, -1px); opacity: .8; }
  96% { transform: translate(-1px, 2px); opacity: .8; }
}

.typed { min-height: 1.6em; font-size: 1.05rem; }
.typed::before { content: "> "; color: var(--green); }
.typed::after {
  content: "█";
  color: var(--green);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: .75rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  z-index: 1;
  transition: opacity .3s;
}
.scroll-hint:hover { color: var(--green); }
.scroll-hint i {
  width: 22px; height: 36px;
  border: 1px solid var(--green);
  border-radius: 12px;
  position: relative;
}
.scroll-hint i::after {
  content: "";
  position: absolute; left: 50%; top: 7px;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: wheel 1.6s var(--ease) infinite;
}
@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}
.scrolled .scroll-hint { opacity: 0; pointer-events: none; }

/* ---------- links ---------- */
.links { display: grid; gap: 12px; }
.link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}
/* light sweep on hover */
.link::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 156, .18), transparent);
  transform: skewX(-20deg);
  transition: left .5s var(--ease);
}
.link:hover::after, .link:focus-visible::after { left: 120%; }
.link:hover, .link:focus-visible {
  border-color: var(--green);
  background: rgba(0, 255, 156, .08);
  box-shadow: 0 0 18px rgba(0, 255, 156, .25);
  transform: translateX(4px);
  outline: none;
}
.tag { color: var(--green); font-weight: 700; }
.handle { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* ---------- cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
}
.about { padding: 26px 24px; font-size: 1.05rem; }
.about p + p { margin-top: 10px; }
.key { color: var(--green); }
.ok { color: var(--green); display: inline-flex; align-items: center; gap: 8px; }
.pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(0, 255, 156, .6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(0, 255, 156, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 156, 0); }
}

.projects {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  perspective: 900px;
}
.project {
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s, box-shadow .15s;
  transform-style: preserve-3d;
}
.project:hover { border-color: var(--green); box-shadow: 0 0 22px rgba(0, 255, 156, .22); }
.project h3 { color: var(--green); font-size: 1.05rem; }
.project p { color: var(--text); font-size: .92rem; flex: 1; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta span {
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
}
.btn {
  align-self: flex-start;
  color: var(--bg);
  background: var(--green);
  text-decoration: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: .9rem;
  transition: box-shadow .15s;
}
.btn:hover, .btn:focus-visible { box-shadow: 0 0 16px var(--green); outline: none; }

/* ---------- footer ---------- */
footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  text-align: center;
  font-size: .8rem;
}
footer p + p { margin-top: 6px; }
.to-top {
  display: inline-block;
  margin-top: 14px;
  color: var(--green);
  text-decoration: none;
}
.to-top:hover { text-shadow: 0 0 10px var(--green); }

/* =========================================================
   SCROLL ANIMATIONS (only active when JavaScript runs)
   ========================================================= */

/* boot-up on page load */
.js .boot {
  opacity: 0;
  transform: translateY(24px) scale(.98);
  filter: blur(6px);
  transition: opacity .7s var(--ease), transform .7s var(--ease), filter .7s var(--ease);
  transition-delay: var(--d, 0s);
}
.js.loaded .boot { opacity: 1; transform: none; filter: none; }

/* generic reveal: fade + slide up + un-blur */
.js .reveal {
  opacity: 0;
  transform: translateY(50px);
  filter: blur(8px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; filter: none; }

/* heading: slide in from the left */
.js h2.reveal { transform: translateX(-40px); }
.js h2.reveal.in { transform: none; }

/* about card: border draws itself, then lines appear one by one */
.js .about.reveal { transform: translateY(50px) scale(.96); }
.js .about.reveal.in { transform: none; }
.js .about .line {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .about.in .line { opacity: 1; transform: none; }

/* program cards: flip up in 3D */
.js .project.reveal {
  transform: translateY(70px) rotateX(35deg);
  transform-origin: 50% 100%;
}
.js .project.reveal.in { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition-delay: var(--d, 0s); }
.js .project.reveal.in.tilting { transition: transform .1s linear, border-color .15s, box-shadow .15s; }

/* hero fades / shrinks as you scroll away */
.hero-inner {
  transform: translateY(var(--hy, 0px)) scale(var(--hs, 1));
  opacity: var(--ho, 1);
}

/* 404 page */
.center { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 16px; }

@media (max-width: 600px) {
  .dots { display: none; }
  .dots a::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .glitch::before, .glitch::after, .typed::after, .pulse, .scroll-hint i::after { animation: none; }
  #matrix { display: none; }
  .link:hover { transform: none; }
  .js .boot, .js .reveal, .js .about .line {
    opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important;
  }
  .hero-inner { transform: none; opacity: 1; }
}

/* =========================================================
   PROGRAMS TEASER (home page)
   ========================================================= */
.programs-cta {
  display: flex; flex-direction: column; gap: 14px;
  color: var(--text);
  text-decoration: none;
  padding: 26px 24px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.programs-cta:hover, .programs-cta:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 26px rgba(0, 255, 156, .22);
  outline: none;
}
.cta-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cta-list span {
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: .9rem;
}
.cta-text { color: var(--text); }
.cta-btn { font-size: 1rem; padding: 8px 16px; }
.programs-cta:hover .cta-btn { box-shadow: 0 0 16px var(--green); }

/* =========================================================
   PROGRAMS PAGE
   ========================================================= */
.page-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 36px;
}
.back {
  color: var(--green);
  text-decoration: none;
  font-size: .95rem;
}
.back:hover, .back:focus-visible { text-shadow: 0 0 10px var(--green); outline: none; }
.page-title {
  font-size: clamp(2.2rem, 10vw, 3.6rem);
  line-height: 1.1;
  margin: 4px 0 10px;
}
.page-intro { color: var(--muted); max-width: 52ch; }

.program-list { display: grid; gap: 16px; margin-top: 36px; perspective: 900px; }
.program-list .project { padding: 22px; }
.program-list .project h3 { font-size: 1.25rem; }
.program-list .project p { font-size: .98rem; }
.program-list .actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.size { color: var(--muted); font-size: .8rem; }

.note {
  margin-top: 28px;
  color: var(--muted);
  font-size: .82rem;
  border-left: 2px solid var(--green-dim);
  padding-left: 12px;
}
.page-screen { align-items: flex-start; }

[hidden] { display: none !important; }

.btn-off {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  cursor: default;
}
.btn-off:hover { box-shadow: none; }

/* =========================================================
   ADMIN EDITOR
   ========================================================= */
body.admin #matrix { display: none; }
.admin-wrap { max-width: 860px; padding-top: 40px; padding-bottom: 120px; }
.admin-login { max-width: 460px; margin: 8vh auto 0; display: grid; gap: 18px; }
.admin-title { font-size: clamp(2.4rem, 12vw, 4rem); }
.admin-h1 { color: var(--green); font-size: 2rem; line-height: 1.2; }

.admin-top {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px;
}
.admin-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-card { margin-bottom: 18px; padding: 22px; }
.admin-card h2 { margin-bottom: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field .key { font-size: .85rem; }
.hint { color: var(--muted); font-size: .8rem; }

.admin input, .admin textarea {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  color: var(--text);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 11px;
}
.admin textarea { resize: vertical; min-height: 70px; }
.admin input:focus, .admin textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 255, 156, .15);
}
.admin button { font: inherit; cursor: pointer; }
.admin .btn { border: 0; }
.admin .btn:disabled { opacity: .6; cursor: wait; }

.ghost {
  display: inline-block;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: .85rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ghost:hover, .ghost:focus-visible { border-color: var(--green); box-shadow: 0 0 12px rgba(0, 255, 156, .2); outline: none; }
.ghost.danger, .tool.danger { color: var(--red); border-color: rgba(255, 77, 109, .35); }

.rows { display: grid; gap: 12px; margin-bottom: 14px; }
.row {
  display: grid;
  gap: 0 12px;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 14px 4px;
  background: rgba(0, 0, 0, .2);
}
.row .full, .row .file-line, .row .row-tools { grid-column: 1 / -1; }
.link-row { grid-template-columns: 70px 1fr 1fr; }
.link-row .wide { grid-column: 1 / -1; }
.row-tools { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 10px; }
.tool {
  width: 34px; height: 30px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.tool:hover { border-color: var(--green); }

.file-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: .85rem; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-input:focus-visible + .ghost { border-color: var(--green); }
.upload-state { color: var(--muted); }

.warn { color: #ffcc4d; }
.form-msg { min-height: 1.4em; color: var(--red); font-size: .9rem; margin-bottom: 6px; }

.save-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 6;
  display: flex; justify-content: flex-end; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 860px) / 2 + 16px));
  background: rgba(5, 8, 10, .92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

@media (max-width: 600px) {
  .row, .link-row { grid-template-columns: 1fr; }
  .save-bar { justify-content: space-between; }
}

/* =========================================================
   CONTACT, FAQ, FOOTER LINKS, IMPRESSUM
   ========================================================= */
.contact-link {
  margin-top: 12px;
  border-style: dashed;
  border-color: rgba(0, 229, 255, .45);
}
.contact-link .tag { color: var(--cyan); }
.contact-link:hover, .contact-link:focus-visible {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, .07);
  box-shadow: 0 0 18px rgba(0, 229, 255, .25);
}

.faq-title {
  margin: 34px 0 14px;
  color: var(--green);
  font-size: 1rem;
  letter-spacing: .08em;
}
.faq { display: grid; gap: 10px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  transition: border-color .2s, box-shadow .2s;
}
.faq-item[open] { border-color: var(--green); box-shadow: 0 0 16px rgba(0, 255, 156, .12); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 44px 14px 18px;
  position: relative;
  color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "> "; color: var(--green); }
.faq-item summary::after {
  content: "+";
  position: absolute; right: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--green);
  font-size: 1.2rem;
  transition: transform .25s var(--ease);
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item summary:hover, .faq-item summary:focus-visible { color: var(--green); outline: none; }
.faq-item p {
  padding: 0 18px 16px;
  color: var(--text);
  opacity: .9;
  white-space: pre-line;
  animation: faqIn .3s var(--ease);
}
@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: .9; transform: none; } }

.foot-links { display: flex; justify-content: center; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.foot-links a { color: var(--green); text-decoration: none; }
.foot-links a:hover, .foot-links a:focus-visible { text-shadow: 0 0 10px var(--green); outline: none; }

.legal { margin-top: 30px; padding: 26px 24px; }
.legal h2 { font-size: .95rem; margin: 22px 0 8px; }
.legal h2:first-child { margin-top: 0; }
.legal p { color: var(--text); }
.legal a { color: var(--green); }
.pre { white-space: pre-line; }

@media (max-height: 760px) {
  .scroll-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .faq-item p { animation: none; }
}
@media (max-width: 480px) {
  .contact-link .handle { display: none; }
}

/* =========================================================
   BRAND COLOURS FOR LINKS
   ========================================================= */
.link-yt { border-color: rgba(255, 0, 51, .5); }
.link-yt .tag { color: #ff2d55; }
.link-yt:hover, .link-yt:focus-visible {
  border-color: #ff0033;
  background: rgba(255, 0, 51, .1);
  box-shadow: 0 0 18px rgba(255, 0, 51, .35);
}
.link-yt::after { background: linear-gradient(90deg, transparent, rgba(255, 0, 51, .2), transparent); }

.link-tt, .link-gh {
  background: #000;
  border-color: rgba(255, 255, 255, .28);
}
.link-tt .tag, .link-gh .tag { color: #fff; }
.link-tt:hover, .link-tt:focus-visible,
.link-gh:hover, .link-gh:focus-visible {
  background: #000;
  border-color: #fff;
  box-shadow: 0 0 18px rgba(255, 255, 255, .22);
}
.link-tt::after, .link-gh::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14), transparent); }

.link-dc { border-color: rgba(88, 101, 242, .6); }
.link-dc .tag { color: #7983f5; }
.link-dc:hover, .link-dc:focus-visible {
  border-color: #5865f2;
  background: rgba(88, 101, 242, .12);
  box-shadow: 0 0 18px rgba(88, 101, 242, .4);
}
.link-dc::after { background: linear-gradient(90deg, transparent, rgba(88, 101, 242, .22), transparent); }

/* contact: copy to clipboard */
.contact-link { cursor: copy; }
.copy-hint {
  font-size: .72rem;
  color: var(--cyan);
  opacity: 0;
  transition: opacity .2s;
  margin-left: 4px;
}
.contact-link:hover .copy-hint, .contact-link:focus-visible .copy-hint { opacity: .8; }
.contact-link.copied { border-style: solid; border-color: var(--cyan); }
.contact-link .handle { margin-left: auto; }

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translate(-50%, 20px);
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: rgba(5, 8, 10, .95);
  color: var(--text);
  font-size: .9rem;
  box-shadow: 0 0 20px rgba(0, 229, 255, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-copy { position: fixed; top: -100px; left: 0; opacity: 0; }

.faq-title { text-transform: uppercase; letter-spacing: .15em; }

@media (max-width: 480px) {
  .copy-hint { display: none; }
}

/* jump links to the FAQ land with the heading visible */
.faq-title { scroll-margin-top: 28px; }
/* fade only (no slide) so anchor links measure the right position */
.js .faq-title.reveal { transform: none; }
