/* ============================
   RESET & CUSTOM PROPERTIES
   ============================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0f;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(0,255,136,0.3);
  --accent: #00ff88;
  --accent-dim: rgba(0,255,136,0.15);
  --secondary: #00ccff;
  --text: #e4e4e7;
  --text-dim: #8b8b94;
  --text-heading: #ffffff;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code','Fira Code','JetBrains Mono','Consolas',monospace;
  --focus-color: #00ff88;
  --radius: 0.75rem;
  --nav-h: 3.75rem;
}

/* ============================
   FOCUS & ACCESSIBILITY
   ============================ */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 2px; }

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

/* ============================
   SKIP LINK
   ============================ */
.skip-link {
  position: absolute; top: -100%; left: 0;
  padding: 0.75rem 1.5rem; background: var(--accent);
  color: var(--bg); font-weight: 700; z-index: 10000;
  text-decoration: none; font-family: var(--font-body);
}
.skip-link:focus-visible { top: 0; outline-offset: -3px; }

/* ============================
   REDUCED MOTION
   ============================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================
   BASE
   ============================ */
html {
  font-size: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 15% 30%, rgba(0,255,136,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 70%, rgba(0,204,255,0.04) 0%, transparent 55%);
  z-index: -1; pointer-events: none;
}

/* ============================
   CODE RAIN CANVAS
   ============================ */
#rain-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  opacity: 0.055;
}

/* ============================
   CUSTOM CURSOR
   ============================ */
.cursor {
  position: fixed;
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  mix-blend-mode: screen;
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(0,255,136,0.4);
}
.cursor--hidden { opacity: 0; }
.cursor--hover {
  width: 36px; height: 36px;
  background: transparent;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 15px rgba(0,255,136,0.3);
}
@media (pointer: coarse) { .cursor { display: none; } }

/* ============================
   PAGE TRANSITION
   ============================ */
.page-transition {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.page-transition.active {
  opacity: 1;
  pointer-events: all;
}
.page-transition__inner {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
}
.page-transition__logo {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: 0.1em;
  animation: glitch-flicker 0.08s infinite;
}
.page-transition__logo span { color: var(--accent); }
.page-transition__bar {
  width: 200px; height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.page-transition__progress {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.28s ease;
}

@keyframes glitch-flicker {
  0%, 100% { opacity: 1; transform: none; }
  33% { opacity: 0.85; transform: translateX(-1px); }
  66% { opacity: 0.9; transform: translateX(1px); }
}

/* ============================
   ICON UTILITY
   ============================ */
.ico { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.2em; flex-shrink: 0; }
.ico--lg { width: 2rem; height: 2rem; }
.ico--xl { width: 2.5rem; height: 2.5rem; }
.ico--accent { color: var(--accent); }
.ico--secondary { color: var(--secondary); }

/* ============================
   NAVIGATION
   ============================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 3rem);
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  overflow: visible;
}
.nav__logo {
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700;
  color: var(--text-heading); text-decoration: none;
  display: flex; align-items: center; gap: 0.5rem;
  cursor: none;
}
.nav__logo-accent { color: var(--accent); }
.nav__links { display: flex; list-style: none; gap: 0.25rem; }
.nav__link {
  color: var(--text-dim); text-decoration: none;
  padding: 0.4rem 0.85rem; border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: color 0.2s, background 0.2s;
  cursor: none;
}
.nav__link:hover, .nav__link:focus-visible { color: var(--text-heading); background: rgba(255,255,255,0.06); }
.nav__link[aria-current="page"] { color: var(--accent); }
.nav__toggle {
  display: none; background: none;
  border: 1px solid var(--border); border-radius: 0.375rem;
  padding: 0.35rem; color: var(--text); cursor: pointer;
}

@media (max-width: 48rem) {
  .nav__toggle { display: flex; align-items: center; cursor: pointer; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: rgba(10,10,15,0.97);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem; gap: 0;
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    z-index: 999;
    pointer-events: none;
    visibility: hidden;
  }
  .nav__links[data-open="true"] { transform: translateY(0); pointer-events: auto; visibility: visible; }
  .nav__link { padding: 0.75rem 1rem; font-size: 1rem; border-radius: 0.5rem; cursor: auto; }
}

/* ============================
   LAYOUT
   ============================ */
.container { width: 100%; max-width: 68rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem); }
section { padding: clamp(4rem, 8vw, 7rem) 0; position: relative; z-index: 1; }

/* ============================
   TERMINAL PROMPT
   ============================ */
.terminal-prompt {
  font-family: var(--font-mono); font-size: 0.8125rem;
  margin-bottom: 1rem; color: var(--text-dim);
  display: flex; flex-wrap: wrap; gap: 0; align-items: center;
}
.terminal-prompt__user { color: var(--accent); }
.terminal-prompt__sep { color: var(--text-dim); opacity: 0.5; }
.terminal-prompt__path { color: var(--secondary); }
.terminal-prompt__cmd { color: var(--text-dim); opacity: 0.6; }

/* ============================
   SECTION HEADER + GLITCH
   ============================ */
.section-header { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section-header__number {
  font-family: var(--font-mono); font-size: 0.8125rem;
  color: var(--accent); display: block; margin-bottom: 0.25rem;
}
.section-header__title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700; color: var(--text-heading); line-height: 1.2;
  position: relative; display: inline-block;
}
.section-header__title::before,
.section-header__title::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  color: var(--text-heading);
  opacity: 0; pointer-events: none;
}
.section-header__title:hover::before {
  color: var(--accent); opacity: 0.7;
  animation: glitch-top 0.35s steps(2) forwards;
}
.section-header__title:hover::after {
  color: var(--secondary); opacity: 0.5;
  animation: glitch-bot 0.35s steps(2) 0.05s forwards;
}
@keyframes glitch-top {
  0%   { clip-path: polygon(0 15%, 100% 15%, 100% 40%, 0 40%); transform: translateX(-4px); }
  25%  { clip-path: polygon(0 5%,  100% 5%,  100% 25%, 0 25%); transform: translateX(3px); }
  50%  { clip-path: polygon(0 30%, 100% 30%, 100% 55%, 0 55%); transform: translateX(-3px); }
  75%  { clip-path: polygon(0 10%, 100% 10%, 100% 30%, 0 30%); transform: translateX(2px); }
  100% { clip-path: polygon(0 0,   100% 0,   100% 0,   0 0);   opacity: 0; }
}
@keyframes glitch-bot {
  0%   { clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); transform: translateX(4px); }
  25%  { clip-path: polygon(0 70%, 100% 70%, 100% 90%, 0 90%); transform: translateX(-3px); }
  50%  { clip-path: polygon(0 50%, 100% 50%, 100% 75%, 0 75%); transform: translateX(3px); }
  75%  { clip-path: polygon(0 65%, 100% 65%, 100% 85%, 0 85%); transform: translateX(-2px); }
  100% { clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%); opacity: 0; }
}
.section-header__line {
  display: block; width: 3rem; height: 2px;
  background: var(--accent); margin-top: 0.75rem; border-radius: 1px;
}

