/* ===== VARIABLES ===== */
:root {
  --bg: oklch(14% 0.008 220);
  --surface: oklch(21% 0.010 220);
  --surface-2: oklch(27% 0.012 220);
  --accent: oklch(72% 0.140 200);
  --accent-dim: oklch(72% 0.140 200 / 0.15);
  --accent-glow: oklch(72% 0.140 200 / 0.35);
  --text: oklch(92% 0.005 220);
  --muted: oklch(56% 0.010 220);
  --border: oklch(56% 0.010 220 / 0.15);
  --radius: 12px;
  --nav-height: 64px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===== NAV ===== */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-height);
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}

#nav.scrolled {
  background: oklch(12% 0.006 220 / 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

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

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s var(--ease-out);
}

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

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

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

/* ===== CONTAINER ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== ACCENT ===== */
.accent { color: var(--accent); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 0.25s var(--spring), box-shadow 0.2s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: oklch(10% 0.005 220);
  font-weight: 600;
}

.btn-primary:hover {
  background: oklch(82% 0.110 200);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 24px var(--accent-glow);
}

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

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.96) !important;
  transition-duration: 0.08s !important;
}

.btn-large {
  padding: 14px 32px;
  font-size: 1rem;
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.82rem;
}

.nav-cv-link {
  color: var(--accent) !important;
  font-weight: 600;
  border: 1px solid oklch(72% 0.140 200 / 0.4);
  padding: 4px 12px;
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s !important;
}

.nav-cv-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* ===== HERO ===== */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: var(--nav-height);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(oklch(72% 0.140 200 / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, oklch(72% 0.140 200 / 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid oklch(72% 0.140 200 / 0.2);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 24px;
}

.hero-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  background: oklch(94% 0.004 220);
  border-radius: 50%;
  box-shadow: 0 0 0 2px oklch(72% 0.140 200 / 0.5), 0 0 8px oklch(94% 0.004 220 / 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2px oklch(72% 0.140 200 / 0.5), 0 0 8px oklch(94% 0.004 220 / 0.6); }
  50% { opacity: 0.8; transform: scale(0.85); box-shadow: 0 0 0 3px oklch(72% 0.140 200 / 0.3), 0 0 14px oklch(94% 0.004 220 / 0.4); }
}

#hero h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 16px;
}

.hero-role {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--muted);
  margin-bottom: 20px;
  font-weight: 400;
  position: relative;
  overflow: hidden;
  height: 1.7em;
}

.hero-desc {
  max-width: 520px;
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 36px;
}

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

.hero-scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
}

.hero-scroll span {
  display: block;
  width: 2px;
  height: 60px;
  background: linear-gradient(to bottom, transparent, oklch(94% 0.004 220));
  box-shadow: 0 0 8px oklch(94% 0.004 220 / 0.6);
  border-radius: 2px;
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ===== SECTIONS ===== */
section { padding: 100px 0; }

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 48px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== FADE IN ===== */
.fade-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.fade-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== ABOUT ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 60px;
  align-items: start;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 1.05rem;
  line-height: 1.75;
}

.about-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.chip {
  padding: 5px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--spring);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.06);
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.about-card-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.about-card-line:last-of-type {
  padding-bottom: 0;
  border-bottom: none;
}

.about-card-line--top { align-items: flex-start; }
.label--top { padding-top: 2px; }
.about-value--right { text-align: right; line-height: 1.7; }
.about-card-btn { margin-top: 4px; }

.about-card-line .label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== PROJECTS ===== */
#projects { background: var(--surface); }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.project-card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 4px oklch(0% 0 0 / 0.25);
  transition: border-color 0.2s ease, transform 0.4s var(--spring), box-shadow 0.3s var(--ease-out), opacity 0.4s var(--ease-out);
}

.project-card.card-hidden {
  opacity: 0;
  transform: translateY(20px);
}

.project-card:hover {
  border-color: oklch(72% 0.140 200 / 0.4);
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 60px oklch(0% 0 0 / 0.45), 0 4px 16px oklch(0% 0 0 / 0.15);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.project-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.project-card--featured {
  background: var(--surface-2);
  border-top: 2px solid var(--accent);
  border-color: oklch(72% 0.140 200 / 0.35);
}

.project-card--live {
  border-top: 2px solid oklch(70% 0.160 145 / 0.5);
}

.project-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  flex-wrap: wrap;
}

.project-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.67rem;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-status--dev {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid oklch(72% 0.140 200 / 0.25);
}

.project-status--live {
  background: oklch(70% 0.160 145 / 0.12);
  color: oklch(70% 0.160 145);
  border: 1px solid oklch(70% 0.160 145 / 0.3);
}

.project-links {
  display: flex;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius);
  cursor: pointer;
}

.icon-link {
  color: var(--muted);
  transition: color 0.15s ease, transform 0.2s var(--spring);
  padding: 11px;
  margin: -11px;
  position: relative;
  z-index: 2;
}

.icon-link:hover { color: var(--accent); transform: scale(1.15); }

.project-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.project-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  padding: 3px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  border: 1px solid var(--accent-dim);
}

/* ===== CONTACT ===== */
.contact-container {
  text-align: center;
  max-width: 600px;
}

.contact-desc {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 36px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 32px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.15s ease, transform 0.2s var(--spring);
}

.social-link:hover { color: var(--accent); transform: translateY(-2px); }

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* ===== MOTION ===== */

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 200;
  animation: progress-fill linear both;
  animation-timeline: scroll(root);
}
@keyframes progress-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* View transitions */
@view-transition { navigation: auto; }
@keyframes vt-out { to { opacity: 0; translate: 0 -4px; } }
@keyframes vt-in { from { opacity: 0; translate: 0 6px; } }
::view-transition-old(root) { animation: 200ms ease-in vt-out; }
::view-transition-new(root) { animation: 350ms var(--ease-out) vt-in; }

/* Hero staggered entrance */
@keyframes hero-up {
  from { opacity: 0; translate: 0 22px; }
  to   { opacity: 1; translate: 0 0; }
}
.hero-tag     { animation: hero-up 0.65s var(--ease-out) 0.05s both; }
#hero h1      { animation: hero-up 0.65s var(--ease-out) 0.15s both; }
.hero-role    { animation: hero-up 0.65s var(--ease-out) 0.25s both; }
.hero-desc    { animation: hero-up 0.65s var(--ease-out) 0.35s both; }
.hero-actions { animation: hero-up 0.65s var(--ease-out) 0.45s both; }
.hero-scroll  { animation: hero-up 0.65s var(--ease-out) 0.60s both; }

/* Role cycling */
.role-item {
  position: absolute;
  left: 0;
  opacity: 0;
  transform: translateY(80%);
  white-space: nowrap;
  animation: role-cycle 9s ease-in-out infinite;
}
.role-item:nth-child(1) { animation-delay: 0.25s; }
.role-item:nth-child(2) { animation-delay: 3.25s; }
.role-item:nth-child(3) { animation-delay: 6.25s; }
@keyframes role-cycle {
  0%   { opacity: 0; transform: translateY(80%); }
  8%   { opacity: 1; transform: translateY(0); }
  28%  { opacity: 1; transform: translateY(0); }
  36%  { opacity: 0; transform: translateY(-80%); }
  100% { opacity: 0; transform: translateY(80%); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

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

@media (max-width: 640px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    flex-direction: column;
    gap: 20px;
  }

  .nav-links.open { display: flex; }

  .nav-toggle { display: flex; }

  section { padding: 72px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
