/* ============================================================
   layout.css - Header, hero, avatar, divider, footer
   ============================================================ */

/* Font is injected at runtime by config-loader.js from config.json */

/* ── Theme switcher ── */
.theme-switcher {
  position: fixed;
  top: 1.4rem;
  left: 1.8rem;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

[data-theme="light"] .theme-switcher {
  background: rgba(232, 230, 225, 0.85);
}

.theme-switcher:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.theme-switcher:active {
  transform: scale(0.95);
}

.theme-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  transition: opacity 0.3s, transform 0.3s;
}

.theme-icon.sun {
  position: absolute;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-icon.moon {
  position: absolute;
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

[data-theme="light"] .theme-icon.sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

[data-theme="light"] .theme-icon.moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ── Language switcher ── */
.lang-switcher {
  position: fixed;
  top: 1.4rem;
  right: 1.8rem;
  z-index: 1000;
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

[data-theme="light"] .lang-switcher {
  background: rgba(232, 230, 225, 0.85);
}

.lang-btn {
  padding: 0.38rem 0.95rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.lang-btn.active {
  color: var(--bg);
  background: var(--accent);
}

.lang-btn:not(.active):hover {
  color: var(--accent2);
}

/* ════════════════════════════════════════════════════════════
   SNAP SECTIONS
   ─ snap-container: fixed, covers viewport, holds stage only
   ─ snap-projects:  fixed, separate from container, z-index above
                     container when active, below when inactive
   ════════════════════════════════════════════════════════════ */

body {
  overflow: hidden;
}

/* Project detail page — normal scroll, no snap */
body.page-project {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* hide native, use custom */
}
body.page-project::-webkit-scrollbar { display: none; }

/* Stage container — holds hero/skills sections */
.snap-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  overflow: hidden;
  background-color: var(--bg);
  background-image: var(--noise-svg);
  background-attachment: fixed;
  will-change: transform;
}

/* Projects section — separate fixed layer */
#snap-projects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9;
  background-color: var(--bg);
  background-image: var(--noise-svg);
  background-attachment: fixed;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  transform: translateY(100%);
  will-change: transform;
}

/* When projects are active, bring above stage */
#snap-projects.is-active {
  z-index: 11;
}

/* snap-stage — fills its container, transparent so container bg/noise shows */
#snap-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  will-change: transform;
}

/* ── Background glow for stage section ── */
#snap-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, var(--glow) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 20% 80%, var(--gradient-bottom) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Stage: single section that holds both hero and skills ── */
#snap-stage {
  overflow: hidden;
}

/* Skills panel — full left half, starts off-screen left */
.stage-skills {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 5rem 2rem 4rem 3rem;
  border-right: 1px solid transparent;
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 1;
  /* Off-screen left initially — JS drives transitions */
  transform: translateX(-100%);
  will-change: transform, opacity;
  opacity: 0;
}
.stage-skills::-webkit-scrollbar { display: none; }
.stage-skills .skills-inner { width: 100%; max-width: 100%; margin: 0; }

/* Hero panel — centred initially, shifts right on transition */
.stage-hero {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem 4rem;
  z-index: 2;
  will-change: left, width;
}

/* Inner hero card — always centred within its panel */
.stage-hero .hero {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.4rem;
}

/* Top block: avatar + title */
.hero-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  will-change: transform;
}

/* Bottom block: links */
.hero-bottom {
  will-change: transform;
}

/* Bio — sits between top and bottom, fades + collapses */
.hero-bio {
  will-change: opacity, max-height, margin;
  overflow: hidden;
}

/* ── Section 3: projects with internal scroll ── */
#snap-projects {
  align-items: stretch;
  justify-content: flex-start;
}

.projects-scroll {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 2.5rem; /* space for custom scrollbar */
  scrollbar-width: none; /* hide native */
}
.projects-scroll::-webkit-scrollbar { display: none; }

/* ── Custom scrollbar (left side of projects section) ── */
.custom-scrollbar {
  position: absolute;
  left: 0;
  /* top/bottom set by JS to align with content area */
  top: var(--sb-top, 0px);
  bottom: var(--sb-bottom, 0px);
  width: 6px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-right: 1px solid var(--border);
  z-index: 5;
  cursor: pointer;
  border-radius: 0 3px 3px 0;
}

.custom-scrollbar__thumb {
  position: absolute;
  left: 0;
  width: 100%;
  min-height: 40px;
  background: var(--accent);
  border-radius: 3px;
  transition: background 0.2s;
  cursor: grab;
}

.custom-scrollbar__thumb:hover,
.custom-scrollbar__thumb:active {
  background: var(--accent2);
}

.custom-scrollbar__thumb:active {
  cursor: grabbing;
}

/* Section nav dots */
.section-nav {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.section-nav__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s, opacity 0.25s;
  padding: 0;
  opacity: 0.45;
}

.section-nav__dot.is-active {
  background: var(--accent);
  transform: scale(1.35);
  opacity: 1;
}