/* ============================
   HERO
   ============================ */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding-top: var(--nav-h); position: relative; overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 3px,
    rgba(0,255,136,0.012) 3px, rgba(0,255,136,0.012) 4px
  );
  pointer-events: none; z-index: 0;
  animation: scanline-scroll 8s linear infinite;
}
@keyframes scanline-scroll {
  0%   { background-position: 0 0; }
  100% { background-position: 0 100px; }
}
.hero .container { position: relative; z-index: 1; }
.hero__inner { display: flex; flex-direction: column; gap: 1.5rem; max-width: 44rem; }
.hero__badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--accent-dim); border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--accent); width: fit-content;
  background: rgba(0,255,136,0.05);
}
.hero__badge-dot {
  width: 6px; height: 6px;
  background: var(--accent); border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.hero__title {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 800; line-height: 1.1; color: var(--text-heading);
}
.hero__title-accent { color: var(--accent); }
.hero__desc {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-dim); max-width: 36rem;
  line-height: 1.7; text-align: justify;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem; border-radius: 0.5rem;
  font-size: 0.9rem; font-weight: 600;
  text-decoration: none; border: none; cursor: none;
  font-family: var(--font-body);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
@media (pointer: coarse) { .btn { cursor: pointer; } }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--bg); }
.btn--primary:hover { box-shadow: 0 0 24px rgba(0,255,136,0.3), 0 0 48px rgba(0,255,136,0.1); }
.btn--outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--inline-fit { width: fit-content; margin-top: 0.5rem; }

/* ============================
   CARDS GRID + STAGGER
   ============================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 1.25rem;
}

/* ============================
   CARD (now <a> tags)
   ============================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  text-decoration: none; color: inherit;
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
  cursor: none;
  /* stagger via JS */
  opacity: 0; transform: translateY(24px);
}
@media (pointer: coarse) { .card { cursor: pointer; } }
.card.card--visible {
  opacity: 1; transform: translateY(0);
  transition: border-color 0.25s, background 0.25s,
    transform 0.45s cubic-bezier(0.22,1,0.36,1),
    box-shadow 0.25s, opacity 0.45s ease;
}
.card:hover, .card:focus-visible {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-5px);
  box-shadow: 0 8px 32px rgba(0,255,136,0.08), 0 0 0 1px rgba(0,255,136,0.1);
}
.card__icon-wrap {
  width: 2.75rem; height: 2.75rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0.5rem;
  background: var(--accent-dim); color: var(--accent);
}
.card__icon-wrap--blue { background: rgba(0,204,255,0.12); color: var(--secondary); }
.card__title { font-size: 1.1rem; font-weight: 700; color: var(--text-heading); }
.card__desc { font-size: 0.875rem; color: var(--text-dim); line-height: 1.6; flex-grow: 1; text-align: justify; }
.card__link-hint {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8125rem; font-family: var(--font-mono);
  color: var(--accent); margin-top: 0.25rem;
  transition: gap 0.2s;
}
.card:hover .card__link-hint { gap: 0.65rem; }

