/* ===========================
   THEME & BASE
=========================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root{
    --bg: #000000;
    --text: #f4f4f4;
    --muted: #9aa3af;
    --card: #1e1e1e;
    --border: #1f2937;
    --accent: #a7f3d0; 
    /* Your blue */
    --brand:   #61dafb;
    --brand-2: #6ab7ff;

    /* Typography */
    --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  }
  
  *{ box-sizing: border-box; }
  html, body{ height: 100%; }
  
  body{
    margin: 0;
    font-family: var(--font-body);
    background: #03050a;
    color: var(--text);
  }

  h1,h2,h3,h4{
    font-family: var(--font-display);
    letter-spacing: .01em;
  }

  .type-display{
    font-family: var(--font-display);
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .type-subhead{
    font-family: var(--font-display);
    letter-spacing: .18em;
    text-transform: uppercase;
  }
  .type-mono{
    font-family: var(--font-mono);
  }
  
  /* Keep main content above particles */
  header, main, footer{
    position: relative;
    z-index: 1;
  }
  
  /* ===========================
     PARTICLES BACKGROUND
  =========================== */
  #particles-js{
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: transparent;
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: no-repeat;
  }
  
  /* ===========================
     HEADER (old legacy blocks trimmed)
     Note: the updated PHP has its own header styles inline.
     These are just safe theme tweaks.
  =========================== */
  .hero{
    background-color: transparent;
    color: #fff;
    text-align: center;
    padding: 50px 20px;
  }
  .hero h1{ margin: 0; font-size: 2.5em; }
  .hero p{ font-size: 1.2em; }
  
  /* Make the new .menu links use your blue by default */
  .menu > li > a,
  .menu > li > button{
    color: var(--brand);
  }
  .menu > li > a:hover,
  .menu > li > button:hover{
    color: #fff;
    border-color: var(--brand-2);
    background: rgba(106,183,255,.10);
  }
  
  /* Dropdown links inside menus */
  .dropdown a{ color: #e8f2ff; }
  .dropdown a:hover{ border-color: var(--brand-2); }
  
  /* ===========================
     USER MENU (avatar / profile / logout)
  =========================== */
  .user-menu{
    position: relative;
    display: flex;
    align-items: center;
  }
  .user-btn{
    appearance: none; -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    cursor: pointer;
    line-height: 1;
  }
  .user-btn:hover{ background: rgba(255,255,255,.03); }
  
  .user-label{
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .avatar{
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700;
    color: #0b0c10;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
  }
  
  /* Open the dropdown on hover/focus (desktop) */
  .user-menu:hover > .dropdown,
  .user-menu:focus-within > .dropdown{
    display: block;
  }
  
  /* Right-align this dropdown when using .right */
  .dropdown.right{ left: auto; right: 0; }
  
  /* Optional: support click-to-toggle with a class */
  .user-menu.open > .dropdown{ display: block; }
  
  /* Hide long usernames on small screens */
  @media (max-width: 980px){
    .user-label{ display: none; }
  }
  
  /* ===========================
     CONTENT SECTIONS
  =========================== */
  .about, .projects, .discord-bots, .interests, .contact, .social{
    padding: 20px;
    color: #fff;
    background: var(--card);
    margin: 20px auto;
    max-width: 75%;
    box-shadow: 0 0 10px rgba(0,0,0,.1);
    border-radius: 10px;
  }
  .about h2, .projects h2, .discord-bots h2, .interests h2, .contact h1, .social h2{
    margin-top: 0;
    color: var(--brand);
  }
  
  /* Project cards */
  .project-cards{
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-wrap: wrap;
  }
  .project-card{
    background: #2c2f33;
    border: 1px solid var(--brand);
    padding: 20px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    box-shadow: 0 0 5px rgba(0,0,0,.1);
    border-radius: 10px;
    text-align: left;
    max-height: 200px;
    overflow: hidden;
    transition: max-height .3s ease;
    position: relative;
  }
  .project-card.expanded{ max-height: none; }
  .project-card img{
    max-width: 150px; height: auto; margin-right: 20px;
    border-radius: 10px;
  }
  .project-card ul{ padding-left: 20px; list-style: disc; }
  .expand-btn{
    display: none;
    margin-top: 10px;
    background: transparent;
    border: none;
    color: var(--brand);
    cursor: pointer;
    text-align: left;
  }
  
  /* ===========================
     CAROUSEL
  =========================== */
  .bot-carousel{ overflow: hidden; position: relative; width: 100%; }
  .bot-carousel-track{
    display: flex;
    width: calc(300px * 14);
    animation: scroll 40s linear infinite;
  }
  @keyframes scroll{
    0%{ transform: translateX(0); }
    100%{ transform: translateX(calc(-300px * 7)); }
  }
  .bot-carousel:hover .bot-carousel-track{ animation-play-state: paused; }
  
  .bot-card{
    min-width: 300px;
    background: #2c2f33;
    border: 1px solid var(--brand);
    padding: 10px;
    border-radius: 10px;
    flex: 0 0 auto;
    text-align: center;
  }
  .bot-card img{
    width: 200px; height: 200px;
    object-fit: cover;
    border-radius: 10px;
  }
  .description{ max-width: 200px; margin: 0 auto; }
  
  /* Tags with your blue */
  .interest-tags{ display: flex; flex-wrap: wrap; gap: 10px; }
  .tag{
    background: var(--brand);
    color: #fff;
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
  }
  
  /* ===========================
     FOOTER
  =========================== */
  footer{
    text-align: center;
    padding: 20px 0;
    background: #282c34;
    color: var(--brand);
  }
  
  /* ===========================
     POPUP IMAGE
  =========================== */
  .popup-img{
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    padding-top: 60px;
    background: rgba(0,0,0,.9);
  }
  .popup-img-content{
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
  }
  .close{
    position: absolute;
    top: 15px; right: 35px;
    color: #fff;
    font-size: 40px; font-weight: bold;
    transition: .3s;
  }
  .close:hover, .close:focus{
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
  }
  
  /* ===========================
     RESPONSIVE TWEAKS
  =========================== */
  @media (max-width: 768px){
    .project-card{ flex-direction: column; align-items: flex-start; padding: 10px; margin: 10px 0; }
    .project-card img{ max-width: 100%; margin: 0 0 10px 0; }
    .project-cards{ padding: 10px; }
    .about, .projects, .discord-bots, .interests, .contact, .social{ max-width: 95%; }
  }
  @media (max-width: 480px){
    .project-card{ padding: 10px; margin: 10px 0; }
    .about, .projects, .discord-bots, .interests, .contact, .social{ max-width: 95%; }
    .expand-btn{ display: block; }
  }
  
  /* ===========================
     SMALL UTILITIES
  =========================== */
  .hover-img{ color: var(--brand); font-weight: bold; cursor: pointer; }
  
  footer {
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: transparent;
  }
  
  /* --- Mobile nav fixes --- */
@media (max-width:980px){
  /* Ensure the “drawer” sits on top and is scrollable */
  header{ z-index: 1000; }
  .nav-wrap{ position: relative; }     /* make absolute children anchor here */
  .mobile-toggle{ position: relative; z-index: 1001; }

  /* Turn the menu into a fixed panel under the header */
  .menu{
    position: fixed;
    left: 0; right: 0;
    top: 56px;                           /* adjust if your header is taller */
    display: none;
    z-index: 1000;
    max-height: calc(100vh - 56px);
    overflow: auto;
    background: rgba(18,20,26,.98);
    border-top: 1px solid var(--border);
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
  }
  .menu.open{ display: block; }

  /* Submenus are CLOSED by default on mobile and open per item tap */
  .menu .dropdown{ display: none; position: static; margin: 6px 0; padding: 8px; }
  .menu li.open > .dropdown{ display: block; }

  /* Make full-row touch targets */
  .menu > li{ display: block; }
  .menu > li > a,
  .menu > li > button{ width: 100%; justify-content: space-between; }

  /* Little caret that rotates when open */
  .menu > li > button .caret{ transition: transform .2s ease; }
  .menu li.open > button .caret{ transform: rotate(180deg); }

  /* Lock body scroll when the nav is open */
  body.nav-open{ overflow: hidden; touch-action: none; }
}

/* layout wrapper for the mobile user button + burger */
.nav-actions{ display:flex; align-items:center; gap:10px }

/* hidden on desktop, visible on mobile */
.user-menu-mobile{ display:none; }
@media (max-width:980px){
  .user-menu-mobile{ display:flex; position:relative; z-index:1001; }
  /* keep avatar only on very narrow screens, hide long label */
  .user-menu-mobile .user-label{ display:none; }

  /* right-cta stays hidden on mobile (your existing rule) */
  .right-cta{ display:none; }

  /* make sure the mobile user dropdown floats above the drawer */
  .user-menu-mobile .dropdown{
    position:absolute; right:0; top:calc(100% + 6px);
    display:none; min-width:220px;
  }
  .user-menu-mobile:hover > .dropdown,
  .user-menu-mobile:focus-within > .dropdown,
  .user-menu-mobile.open > .dropdown{ display:block; }
}

/* ===========================
   Layout + header shell
   =========================== */
header{
  position:sticky; top:0; z-index:4000;
  background:rgba(11,12,16,.75); backdrop-filter:blur(6px);
  border-bottom:1px solid var(--border);
}
.nav-wrap{ display:flex; align-items:center; justify-content:space-between; gap:18px; padding:10px 18px; }
.brand{ display:flex; align-items:center; gap:10px; font-weight:700; letter-spacing:.2px; }
.brand .dot{ width:10px; height:10px; border-radius:50%; background:linear-gradient(135deg,var(--brand),var(--brand-2)); }
.brand span{ font-size:18px; }

/* ===========================
   Main menu
   =========================== */
.menu{ display:flex; align-items:center; gap:10px; margin:0; padding:0; }
.menu>li{ list-style:none; position:relative; }
.menu>li>a,
.menu>li>button{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 12px; border-radius:10px; border:1px solid transparent;
  background:transparent; cursor:pointer;
  color:var(--brand);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
  text-decoration:none; /* ensure no underlines on top-level items */
}
.menu>li>a:hover,
.menu>li>button:hover{
  color:#ffffff;
  border-color:var(--brand-2);
  background:rgba(106,183,255,.10);
}
.menu>li>a:focus-visible,
.menu>li>button:focus-visible{
  outline:2px solid var(--brand-2);
  outline-offset:2px;
  border-color:var(--brand-2);
}
.caret{ font-size:12px; opacity:.85; }

/* ===========================
   Dropdowns (desktop default)
   =========================== */
.dropdown{
  position:absolute; top:100%; left:0; min-width:260px;
  background:rgba(18,20,26,.98); border:1px solid var(--border); border-radius:12px;
  padding:8px; margin-top:0; display:none; z-index:20;
}
.dropdown::before{ content:""; position:absolute; left:0; right:0; top:-8px; height:8px; } /* hover bridge */
.dropdown a{
  display:flex; flex-direction:column; gap:2px;
  padding:10px; border-radius:8px; border:1px solid transparent; color:#e8f2ff;
  text-decoration:none; /* kill underline in dropdown links */
}
.dropdown a strong,
.dropdown a small{ text-decoration:none; } /* belt & suspenders */
.dropdown a:hover{ background:rgba(255,255,255,.03); border-color:var(--brand-2); }
.menu>li:hover>.dropdown,
.menu>li:focus-within>.dropdown{ display:block; }

/* ===========================
   Right-side actions
   =========================== */
.right-cta{ display:flex; align-items:center; gap:10px; }
.btn{ border:1px solid var(--border); border-radius:12px; padding:9px 12px; display:inline-flex; align-items:center; text-decoration:none; }
.btn:hover{ background:rgba(255,255,255,.03); }
.btn-primary{ border-color:transparent; background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#0b0c10; font-weight:700; }
.btn-primary:hover{ filter:brightness(1.05); }

/* ===========================
   User menu (shared)
   =========================== */
.user-menu{ position:relative; display:flex; align-items:center; }
.user-btn{
  appearance:none; -webkit-appearance:none;
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:12px; line-height:1;
  border:1px solid var(--border); background:transparent; color:#e5f0ff; cursor:pointer;
  transition: background .15s ease, border-color .15s ease;
  text-decoration:none;
}
.user-btn:hover{ background:rgba(106,183,255,.08); border-color:var(--brand-2); }
.user-btn:focus-visible{ outline:2px solid var(--brand-2); outline-offset:2px; border-color:var(--brand-2); }
.avatar{
  width:26px; height:26px; border-radius:50%;
  display:grid; place-items:center; font-size:12px; font-weight:800; color:#0b0c10;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
}
.user-label{ max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.user-menu .dropdown.right{ left:auto; right:0; min-width:220px; }

/* ===========================
   Burger + inline user on mobile
   =========================== */
.mobile-toggle{ display:none; border:1px solid var(--border); border-radius:10px; padding:8px 10px; }
.nav-actions{ display:flex; align-items:center; gap:10px; }

/* ===========================
   Mobile: collapsed submenus + inline user menu that drops downward
   =========================== */
.user-menu-mobile{ display:none; position:relative; }
.user-menu-mobile .dropdown{
  position:absolute; top:calc(100% + 6px); right:0; left:auto; min-width:220px; display:none; z-index:1001;
}
.user-menu-mobile.open .dropdown{ display:block; }

/* ===========================
   Media (≤ 980px)
   =========================== */
@media (max-width:980px){
  .menu{
    display:none; position:absolute; left:0; right:0; top:64px;
    background:rgba(18,20,26,.98); border-top:1px solid var(--border); padding:8px 12px;
    max-height:calc(100vh - 64px); overflow:auto;
  }
  .menu.open{ display:block; }
  .menu>li{ display:block; }
  .menu>li>a, .menu>li>button{ width:100%; justify-content:space-between; }
  .dropdown{ position:relative; top:auto; left:auto; min-width:unset; margin:6px 0; display:none; }
  .menu li.open > .dropdown{ display:block; } /* tap to open (JS adds .open) */

  .mobile-toggle{ display:inline-flex; }
  .right-cta{ display:none; }        /* hide desktop CTAs on mobile */
  .user-label{ display:none; }       /* shorten user button on mobile */
  .user-menu-mobile{ display:flex; } /* show mobile user button next to burger */
  .right-cta .user-menu{ display:none; } /* hide desktop user menu on mobile */
}

/* ===========================
   Header-specific underline guard
   =========================== */
header a,
header button { text-decoration:none; }
header .dropdown a,
header .dropdown a strong,
header .dropdown a small { text-decoration:none; }

/* ===========================
   (Optional) Card reset – prevents unexpected blue borders
   =========================== */

/* Remove any permanent stripe; this must win */
.container .card::before { content: none !important; }

/* Base card (keep a thin border when idle) */
.container .card{
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;          /* match your card radius */
  box-shadow: none;
  outline: none;
  z-index: 0;                   /* new stacking context for the ring */
}

/* On hover/focus: hide the base border so the gradient can show */
.container .card:hover,
.container .card:focus-visible{
  border-color: transparent !important;
}

/* The gradient frame */
.container .card:hover::before,
.container .card:focus-visible::before{
  content: "" !important;       /* re-enable the pseudo-element */
  position: absolute;
  inset: 0;
  padding: 2px;                 /* ring thickness */
  border-radius: 16px;          /* match card */
  background: linear-gradient(135deg, var(--brand), var(--accent), var(--brand-2));
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

/* === Brand logo (image) === */
header .brand-logo{
  width: 240px;      /* desktop width */
  height: auto;      /* keep aspect ratio */
  max-height: 140px; /* cap vertical size so header doesn't grow */
  display: block;    /* remove baseline gap */
}

@media (max-width: 640px){
  header .brand-logo{
    width: 160px;    /* mobile width */
    max-height: 80px;
  }
}

/* a11y helper (only add once in the whole file) */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); border:0;
}


@media (max-width:980px){
  .menu{ display:none }
  .menu.open{ display:block }
}

/* hard-override: ensure mobile drawer shows when nav.js adds .open */
@media (max-width:980px){
  #mainMenu.menu.open{ display:block !important; }
  #mainMenu.menu{
    position:fixed !important;
    top:56px !important; left:0 !important; right:0 !important;
    max-height:calc(100vh - 56px) !important;
    overflow:auto !important;
    z-index:1000 !important;
    background:rgba(18,20,26,.98) !important;
    -webkit-overflow-scrolling:touch;
  }
}
