/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #0b0906;
  --bg-alt: #141210;
  --surface: #141210;
  --border: rgba(255,255,255,0.08);
  --ink: #faf3e6;
  --ink-soft: rgba(250,243,230,0.65);
  --ink-faint: rgba(250,243,230,0.42);
  --accent: #f5a623;
  --accent-ink: #0b0906;
  --accent-soft: rgba(245,166,35,0.15);
  --accent-2: #f5a623;
  --accent-2-soft: rgba(245,166,35,0.15);
  --accent-muted: #c97b1f;
  --highlight: #f5a623;
  --highlight-soft: rgba(245,166,35,0.15);
  --pop: #f5a623;
  --pop-soft: rgba(245,166,35,0.15);
  --amber: #f5a623;
  --amber-deep: #c97b1f;
  --amber-glow: #ffcf7a;
  --cream: #faf3e6;
  --text-secondary: rgba(250,243,230,0.65);
  --border-subtle: rgba(255,255,255,0.08);
  --glow-amber: 0 0 24px rgba(245,166,35,0.35);
  --think: #7aa8ff;
  --act: #f5a623;
  --verify: #6bd48a;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.25);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 24px 48px -12px rgba(0,0,0,0.6);
  --maxw: 1120px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
}

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

/* subtle film-grain overlay for texture without going dark */
.noise-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: 0.025; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Nav
   ========================================================================== */
.nav-wrap {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,9,6,0.75);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 18px; padding-bottom: 18px;
}

.logo {
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em;
}
.logo .dot { color: var(--accent); }

.nav-links {
  display: flex; gap: 32px;
  font-size: 0.92rem; font-weight: 500; color: var(--ink-soft);
}
.nav-link { position: relative; padding: 4px 0; transition: color 0.2s ease; }
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link-resume-item { display: none; }
.nav-link-resume { color: var(--accent); font-weight: 700; }
.nav-link-resume:hover { color: var(--amber-glow); }
.nav-link.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--accent-2); border-radius: 2px;
}

.nav-toggle {
  display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: 0.3s; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { border-color: var(--border); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--ink-faint); }
.btn-nav {
  background: var(--accent); color: var(--bg); padding: 9px 18px; font-size: 0.85rem;
}
.btn-nav:hover { background: var(--amber-glow); color: var(--bg); box-shadow: var(--glow-amber); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding: 120px 32px 96px;
  overflow: hidden;
}

.hero-bg {
  position: absolute; inset: -15% -10% -10% -10%;
  background:
    radial-gradient(ellipse 50% 45% at 10% 15%, rgba(245,166,35,0.20), transparent 62%),
    radial-gradient(ellipse 50% 45% at 85% 80%, rgba(201,123,31,0.14), transparent 62%);
  filter: blur(50px);
  z-index: -1;
}

.hero-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center;
}

.hero-content { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }

/* ---- Hero code panel ---- */
.hero-code { min-width: 0; }

.code-window {
  background: rgba(20,18,16,0.85);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}

.code-titlebar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px; background: rgba(255,255,255,0.04); border-bottom: 1px solid var(--border);
}
.code-dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.code-filename {
  margin-left: 10px; font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-faint);
}

.code-body {
  margin: 0; padding: 22px 20px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.7; color: var(--ink);
}
.code-kw { color: var(--accent); font-weight: 600; }
.code-comment { color: var(--ink-faint); font-style: italic; }
.code-check { color: var(--verify); font-style: normal; font-weight: 700; }
.code-comment-think { color: var(--think); font-style: italic; }
.code-comment-act { color: var(--act); font-style: italic; }
.code-comment-verify { color: var(--verify); font-style: italic; }

.code-fn-think, .code-fn-act, .code-fn-verify { font-weight: 700; }
.code-fn-think { color: var(--think); }
.code-fn-act { color: var(--act); }
.code-fn-verify { color: var(--verify); }

.code-footer {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 20px; background: rgba(255,255,255,0.04); border-top: 1px solid var(--border);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ink);
  animation: status-pulse 1.8s ease-out infinite;
}
@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 rgba(250,243,230,0.4); }
  70% { box-shadow: 0 0 0 7px rgba(250,243,230,0); }
  100% { box-shadow: 0 0 0 0 rgba(250,243,230,0); }
}
.status-text { font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600; color: var(--ink); }
.status-metric { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); margin-left: auto; }
.c-think { color: var(--think); }
.c-act { color: var(--act); }
.c-verify { color: var(--verify); }

.hero-name {
  font-size: 1.15rem; font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em; margin-bottom: 10px;
}

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

