/* ============================================================
   PEGIADIS® — v2 prototype
   Dark immersive creative-dev aesthetic: interactive neural
   canvas, Syne display type, lime accent, custom cursor,
   sticky split work section, magnetic CTA.
   ============================================================ */

:root {
  --bg: #0b0c0a;
  --bg-soft: #121410;
  --fg: #e9ece3;
  --fg-dim: #8d937f;
  --lime: #c6f24e;
  --line: rgba(233, 236, 227, 0.12);
  --syne: "Syne", sans-serif;
  --archivo: "Archivo", sans-serif;
  --mono: "Azeret Mono", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--archivo);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
}

@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  body a, body button { cursor: none; }
}

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

.lime { color: var(--lime); font-style: normal; }

/* ---- neural canvas ---- */
#net {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

main, .nav, .footer { position: relative; z-index: 1; }

/* ---- custom cursor ---- */
.cursor, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .cursor, .cursor-ring { display: block; }
}
.cursor {
  width: 8px; height: 8px;
  background: var(--lime);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1px solid rgba(198, 242, 78, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, background 0.25s ease;
}
.cursor-ring.hovering {
  width: 64px; height: 64px;
  background: rgba(198, 242, 78, 0.08);
}

/* ============ NAV ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4rem 3vw;
  mix-blend-mode: difference;
}
.nav a {
  color: #fff;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}
.nav-name { font-family: var(--syne) !important; font-weight: 700; font-size: 1rem !important; }
.nav nav { display: flex; gap: 2.2rem; }

/* ============ HERO ============ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 3vw;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 2.2rem;
  opacity: 0;
  animation: fade-in 0.8s ease 0.9s forwards;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

.hero-h {
  font-family: var(--syne);
  font-weight: 800;
  font-size: clamp(3rem, 10.2vw, 10.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.hero-h .hl { display: block; overflow: hidden; }
.hero-h .indent { padding-left: 5vw; }
.hero-h .word {
  display: inline-block;
  transform: translateY(110%);
  animation: rise 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-h .indent .word { animation-delay: 0.15s; }
@keyframes rise { to { transform: translateY(0); } }
@keyframes fade-in { to { opacity: 1; } }

.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 3rem;
  margin-top: 3.5rem;
}
.hero-sub {
  max-width: 34em;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--fg-dim);
  opacity: 0;
  animation: fade-in 0.8s ease 1.1s forwards;
}
.hero-sub strong { color: var(--fg); font-weight: 500; }
.scroll-hint {
  color: var(--lime);
  animation: bob 2s ease-in-out infinite, fade-in 0.8s ease 1.4s forwards;
  opacity: 0;
}
@keyframes bob { 50% { transform: translateY(8px); } }

/* ============ STATS ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 12, 10, 0.7);
  backdrop-filter: blur(4px);
}
.stat {
  padding: 2.6rem 2rem;
  text-align: center;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat-n {
  display: block;
  font-family: var(--syne);
  font-weight: 700;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
  color: var(--lime);
  line-height: 1;
}
.stat-n::after { content: "+"; font-size: 0.5em; vertical-align: super; opacity: 0.6; }
.stat-l {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* ============ WORK (sticky split) ============ */
.work {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 4rem;
  padding: 8rem 3vw;
  max-width: 1500px;
  margin: 0 auto;
}
.work-sticky {
  position: sticky;
  top: 28vh;
  align-self: start;
}
.sec-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--lime);
  margin-bottom: 1.4rem;
}
.sec-tag::before { content: "// "; opacity: 0.5; }
.work-counter {
  font-family: var(--syne);
  font-weight: 800;
  font-size: clamp(4rem, 9vw, 9rem);
  line-height: 1;
}
.wc-total { color: var(--fg-dim); font-size: 0.35em; font-weight: 600; }
.work-hint { color: var(--fg-dim); font-size: 0.95rem; margin-top: 0.6rem; }

.work-list { display: flex; flex-direction: column; gap: 7rem; }

.project { max-width: 640px; }

/* ---- project media: screenshot + animated workflow ---- */
.proj-media {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.8rem;
}
.proj-shot {
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.4s ease;
}
.proj-shot img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.project:hover .proj-shot { border-color: rgba(198, 242, 78, 0.45); }
.project:hover .proj-shot img { transform: scale(1.03); }

.proj-flow {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(18, 20, 16, 0.85);
  padding: 2.4rem 1.1rem 0.9rem;
  transition: border-color 0.4s ease;
}
.project:hover .proj-flow { border-color: rgba(198, 242, 78, 0.45); }
.flow-label {
  position: absolute;
  top: 0.8rem;
  left: 1.1rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--lime);
}
.flow-label::before {
  content: "●";
  margin-right: 0.5em;
  animation: blink 2.4s ease-in-out infinite;
}
.proj-flow svg { display: block; width: 100%; height: auto; }

