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

:root {
  --bg: #0b0e14;
  --bg-alt: #0f1420;
  --bg-card: #131926;
  --bg-card-hover: #1a2233;
  --border: #232c3f;
  --text: #d7e0ee;
  --text-dim: #93a1b8;
  --accent: #ff7a45;
  --accent-2: #58c4ff;
  --green: #6dffa4;
  --yellow: #ffd66d;
  --purple: #b48cff;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: #0b0e14;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

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

/* ============ Nav ============ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}

.nav.scrolled {
  border-bottom-color: var(--border);
  background: rgba(11, 14, 20, 0.94);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.nav-logo-prompt {
  color: var(--green);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  position: relative;
}

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

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

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

.nav-cta {
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  padding: 6px 14px;
  border-radius: 8px;
}

.nav-cta:hover {
  background: var(--accent);
  color: #0b0e14 !important;
}

.nav-cta::after {
  display: none;
}

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

.nav-burger span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: 0.3s;
}

.nav-burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-burger.open span:nth-child(2) {
  opacity: 0;
}

.nav-burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============ Hero ============ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 45% at 50% -10%, rgba(88, 196, 255, 0.16), transparent),
    radial-gradient(ellipse 50% 40% at 85% 60%, rgba(255, 122, 69, 0.10), transparent),
    radial-gradient(ellipse 50% 40% at 15% 75%, rgba(180, 140, 255, 0.10), transparent);
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88, 196, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 196, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 75%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeUp 0.9s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.terminal {
  width: min(560px, 100%);
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: left;
  margin-bottom: 36px;
  font-family: var(--mono);
  font-size: 0.85rem;
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #161b27;
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot.r { background: #ff5f57; }
.dot.y { background: #febc2e; }
.dot.g { background: #28c840; }

.terminal-title {
  margin-left: auto;
  margin-right: auto;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.terminal-body {
  padding: 16px 18px 18px;
  min-height: 148px;
}

.t-line { color: var(--text-dim); }
.t-prompt { color: var(--green); }
.t-out { color: var(--text); margin: 2px 0 10px 0; }
.t-cursor {
  display: inline-block;
  color: var(--green);
  transition: opacity 0.2s;
}

.hero-name {
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--text) 40%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.hero-tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: var(--text-dim);
  margin-bottom: 26px;
  max-width: 640px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 32px;
}

.badge {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dim);
  transition: transform 0.2s, border-color 0.2s, color 0.2s;
}

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

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 26px;
}

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 12px 26px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
}

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

.btn-primary {
  background: var(--accent);
  color: #0b0e14;
  box-shadow: 0 8px 24px rgba(255, 122, 69, 0.35);
}

.btn-primary:hover {
  background: #ff8f63;
  box-shadow: 0 10px 30px rgba(255, 122, 69, 0.45);
}

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

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

.hero-meta {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: 14px;
  z-index: 2;
}

.scroll-hint span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  background: var(--accent);
  border-radius: 3px;
  animation: scrollDot 1.6s ease-in-out infinite;
}

@keyframes scrollDot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ============ Sections ============ */
.section {
  padding: 96px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
}

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

.title-text::after {
  content: '';
  display: inline-block;
  width: 100px;
  height: 1px;
  background: var(--border);
  margin-left: 18px;
  vertical-align: middle;
}

/* ============ About ============ */
.about-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text p {
  margin-bottom: 18px;
  color: var(--text-dim);
  font-size: 1.02rem;
}

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

.about-quote {
  margin: 26px 0;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
}

.quote-sub {
  display: block;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.88rem;
}

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  transition: transform 0.25s, border-color 0.25s;
}

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

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

.stat-label {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ============ Timeline ============ */
.timeline {
  position: relative;
  padding-left: 32px;
  max-width: 860px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2), var(--purple));
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
}

.timeline-marker {
  position: absolute;
  left: -32px;
  top: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 122, 69, 0.15);
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.timeline-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 122, 69, 0.5);
  box-shadow: var(--shadow);
}

.timeline-head {
  margin-bottom: 14px;
}

.timeline-head h3 {
  font-size: 1.12rem;
  font-weight: 700;
}

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

