/* ---------- Root Variables ---------- */
:root {
    --bg: #0d0d0d;
    --bg-soft: #121212;
    --panel: #1a1a1a;
    --text: #f3f3f3;
    --muted: #a0a0a0;
    --accent: #00ffff;
    --accent-dim: #00cccc;
    --shadow: rgba(0, 255, 255, 0.25);
    --radius: 12px;
    --radius-sm: 10px;
    --space: clamp(16px, 2vw, 28px);
    --font-main: "Inter", sans-serif;
    --font-display: "Playfair Display", serif;
  }
  
  /* ---------- Global ---------- */
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.6s ease;
  }
  body.loaded { opacity: 1; }
  
  img, video { max-width: 100%; display: block; }
  a { color: inherit; text-decoration: none; }
  
  /* ---------- Scroll progress bar ---------- */
  #progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--accent);
    z-index: 100;
  }
  
  /* ---------- Hero Section ---------- */
  .hero-section {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden; /* fix for arrow visibility */
    background: linear-gradient(180deg, #0f0f0f 0%, #101010 100%);
    z-index: 0;
  }
  
  .hero-overlay {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: float 6s ease-in-out infinite;
  }
  
  #particle-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
  }
  
  /* ---------- Hero Down Arrow ---------- */
  .cta-down {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50; /* ensures it's above everything */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: rgba(0, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
  }
  
  .cta-down svg {
    stroke: var(--accent);
    width: 32px;
    height: 32px;
    animation: arrow-float 2s ease-in-out infinite;
  }
  
  .cta-down:hover {
    background: rgba(0, 255, 255, 0.15);
    box-shadow: 0 0 14px var(--shadow);
  }
  
  @keyframes arrow-float {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(6px); opacity: 1; }
  }
  
  /* ---------- Logo + Tagline ---------- */
  .logo {
    font-family: var(--font-display);
    font-size: clamp(42px, 6vw, 72px);
    font-weight: 600;
    letter-spacing: 0.04em;
  }
  .tagline {
    color: var(--muted);
    margin-top: 0.5rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
  }
  
  /* ---------- Navbar ---------- */
  #navbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
    background: rgba(18, 18, 18, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: center;
    padding: 12px 0;
  }
  .nav-inner { display: flex; gap: 30px; align-items: center; }
  .nav-link {
    color: var(--muted);
    padding: 8px 6px;
    border-bottom: 2px solid transparent;
    transition: color 0.25s, border-color 0.25s;
    font-weight: 500;
  }
  .nav-link:hover, .nav-link.is-active {
    color: var(--accent);
    border-color: var(--accent);
  }
  
  /* ---------- Sections ---------- */
  .section-title {
    font-size: clamp(22px, 2.4vw, 32px);
    text-align: center;
    margin: calc(var(--space) * 1.2) 0 var(--space);
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.03em;
  }
  .portfolio-section {
    background: var(--bg-soft);
    padding: 0 10px var(--space);
  }
  
  /* ---------- Filter Bar ---------- */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: var(--space);
  }
  .filter-btn {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.25s;
  }
  .filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 8px var(--shadow);
  }
  .filter-btn.is-active {
    background: rgba(0, 255, 255, 0.08);
    border-color: var(--accent);
    color: var(--accent);
  }
  
  /* ---------- Portfolio Grid ---------- */
  /* ---------- Portfolio Grid (Aligned Layout) ---------- */
  .portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto var(--space);
  }
  
  /* Card Container */
  .card {
    background: var(--panel);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
  }
  
  .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px rgba(0, 255, 255, 0.25);
    border-color: var(--accent);
  }
  
  /* Subtle blue glow overlay */
  .card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 255, 255, 0.08);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: var(--radius-sm);
  }
  .card:hover::before {
    opacity: 1;
  }
  
  /* Media Section */
  .media-trigger {
    position: relative;
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    aspect-ratio: 16 / 9; /* makes all thumbnails same height */
    overflow: hidden;
  }
  
  .media-trigger img,
  .media-trigger video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, opacity 0.4s ease;
  }
  
  .card:hover .media-trigger img,
  .card:hover .media-trigger video {
    transform: scale(1.04);
    opacity: 0.95;
  }
  
  /* Title under video/image */
  .card-title {
    margin: 0;
    padding: 14px 12px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    transition: color 0.3s ease;
  }
  
  .card:hover .card-title {
    color: var(--accent);
  }
  
  
  /* ---------- Sketches Layout ---------- */
  /* ---------- Sketches Section (Aligned and Unified with Projects) ---------- */
  #sketches .portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto var(--space);
  }
  
  /* Each card now matches the project card style */
  #sketches .card {
    background: var(--panel);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  }
  
  /* Hover glow and movement */
  #sketches .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px rgba(0, 255, 255, 0.25);
    border-color: var(--accent);
  }
  
  /* Cyan glow overlay */
  #sketches .card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 255, 255, 0.08);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: var(--radius-sm);
  }
  #sketches .card:hover::before {
    opacity: 1;
  }
  
  /* Image Area - fixed aspect ratio for alignment */
  #sketches .card button {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
  }
  
  #sketches .card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, opacity 0.4s ease;
  }
  #sketches .card:hover img {
    transform: scale(1.04);
    opacity: 0.95;
  }
  
  /* Caption area */
  #sketches .card-caption {
    margin: 0;
    padding: 14px 12px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transition: color 0.3s ease;
  }
  #sketches .card:hover .card-caption {
    color: var(--accent);
  }
  
  
  /* ---------- About Section ---------- */
  .about-me-section {
    background: linear-gradient(180deg, #0f0f0f 0%, #121212 100%);
    padding: 0 10px var(--space);
  }
  .about-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    background: var(--panel);
    border-radius: var(--radius);
    padding: calc(var(--space) * 0.9);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }
  .about-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .about-image img {
    width: 260px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.25);
    transition: box-shadow 0.3s;
  }
  .about-image img:hover {
    box-shadow: 0 0 24px rgba(0, 255, 255, 0.4);
  }
  
  .resume-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
  }
  /* ---------- Unified Resume Buttons ---------- */
  .resume-button,
  .view-resume-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    height: 46px;
    border-radius: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
    color: var(--accent);
    border: 1px solid var(--accent);
    background: transparent;
    box-shadow: 0 0 0 transparent;
  }
  
  /* Default hover + focus states */
  .resume-button:hover,
  .view-resume-btn:hover,
  .resume-button:focus,
  .view-resume-btn:focus {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 12px var(--shadow);
    color: var(--accent);
  }
  
  /* Active (click) effect */
  .resume-button:active,
  .view-resume-btn:active {
    transform: scale(0.97);
    box-shadow: 0 0 6px var(--shadow);
  }
  
  
  /* ---------- Contact Form ---------- */
  .about-details { align-self: center; }
  #contact-form {
    display: grid;
    gap: 12px;
    margin-top: 12px;
  }
  #contact-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    color: var(--muted);
  }
  #contact-form input,
  #contact-form textarea {
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
  }
  .send-btn {
    background: var(--accent);
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.25s;
  }
  .send-btn:hover { background: var(--accent-dim); }
  
  #form-success {
    display: none;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(0, 255, 255, 0.15);
    color: var(--accent);
    font-weight: 600;
  }
  #form-success.show { display: block; }
  
  /* ---------- Resume Modal ---------- */
  #resumeModal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  #resumeModal.is-open {
    display: grid;
    opacity: 1;
  }
  #resumeModal iframe {
    width: 90vw;
    height: 85vh;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
  }
  #resumeModal.is-open iframe { display: block; }
  #resumeModal .close-resume {
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 28px;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    transition: 0.3s;
  }
  #resumeModal .close-resume:hover { color: var(--accent); }
  
  /* ---------- Footer ---------- */
  #footer {
    background: #0a0a0a;
    padding: 24px 10px;
    text-align: center;
  }
  .social-links {
    display: flex;
    gap: 10px;
    justify-content: center;
  }
  .social-links img {
    width: 38px;
    filter: invert(1);
    transition: transform 0.25s, filter 0.25s;
  }
  .social-links a:hover img {
    transform: scale(1.12);
    filter: drop-shadow(0 0 8px var(--shadow));
  }
  
  /* ---------- Media Modal ---------- */
  .modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    z-index: 50;
  }
  .modal.is-open { display: grid; }
  .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.25s;
  }
  .modal.is-open .modal-backdrop { opacity: 1; }
  .modal-content {
    position: relative;
    z-index: 1;
    width: min(92vw, 1000px);
    border-radius: 14px;
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px var(--shadow);
    padding: 14px;
  }
  #modal-stage {
    min-height: 50vh;
    display: grid;
    place-items: center;
  }
  #modal-stage img,
  #modal-stage video {
    max-width: 100%;
    max-height: 74vh;
    border-radius: 10px;
  }
  .modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
  }
  .modal-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
  }
  .modal-prev,
  .modal-next {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.25s;
  }
  .modal-prev:hover,
  .modal-next:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 8px var(--shadow);
  }
  .modal-info {
    margin-bottom: 14px;
    text-align: center;
    color: var(--text);
  }
  #modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
  }
  #modal-description {
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 10px;
    line-height: 1.5;
  }
  #modal-link {
    display: inline-block;
    margin-top: 4px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: underline;
  }
  #modal-link:hover {
    color: var(--accent-dim);
  }
  
  /* ---------- Responsive ---------- */
  @media (max-width: 900px) {
    .about-container {
      grid-template-columns: 1fr;
      text-align: center;
    }
    .about-image img { width: 200px; }
    .portfolio-grid { gap: 22px; }
  }
  @media (max-width: 600px) {
    .logo { font-size: 42px; }
    .cta-down {
      bottom: 24px;
      width: 48px;
      height: 48px;
    }
    .hero-overlay { padding: 0 12px; }
  }
  /* ---------- Smooth Fade-In Animation Optimization ---------- */
  .portfolio-grid .card {
    will-change: transform, opacity;
    transform-origin: center bottom;
  }
  .active-flash {
    box-shadow: 0 0 20px var(--shadow);
  }
  .view-more {
    display: inline-block;
    background: #00ffff;
    color: #000;
    padding: 12px 24px;
    border: 1px solid #00ffff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: 20px;
  }
  
  .view-more:hover {
    background: #00cccc;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
  }
  