.fnode rect {
  fill: rgba(233, 236, 227, 0.03);
  stroke: rgba(233, 236, 227, 0.25);
  stroke-width: 1;
}
.fnode.hot rect {
  fill: rgba(198, 242, 78, 0.06);
  stroke: rgba(198, 242, 78, 0.45);
  animation: node-glow 4s ease-in-out infinite;
}
@keyframes node-glow {
  50% { fill: rgba(198, 242, 78, 0.13); }
}
.ft { fill: var(--fg); font-size: 11px; font-weight: 500; }
.fnode.hot .ft { fill: var(--lime); }
.fs { fill: var(--fg-dim); font-size: 8.5px; }
.fcap { fill: var(--fg-dim); font-size: 8px; letter-spacing: 0.12em; }

.fline {
  fill: none;
  stroke: rgba(233, 236, 227, 0.22);
  stroke-width: 1;
  stroke-dasharray: 4 7;
  animation: dashflow 1.1s linear infinite;
}
.fline.loop { stroke: rgba(198, 242, 78, 0.25); }
@keyframes dashflow {
  to { stroke-dashoffset: -11; }
}
.fpacket {
  fill: var(--lime);
  filter: drop-shadow(0 0 5px rgba(198, 242, 78, 0.9));
}
.fpacket.dim { fill: rgba(198, 242, 78, 0.5); filter: none; }

.project h3 {
  font-family: var(--syne);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  margin-bottom: 0.4rem;
}
.proj-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--fg-dim);
  margin-bottom: 1rem;
}
.proj-desc { color: var(--fg-dim); margin-bottom: 1rem; }
.proj-desc strong { color: var(--fg); }
.proj-stack {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--lime);
  letter-spacing: 0.05em;
}

/* ============ ABOUT ============ */
.about {
  padding: 8rem 3vw;
  max-width: 1500px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
}
.about-big {
  font-family: var(--syne);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.6vw, 3.2rem);
  line-height: 1.25;
  max-width: 22em;
  margin-bottom: 4.5rem;
}
.about-big em {
  font-style: normal;
  color: var(--lime);
}
.about-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}
.about-cols h4 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 0.8rem;
}
.about-cols p { color: var(--fg-dim); font-size: 0.95rem; }

/* ============ CONTACT ============ */
.contact {
  padding: 10rem 3vw 8rem;
  text-align: center;
  border-top: 1px solid var(--line);
}
.contact-h {
  font-family: var(--syne);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 7.5rem);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  margin-bottom: 3.5rem;
}
.cta {
  display: inline-block;
  font-family: var(--mono);
  font-size: clamp(0.85rem, 2vw, 1.15rem);
  color: var(--bg);
  background: var(--lime);
  text-decoration: none;
  padding: 1.4rem 3rem;
  border-radius: 100px;
  margin-bottom: 3.5rem;
  transition: box-shadow 0.3s ease;
  will-change: transform;
}
.cta:hover { box-shadow: 0 0 50px rgba(198, 242, 78, 0.35); }
.cta span { display: inline-block; }
.contact-links {
  display: flex;
  justify-content: center;
  gap: 3rem;
}
.contact-links a {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.25s ease;
}
.contact-links a:hover { color: var(--lime); }

/* ============ FOOTER ============ */
.footer {
  display: flex;
  justify-content: space-between;
  padding: 1.6rem 3vw;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}

/* ============ EXPERIENCE ============ */
.record {
  padding: 8rem 3vw;
  max-width: 1500px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
}
.record-h2, .skills-h2 {
  font-family: var(--syne);
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin-bottom: 3rem;
}
.rec-row {
  display: grid;
  grid-template-columns: 9rem 1.4fr 1fr auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.25s ease, padding-left 0.25s ease;
}
.rec-row:first-of-type { border-top: 1px solid var(--line); }
.rec-row:hover { background: rgba(198, 242, 78, 0.05); padding-left: 1.2rem; }
.rec-date { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--lime); }
.rec-role { font-family: var(--syne); font-weight: 600; font-size: 1.1rem; }
.rec-org { color: var(--fg-dim); font-size: 0.95rem; }
.rec-what { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; color: var(--fg-dim); text-align: right; text-transform: uppercase; }

