/* =========================================================
   TOKENS
   ========================================================= */
:root {
  --bg: #000000;
  --bg-alt: #030303;
  --card: #0a0a0a;
  --card-hover: #0e0e0e;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ededed;
  --text-dim: #8c8c8c;
  --text-dimmer: #5c5c5c;
  --accent: #8a97ab;
  --accent-soft: rgba(138, 151, 171, 0.12);
  --accent-line: rgba(138, 151, 171, 0.35);
  --green: #7fae8e;
  --amber: #b79a6a;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --max: 1120px;
  --radius: 10px;
  --radius-sm: 6px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  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 { display: block; max-width: 100%; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }

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

:focus-visible {
  outline: 1px solid var(--accent-line);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   AMBIENT LAYERS
   ========================================================= */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%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");
}

.cursor-light {
  position: fixed;
  top: 0;
  left: 0;
  width: 500px;
  height: 500px;
  margin-left: -250px;
  margin-top: -250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(138, 151, 171, 0.05) 0%, rgba(138, 151, 171, 0) 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-1000px, -1000px);
  transition: transform 0.15s ease-out;
}

/* =========================================================
   LAYOUT HELPERS
   ========================================================= */
.section-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 2;
}

.section { padding: 120px 0; position: relative; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.section-lead {
  color: var(--text-dim);
  max-width: 560px;
  margin-bottom: 56px;
  font-size: 16px;
}

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

/* =========================================================
   REVEAL ANIMATION
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

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

.nav-link {
  font-size: 14px;
  color: var(--text-dim);
  position: relative;
  transition: color 0.25s var(--ease);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 22px;
}
.nav-toggle span {
  height: 1px;
  width: 100%;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding: 100px 0 110px;
  position: relative;
  z-index: 2;
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 60px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 12px;
  margin-bottom: 28px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(127, 174, 142, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}

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

.hero-title {
  font-size: clamp(42px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 18px;
}

.hero-tagline {
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.35;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

.hero-desc {
  color: var(--text-dim);
  max-width: 480px;
  margin-bottom: 36px;
  font-size: 15.5px;
}

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

.btn {
  font-size: 14px;
  font-weight: 500;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
  display: inline-block;
}

.btn-primary {
  background: var(--text);
  color: #000;
}
.btn-primary:hover { transform: translateY(-2px); background: #fff; }

.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--accent-line); background: var(--accent-soft); }

/* Terminal */
.terminal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.term-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.term-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dimmer);
  margin-left: 6px;
}

.terminal-body {
  padding: 24px 22px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 2;
}

.terminal-body .prompt { color: var(--accent); margin-right: 8px; }
.terminal-body .out { color: var(--text-dim); margin-bottom: 6px; }
.terminal-body p { white-space: pre; }
.terminal-body .cols {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  white-space: normal;
}
.mono-dim { color: var(--text-dimmer) !important; }

.caret {
  display: inline-block;
  color: var(--accent);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.terminal-mini { max-width: 480px; }

/* =========================================================
   ABOUT
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: start;
}

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

.about-cards {
  display: grid;
  gap: 14px;
}

.about-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.about-card:hover {
  border-color: var(--border-strong);
  transform: translateX(4px);
}

.about-card-index {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dimmer);
  margin-bottom: 10px;
}

.about-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.about-card p {
  font-size: 14px;
  color: var(--text-dim);
}

/* =========================================================
   TECH GRID
   ========================================================= */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tech-card {
  background: var(--card);
  padding: 26px;
  display: flex;
  gap: 16px;
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}
.tech-card:hover {
  background: var(--card-hover);
  transform: translateY(-3px);
}

.tech-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  opacity: 0.9;
  filter: grayscale(15%);
}

.tech-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.tech-info h3 {
  font-size: 15px;
  font-weight: 600;
}

.tech-info p {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tag-comfortable { color: var(--green); border-color: rgba(127, 174, 142, 0.35); background: rgba(127, 174, 142, 0.08); }
.tag-working { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tag-learning { color: var(--amber); border-color: rgba(183, 154, 106, 0.4); background: rgba(183, 154, 106, 0.08); }

/* =========================================================
   SECURITY
   ========================================================= */
.security-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.security-copy p {
  color: var(--text-dim);
  font-size: 15.5px;
  margin-bottom: 16px;
}

.security-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin-top: 24px;
}

.security-list li {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  padding-left: 16px;
  position: relative;
}
.security-list li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* =========================================================
   PROJECTS
   ========================================================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease);
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
}

.project-preview {
  height: 140px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(var(--bg-alt), var(--bg-alt)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 14px);
}

.preview-glyph {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 700;
  color: var(--border-strong);
}

.project-body { padding: 24px; }

.project-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.project-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dimmer);
}

.project-category {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.project-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
}

.project-body > p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.project-tags span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
}

.project-links {
  display: flex;
  gap: 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.project-link {
  font-size: 13px;
  color: var(--text-dim);
  position: relative;
  transition: color 0.25s var(--ease);
}
.project-link:hover { color: var(--text); }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 40px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -33px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--text-dimmer);
}

.timeline-current .timeline-marker {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-content p {
  font-size: 14px;
  color: var(--text-dim);
}

/* =========================================================
   PHILOSOPHY
   ========================================================= */
.philosophy { padding: 100px 0; }
.philosophy .section-inner { text-align: center; }

.philosophy-quote {
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  max-width: 700px;
  margin: 0 auto;
}

/* =========================================================
   CONTACT
   ========================================================= */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.contact-card {
  background: var(--card);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}
.contact-card:hover {
  background: var(--card-hover);
  transform: translateY(-3px);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dimmer);
}

.contact-value {
  font-size: 14.5px;
  font-weight: 500;
  word-break: break-word;
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
}

.footer-tag {
  font-size: 13px;
  color: var(--text-dimmer);
}

.back-to-top {
  font-size: 13px;
  color: var(--text-dim);
  transition: color 0.25s var(--ease);
}
.back-to-top:hover { color: var(--text); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .security-inner { grid-template-columns: 1fr; gap: 40px; }
  .tech-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .section { padding: 80px 0; }
  .section-lead { margin-bottom: 40px; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
  }
  .nav-links.open { max-height: 260px; }
  .nav-link {
    padding: 16px 28px;
    width: 100%;
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle { display: flex; }

  .tech-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .security-list { grid-template-columns: 1fr; }

  .hero { padding: 60px 0 70px; }
  .hero-actions { width: 100%; }
  .btn { flex: 1; text-align: center; }
}
