/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0a0a0a;
  --surface:     #111111;
  --border:      #1e1e1e;
  --text:        #e8e8e8;
  --text-muted:  #555555;
  --accent:      #D5B60A;
  --accent-dim:  rgba(213, 182, 10, 0.13);
  --font-sans:   'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   WEBGL CANVAS
   ============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* All content sits above canvas — no z-index here so section/footer don't
   form stacking contexts, which prevents OOPIF compositor layer conflicts
   with the WebGL canvas during scroll. .nav has its own z-index: 100 rule. */
nav, section, footer { position: relative; }

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 5rem);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem clamp(1.5rem, 5vw, 5rem);
  background: rgba(6, 6, 10, 0.55);
  border-bottom: 0px solid var(--border);
}

.nav__logo {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  pointer-events: none;
}

.nav__logo-name {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(240, 244, 255, 0.85);
  text-decoration: none;
  pointer-events: auto;
}

.nav__logo-role {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(180, 196, 225, 0.35);
}

.nav__links {
  list-style: none;
  display: flex;
  gap: 2.5rem;
}

.nav__links a {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  transition: opacity 0.2s;
}
.nav__links a:hover { opacity: 0.5; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: 0 clamp(1.5rem, 5vw, 5rem) 6rem;
}

.hero__content { max-width: 820px; }

.hero__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
}

.hero__title {
  font-size: clamp(3rem, 7vw, 7.5rem);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(40px);
}

.hero__sub {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 3rem;
  opacity: 0;
  transform: translateY(20px);
}

.hero__scroll-hint {
  position: absolute;
  bottom: 3rem;
  right: clamp(1.5rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
}

.hero__scroll-hint span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  writing-mode: vertical-rl;
}

.hero__scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scroll-hint 2s ease-in-out infinite;
}

@keyframes scroll-hint {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50%       { transform: scaleY(0.4); opacity: 0.3; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.9rem 2rem;
  border: 1px solid;
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out);
  cursor: pointer;
}

.btn--ghost {
  border-color: #ffffff33;
  color: #fff;
  background: transparent;
  opacity: 0;
}
.btn--ghost:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.btn--outline {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn--outline:hover {
  background: var(--accent);
  color: #000;
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3rem;
}

/* ============================================================
   FILTER GALAXIES
   ============================================================ */
.filter-galaxy-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 89;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(0.5rem, 2.5vw, 2.5rem);
  padding: 0 2rem 1.2rem;
  pointer-events: none;
}

.filter-galaxy {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  pointer-events: auto;
  color: rgba(220, 230, 245, 0.75);
  transition: color 0.35s ease;
}

.filter-galaxy:hover {
  color: rgba(240, 245, 255, 1);
}

.filter-galaxy.is-active {
  color: #D5B60A;
}

.filter-galaxy__svg {
  width: 110px;
  height: 110px;
  display: block;
  overflow: visible;
}

.filter-galaxy__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects {
  padding: 8rem 0;
}

.projects__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3rem;
}

.project-card {
  grid-column: span 6;
  overflow: hidden;
}

.project-card--wide {
  grid-column: span 12;
}

.project-card:nth-child(3) { grid-column: 1 / span 12; }
.project-card:nth-child(4) { grid-column: 1 / span 5; }
.project-card:nth-child(5) { grid-column: 6 / span 7; }

.project-card__link {
  display: block;
  cursor: pointer;
}

.project-card__media {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
}

.project-card--wide .project-card__media { aspect-ratio: 21 / 7; }

.project-card__placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #111 0%, #1a1a1a 50%, #111 100%);
  transition: transform 0.7s var(--ease-out);
}

.project-card__link:hover .project-card__placeholder {
  transform: scale(1.03);
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease-out);
}

.project-card__link:hover .project-card__media img {
  transform: scale(1.04);
}

.project-card__info {
  padding: 0.4rem 0 0;
}

.project-card__cat {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.project-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-top: 0.35rem;
  transition: color 0.2s;
}