/* ============================
   ABOUT
   ============================ */
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem); align-items: start;
}
@media (max-width: 48rem) { .about-grid { grid-template-columns: 1fr; } }
.about__text { display: flex; flex-direction: column; gap: 1rem; }
.about__text p { color: var(--text-dim); font-size: 0.95rem; text-align: justify; }
.about__text p strong { color: var(--text-heading); }
.about__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.stat-card:hover {
  border-color: rgba(0,255,136,0.2);
  box-shadow: 0 4px 20px rgba(0,255,136,0.06);
}
.stat-card__value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.stat-card__label { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.15rem; }

/* ============================
   QUOTE BANNER
   ============================ */
.quote-banner {
  position: fixed; bottom: 1rem; right: 1rem;
  max-width: 22rem;
  padding: 0.75rem 1rem;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 0.5rem;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--text-dim); z-index: 900;
  transition: opacity 0.3s, transform 0.3s;
}
.quote-banner[hidden] {
  display: block; opacity: 0; transform: translateY(1rem); pointer-events: none;
}
.quote-banner__icon { color: var(--accent); margin-right: 0.35rem; }
@media (max-width: 30rem) { .quote-banner { right: 0.5rem; left: 0.5rem; max-width: none; } }

/* ============================
   CONTACT FORM
   ============================ */
.contact-grid {
  display: grid; grid-template-columns: 1fr 1.2fr;
  gap: clamp(1.5rem, 4vw, 3rem); align-items: start;
}
@media (max-width: 48rem) { .contact-grid { grid-template-columns: 1fr; } }
.contact__info { display: flex; flex-direction: column; gap: 1.25rem; }
.contact__info p { color: var(--text-dim); font-size: 0.95rem; text-align: justify; }
.contact__channels { display: flex; flex-direction: column; gap: 0.75rem; }
.contact__channel {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--text); text-decoration: none; font-size: 0.9rem;
  transition: color 0.2s; cursor: none;
}
@media (pointer: coarse) { .contact__channel { cursor: auto; } }
.contact__channel:hover { color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 1rem; }
.form__group { display: flex; flex-direction: column; gap: 0.3rem; }
.form__label { font-size: 0.8125rem; font-weight: 600; color: var(--text-dim); }
.form__input, .form__textarea {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 0.5rem; padding: 0.65rem 0.85rem;
  color: var(--text); font-family: var(--font-body); font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form__input:focus-visible, .form__textarea:focus-visible {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form__textarea { resize: vertical; min-height: 7rem; }
.form__select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b8b94' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}
.form__select option { background: #0a0a0f; color: #e4e4e7; }
.form__counter {
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-dim); text-align: right; margin-top: 0.2rem;
  transition: color 0.2s;
}
.form__counter--warn { color: #ffaa00; }
.form__counter--max  { color: #ff5555; }
.form__status { font-family: var(--font-mono); font-size: 0.8125rem; margin-top: 0.5rem; }
.form__status--success { color: var(--accent); }
.form__status--error { color: #ff5555; }

/* ============================
   FOOTER
   ============================ */
.footer { border-top: 1px solid var(--border); padding: 2.5rem 0; text-align: center; position: relative; z-index: 1; }
.footer__code { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text-dim); margin-bottom: 0.75rem; }
.footer__code span { color: var(--accent); }
.footer__copy { font-size: 0.75rem; color: var(--text-dim); opacity: 0.6; }
.footer__socials { display: flex; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
.footer__social {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--border); border-radius: 0.375rem;
  color: var(--text-dim); text-decoration: none;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: none;
}
@media (pointer: coarse) { .footer__social { cursor: auto; } }
.footer__social:hover { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px rgba(0,255,136,0.2); }

/* ============================
   BACK TO TOP
   ============================ */
.back-to-top {
  position: fixed; bottom: 1rem; left: 1rem;
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,15,0.85);
  border: 1px solid var(--border); border-radius: 0.5rem;
  color: var(--text-dim); text-decoration: none;
  z-index: 900; opacity: 0; transform: translateY(0.5rem);
  transition: opacity 0.3s, transform 0.3s, color 0.2s;
  pointer-events: none; cursor: none;
}
@media (pointer: coarse) { .back-to-top { cursor: pointer; } }
.back-to-top[data-visible="true"] { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { color: var(--accent); }

/* ============================
   FADE IN ANIMATION (section level)
   ============================ */
.fade-in {
  opacity: 0; transform: translateY(1.5rem);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in--visible { opacity: 1; transform: translateY(0); }