/* ============ SKILLS ============ */
.skills {
  padding: 8rem 3vw;
  max-width: 1500px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.skill-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.6rem;
  background: rgba(18, 20, 16, 0.6);
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.skill-card:hover { border-color: rgba(198, 242, 78, 0.45); transform: translateY(-4px); }
.skill-card h4 {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 1.1rem;
}
.skill-card h4::before { content: "// "; opacity: 0.5; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.skill-tags span {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.65rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.skill-card:hover .skill-tags span { color: var(--fg); }
.skill-tags span.hot { color: var(--lime); border-color: rgba(198, 242, 78, 0.4); }

/* ============ RAG CHAT ============ */
.rag-fab {
  position: fixed;
  right: 1.6rem;
  bottom: 1.6rem;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--bg);
  background: var(--lime);
  border: none;
  border-radius: 100px;
  padding: 0.9rem 1.5rem;
  box-shadow: 0 4px 30px rgba(198, 242, 78, 0.25);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, box-shadow 0.3s ease;
}
.rag-fab:hover { transform: translateY(-3px); box-shadow: 0 6px 40px rgba(198, 242, 78, 0.45); }
.rag-fab.hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }
.rag-fab-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bg);
  animation: blink 2.4s ease-in-out infinite;
}

.rag-panel {
  position: fixed;
  right: 1.6rem;
  bottom: 1.6rem;
  z-index: 210;
  width: min(400px, calc(100vw - 3.2rem));
  height: min(560px, calc(100svh - 6rem));
  display: flex;
  flex-direction: column;
  background: rgba(14, 16, 12, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(198, 242, 78, 0.3);
  border-radius: 14px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.rag-panel[hidden] { display: none; }
.rag-panel.open { opacity: 1; transform: translateY(0) scale(1); }

.rag-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.rag-title {
  font-family: var(--syne);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--lime);
}
.rag-sub { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; color: var(--fg-dim); }
.rag-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 30px; height: 30px;
  color: var(--fg-dim);
  font-size: 0.8rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.rag-close:hover { color: var(--lime); border-color: var(--lime); }

.rag-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 242, 78, 0.3) transparent;
}
.rag-msg {
  max-width: 88%;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.5;
}
.rag-msg.bot {
  align-self: flex-start;
  background: rgba(233, 236, 227, 0.05);
  border: 1px solid var(--line);
  color: var(--fg);
}
.rag-msg.user {
  align-self: flex-end;
  background: rgba(198, 242, 78, 0.12);
  border: 1px solid rgba(198, 242, 78, 0.35);
  color: var(--fg);
}
.rag-cites { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.rag-cites span {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--lime);
  border: 1px solid rgba(198, 242, 78, 0.3);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}
.rag-cites span::before { content: "⌕ "; }

.rag-steps {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.2rem;
}
.rag-step {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rag-step.done { color: var(--lime); }
.rs-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 0.8s ease-in-out infinite;
}
.rag-step.done .rs-dot { animation: none; }

.rag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.1rem 0.8rem;
}
.rag-chips button {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.35rem 0.8rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.rag-chips button:hover { color: var(--lime); border-color: rgba(198, 242, 78, 0.5); }

.rag-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
}
.rag-input input {
  flex: 1;
  background: rgba(233, 236, 227, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--fg);
  font-family: var(--archivo);
  font-size: 0.86rem;
}
.rag-input input:focus { outline: none; border-color: rgba(198, 242, 78, 0.5); }
.rag-input button {
  background: var(--lime);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  width: 42px;
  font-size: 1rem;
  transition: box-shadow 0.2s ease;
}
.rag-input button:hover { box-shadow: 0 0 18px rgba(198, 242, 78, 0.4); }
.rag-note {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  text-align: center;
  padding: 0 1.1rem 0.7rem;
}

/* ============ SCROLL REVEAL ============ */
.project, .about-big, .about-cols > div, .contact-h, .cta, .stat, .rec-row, .skill-card {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.in { opacity: 1 !important; transform: translateY(0) !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .project, .about-big, .about-cols > div, .contact-h, .cta, .stat, .rec-row, .skill-card { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  .work { grid-template-columns: 1fr; gap: 3rem; }
  .work-sticky { position: static; }
  .work-counter { display: none; }
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: none; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: none; }
  .about-cols { grid-template-columns: 1fr; gap: 2rem; }
  .skills-grid { grid-template-columns: 1fr; }
  .rec-row { grid-template-columns: 8rem 1fr; }
  .rec-org, .rec-what { grid-column: 2; text-align: left; }
}
@media (max-width: 640px) {
  .hero-h { font-size: clamp(2.2rem, 10vw, 3rem); }
  .hero-h .indent { padding-left: 3vw; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 2rem; }
  .nav nav { gap: 1.3rem; }
  .contact-links { flex-wrap: wrap; gap: 1.5rem; }
}
