/* ---------- Tokens ---------- */
:root {
  --bg: #0b0e14;
  --bg-elevated: #111520;
  --bg-card: #141926;
  --border: #232a3a;
  --border-hover: #333d54;
  --text: #e6e9f0;
  --text-muted: #8b92a5;
  --text-dim: #5c6479;
  --accent: #a78bfa;
  --accent-soft: rgba(167, 139, 250, 0.12);
  --accent-2: #7c3aed;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --max-width: 1080px;
}

/* ---------- Reset ---------- */
* { 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-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ---------- Background grid ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ---------- Layout helpers ---------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 96px 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 48px;
}

.section-num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
}

.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(11, 14, 20, 0.75);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.brand .dot { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a:hover { color: var(--text); }

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.nav-links a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 24px 80px;
  min-height: 70vh;
  display: flex;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 10px;
}

.hero-role {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--text-muted);
  margin-bottom: 24px;
}

.accent { color: var(--accent); }

.hero-desc {
  max-width: 640px;
  color: var(--text-muted);
  font-size: 1.02rem;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 13px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #0b0e14;
}

.btn-primary:hover { transform: translateY(-2px); }

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

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

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: 20px;
}

.about-text {
  color: var(--text-muted);
  max-width: 760px;
  font-size: 1.02rem;
  text-align: justify;
}

.about-stats {
  display: flex;
  gap: 48px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

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

.skill-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 16px;
  color: var(--text);
}

.tag-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tag-list li {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.tag-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.tag-list.small {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list.small li {
  padding: 6px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tag-list.small li::before { display: none; }

/* ---------- Timeline ---------- */
.timeline-group {
  margin-bottom: 56px;
}

.timeline-group:last-child {
  margin-bottom: 0;
}

.timeline-group-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 28px;
}

.timeline {
  position: relative;
  padding-left: 32px;
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 48px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -37px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.timeline-content h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 8px 0 10px;
}

.timeline-content p {
  color: var(--text-muted);
  max-width: 640px;
  font-size: 0.95rem;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.project-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, var(--bg-elevated), var(--bg-elevated) 10px, var(--border) 10px, var(--border) 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

img.project-image {
  aspect-ratio: auto;
  height: auto;
}

.project-head h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.35;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  flex: 1;
}

.project-more {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

/* ---------- Contact ---------- */
.contact-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
}

.contact-box > p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 180px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.contact-link:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.contact-value {
  font-size: 0.92rem;
  color: var(--text);
}

/* ---------- Project detail page ---------- */
.back-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.back-link:hover { color: var(--accent); }

.project-detail {
  max-width: 760px;
}

.project-detail h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  margin: 14px 0 20px;
  line-height: 1.15;
}

.project-detail .tag-list.small {
  margin-bottom: 32px;
}

.project-hero-image {
  width: 100%;
  aspect-ratio: 16 / 7;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(45deg, var(--bg-elevated), var(--bg-elevated) 12px, var(--border) 12px, var(--border) 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 48px;
  border: 1px solid var(--border);
}

img.project-hero-image {
  aspect-ratio: auto;
  height: auto;
}

img.project-hero-image,
.compare-item img {
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

img.project-hero-image:hover,
.compare-item img:hover {
  opacity: 0.88;
}

/* ---------- Lightbox ---------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(6, 8, 13, 0.92);
  cursor: zoom-out;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.lightbox-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Before / after comparison ---------- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.compare-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compare-item img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.compare-item figcaption {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-align: center;
}

@media (max-width: 640px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

.detail-block {
  margin-bottom: 36px;
}

.detail-block h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.detail-block p {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 68ch;
  text-align: justify;
}

.detail-block p + p {
  margin-top: 16px;
}

.detail-block strong {
  color: var(--text);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 20px 24px;
    gap: 18px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .hero { min-height: auto; padding: 80px 24px 60px; }

  .section { padding: 64px 24px; }

  .contact-box { padding: 32px 20px; }
}
