/* ============================
   Theme
============================ */
:root{
  --bg: #080808;
  --panel: #141414;
  --panel2: #1b1b1b;

  --text: #cfe9f6;
  --muted: rgba(207,233,246,0.7);

  --accent: #F78C8C;
  --accent2: #5F9DE7;

  --border: rgba(173,216,230,0.25);

  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 16px;
}

/* ============================
   Base
============================ */
html{
  scroll-padding-top: 80px;
}

* { box-sizing: border-box; }

body{
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  padding: 80px 0 0 0;
  background-color: var(--bg);
  color: var(--text);
  max-width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  transition: opacity 0.12s ease;
}

body::before{
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(95,157,231,0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0px var(--parallax-y, 0px);
}

body.page-exit{
  opacity: 0;
}

::selection{
  background: rgba(95,157,231,0.30);
  color: var(--text);
}

::-webkit-scrollbar{
  width: 5px;
}

::-webkit-scrollbar-track{
  background: transparent;
}

::-webkit-scrollbar-thumb{
  background: rgba(207,233,246,0.18);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover{
  background: rgba(207,233,246,0.32);
}


a{ color: inherit; }

/* ============================
   Header
============================ */
header{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;

  background: var(--bg);
  color: var(--text);
  padding: 1rem 0;

  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.04);

  transition: background 0.25s ease, box-shadow 0.25s ease;
}

header.scrolled{
  background: rgba(8,8,8,0.80);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2px 24px rgba(0,0,0,0.6);
}

.header-container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.name-container{ text-align: left; }

.name{
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.sub-text{
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

header nav ul{
  list-style: none;
  padding: 0;
  margin: 0;
}

header nav ul li{
  display: inline;
  margin: 0 12px;
}

header nav ul li a{
  position: relative;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  padding-bottom: 3px;
}

header nav ul li a::after{
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
  transform: scaleX(0);
  transition: transform 0.18s ease;
}

header nav ul li a:hover,
header nav ul li a.active{
  color: var(--text);
}

header nav ul li a:hover::after,
header nav ul li a.active::after{
  transform: scaleX(1);
}

/* ============================
   Sections / Layout
============================ */
section{
  max-width: 1100px;
  margin: 0 auto;
  padding: 3.5rem 20px;
}

.section-head{ margin-bottom: 1.25rem; }

.muted{
  color: var(--muted);
  margin: 0.25rem 0 0 0;
}

/* ============================
   Page load fade-in
============================ */
@keyframes fadeUp{
  from{ opacity: 0; transform: translateY(20px); }
  to  { opacity: 1; transform: translateY(0); }
}

#about   { animation: fadeUp 0.5s ease both; }
#projects{ animation: fadeUp 0.5s ease 0.08s both; }
#tech-exp{ animation: fadeUp 0.5s ease 0.14s both; }
#contact { animation: fadeUp 0.5s ease 0.18s both; }

/* ============================
   About
============================ */

#about{
  position: relative;
}


#heroCanvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
}

#about h1,
#about p{
  position: relative;
}

#about h1{
  font-size: clamp(2rem, 3.2vw, 3rem);
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.1;
  margin: 0 0 1rem 0;
}

#about p{
  max-width: 70ch;
  margin: 0 0 0.75rem 0;
  color: var(--text);
  opacity: 0.95;
}

/* ============================
   About glow
============================ */
@keyframes aboutGlow{
  to{ opacity: 0.45; }
}

#about::before{
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 80% at 0%   50%, rgba(95,157,231,0.09)  0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 100% 30%, rgba(247,140,140,0.09) 0%, transparent 70%);
  pointer-events: none;
  animation: aboutGlow 6s ease-in-out infinite alternate;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 22%, black 78%, transparent 100%),
                      linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
  -webkit-mask-composite: destination-in;
  mask-image: linear-gradient(to right, transparent 0%, black 22%, black 78%, transparent 100%),
              linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
  mask-composite: intersect;
}

@keyframes pulse{
  0%, 100%{ box-shadow: 0 0 0 2px rgba(74,222,128,0.25); }
  50%      { box-shadow: 0 0 0 5px rgba(74,222,128,0.0); }
}

.about-open{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 1;
}

