/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:          #080b14;
  --bg-card:     #0d1117;
  --blue-dark:   #0a1628;
  --blue-mid:    #1d3461;
  --blue-accent: #2563eb;
  --blue-glow:   #3b82f6;
  --blue-sonic:  #0066cc;
  --gold:        #FFD700;
  --text:        #e2e8f0;
  --text-sub:    #94a3b8;
  --text-muted:  #475569;
  --border:      #1e293b;
  --font:        'Space Grotesk', sans-serif;
  --mono:        'JetBrains Mono', monospace;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar          { width: 5px; }
::-webkit-scrollbar-track    { background: var(--bg); }
::-webkit-scrollbar-thumb    { background: var(--blue-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-accent); }
::selection { background: rgba(37, 99, 235, 0.3); color: var(--text); }

/* ─── Navigation ─────────────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.4s, border-color 0.4s, padding 0.3s;
  animation: slideDown 0.7s ease both;
}
#navbar.scrolled {
  padding-block: 0.7rem;
  background: rgba(8, 11, 20, 0.85);
  border-color: var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#navbar nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--blue-glow);
  text-decoration: none;
  flex-shrink: 0;
}
.cursor { animation: blink 1.1s step-end infinite; color: var(--blue-accent); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.nav-links a:hover { color: var(--text); background: rgba(37, 99, 235, 0.08); }
.nav-links a[aria-current] {
  color: var(--text);
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
}
.nav-links a:focus-visible { outline: 2px solid var(--blue-glow); outline-offset: 2px; }
section[id], footer[id] { scroll-margin-top: 80px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
#navbar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#navbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
#navbar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  overflow: hidden;
  padding: 6rem 2rem 4rem;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  animation: floatOrb 12s ease-in-out infinite;
}
.orb-1 {
  width: 520px; height: 520px;
  background: rgba(37, 99, 235, 0.13);
  top: -160px; right: -120px;
}
.orb-2 {
  width: 360px; height: 360px;
  background: rgba(0, 102, 204, 0.09);
  bottom: 40px; left: -100px;
  animation-delay: -6s;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.07) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 15%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 15%, transparent 75%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  animation: fadeUp 0.9s ease 0.2s both;
}
h1 {
  font-size: clamp(3.5rem, 9vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f0f4ff 0%, #93c5fd 45%, #2563eb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.2rem;
  cursor: default;
  user-select: none;
  line-height: 1.1;
  transition: filter 0.3s;
}
h1:hover { filter: drop-shadow(0 0 24px rgba(59, 130, 246, 0.45)); }
.tagline {
  font-size: 1.25rem;
  color: var(--text-sub);
  line-height: 1.8;
}
.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  text-decoration: none;
  animation: bounce 2.2s ease-in-out infinite;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.scroll-indicator:hover { opacity: 0.75; }
.chevron {
  display: block;
  width: 20px; height: 20px;
  border-right: 2px solid var(--text-sub);
  border-bottom: 2px solid var(--text-sub);
  transform: rotate(45deg);
}

/* ─── Content sections ───────────────────────────────────────────────────── */
.content-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 0;
}
.content-section:last-of-type { padding-bottom: 6rem; }

/* ─── Section titles ─────────────────────────────────────────────────────── */
.page-title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.6rem;
  margin-top: 3rem;
}
.page-title:first-of-type { margin-top: 0; }

.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  margin-top: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-title:first-of-type { margin-top: 0; }
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

/* ─── About ──────────────────────────────────────────────────────────────── */
.about-text {
  font-size: 1.05rem;
  color: var(--text-sub);
  line-height: 1.9;
  max-width: 680px;
}

/* ─── Project list (original style) ─────────────────────────────────────── */
.project-list {
  list-style: disc;
  margin: 0 0 0 1.4rem;
  padding: 0;
}
.project-list li {
  margin: 6px 0;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
}
.project-list ul {
  list-style: circle;
  margin: 4px 0 4px 1.4rem;
  padding: 0;
}
.project-list ul li {
  font-size: 0.95rem;
  color: var(--text-sub);
}
.project-list a {
  color: #6ab0ff;
  text-decoration: none;
  transition: color 0.2s;
}
.project-list a:hover { color: var(--blue-glow); }
.project-list a:visited { color: #b48fff; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  margin-top: 5rem;
  border-top: 1px solid var(--border);
  padding: 3rem 2rem 4rem;
  text-align: center;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-eyebrow {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 1.5rem;
}
.social-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}
.social-link {
  color: var(--text-sub);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 2px;
}
.social-link::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 1px;
  background: var(--blue-accent);
  transition: width 0.3s ease;
}
.social-link:hover { color: var(--text); }
.social-link:not(.discord):hover::after { width: 100%; }
.social-link.discord { cursor: default; }