.hero-title {
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.08;
  max-width: 900px;
  margin-bottom: 24px;
}
.highlight {
  color: var(--amber);
}
.cta-pop {
  color: var(--highlight);
}
.highlight-lg {
  font-weight: 800;
}

.hero-sub {
  font-size: clamp(1.02rem, 1.6vw, 1.2rem);
  color: var(--ink-soft); max-width: 640px; margin-bottom: 40px;
}

.hero-cta { display: flex; gap: 14px; margin-bottom: 72px; flex-wrap: wrap; }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 24px; width: 100%; max-width: 720px;
  padding-top: 40px; border-top: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.82rem; color: var(--ink-faint); }

/* ==========================================================================
   Sections (generic)
   ========================================================================== */
.section { padding: 48px 32px; }

.section-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700;
  color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--accent-soft); border: 1.5px solid var(--accent);
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 20px;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -0.025em;
  max-width: 1000px; margin-bottom: 48px;
}

/* ==========================================================================
   About
   ========================================================================== */
.about-text {
  font-size: 1.15rem; color: var(--ink-soft); line-height: 1.75;
  max-width: 820px;
}
.about-text strong { color: var(--ink); font-weight: 600; }

.about-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
.mini-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.mini-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.mini-card-tag { display: block; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--accent); margin-bottom: 12px; }
.mini-card p { font-size: 0.9rem; color: var(--ink-soft); }

/* ==========================================================================
   Skills strip
   ========================================================================== */
.skills-strip {
  border-top: 1px solid var(--border); max-width: 964px;
}
.skill-row {
  display: grid; grid-template-columns: 240px 1fr; gap: 24px; max-width: 964px;
  padding: 22px 0; border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.skill-cat {
  font-size: 1.05rem; font-weight: 700;
}
.skill-items {
  font-size: 0.92rem; color: var(--ink-soft); line-height: 1.8; max-width: 700px;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.78rem; font-weight: 500; color: var(--ink-soft);
  background: var(--bg-alt); border: 1.5px solid rgba(255,255,255,0.12);
  padding: 6px 12px; border-radius: 999px;
}

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 48px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute; left: -28px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent-muted); box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-bottom: 4px;
}
.timeline-head h3 { font-size: 1.12rem; font-weight: 700; }
.timeline-date {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint);
}
.timeline-org { font-size: 0.92rem; color: var(--accent-muted); font-weight: 400; font-style: italic; margin-bottom: 14px; }
.timeline-list { display: flex; flex-direction: column; gap: 10px; }
.timeline-list li {
  font-size: 0.95rem; color: var(--ink-soft); line-height: 1.6; padding-left: 18px; position: relative;
}
.timeline-list li::before {
  content: '→'; position: absolute; left: 0; color: var(--ink); font-weight: 600;
}

/* ==========================================================================
   Projects
   ========================================================================== */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.project-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.project-emoji {
  font-size: 1.6rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); border-radius: var(--radius-sm);
}
.project-links { display: flex; gap: 10px; }
.project-link {
  font-size: 0.82rem; font-weight: 600; color: var(--accent);
  border-bottom: 1px solid transparent;
}
.project-link:hover { border-color: var(--accent); }
.project-card h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.project-sub { font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 14px; }
.project-card > p:not(.project-sub) { font-size: 0.94rem; color: var(--ink-soft); line-height: 1.65; margin-bottom: 18px; }
.project-note { margin-top: 24px; font-size: 0.85rem; color: var(--ink-faint); font-style: italic; }