.about-open::before{
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2.2s ease infinite;
}

/* ============================
   Card scroll-in animation
============================ */
@keyframes cardFadeIn{
  from{ opacity: 0; transform: translateY(22px); }
  to  { opacity: 1; transform: translateY(0); }
}

.card-animate{
  opacity: 0;
}

.card-animate.is-visible{
  animation: cardFadeIn 0.45s ease both;
  animation-delay: calc(var(--card-index, 0) * 70ms);
}

/* ============================
   Empty state
============================ */
.empty-state{
  grid-column: span 12;
  text-align: center;
  padding: 3.5rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ============================
   Projects (Toolbar)
============================ */
#projects h2,
#tech-exp h2,
#contact h2{
  border-left: 3px solid var(--accent2);
  padding-left: 12px;
}

#projects h2{
  color: var(--accent2);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.projects-toolbar{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.project-search{
  flex: 1 1 240px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
}

.project-search:focus{
  border-color: rgba(95,157,231,0.65);
  box-shadow: 0 0 0 3px rgba(95,157,231,0.15);
}

.tag-filters{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip{
  cursor: pointer;
  user-select: none;

  font-size: 0.9rem;
  padding: 7px 11px;
  border-radius: 999px;

  border: 1px solid rgba(173,216,230,0.25);
  background: rgba(255,255,255,0.02);
  color: var(--muted);

  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.filter-chip:hover{
  transform: translateY(-1px);
  border-color: rgba(247,140,140,0.55);
  color: var(--text);
}

.filter-chip.active{
  border-color: rgba(247,140,140,0.65);
  background: rgba(247,140,140,0.12);
  color: var(--accent);
}

.results{
  margin-left: auto;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ============================
   Projects (Grid Cards)
============================ */
.projects-grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-top: 1.25rem;
}

/* Card */
.project-card{
  grid-column: span 6;
  position: relative;

  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #000;

  text-decoration: none;
  color: inherit;

  min-height: 340px;

  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  will-change: transform;
}


.project-card:hover{
  transform: translateY(-4px);
  border-color: rgba(247,140,140,0.5);
  box-shadow: 0 20px 48px rgba(0,0,0,0.5);
}

.project-card:focus-visible{
  outline: none;
  transform: translateY(-4px);
  border-color: rgba(95,157,231,0.75);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45), 0 0 0 3px rgba(95,157,231,0.18);
}

/* Image */
.project-card .thumb-wrap{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

.project-card .thumb{
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  /* gradient fallback when no image is set */
  background-color: var(--panel2);
  background-image: linear-gradient(135deg, #111827 0%, #0d1b2a 60%, #0f2033 100%);

  transition: transform 0.45s ease;
}

.project-card:hover .thumb{
  transform: scale(1.04);
}

/* No-image animated gradient */
@keyframes gradientDrift{
  0%  { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100%{ background-position: 0% 50%; }
}

.project-card.no-image .thumb{
  background-image: linear-gradient(
    135deg,
    #0d1524 0%,
    #111d2e 25%,
    #162538 50%,
    #0a1628 75%,
    #0d1524 100%
  );
  background-size: 400% 400%;
  animation: gradientDrift 10s ease infinite;
}

/* ============================
   Featured card glint sweep
============================ */
@keyframes glintSweep {
  0%   { transform: translateX(-100%) skewX(-18deg); }
  13%  { transform: translateX(200%) skewX(-18deg); }
  100% { transform: translateX(200%) skewX(-18deg); }
}

.project-card.featured .thumb-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  /* Primary band + faint echo band — mimics light reflecting off glass */
  background: linear-gradient(
    to right,
    transparent 35%,
    rgba(255, 255, 255, 0.012) 40%,
    rgba(255, 255, 255, 0.08)  45%,
    rgba(255, 255, 255, 0.13)  49%,
    rgba(255, 255, 255, 0.08)  53%,
    rgba(255, 255, 255, 0.012) 58%,
    transparent 63%,
    rgba(255, 255, 255, 0.032) 67%,
    transparent 73%
  );
  animation: glintSweep 5.5s linear infinite;
  animation-delay: calc(var(--card-index, 0) * -1.85s);
  pointer-events: none;
  z-index: 2;
}

@keyframes borderGlint {
  0%    { opacity: 0; }
  5%    { opacity: 1; }
  13%   { opacity: 1; }
  19%   { opacity: 0; }
  100%  { opacity: 0; }
}

.project-card.featured::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(173, 216, 230, 0.32),
              0 0 18px 2px rgba(173, 216, 230, 0.03);
  opacity: 0;
  animation: borderGlint 5.5s linear infinite;
  animation-delay: calc(var(--card-index, 0) * -1.85s);
  transition: box-shadow 0.15s ease;
  pointer-events: none;
  z-index: 3;
}

.project-card.featured:hover::before {
  box-shadow: 0 0 0 1px rgba(247, 140, 140, 0.55),
              0 0 18px 2px rgba(247, 140, 140, 0.09);
}

/* Featured badge */
.card-badge{
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;

  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  color: var(--accent);
  background: rgba(247,140,140,0.12);
  border: 1px solid rgba(247,140,140,0.35);
  padding: 4px 10px;
  border-radius: 999px;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card-badge--wip {
  left: auto;
  right: 14px;
  color: #f5c842;
  background: rgba(245,200,66,0.1);
  border-color: rgba(245,200,66,0.35);
}

.wip-notice {
  color: var(--text-muted, #8899aa);
  font-style: italic;
}

.project-card .thumb::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.0) 0%,
    rgba(0,0,0,0.25) 55%,
    rgba(0,0,0,0.6) 100%
  );
}

/* Info panel */
.card-body{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  padding: 14px 16px 16px 16px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);

  display: flex;
  flex-direction: column;
  gap: 10px;

  background: rgba(20,20,20,0.30);
  border-top: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 -18px 40px rgba(0,0,0,0.35);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.title-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-row h3{
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

.meta-sep{
  color: var(--muted);
  opacity: 0.35;
  user-select: none;
}

.year{
  color: var(--muted);
  font-size: 0.9rem;
}

.desc{
  margin: 0;
  color: var(--text);
  opacity: 0.92;
  font-size: 0.95rem;
  line-height: 1.45;
  max-width: 75ch;
}

.card-footer{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.tags{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.card-cta{
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.project-card:hover .card-cta,
.project-card:focus-visible .card-cta{
  opacity: 1;
  transform: translateX(0);
}

.tag{
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 999px;

  color: var(--accent);
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(247,140,140,0.45);
}

/* Wide card */
.project-card.wide{
  grid-column: span 12;
  min-height: 420px;
}

.project-card.wide .card-body{
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;

  border-radius: 0 0 var(--radius-md) var(--radius-md);

  /* Make sure we don't accidentally inherit "inset" styles */
  padding: 14px 16px 16px 16px;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 -18px 40px rgba(0,0,0,0.35);
}

/* Blur fallback */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))){
  .card-body{
    background: rgba(20,20,20,0.75);
  }
}

/* ============================
   Technical Experience
============================ */
#tech-exp h2{
  color: var(--accent2);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.skill-groups{
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 28px;
}

.skill-group{
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: start;
  gap: 0 16px;
}

.skill-group-label{
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding-top: 9px;
  white-space: nowrap;
}

.tech-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-tag{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(247,140,140,0.45);
  border-radius: 999px;
  padding: 6px 13px;

  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;

  transition: transform 0.15s ease, background-color 0.15s ease;
}

.tech-tag:hover{
  transform: translateY(-2px);
  background: rgba(247,140,140,0.12);
}

.pips{
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
}

.pips b{
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  font-weight: normal;
}

.pips b.off{
  background: rgba(255,255,255,0.12);
}

@media (max-width: 520px){
  .skill-group{
    grid-template-columns: 1fr;
    gap: 8px 0;
  }
  .skill-group-label{
    padding-top: 0;
  }
}

/* ============================
   Contact
============================ */
#contact h2{
  color: var(--accent2);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

#contact p{
  max-width: 70ch;
  color: var(--text);
  opacity: 0.95;
}

#contact strong{
  color: var(--accent);
}

.contact-links{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1.25rem;
}

.contact-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid rgba(247,140,140,0.50);
  background: rgba(247,140,140,0.08);
  color: var(--accent);
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.contact-btn:hover{
  transform: translateY(-2px);
  border-color: rgba(247,140,140,0.8);
  background: rgba(247,140,140,0.14);
}

.contact-btn--secondary{
  border-color: rgba(15,191,62,0.45);
  background: rgba(15,191,62,0.08);
  color: #0FBF3E;
}

.contact-btn--secondary:hover{
  border-color: rgba(15,191,62,0.75);
  background: rgba(15,191,62,0.14);
}

button.contact-btn{
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

/* Keep trigger styled as hovered while popover is open */
.email-wrap:hover .email-trigger{
  transform: translateY(-2px);
  border-color: rgba(247,140,140,0.8);
  background: rgba(247,140,140,0.14);
}

/* Email popover */
.email-wrap{
  position: relative;
}

/* Invisible bridge — keeps :hover alive while cursor crosses the gap */
.email-wrap::after{
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 6px;
}

.email-popover{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;

  min-width: 210px;
  overflow: hidden;
  white-space: nowrap;

  background: rgba(12,12,18,0.96);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.email-wrap:hover .email-popover,
.email-wrap.is-open .email-popover{
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.email-popover__item{
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 14px;

  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  text-align: left;

  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;

  transition: background 0.1s ease, color 0.1s ease;
}

.email-popover__item:last-child{
  border-bottom: none;
}

.email-popover__item:hover{
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.contact-btn--itch{
  border-color: rgba(250,92,92,0.50);
  background: rgba(250,92,92,0.08);
  color: #fa5c5c;
}

.contact-btn--itch:hover{
  border-color: rgba(250,92,92,0.8);
  background: rgba(250,92,92,0.14);
}

/* ============================
   Footer
============================ */
footer{
  background: var(--bg);
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 1.25rem 0;
}

.footer-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links{
  display: flex;
  gap: 20px;
}

.footer-links a{
  color: var(--muted);
  text-decoration: none;
  transition: color 0.14s ease;
}

.footer-links a:hover{
  color: var(--text);
}

/* ============================
   Back to top
============================ */
.back-to-top{
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 900;

  width: 44px;
  height: 44px;
  border-radius: 999px;

  border: 1px solid rgba(173,216,230,0.25);
  background: rgba(20,20,20,0.80);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;

  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.15s ease, background 0.15s ease;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.back-to-top.is-visible{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover{
  border-color: rgba(95,157,231,0.55);
  background: rgba(95,157,231,0.12);
}
/* ============================
   Responsive (main page)
============================ */
@media (max-width: 640px){
  .project-card{
    grid-column: span 12;
  }

  .project-card.wide{
    min-height: 320px;
  }

  .projects-toolbar{
    flex-direction: column;
    align-items: stretch;
  }

  .project-search{
    flex: none;
    width: 100%;
  }

  .results{
    margin-left: 0;
  }

  .contact-links{
    flex-direction: column;
  }

  .contact-btn{
    justify-content: center;
  }

  .footer-inner{
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}

@media (max-width: 480px){
  .name{ font-size: 1.2rem; }

  header nav ul li{ margin: 0 8px; }

  #about h1{
    font-size: clamp(1.6rem, 6vw, 2.2rem);
  }
}

/* ============================
   Project detail page animations
============================ */
#project-details .back-link{
  animation: fadeUp 0.4s ease both;
}

#project-details .project-header{
  animation: fadeUp 0.4s ease 0.08s both;
}

#project-details .project-section{
  animation: fadeUp 0.4s ease both;
}

#project-details .project-section:nth-child(1){ animation-delay: 0.14s; }
#project-details .project-section:nth-child(2){ animation-delay: 0.20s; }
#project-details .project-section:nth-child(3){ animation-delay: 0.26s; }
#project-details .project-section:nth-child(4){ animation-delay: 0.32s; }
#project-details .project-section:nth-child(5){ animation-delay: 0.38s; }

#project-details .project-rail{
  animation: fadeUp 0.4s ease 0.16s both;
}

/* ============================
   Project Details
============================ */

body:has(#project-details),
body:has(#about){
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body:has(#about) main{
  flex: 1;
}

#project-details{
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3.25rem 20px;
}

/* Back link */
#project-details .back-link{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;

  text-decoration: none;
  color: var(--muted);

  border-radius: 999px;
  border: 1px solid rgba(173,216,230,0.18);
  background: rgba(255,255,255,0.015);

  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    background 0.12s ease;
}

#project-details .back-link:hover{
  transform: translateY(-1px);
  color: var(--text);
  border-color: rgba(95,157,231,0.45);
  background: rgba(95,157,231,0.06);
}

/* Layout */
#project-details .project-layout{
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 32px;
  align-items: start;
}

/* Left column */
#project-details .project-main{
  min-width: 0;
}

