/* ==========================================================================
   Kabilan | Portfolio — Dark Theme
   Concept: instrument panel / oscilloscope readout — a nod to EE roots
   and Python automation work. Monospace "telemetry" headers, a phosphor
   signal-green accent, and a scope-dial frame around the hero portrait.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg: #0a0e14;
  --bg-elevated: #0d131b;
  --surface: #121a24;
  --surface-hover: #16202c;

  /* Lines */
  --border: #212d3a;
  --border-strong: #2e3d4d;

  /* Text */
  --text: #e7eef5;
  --text-muted: #93a4b5;
  --text-faint: #57697b;

  /* Signal accent (oscilloscope trace) + secondary (copper / warning LED) */
  --accent: #5eeecb;
  --accent-dim: #3ba98d;
  --accent-glow: rgba(94, 238, 203, 0.35);
  --accent-2: #ff9d52;
  --accent-2-glow: rgba(255, 157, 82, 0.3);

  /* Type */
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --container-w: 1100px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint circuit-grid backdrop across the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(94, 238, 203, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 238, 203, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 0%, transparent 70%);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Shared "telemetry" section eyebrow, e.g. "// About", "$ skills" */
section > .container > h2 {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
}

section > .container > h2::before {
  content: "//";
  color: var(--accent);
  font-weight: 700;
}

section > .container > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.nav-brand::before {
  content: "> ";
  color: var(--accent);
}

.nav-brand::after {
  content: "_";
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.nav-menu {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar {
  display: none;
}

.nav-menu li {
  flex-shrink: 0;
}

.nav-menu a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-menu a:hover {
  color: var(--accent);
  background: var(--surface);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 80px;
  position: relative;
}

.hero-container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Scope-dial frame around the portrait */
.hero-image {
  position: relative;
  width: 286px;
  height: 286px;
  margin-bottom: 36px;
  border-radius: 50%;
  padding: 10px;
  background:
    repeating-conic-gradient(
      var(--border-strong) 0deg 2deg,
      transparent 2deg 18deg
    );
  animation: rotate-ticks 60s linear infinite;
}

@keyframes rotate-ticks {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hero-image::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid var(--border);
  animation: none;
}

.hero-image img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 32px var(--accent-glow);
  animation: rotate-ticks-reverse 60s linear infinite;
}

@keyframes rotate-ticks-reverse {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

.hero h1 {
  font-family: var(--font-mono);
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}

.hero h1 .highlight {
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--text-muted);
  max-width: 560px;
  font-family: var(--font-mono);
}

.hero-subtitle:nth-of-type(1) {
  margin-top: 18px;
  color: var(--text);
}

.hero-subtitle:nth-of-type(2) {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.hero-buttons {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 13px 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #04120e;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ==========================================================================
   About
   ========================================================================== */

.about {
  padding: 100px 0;
  border-top: 1px solid var(--border);
}

.about-content {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: start;
}

.about-text p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 60ch;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.stat h3 {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  color: var(--accent);
  font-weight: 700;
}

.stat p {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ==========================================================================
   Skills
   ========================================================================== */

.skills {
  padding: 100px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.skill-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  position: relative;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.skill-category:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}

/* corner-bracket accent, instrument-panel style */
.skill-category::before,
.skill-category::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.skill-category::before {
  top: 8px;
  left: 8px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.skill-category::after {
  bottom: 8px;
  right: 8px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}

.skill-category:hover::before,
.skill-category:hover::after {
  opacity: 1;
}

.skill-category h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.skill-category h3 i {
  color: var(--accent);
  font-size: 0.9rem;
}

.skill-category ul li {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 6px 0;
  position: relative;
  padding-left: 18px;
}

.skill-category ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-2);
}

/* ==========================================================================
   Projects
   ========================================================================== */

.projects {
  padding: 100px 0;
  border-top: 1px solid var(--border);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-dim);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.project-card h3 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.project-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  min-height: 66px;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tech span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(94, 238, 203, 0.08);
  border: 1px solid rgba(94, 238, 203, 0.25);
  padding: 4px 10px;
  border-radius: 4px;
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact {
  padding: 100px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.contact-content {
  display: flex;
  justify-content: center;
}

.contact-info {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 28px;
  min-width: 200px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.contact-item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.contact-item i {
  font-size: 1.4rem;
  color: var(--accent);
}

.contact-item h4 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  padding: 36px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

.social-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 16px;
}

.social-links a {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.social-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .about-content {
    grid-template-columns: 1fr;
  }

  .stats {
    max-width: 460px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .nav-container {
    padding: 0 16px;
    height: 56px;
  }

  .nav-brand {
    font-size: 0.82rem;
  }

  .nav-menu a {
    padding: 6px 10px;
    font-size: 0.82rem;
  }

  section > .container > h2 {
    margin-bottom: 32px;
  }

  .hero {
    padding: 100px 0 60px;
  }

  .hero-image {
    width: 140px;
    height: 140px;
  }

  .about, .skills, .projects, .contact {
    padding: 64px 0;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-card p {
    min-height: 0;
  }

  .contact-item {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-image,
  .hero-image img,
  .nav-brand::after {
    animation: none;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}