/* ── Mobile: revert to normal scroll ── */
@media (max-width: 900px) {
  body { overflow: auto; }

  .snap-container {
    position: static;
    height: auto;
    overflow: visible;
    transform: none !important;
  }

  #snap-stage {
    position: static;
    height: auto;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: none !important;
  }

  .stage-skills {
    position: static;
    width: 100%;
    height: auto;
    padding: 2rem 1.5rem 3rem;
    transform: none !important;
    opacity: 1 !important;
    border-top: 1px solid var(--border);
    order: 2;
    overflow-y: visible;
  }

  .stage-hero {
    position: static;
    width: 100% !important;
    left: 0 !important;
    height: auto;
    padding: 5rem 1.5rem 2.5rem;
    order: 1;
  }

  .hero-bio {
    opacity: 1 !important;
  }

  .hero-highlights {
    opacity: 1 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  #snap-projects {
    position: static;
    height: auto;
    transform: none !important;
    z-index: auto;
    flex-direction: column;
    overflow: visible;
  }

  .projects-scroll {
    overflow: visible;
    height: auto;
    padding-left: 0;
  }

  .custom-scrollbar { display: none; }
  .section-nav      { display: none; }
}

/* Background glow shared */
.snap-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, var(--glow) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 20% 80%, var(--gradient-bottom) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Hero card ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  text-align: center;
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
  animation: fadeUp 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Highlights list ── */
.hero-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
  width: 100%;
  will-change: opacity, max-height;
  overflow: hidden;
}

.hero-highlights li {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.hl-bullet {
  color: var(--accent);
  font-size: 0.65rem;
  flex-shrink: 0;
  position: relative;
  top: -0.05em;
}

/* ── Section nav dots (right side) ── */
.section-nav {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.section-nav__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s, opacity 0.25s;
  padding: 0;
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.section-nav__dot svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  opacity: 0;
  position: absolute;
  transition: opacity 0.25s;
}

.section-nav__dot.is-active {
  background: var(--accent);
  transform: scale(1.3);
  opacity: 1;
}

.section-nav__dot.is-active svg {
  opacity: 0; /* dots only, no icon when active */
}

/* Projects nav dot is always visible since projects are outside snap */
.section-nav__dot--projects {
  border-style: dashed;
}

/* ── Compact hero for split section ── */
.hero--compact {
  gap: 1rem;
}

.avatar-wrap--sm {
  width: 110px;
  height: 110px;
}

.h1--sm {
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
}

/* ════════════════════════════════════════════════════════════
   AVATAR
   ════════════════════════════════════════════════════════════ */
/* ── Avatar ── */
.avatar-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent),
    transparent 40%,
    var(--accent) 60%,
    transparent 80%,
    var(--accent)
  );
  animation: spin 8s linear infinite;
}

.avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--bg);
}

.avatar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
}

.avatar-placeholder {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)) 0%, color-mix(in srgb, var(--accent) 22%, var(--surface)) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  border: 3px solid var(--surface);
}

/* ── Typography ── */
h1 {
  font-family: inherit;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

h1 span {
  color: var(--accent);
}

.tagline {
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.bio {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
}

[data-theme="light"] .bio {
  color: var(--muted);
}

/* ── Social links ── */
.links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent2);
  text-decoration: none;
  transition: background 0.25s, border-color 0.25s, transform 0.2s;
}

.link-pill:hover {
  background: var(--glow);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ── Section divider ── */
.divider {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-label {
  font-family: inherit;
  font-size: 1.5rem;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border);
}


/* ════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* ── Theme & Lang switchers ── */
  .theme-switcher {
    top: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
  }
  
  .lang-switcher {
    top: 1rem;
    right: 1rem;
  }
  
  .lang-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.65rem;
  }
  
  /* ── Avatar ── */
  .avatar-wrap {
    width: 120px;
    height: 120px;
  }
  
  .avatar-placeholder {
    font-size: 3rem;
  }
  
  /* ── Typography ── */
  .tagline {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
  }
  
  .bio {
    font-size: 0.95rem;
    line-height: 1.6;
  }
  
  /* ── Social links ── */
  .links {
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .link-pill {
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
  }
  
  /* ── Divider ── */
  .divider {
    padding: 0 1.2rem;
  }
  
  .divider-label {
    font-size: 1.2rem;
  }
  
  /* ── Projects section ── */
  .projects-section {
    padding: 3rem 1.2rem 5rem;
  }
  
  .section-intro {
    margin-bottom: 2rem;
  }
  
  .section-intro p {
    font-size: 0.8rem;
  }
  
  /* ── Project grid ── */
  .grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  
  /* ── Footer ── */
  footer {
    padding: 1.5rem 1rem;
    font-size: 0.7rem;
  }
}

/* ── Extra small devices ── */
@media (max-width: 400px) {
  .avatar-wrap {
    width: 100px;
    height: 100px;
  }
  
  .avatar-placeholder {
    font-size: 2.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .links {
    gap: 0.4rem;
  }
  
  .link-pill {
    padding: 0.35rem 0.7rem;
    font-size: 0.7rem;
  }
}

/* ── Touch devices: disable hover effects ── */
@media (hover: none) {
  .theme-switcher:active {
    transform: scale(0.95);
  }
  
  .link-pill:hover {
    transform: none;
  }
  
  .project-card:hover {
    transform: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .project-card:hover .project-image-wrapper,
  .project-card:hover .project-thumb {
    transform: none;
  }
  
  .project-arrow {
    opacity: 1;
    transform: none;
  }
}