#project-details .project-header{
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(173,216,230,0.16);
}

#project-details .title-row{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#project-details .project-title{
  margin: 0;
  font-size: clamp(2.2rem, 3.4vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: 0.2px;
  color: var(--accent);
}

#project-details .year{
  font-size: 0.95rem;
  color: var(--muted);
}

#project-details .project-lead{
  margin: 14px 0 0 0;
  max-width: 70ch;

  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.92;
}

/* Sections */
#project-details .project-section{
  padding: 18px 0;
  border-bottom: 1px solid rgba(173,216,230,0.12);
}

#project-details .project-section:last-child{
  border-bottom: none;
}

#project-details h2{
  margin: 0 0 10px 0;
  font-size: 1.25rem;
  letter-spacing: 0.2px;
  color: var(--accent2);
  border-left: 3px solid var(--accent2);
  padding-left: 12px;
}

#project-details p{
  margin: 0 0 12px 0;
  max-width: 75ch;
}

#project-details .project-section p:last-child{
  margin-bottom: 0;
}

#project-details ul{
  margin: 0 0 12px 0;
  padding-left: 0;
  list-style: none;
}

#project-details ul:last-child{
  margin-bottom: 0;
}

#project-details ul li{
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 6px;
  max-width: 75ch;
}

#project-details ul li:last-child{
  margin-bottom: 0;
}