.project-card__link:hover .project-card__title {
  color: #D5B60A;
}

.project-card__desc {
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.5rem;
  max-width: 480px;
}

/* Hover overlay glow */
.project-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(213, 182, 10, 0.08);
  opacity: 0;
  transition: opacity 0.4s;
}
.project-card__link:hover .project-card__media::after { opacity: 1; }

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-page {
  padding-top: 9rem;
  padding-bottom: 6rem;
  position: relative;
  z-index: 1;
}

.about-layout {
  display: grid;
  grid-template-columns: 3fr 3fr;
  gap: 5rem;
  align-items: start;
}

.about-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #D5B60A;
  margin-bottom: 0.5rem;
}

.about-bio-text {
  font-size: 1.1rem;
  line-height: 1.85;
  color: rgba(240, 244, 255, 0.82);
  max-width: 600px;
}

.about-small-img {
  margin-top: 3rem;
  overflow: hidden;
  aspect-ratio: auto;
  max-width: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.about-small-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-portrait {
  aspect-ratio: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: default;
  margin-top: 45px;
}

.about-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease-out);
}

.about-portrait:hover img {
  transform: scale(1.04);
}

.about-skills {
  list-style: none;
  margin-top: 0.3rem;
}

.about-skills li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.about-skills li:first-child {
  border-top: 1px solid var(--border);
}

.about-skills__name {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(240, 244, 255, 0.82);
  letter-spacing: 0.02em;
}

.about-skills__tools {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(180, 196, 225, 0.38);
  margin-top: 0.1rem;
}

.about-cv-wrap {
  margin-top: 4rem;
}

.about-cv-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.9rem 2.5rem;
  border: 1px solid #D5B60A;
  color: #D5B60A;
  background: transparent;
  cursor: pointer;
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.about-cv-btn:hover {
  background: #D5B60A;
  color: #000;
}

@media (max-width: 768px) {
  /* Switch to flex so display:contents children can be ordered freely */
  .about-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  /* Dissolve the two column wrappers — their children become direct flex items */
  .about-left, .about-right { display: contents; }

  /* Mobile order: photo → About me label → bio → Skills label → skills list → button */
  .about-portrait             { order: 1; }
  .about-left > .about-label  { order: 2; }
  .about-bio-text             { order: 3; }
  .about-right > .about-label { order: 4; }
  .about-skills               { order: 5; }
  .about-cv-wrap              { order: 6; }

  /* Show the full portrait — no forced crop */
  .about-portrait { aspect-ratio: auto; max-height: none; margin-top: 0; }
  .about-portrait img { height: auto; }
}

/* ============================================================
   ABOUT (legacy — section on index page)
   ============================================================ */
.about {
  padding: 8rem 0;
  border-top: 1px solid var(--border);
}

.about__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about__text { max-width: 560px; }

.about__bio {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.about__skills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.5rem;
}

.about__skills li {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */
.contact-body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.contact-page {
  flex: 1;
  padding-top: 9rem;
  padding-bottom: 6rem;
  position: relative;
  z-index: 1;
}

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
  min-height: calc(100svh - 9rem - 6rem - var(--nav-h, 4rem));
}

.contact-inner {
  max-width: 560px;
}

.contact-galaxy-wrap {
  position: relative;
  height: clamp(380px, 55vh, 620px);
}

#contact-galaxy {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

@media (max-width: 860px) {
  .contact-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .contact-galaxy-wrap {
    height: 300px;
  }
}

