/* =========================
   Modern refresh (dark)
   ========================= */

/* Root Variables for Consistent Styling */
:root {
  --bg: #0b0f14;
  --panel: #101826;
  --panel-2: #0f1724;
  --border: rgba(255, 255, 255, 0.08);

  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);

  --accent: #4caf50; /* keep your existing green */
  --accent-2: #7c3aed; /* subtle secondary pop */
  --warn: #f59e0b;

  --radius: 18px;
  --radius-sm: 12px;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.25);

  --max: 1100px;
  --font: "Roboto", system-ui, -apple-system, Segoe UI, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(76, 175, 80, 0.16), transparent 60%),
    radial-gradient(1000px 600px at 95% 5%, rgba(124, 58, 237, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.section {
  padding: 80px 20px;
}

.section > * {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  display: block;
  width: 100%;
  text-align: center !important;
  justify-self: center;
  align-self: center;
  font-size: 1.9rem;
  margin: 0 0 30px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-title::after {
  content: "";
  display: block;
  width: 70px;
  height: 4px;
  margin: 14px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.9;
}

/* =========================
   Sticky Nav
   ========================= */
nav {
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(10px);
  background: rgba(10, 14, 20, 0.62);
  border-bottom: 1px solid var(--border);
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0;
  padding: 14px 16px;
}

nav ul li {
  margin: 0;
}

nav ul li a {
  text-decoration: none;
  font-size: 0.98rem;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
  outline: none;
}

nav ul li a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

nav ul li a.active {
  color: var(--text);
  background: rgba(76, 175, 80, 0.12);
  border: 1px solid rgba(76, 175, 80, 0.18);
}

/* =========================
   Hero
   ========================= */
.hero {
  position: relative;
  padding: 110px 20px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.65)),
    url("images/pcb-background.jpg");
  background-size: cover;
  background-position: center;
  filter: saturate(1.05) contrast(1.05);
  z-index: 0;
}

.hero::after {
  content: "";
  position: absolute;
  inset: -80px -80px auto -80px;
  height: 260px;
  background: radial-gradient(closest-side, rgba(76, 175, 80, 0.35), transparent 70%);
  z-index: 0;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  text-align: center;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.hero .highlight {
  background: linear-gradient(90deg, var(--accent), #b5ffb9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .subtitle {
  margin: 10px 0 0;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.86);
}

.hero .subline {
  margin: 6px 0 0;
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.72);
}

.hero-cta {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn.primary {
  background: linear-gradient(90deg, rgba(76, 175, 80, 0.25), rgba(124, 58, 237, 0.16));
  border-color: rgba(76, 175, 80, 0.22);
}

/* =========================
   About
   ========================= */
.about-container {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: center;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.about-image img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(76, 175, 80, 0.75);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  margin: 0 auto;
}

.about-content {
  color: var(--muted);
}

.about-content p {
  margin: 0 0 12px;
}

/* =========================
   Skills (proper grid)
   ========================= */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
}

.skill-item {
  position: relative;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 12px 10px;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--shadow-soft);
}

.skill-item:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.skill-item img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  transition: transform 0.15s ease;
}

.skill-item:hover img {
  transform: scale(1.08);
}

.tooltip {
  position: absolute;
  bottom: -10px;
  transform: translateY(100%);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  white-space: nowrap;
}

.skill-item:hover .tooltip {
  opacity: 1;
}

/* =========================
   Projects (real grid + cards)
   ========================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.project:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.project-image {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 14px;
}

.project-image img {
  /* Display the entire image without cropping */
  width: 100%;
  height: auto;
  max-height: 210px;
  object-fit: contain;
}

.project h3 {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.project p {
  margin: 0 0 14px;
  color: var(--muted);
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Compact card view: show teaser only (full content is shown in the modal clone) */
.project .project-details,
.project .project-result {
  display: none;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.project-actions .expand-btn {
  margin-top: 0;
}

.project ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.expand-btn {
  display: inline-flex;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.22);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.expand-btn:hover {
  transform: translateY(-2px);
  background: rgba(76, 175, 80, 0.22);
}

/* Make only the “See Code” links not trigger card modal open */
.project a.expand-btn {
  cursor: pointer;
}

/* =========================
   Modal Overlay (project details)
   ========================= */
.project-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  z-index: 2000;
  padding: 28px 16px;
  overflow-y: auto;
}

.project-overlay.active {
  display: block;
}

.project-content {
  max-width: 920px;
  margin: 0 auto;
  border-radius: var(--radius);
  background: rgba(14, 18, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  /* Limit modal height and allow internal scrolling */
  max-height: 80vh;
  overflow-y: auto;

  /* Dark scrollbar (Firefox) */
  scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

/* Dark scrollbar (WebKit: Chrome/Edge/Safari) */
.project-content::-webkit-scrollbar {
  width: 10px;
}

.project-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.project-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.06);
}

.project-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.30);
}

.close-btn {
  position: sticky;
  top: 10px;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.project-overlay .project-details {
  margin-top: 10px;
  color: var(--muted);
}

.project-overlay .project-details h3 {
  margin-top: 0;
  color: var(--text);
  font-size: 1.7rem;
}

.project-overlay .project-details p {
  color: var(--muted);
}

pre code {
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Prevent background scroll when modal open */
body.overlay-active {
  overflow: hidden;
}

/* =========================
   Contact
   ========================= */
.contact {
  text-align: center;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.contact p {
  color: var(--muted);
  margin-top: 0;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.contact a {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: transform 0.15s ease, background 0.15s ease;
}

.contact a:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
}

/* Footer */
footer {
  padding: 26px 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  border-top: 1px solid var(--border);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 980px) {
  .skills-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .about-container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .about-content {
    text-align: left;
  }
  .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .skill-item img {
    width: 64px;
    height: 64px;
  }
  .hero {
    padding: 95px 16px 70px;
  }
}

@media (max-width: 420px) {
  nav ul {
    gap: 10px;
    padding: 12px 10px;
  }
  nav ul li a {
    padding: 9px 10px;
    font-size: 0.95rem;
  }
  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .skill-item img {
    width: 58px;
    height: 58px;
  }
}