.timeline-date {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 6px;
}

.timeline-card ul {
  list-style: none;
  margin: 0 0 16px 0;
}

.timeline-card ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.timeline-card ul li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent-2);
}

.timeline-card ul li strong {
  color: var(--text);
}

/* ============ Tech chips ============ */
.tech-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-chips span {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  background: rgba(88, 196, 255, 0.08);
  border: 1px solid rgba(88, 196, 255, 0.22);
  padding: 4px 10px;
  border-radius: 6px;
}

/* ============ Projects ============ */
.sub-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 8px 0 22px;
  color: var(--text);
}

/* CivicSense spotlight */
.spotlight {
  background: var(--bg-card);
  border: 1px solid rgba(255, 122, 69, 0.35);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 56px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.spotlight::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--green));
}

.spotlight-flag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0b0e14;
  background: linear-gradient(90deg, var(--accent), #ffb347);
  padding: 5px 14px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.spotlight-body {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
}

.spotlight-main h3 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.spotlight-main p {
  color: var(--text-dim);
  font-size: 0.98rem;
  margin-bottom: 12px;
}

.spotlight-main p strong {
  color: var(--text);
}

.spotlight-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.spotlight-side {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.spotlight-side h4 {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.spotlight-side a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  color: var(--text);
  transition: background 0.2s;
}

.spotlight-side a:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.spotlight-side a b {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.spotlight-side a span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* openBatarangs spotlight */
.spotlight-openbatrangs {
  border-color: rgba(180, 140, 255, 0.45);
}

.spotlight-openbatrangs::before {
  background: linear-gradient(90deg, var(--purple), var(--accent-2), var(--green));
}

.cs-logo {
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(88, 196, 255, 0.35);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.ob-logo {
  max-width: 260px;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(180, 140, 255, 0.35);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.ob-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
}

.ob-badges span {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--purple);
  background: rgba(180, 140, 255, 0.08);
  border: 1px solid rgba(180, 140, 255, 0.28);
  padding: 5px 12px;
  border-radius: 999px;
}

.spotlight-video h4 {
  color: var(--accent);
}

.spotlight-video video {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
  margin-bottom: 10px;
}

.spotlight-video p {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.project-new {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #0b0e14;
  background: var(--green);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(88, 196, 255, 0.4);
  box-shadow: var(--shadow);
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-icon {
  font-size: 1.6rem;
}

.project-lang {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

.project-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.project-card h3 a {
  color: var(--text);
}

.project-card h3 a:hover {
  color: var(--accent);
}

.project-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  flex: 1;
}

.project-meta {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.project-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.projects-more {
  text-align: center;
}

/* ============ Skills ============ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 22px;
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.skill-group h4 {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.skill-group .tech-chips span {
  color: var(--text-dim);
  background: var(--bg-alt);
  border-color: var(--border);
}

.skill-group .tech-chips span:hover {
  color: var(--accent-2);
  border-color: var(--accent-2);
}

/* ============ Education ============ */
.edu-card {
  display: flex;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  max-width: 700px;
  align-items: flex-start;
}

.edu-icon {
  font-size: 2.2rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  line-height: 1;
}

.edu-card h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.edu-card p {
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* ============ Contact ============ */
.section-contact {
  text-align: center;
}

.section-contact .section-title {
  justify-content: center;
}

.contact-lead {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 620px;
  margin: 0 auto 36px;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 48px;
}

.books {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 620px;
  margin: 0 auto;
}

.books h4 {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--yellow);
  margin-bottom: 14px;
}

.book-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.86rem;
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  background: var(--bg-alt);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

.footer-mono {
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* ============ Reveal animation ============ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .spotlight-body {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .nav-links {
    position: fixed;
    top: 64px;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    padding: 24px 32px;
    gap: 20px;
    transform: translateX(100%);
    transition: transform 0.3s;
    align-items: flex-start;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-burger {
    display: flex;
  }

  .section {
    padding: 72px 0;
  }
}

@media (max-width: 520px) {
  .about-stats {
    grid-template-columns: 1fr 1fr;
  }

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

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

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