#project-details ul li::before{
  content: "–";
  position: absolute;
  left: 0;
  color: var(--accent2);
  opacity: 0.7;
}

/* Team indicator — person silhouette icon(s) */
.title-row-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.team-indicator {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  transform: translateY(-1px);
}

.team-indicator--solo,
.team-indicator--team {
  color: var(--muted);
}

.person-icon {
  display: block;
  width: 11px;
  height: 13px;
  flex-shrink: 0;
}

.person-icon--stack {
  margin-left: -4px;
}

/* Duration indicator — clock icon + label */
.duration-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  line-height: 0;
}

.clock-icon {
  display: block;
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.duration-label {
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
}

/* Tags */
#project-details .detail-tags{
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#project-details .tag{
  padding: 3px 9px;
  font-size: 0.75rem;
  border-radius: 999px;

  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

/* Buttons */
#project-details .project-links{
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#project-details .btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 10px 14px;
  border-radius: 12px;

  text-decoration: none;
  font-weight: 700;

  border: 1px solid rgba(173,216,230,0.22);
  background: rgba(255,255,255,0.02);

  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease,
    filter 0.12s ease;
}

#project-details .btn-icon{
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

#project-details .btn:hover{
  transform: translateY(-2px);
  filter: brightness(1.15);
}

