/* =========================
   1. Reset & Base
========================= */
:root {
  --nav-height: 110px;
}

html {
    scroll-padding-top: var(--nav-height);
    scroll-behavior: smooth;
    overflow-x: hidden;
}

#pageLoader {
  position: fixed;
  inset: 0;
  background: #111;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: opacity 0.3s ease;
}

#pageLoader.hidden {
  opacity: 0;
  pointer-events: none;
}

body.loaded #pageLoader {
  opacity: 0;
  pointer-events: none;
}

body {
  margin: 0;
  padding-top: 80px;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: #0f172a;
  color: #e2e8f0;
  overflow-x: hidden;
}

h1, h2 {
    margin-bottom: 10px;
}


/* =========================
   2. Layout
========================= */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.6s ease;
}

/*Scroll Progress-bar*/
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;

    height: 3px;
    width: 0%;

    background: linear-gradient(to right, #00c6ff, #0072ff);

    z-index: 9999;

    transition: width 0.1s linear;
}

.section {
    width: 80%;
    max-width: 800px;
    margin: 15px;
    padding: 25px;
    border-radius: 10px;
    background: #1e293b;
    transition: transform 0.3s ease;
}

.section-content {
    transition: transform 0.3s ease;
}

.section-content:hover {
    transform: translateY(-3px);
}

/* =====================
   SECTION FOCUS SYSTEM
===================== */
section {
    box-sizing: border-box;
    padding-left: 1.5rem;
    padding-right: 1rem;
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

/* inactive sections */
section:not(.active-section) {
  opacity: 0.6;
  transform: scale(0.98);
}

/* active section */
section.active-section {
  opacity: 1;
  transform: scale(1);
  border-left: 8px solid;
}

/* =========================
   3. Navigation
========================= */
nav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;

    width: 100%;
    padding: 15px;

    display: flex;
    justify-content: center;
    gap: 20px;

    background: rgba(0, 0, 0, 0.95);
}

nav {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

nav.nav-scrolled {
  background-color: rgba(0, 0, 0, 0.85);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

nav a {
    position: relative;
    padding-bottom: 5px;

    color: #e2e8f0;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

nav a.active {
  color: #00c6ff;
  border-bottom: 2px solid #00c6ff;
}

nav a:hover {
    color: #38bdf8;
}

nav a::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;

    width: 0%;
    height: 3px;

    background: #38bdf8;
    transition: width 0.3s ease;
}

nav a:hover::before,
nav a.active::before {
    width: 100%;
}

/* =========================
   4. Buttons & Links
========================= */

button:focus,
a:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 2px #38bdf8;
}

button,
.details-btn,
#darkModeToggle,
#helloBtn {
  padding: 10px 15px;

  border: none;
  border-radius: 6px;

  background-color: #333;
  color: white;

  cursor: pointer;

  transition: transform 0.1s ease, box-shadow 0.1s ease;

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

#darkModeToggle:hover,
#helloBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.details-btn:hover {
  color: #38bdf8;
}

.project-actions .btn:hover,
.project-actions a:hover {
  color: #38bdf8;
}

button:active,
.details-btn:active,
#darkModeToggle:active,
#helloBtn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cta-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 15px;

  background: #38bdf8;
  color: black;
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;

  transition: transform 0.1s ease, box-shadow 0.1s ease;

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.cta-btn:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* =========================
   Button System (Unified)
========================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 36px;              /* fixed height = consistency */
  width: 100%; 
  min-width: 0;
  padding: 0 12px;           /* horizontal padding only */

  font-size: 13px;
  line-height: 1;

  border-radius: 6px;
  background: #1a1a1a;
  color: #ccc;

  border: none;
  text-decoration: none;
  cursor: pointer;

  box-sizing: border-box;
  vertical-align: middle;    /* fixes inline alignment issues */

  transition: 
    background 0.2s ease,
    transform 0.08s ease,
    box-shadow 0.08s ease;
}

/* Hover */
.btn:hover {
  background: #1f2937;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* Active */
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* =========================
   5. Hero
========================= */
/* Ensure hero is strong on load */
#hero {
    text-align: center;
    opacity: 1;
    transform: scale(1);
    border-radius: 10px;
}

.hero-tagline {
    opacity: 0.8;
    font-size: 1rem;
}

.hero-actions {
  display: flex;
  gap: 12px;        /* spacing between buttons */
  justify-content: center;  /* optional (center align) */
  margin-top: 10px; /* space from above content */
}

/* =========================
   6. Animations
========================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

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

.clicked {
  transform: translateY(1px) scale(0.97);
}

/* No_ scroll*/
.no-scroll {
  overflow: hidden;
  touch-action: none;
}

/* =========================
   7. Skills
========================= */
.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    width: 100%;
}

.skills-container div {
    text-align: center;
    padding: 10px 15px;

    background: #334155;
    border-radius: 6px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.skills-container div:hover {
    background: #38bdf8;
    color: black;
    transform: scale(1.05);
}


/* =========================
   8. Projects
========================= */
#projects {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.project-subtitle {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 6px;
}

.project-card {
    margin-top: 25px;
    margin-bottom: 15px;
    padding: 1.2rem;

    background: #435875;
    border-radius: 10px;

    transition: transform 0.2s ease, box-shadow 0.2s ease;

    cursor: default;
}

.project-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
  cursor: pointer;
}

.project-card:active {
    transform: scale(0.98);
}