/* ==========================================================================
   Certifications
   ========================================================================== */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cert-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cert-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.cert-badge {
  width: 88px; height: 88px; min-width: 88px; object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.cert-card p { font-size: 0.9rem; font-weight: 500; line-height: 1.35; }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-section { text-align: center; }
.contact-section .section-title { margin-left: auto; margin-right: auto; }
.contact-sub { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 40px; margin-top: -24px; }
.contact-grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-bottom: 32px;
}
.contact-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 14px 26px; font-weight: 600; font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.contact-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); background: var(--accent-soft); }
.contact-icon { font-size: 1.1rem; }
svg.contact-icon { width: 18px; height: 18px; flex-shrink: 0; }
.contact-loc { color: var(--ink-faint); font-size: 0.9rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { border-top: 1px solid var(--border); padding: 32px; }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
}
.footer p { font-size: 0.85rem; color: var(--ink-faint); }
.back-to-top { font-size: 0.85rem; font-weight: 600; color: var(--accent); }

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.reveal {
  opacity: 0; transform: translateY(22px) scale(0.98); filter: blur(4px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }

/* Staggered cascade for grouped cards/items — each sibling reveals slightly
   after the previous one, instead of all popping in at once. */
.about-cards > .reveal:nth-child(1), .skills-strip > .reveal:nth-child(1),
.timeline > .reveal:nth-child(1), .projects-grid > .reveal:nth-child(1),
.cert-grid > .reveal:nth-child(1) { transition-delay: 0s; }
.about-cards > .reveal:nth-child(2), .skills-strip > .reveal:nth-child(2),
.timeline > .reveal:nth-child(2), .projects-grid > .reveal:nth-child(2),
.cert-grid > .reveal:nth-child(2) { transition-delay: 0.08s; }
.about-cards > .reveal:nth-child(3), .skills-strip > .reveal:nth-child(3),
.timeline > .reveal:nth-child(3), .projects-grid > .reveal:nth-child(3),
.cert-grid > .reveal:nth-child(3) { transition-delay: 0.16s; }
.skills-strip > .reveal:nth-child(4), .timeline > .reveal:nth-child(4),
.projects-grid > .reveal:nth-child(4), .cert-grid > .reveal:nth-child(4) { transition-delay: 0.24s; }
.skills-strip > .reveal:nth-child(5), .cert-grid > .reveal:nth-child(5) { transition-delay: 0.3s; }
.skills-strip > .reveal:nth-child(6), .cert-grid > .reveal:nth-child(6) { transition-delay: 0.36s; }
.skills-strip > .reveal:nth-child(7), .cert-grid > .reveal:nth-child(7) { transition-delay: 0.42s; }
.skills-strip > .reveal:nth-child(8), .cert-grid > .reveal:nth-child(8) { transition-delay: 0.48s; }
.cert-grid > .reveal:nth-child(9) { transition-delay: 0.54s; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-code { order: 2; }
  .about-cards { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 180px 1fr; gap: 16px; }
  .projects-grid { grid-template-columns: 1fr; }
  .cert-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed; top: 64px; left: 0; right: 0; background: var(--bg);
    flex-direction: column; padding: 24px 32px; gap: 18px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-140%); transition: transform 0.3s ease;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-toggle { display: flex; }
  .nav-link-resume-item { display: block; }
  .btn-nav { display: none; }
  .skill-row { grid-template-columns: 1fr; gap: 6px; }
  .cert-grid { grid-template-columns: 1fr; }
  .hero { padding: 96px 24px 64px; }
  .section { padding: 64px 24px; }
  .container { padding-left: 24px; padding-right: 24px; }
}

/* ==========================================================================
   Sun intro
   ========================================================================== */
.hero-content, .hero-code {
  transition: opacity 0.7s ease, transform 0.7s ease;
}
html.intro-pending .hero-content,
html.intro-pending .hero-code {
  opacity: 0;
  transform: translateY(16px);
}

.intro-overlay {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; overflow: hidden;
}

.intro-overlay .sun {
  position: absolute;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--amber-glow), var(--amber) 55%, var(--amber-deep) 100%);
  box-shadow:
    0 0 30px 8px rgba(245,166,35,0.55),
    0 0 80px 30px rgba(245,166,35,0.25);
  left: -80px;
  top: 50%;
  transform: translateY(-50%);
  animation: sunRollIn 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes sunRollIn {
  0% {
    left: -80px; top: 50%; width: 46px; height: 46px;
    transform: translateY(-50%) rotate(0deg);
    opacity: 1;
  }
  55% {
    left: 50%; top: 50%; width: 280px; height: 280px;
    transform: translate(-50%, -50%) rotate(320deg);
  }
  75% {
    left: 50%; top: 50%; width: 250px; height: 250px;
    transform: translate(-50%, -50%) rotate(340deg);
  }
  100% {
    left: var(--sun-end-x, 50%); top: var(--sun-end-y, 40px);
    width: 14px; height: 14px;
    transform: translate(-50%, -50%) rotate(360deg);
    box-shadow:
      0 0 8px 3px rgba(245,166,35,0.7),
      0 0 20px 8px rgba(245,166,35,0.3);
  }
}

.intro-overlay .flash {
  position: absolute; inset: 0;
  background: var(--amber-glow);
  opacity: 0;
  animation: flashPulse 1.35s ease-out forwards;
}

@keyframes flashPulse {
  0%, 78% { opacity: 0; }
  86% { opacity: 0.9; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-overlay .sun, .intro-overlay .flash { animation: none; display: none; }
  html.intro-pending .hero-content,
  html.intro-pending .hero-code { opacity: 1; transform: none; }
}