/* Itch.io / demo — red */
#project-details .btn-itch{
  color: #fa5c5c;
  border-color: rgba(250,92,92,0.55);
  background: rgba(250,92,92,0.10);
}

/* Trailer / video — purple */
#project-details .btn-trailer{
  color: #B97EE8;
  border-color: rgba(185,126,232,0.50);
  background: rgba(185,126,232,0.10);
}

/* GitHub — green */
#project-details .btn-github{
  color: #0FBF3E;
  border-color: rgba(15,191,62,0.45);
  background: rgba(15,191,62,0.08);
}

/* Docs — warm parchment */
#project-details .btn-docs{
  color: #d4bc72;
  border-color: rgba(212,188,114,0.42);
  background: rgba(212,188,114,0.07);
}

/* Right rail */
#project-details .project-rail{
  position: sticky;
  top: 96px;

  display: flex;
  flex-direction: column;
  gap: 16px;
}

#project-details .hero-media{
  border-radius: 16px;
  overflow: hidden;

  border: 1px solid rgba(173,216,230,0.18);
  background: rgba(255,255,255,0.02);
}

#project-details .hero-img{
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Gallery */
#project-details .gallery-grid{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

#project-details .gallery-item{
  display: block;
  border-radius: 14px;
  overflow: hidden;

  border: 1px solid rgba(173,216,230,0.16);
  background: rgba(255,255,255,0.02);

  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