.project-desc {
    margin: 8px 0;
    font-size: 0.95rem;
}

.project-details {
    max-height: 0;
    overflow: hidden;

    transition: max-height 0.3s ease;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}

.project-details-list {
  margin: 10px 0;
  padding-left: 18px;
  font-size: 14px;
}

.project-details.show {
  max-height: 2000px;
}

.tech-label {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 8px;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.project-tech span {
  font-size: 11px;
  background: #1a1a1a;
  padding: 4px 6px;
  border-radius: 6px;
  color: #888;
}

.project-note {
    font-size: 0.8rem;
    opacity: 0.6;
}

/* =========================
   Project Actions (NEW)
========================= */

.project-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-items: stretch;
  justify-items: stretch;
  overflow: hidden;
  margin-top: 12px;
  padding: 4px 0;
}

.project-actions a,
.project-actions button {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #1a1a1a;
  color: #ccc;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.1s ease;
}

.project-actions a:hover,
.project-actions button:hover {
  background: #2a2a2a;
}

.project-actions a:hover {
  color: #38bdf8;
}

.project-actions a:active,
.project-actions button:active {
  transform: scale(0.96);
}

.hidden {
    display: none;
}

/* project meta*/

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 12px;
  opacity: 0.8;
}

.project-meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #222;
  color: #aaa;
}

.status.live {
  color: #4ade80;
}

.status.wip {
  color: #facc15;
}

.status.completed {
  color: #60a5fa;
}

/* ===================
   PROJECT FEATURE
=====================*/

.project-features {
  margin: 10px 0;
  padding-left: 16px;
  font-size: 13px;
}

.project-features li {
  margin-bottom: 4px;
}

/* =========================
   Preview
========================= */

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

.preview-modal.active {
  opacity: 1;
  visibility: visible;
}

.preview-modal.active .preview-content {
  opacity: 1;
  transform: scale(1);
}

.preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
    opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;

  z-index: 1;
}

.preview-btn {
  background: #0ea5e9;
  color: white;
  font-weight: 600;              /* 🔥 stronger presence */
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  transform: translateY(0);
  cursor: pointer;
}

.project-actions .preview-btn:hover {
  background: #0284c7;
  box-shadow: 0 6px 16px rgba(14,165,233,0.35);
  transform: translateY(-1px);
  color: #fff;
}

.preview-modal.active .preview-overlay {
  opacity: 1;
}

.preview-content {
  position: relative;

  width: 90%;
  max-width: 900px;
  height: 80vh;

  background: #111;
  border-radius: 10px;
  overflow: hidden;

  margin: auto; /* ✅ THIS fixes centering */

  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease;

  z-index: 2;
  will-change: transform, opacity;
}

.preview-content iframe {
  width: 100%;
  height: 100%;
  border: none;
    opacity: 0;
  transition: opacity 0.2s ease;
}

.preview-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 24px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

.preview-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111;
  z-index: 2;

  transition: opacity 0.2s ease;
}

.preview-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  opacity: 0.6;
}

.preview-loader.hidden {
  display: none;

  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #444;
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #111;
  color: white;
}

.preview-fallback a {
  margin-top: 10px;
  padding: 8px 12px;
  background: #38bdf8;
  color: black;
  border-radius: 6px;
  text-decoration: none;
}

.preview-fallback.hidden {
  display: none;
}

.preview-content iframe.loaded {
  opacity: 1;
}

/* Security */
#security {
  min-height: 70vh;
}

.security-points {
  margin-top: 10px;
  padding-left: 18px;
  font-size: 14px;
}

.security-points li {
  margin-bottom: 6px;
}

.project-security {
  margin-top: 10px;
  font-size: 13px;
 /*color: #9ca3af;*/
}

.project-security ul {
  padding-left: 16px;
  margin-top: 4px;
}

/* =========================
   9. Footer
========================= */
footer {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    background: #1e293b;
}


/* =========================
   10. Dark Mode
========================= */
body.dark {
    background-color: #121212;
    color: #39FF14;
}

body.dark .cta-btn {
    color: #39FF14;
}

body.dark .section {
    background: #1e1e1e;
}

body.dark .cta-btn,
body.dark .skills-container div,
body.dark .project-card {
    background: #2a2a2a;
}

body.dark .cta-btn:hover,
body.dark .skills-container div:hover,
body.dark .project-card:hover {
    color: #ffffff;
}

body.dark footer {
  background-color: black;
}

/* =========================
   15. RESPONSIVE (FULL - RESTORED)
========================= */

@media (max-width: 600px) {

  :root {
    --nav-height: 80px;
  }

  body {
    padding-top: 100px;
  }

  /* NAVBAR (IMPORTANT FOR MOBILE SCROLL) */
  nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px;
    scroll-padding-right: 20px;
  }

  nav a {
    flex: 0 0 auto;
  }

  nav a:last-child {
    margin-right: 20px;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  /* SECTION SPACING */
  section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .section {
    width: 95%;
    margin: 10px 0;
  }

  section.active-section {
    border-left: none;
    border-top: 3px solid white;
  }

  /* HERO STACKING */
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  /* SKILLS STACK */
  .skills-container {
    grid-template-columns: 1fr;
  }

  /* PROJECT BUTTONS STACK */
  .project-actions {
    grid-template-columns: 1fr;
  }

  /* PREVIEW FIX */
  .preview-content {
    width: 95%;
    height: 75vh;
  }
}