/* ═══════════════════════════════════════════
   XIU Portfolio — Shared Styles
   ═══════════════════════════════════════════ */

/* ─── Variables ─── */
:root {
  --bg: #07070b;
  --bg-surface: #0e0e15;
  --bg-card: #13131d;
  --bg-card-hover: #1a1a28;
  --border: #1e1e30;
  --border-hover: #2a2a44;
  --accent: #d4a016;
  --accent-dim: #b8891a;
  --accent-glow: rgba(212, 160, 22, 0.15);
  --accent-glow-strong: rgba(212, 160, 22, 0.3);
  --teal: #2dd4a8;
  --teal-dim: rgba(45, 212, 168, 0.12);
  --text: #e4e4ec;
  --text-secondary: #7e7e98;
  --text-dim: #55556a;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'Fira Code', monospace;
}

/* ─── Reset ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

a { color: inherit; text-decoration: none; }

/* ─── Navigation ─── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  background: rgba(7, 7, 11, 0.7);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s, background 0.4s;
}

nav.scrolled {
  border-bottom-color: var(--border);
  background: rgba(7, 7, 11, 0.92);
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-right { display: flex; align-items: center; gap: 1.5rem; }

.nav-links { display: flex; gap: 2rem; list-style: none; }

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.3s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width 0.3s;
}

.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.lang-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.1rem;
  display: flex;
  cursor: pointer;
  gap: 0;
}

.lang-btn {
  padding: 0.2rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}

.lang-btn.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-secondary);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

/* ─── Section Base ─── */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section-label::before {
  content: '';
  width: 32px; height: 1px;
  background: var(--accent);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.8rem;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s;
  cursor: pointer;
  border: none;
}

.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover {
  background: #e0ad1c;
  box-shadow: 0 0 30px var(--accent-glow-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ─── Tags ─── */
.tag {
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.tag.featured {
  background: var(--accent-glow);
  border-color: rgba(212, 160, 22, 0.2);
  color: var(--accent);
}

.tag.teal {
  background: var(--teal-dim);
  border-color: rgba(45, 212, 168, 0.2);
  color: var(--teal);
}

/* ─── Footer ─── */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.3s;
}

footer a:hover { color: var(--accent); }

/* ─── Reveal Animation ─── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible { opacity: 1; transform: translateY(0); }

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ─── Grain Overlay ─── */
.grain::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════
   Project Detail Pages
   ═══════════════════════════════════════════ */

/* ─── Breadcrumb ─── */
.breadcrumb {
  padding: 5.5rem 2rem 0;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.3s;
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb .sep { color: var(--border); }

.breadcrumb .current { color: var(--text-secondary); }

/* ─── Project Hero ─── */
.project-hero {
  padding: 3rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.project-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 1rem;
  border-radius: 100px;
  background: var(--accent-glow);
  border: 1px solid rgba(212, 160, 22, 0.25);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.project-hero-badge.live { background: var(--teal-dim); border-color: rgba(45, 212, 168, 0.25); color: var(--teal); }
.project-hero-badge.live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.project-hero-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.project-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.project-hero-tagline {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.project-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.project-hero-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-hero-stats {
  display: flex;
  gap: 3rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.project-hero-stats .stat {
  text-align: center;
}

.project-hero-stats .stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.project-hero-stats .stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
}

/* ─── Content Sections ─── */
.project-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.content-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.content-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

/* ─── Overview ─── */
.overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
  align-items: start;
}

.overview-prose p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 1.5rem;
}

.overview-prose p strong {
  color: var(--text);
  font-weight: 600;
}

.overview-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  position: sticky;
  top: 6rem;
}

.overview-sidebar h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-item {
  margin-bottom: 1.2rem;
}

.sidebar-item-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  margin-bottom: 0.3rem;
}

.sidebar-item-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.sidebar-item-value a {
  color: var(--accent);
  transition: color 0.3s;
}

.sidebar-item-value a:hover { color: #e0ad1c; }

/* ─── Feature Grid ─── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.feature-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── Tech Breakdown ─── */
.tech-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.2rem;
}

.tech-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.6rem;
}

.tech-group-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tech-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ─── Challenges / Story ─── */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.challenge-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.challenge-marker {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.challenge-marker.problem {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.challenge-marker.solution {
  background: var(--teal-dim);
  border: 1px solid rgba(45, 212, 168, 0.2);
  color: var(--teal);
}

.challenge-body h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.challenge-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ─── Blockquote ─── */
.content-quote {
  border-left: 3px solid var(--accent);
  padding: 1.2rem 1.5rem;
  margin: 2rem 0;
  background: var(--accent-glow);
  border-radius: 0 8px 8px 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.7;
}

.content-quote strong { color: var(--text); font-style: normal; }

/* ─── Back to Portfolio CTA ─── */
.back-cta {
  padding: 5rem 2rem;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.back-cta p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

/* ─── Related Projects ─── */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  transition: all 0.3s;
  display: block;
}

.related-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-3px);
}

.related-card-icon { font-size: 1.5rem; margin-bottom: 0.8rem; }

.related-card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.related-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-links { display: none; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: rgba(7, 7, 11, 0.96);
    backdrop-filter: blur(20px);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    gap: 1.2rem;
  }

  .nav-toggle { display: block; }

  .overview-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .overview-sidebar {
    position: static;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .challenge-card {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .project-hero-stats {
    flex-wrap: wrap;
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  .project-hero { padding: 2rem 1.2rem 3rem; }
  .project-content { padding: 0 1.2rem; }
  .breadcrumb { padding: 5.5rem 1.2rem 0; }

  .tech-breakdown {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }
}