#project-details .gallery-item:hover{
  transform: translateY(-2px);
  border-color: rgba(247,140,140,0.55);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}

#project-details .gallery-item img{
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Responsive */
@media (max-width: 980px){
  #project-details .project-layout{
    grid-template-columns: 1fr;
    gap: 18px;
  }

  #project-details .project-rail{
    position: static;
  }

  #project-details .gallery-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px){
  #project-details .gallery-grid{
    grid-template-columns: 1fr;
  }
}

/* ============================
   Lightbox
============================ */

.lightbox{
  position: fixed;
  inset: 0;
  z-index: 5000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;
  overflow: hidden;
  background: rgba(0,0,0,0.75);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.lightbox.is-open{
  opacity: 1;
  pointer-events: auto;
}

/* Image frame */
.lightbox__frame{
  position: relative;
  width: fit-content;
  max-width: min(1100px, 100%);
  max-height: 100%;

  border-radius: 16px;
  overflow: hidden;

  border: 1px solid rgba(173,216,230,0.22);
  background: transparent;

  display: grid;
  place-items: center;

  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox.is-open .lightbox__frame{
  transform: scale(1);
}

.lightbox__img{
  display: block;
  width: auto;
  height: auto;
  max-width: min(1100px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  object-fit: contain;
  transition: opacity 0.12s ease;
}

/* Close */
.lightbox__close{
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;

  width: 36px;
  height: 36px;

  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;

  opacity: 0;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.22s ease;
}

.lightbox__close:hover{
  background: rgba(0,0,0,0.82);
  transform: scale(1.08);
}

/* Navigation */
.lightbox__nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;

  width: 44px;
  height: 44px;

  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  color: #fff;
  cursor: pointer;

  opacity: 0;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.22s ease;
}

.lightbox__nav:hover{
  background: rgba(0,0,0,0.78);
}

.lightbox__nav--prev{ left: 12px; }
.lightbox__nav--next{ right: 12px; }

.lightbox__nav.is-hidden{
  opacity: 0 !important;
  pointer-events: none;
}

/* Arrow */
.lightbox__nav::before{
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;

  width: 10px;
  height: 10px;

  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.lightbox__nav--prev::before{
  transform: translate(-38%, -50%) rotate(135deg);
}

.lightbox__nav--next::before{
  transform: translate(-62%, -50%) rotate(-45deg);
}

.lightbox__nav:active{
  transform: translateY(-50%) scale(0.92);
}

/* Counter */
.lightbox__counter{
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;

  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);

  background: rgba(0,0,0,0.50);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;

  opacity: 0;
  transition: opacity 0.22s ease;
}

.lightbox__counter:empty{
  display: none;
}

/* Reveal controls via JS class or keyboard focus */
.lightbox__frame:has(:focus-visible) .lightbox__close,
.lightbox__frame:has(:focus-visible) .lightbox__nav,
.lightbox__frame:has(:focus-visible) .lightbox__counter,
.lightbox__frame.controls-visible .lightbox__close,
.lightbox__frame.controls-visible .lightbox__nav,
.lightbox__frame.controls-visible .lightbox__counter{
  opacity: 1;
}

/* Touch devices: hide arrows entirely, always show close */
@media (hover: none){
  .lightbox__nav{
    display: none;
  }
  .lightbox__close{
    opacity: 1;
  }
}

/* Scroll lock */
body.lb-lock{
  overflow: hidden;
}

/* Lightbox responsive */
@media (max-width: 720px){
  .lightbox{
    padding: 10px;
  }
}

/* ============================
   Dynamic project page helpers
============================ */

/* When rail is hidden, remove it from layout */
#project-details .project-rail[style*="display: none"]{
  display: none !important;
}

/* When lead paragraph is empty/hidden, remove extra spacing */
#project-details .project-lead:empty{
  display: none;
}

/* When no links are present, hide the links container */
#project-details .project-links:empty{
  display: none;
}