/* ─── Gallery ────────────────────────────────────────────────────────────── */
.gallery-row {
  margin-bottom: 2.5rem;
}
.gallery-row:last-of-type {
  margin-bottom: 0;
}
.gallery-caption {
  font-size: 1rem;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 0.9rem;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s, transform 0.2s;
  overflow: hidden;
}
.gallery-item:hover {
  border-color: var(--blue-mid);
  transform: translateY(-2px);
}
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.gallery-link {
  position: relative;
  display: block;
}
.gallery-link-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 11, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s, border-color 0.2s;
}
.gallery-link-icon svg {
  width: 14px;
  height: 14px;
}
.gallery-link:hover .gallery-link-icon {
  background: var(--blue-accent);
  border-color: var(--blue-accent);
}
.gallery-link-icon::after {
  content: attr(data-label);
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%) translateX(4px);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  background: rgba(8, 11, 20, 0.92);
  border: 1px solid var(--border);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.gallery-link:hover .gallery-link-icon::after,
.gallery-link:focus-visible .gallery-link-icon::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.gallery-item-caption {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-sub);
  text-align: center;
  padding: 0.5rem 0.4rem;
  line-height: 1.4;
}
.gallery-item:not(:has(img)) {
  aspect-ratio: 1 / 1;
}
.gallery-grid-certs {
  grid-template-columns: repeat(2, 1fr);
}
.gallery-grid-certs .gallery-item img,
.gallery-grid-certs .gallery-item:not(:has(img)) {
  aspect-ratio: 919 / 617;
}

/* ─── Lightbox ───────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 13, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  padding: 3rem;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}
.lightbox.open img {
  transform: scale(1);
}

/* ─── Scroll reveal ──────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ─── P3 Reload-style social link toast ──────────────────────────────────── */
.p3-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  width: 320px;
  max-width: calc(100vw - 2rem);
  transform: translateX(130%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(.22, 1, .36, 1), opacity 0.4s ease;
}
.p3-toast.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.p3-toast-panel {
  position: relative;
  background: linear-gradient(135deg, #0a1a3f 0%, #0d2a5e 55%, #123a7a 100%);
  border: 1px solid rgba(255, 215, 0, 0.45);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  padding: 1.15rem 1.35rem 1.25rem;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 215, 0, 0.06);
  overflow: hidden;
}
.p3-toast-stripe {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 215, 0, 0.16) 46%, rgba(255, 215, 0, 0.16) 51%, transparent 57%);
  pointer-events: none;
}
.p3-toast-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.p3-toast-close:hover { opacity: 1; }
.p3-toast-body { position: relative; }
.p3-toast-eyebrow {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.p3-toast-title {
  font-family: var(--font);
  font-weight: 700;
  font-style: italic;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: #fff;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
  text-shadow: 0 0 18px rgba(59, 130, 246, 0.5);
}
.p3-toast-sub {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.82);
  line-height: 1.55;
  margin-bottom: 1rem;
}
.p3-toast-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  color: #0a1a3f;
  background: var(--gold);
  text-decoration: none;
  padding: 0.5rem 1.05rem;
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
  transition: background 0.2s, transform 0.2s;
}
.p3-toast-link:hover {
  background: #ffe873;
  transform: translateX(2px);
}
@media (prefers-reduced-motion: reduce) {
  .p3-toast { transition: opacity 0.4s ease; }
}

/* ─── Keyframes ──────────────────────────────────────────────────────────── */
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0);    }
  50%       { transform: translateX(-50%) translateY(10px); }
}
@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0);       }
  33%       { transform: translate(30px, -25px); }
  66%       { transform: translate(-20px, 15px); }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #navbar, #navbar.scrolled { padding: 0.7rem 1.25rem; }
  #navbar.nav-open { background: rgba(8, 11, 20, 0.97); border-color: var(--border); }
  .nav-logo { font-size: 1rem; }
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0 1rem;
    background: rgba(8, 11, 20, 0.97);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
  }
  #navbar.nav-open .nav-links {
    max-height: 280px;
    padding-block: 0.6rem 0.9rem;
    opacity: 1;
  }
  .nav-links a { padding: 0.75rem 1rem; border-radius: 10px; }
  .hero { padding: 5rem 1.25rem 3rem; }
  .content-section { padding: 2rem 1.25rem 0; }
  .section-title { margin-top: 2.5rem; }
  .social-links { gap: 1.2rem; }
  footer { padding: 2.5rem 1.25rem 3rem; }
  .gallery-grid, .gallery-grid-certs { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .p3-toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
    transform: translateY(140%);
  }
  .p3-toast.open { transform: translateY(0); }
}

@media (min-width: 769px) and (max-width: 1000px) {
  #navbar { padding-inline: 1.5rem; }
  #navbar nav { gap: 1rem; }
  .nav-links a { padding-inline: 0.65rem; font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #navbar, .nav-links a { animation: none; transition: none; }
}