.contact-sub {
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(240, 244, 255, 0.45);
  margin-bottom: 4rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.contact-links {
  list-style: none;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.25s;
}

.contact-links li:first-child .contact-link {
  border-top: 1px solid var(--border);
}

.contact-link__platform {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #D5B60A;
  width: 6rem;
  flex-shrink: 0;
}

.contact-link__handle {
  font-size: 1.15rem;
  font-weight: 500;
  color: rgba(240, 244, 255, 0.78);
  flex: 1;
  transition: color 0.25s;
}

.contact-link__arrow {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: rgba(213, 182, 10, 0);
  transform: translateX(-8px);
  transition: color 0.25s, transform 0.3s var(--ease-out);
}

.contact-link:hover .contact-link__handle {
  color: #fff;
}

.contact-link:hover .contact-link__arrow {
  color: #D5B60A;
  transform: translateX(0);
}

.contact-link:hover {
  border-color: rgba(213, 182, 10, 0.25);
}

.contact-link--static {
  cursor: default;
}

.contact-link--static .contact-link__handle {
  color: rgba(240, 244, 255, 0.45);
}

.contact-link--static:hover .contact-link__handle {
  color: rgba(240, 244, 255, 0.45);
}

.contact-link--static:hover {
  border-color: var(--border);
}

/* ============================================================
   CONTACT (legacy — section on index page)
   ============================================================ */
.contact {
  padding: 8rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.contact__sub {
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 2rem clamp(1.5rem, 5vw, 5rem);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ============================================================
   GALAXY FLY-THROUGH (projects page)
   ============================================================ */
.galaxy-page {
  overflow: hidden;
  height: 100svh;
}

#card-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.gcard {
  position: absolute;
  top: 0; left: 0;
  width: 340px;
  text-decoration: none;
  will-change: transform, opacity;
  transform-origin: 50% 50%;
}

.gcard__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  overflow: hidden;
}

.gcard__media::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(4, 4, 12, 0.72) 90%);
  pointer-events: none;
}

.gcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.gcard__info {
  padding: 0.55rem 0 0;
}

.gcard__cat {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.60rem;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #D5B60A;
}

.gcard__title {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(240, 244, 255, 0.90);
  margin-top: 0.2rem;
  line-height: 1.3;
}

.gcard__tags {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.10em;
  color: rgba(180, 196, 225, 0.40);
  margin-top: 0.18rem;
}

/* Scroll hint */
.galaxy-hint {
  position: fixed;
  top: 10rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.galaxy-hint.is-gone { opacity: 0; }

.galaxy-hint span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.galaxy-hint__line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, rgba(160, 180, 215, 0.35), transparent);
  animation: galaxy-hint-pulse 1.8s ease-in-out infinite;
}

@keyframes galaxy-hint-pulse {
  0%, 100% { opacity: 1;   transform: scaleY(1);   }
  50%       { opacity: 0.3; transform: scaleY(0.4); }
}

/* ============================================================
   SCROLL-REVEAL (initial hidden state)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .about__inner { grid-template-columns: 1fr; }

  .project-card         { grid-column: span 12 !important; }
  .project-card--wide   { grid-column: span 12 !important; }
  .project-card:nth-child(n) { grid-column: span 12 !important; }
}

/* ============================================================
   HAMBURGER NAV TOGGLE
   ============================================================ */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  position: relative;
  z-index: 102;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.85);
  transition: transform 0.35s var(--ease-out), opacity 0.25s;
  transform-origin: center;
}

.nav__toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav__toggle { display: flex; }

  /* backdrop-filter on .nav creates a containing block for position:fixed children,
     constraining nav__links to the nav's height instead of the viewport */
  .nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Hide subtitle in nav — too wide for mobile */
  .nav__logo-role { display: none; }

  /* Scale down galaxy filter buttons to fit all 5 across */
  .filter-galaxy__svg   { width: 44px; height: 44px; }
  .filter-galaxy__label { font-size: 0.50rem; letter-spacing: 0.06em; }
  .filter-galaxy-bar    { gap: 4px; padding: 0 4px 0.75rem; }

  .nav__links {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    transform: translateY(-100%);
    transition: transform 0.45s var(--ease-out);
    z-index: 99;
    pointer-events: none;
  }

  .nav__links.is-open {
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav__links li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--border);
  }

  .nav__links li:first-child {
    border-top: 1px solid var(--border);
  }

  .nav__links a {
    display: block;
    padding: 1.4rem 2rem;
    font-size: 1.1rem;
  }
}
