/* ============ Reset & base ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/archivo-variable.woff2") format('woff2');
}

:root {
  --bg: #0f0e13;
  --fg: #f2f2f1;
  --muted: #9a9a9a;
  --accent: #8fd694;
  --radius: 32px;
  --header-clearance: clamp(88px, 10vw, 116px);
  --side-pad: clamp(90px, 11vw, 160px);
  --glass-bg: rgba(255, 255, 255, 0.038);
  --glass-border: rgba(255, 255, 255, 0.085);
  --glass-blur: 34px;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  cursor: none;
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: #c99; }

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

@media (hover: none) {
  body { cursor: auto; }
  #custom-cursor { display: none; }
}

img { max-width: 100%; display: block; }

/* ============ Animated background ============ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#bg-gradient {
  background:
    radial-gradient(ellipse 60% 45% at 20% 25%, oklch(0.28 0.09 250 / 0.55) 0%, transparent 60%),
    radial-gradient(ellipse 55% 50% at 82% 15%, oklch(0.30 0.08 300 / 0.4) 0%, transparent 62%),
    radial-gradient(ellipse 65% 55% at 50% 90%, oklch(0.24 0.07 220 / 0.45) 0%, transparent 65%),
    linear-gradient(135deg, oklch(0.12 0.014 265) 0%, oklch(0.16 0.03 250) 45%, oklch(0.11 0.01 265) 100%);
  background-size: 220% 220%, 220% 220%, 220% 220%, 100% 100%;
  animation: bgDrift 34s ease-in-out infinite alternate;
  will-change: background-position;
}

@keyframes bgDrift {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  50%  { background-position: 30% 40%, 65% 35%, 40% 60%, 0 0; }
  100% { background-position: 10% 70%, 80% 60%, 60% 30%, 0 0; }
}

#bg-dots {
  opacity: 0.13;
  background-image: radial-gradient(rgba(255, 255, 255, 0.9) 1px, transparent 1px);
  background-size: 28px 28px;
}

#bg-noise {
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  #bg-gradient { animation: none; }
}

/* ============ Custom cursor ============ */
#custom-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 242, 241, 0.8);
  pointer-events: none;
  z-index: 200;
  transform: translate3d(-50%, -50%, 0);
  transition: width 0.18s ease, height 0.18s ease, background 0.18s ease;
  will-change: transform;
}
#custom-cursor.hover { width: 34px; height: 34px; background: rgba(242, 242, 241, 0.15); }

/* ============ Fixed chrome ============ */
#logo-img {
  position: fixed;
  top: clamp(16px, 3vw, 32px);
  left: 50%;
  width: clamp(90px, 10vw, 140px);
  opacity: 0.9;
  z-index: 60;
  pointer-events: none;
  animation: fadeIn 1s ease both;
  transition: transform 0.2s ease-out;
  transform: translateX(-50%);
}

#lang-toggle {
  position: fixed;
  top: clamp(16px, 3vw, 32px);
  right: clamp(16px, 3vw, 32px);
  z-index: 61;
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 1px;
  animation: fadeIn 1s ease both;
}
#lang-toggle span { opacity: 0.4; transition: opacity 0.2s, font-weight 0.2s; }
#lang-toggle span.active { opacity: 1; font-weight: 700; }

/* Side nav (desktop): vertical, left-fixed */
#side-nav {
  position: fixed;
  left: clamp(10px, 2.2vw, 32px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 60;
  animation: fadeIn 1s ease 0.15s both;
}
.nav-dot {
  width: 32px; height: 32px;
  border: 1.5px solid rgba(242, 242, 241, 0.5);
  background: transparent;
  color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  border-radius: 50%;
}
.nav-dot:hover { transform: scale(1.15); }
.nav-dot.active { background: var(--fg); color: #0b0a09; }

#nav-progress-track {
  width: 2px; height: 80px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
#nav-progress-fill { width: 100%; height: 0%; background: var(--fg); transition: height 0.1s linear; }

/* ============ Layout ============ */
#page {
  position: relative;
  min-height: 100vh;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  overflow-x: hidden;
}

section { position: relative; z-index: 1; }

#home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--header-clearance) clamp(24px, 6vw, 80px) clamp(24px, 3vw, 40px) var(--side-pad);
  perspective: 1400px;
}

#home-wrapper {
  width: 100%;
  max-width: 2000px;
  will-change: transform;
  transition: transform 0.2s ease-out;
}

/* Glass card */
.glass {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: fadeInUp 0.8s ease both;
}
.glass::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.glass > * { position: relative; z-index: 1; }

#home-card {
  padding: clamp(24px, 3vw, 44px);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 32px);
}

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.name-label { font-size: 13px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.name-title { font-family: 'Archivo', Helvetica, sans-serif; font-weight: 800; font-size: clamp(28px, 3.4vw, 42px); letter-spacing: 0.5px; text-transform: uppercase; line-height: 1.05; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.header-icons { display: flex; gap: 10px; flex-shrink: 0; }

.hero-cards { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-card {
  flex: 1 1 320px;
  position: relative;
  height: clamp(220px, 26vw, 340px);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: block;
  transition: transform 0.3s ease;
}
.hero-card:hover { transform: scale(1.015); }
.hero-card img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.85); }
.hero-card .overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 55%); }
.hero-card .label { position: absolute; left: 24px; bottom: 22px; font-weight: 700; font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase; }

#projects { scroll-margin-top: 100px; }
.projects-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.section-title { font-family: 'Archivo', Helvetica, sans-serif; font-weight: 800; font-size: clamp(24px, 2.8vw, 34px); letter-spacing: 0.5px; text-transform: uppercase; }
.projects-controls { display: flex; align-items: center; gap: 16px; }
#project-counter { font-size: 13px; color: var(--muted); letter-spacing: 1px; }
.arrow-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; border: none; color: var(--fg);
  transition: background 0.2s;
}
.arrow-btn:hover { background: rgba(255, 255, 255, 0.18); }

#projects-track {
  display: flex; gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
}
.project-card {
  scroll-snap-align: start;
  flex: 0 0 calc((100% - 36px) / 3);
  min-width: 260px;
  height: 340px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #151412;
  transition: transform 0.3s ease;
}
.project-card:hover { transform: translateY(-6px); }
.project-card .thumb {
  width: 100%; height: 100%;
  background-size: cover; background-position: center;
  filter: grayscale(0.3) brightness(0.85);
  opacity: 0; transition: opacity 0.6s ease;
}
.project-card .thumb.loaded { opacity: 1; }
.project-card .overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent 50%); }
.project-card .meta { position: absolute; left: 18px; bottom: 16px; }
.project-card .meta .p-name { font-weight: 700; font-size: 14px; letter-spacing: 0.5px; }
.project-card .meta .p-cms { font-size: 11px; color: #b8b8b8; letter-spacing: 0.5px; }

#contact {
  scroll-margin-top: 0;
  padding: 24px clamp(24px, 6vw, 80px) 60px var(--side-pad);
  display: flex; align-items: center; justify-content: center;
}
#contact-card { padding: clamp(32px, 4vw, 64px); }
.contact-bg-word {
  position: absolute; top: 50%; right: clamp(16px, 3vw, 48px);
  transform: translateY(-50%);
  font-family: 'Archivo', Helvetica, sans-serif; font-weight: 800;
  font-size: clamp(80px, 14vw, 220px); letter-spacing: -2px;
  color: rgba(255, 255, 255, 0.035);
  white-space: nowrap; pointer-events: none; z-index: 0;
}
.contact-inner { position: relative; display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.talk-label { font-size: 13px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.contact-title { font-family: 'Archivo', Helvetica, sans-serif; font-weight: 800; font-size: clamp(32px, 5vw, 58px); text-transform: uppercase; line-height: 1.02; margin-top: 10px; }
.contact-links { flex: 1 1 320px; display: flex; flex-direction: column; gap: 12px; }
.contact-link {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px; padding: 16px 20px;
  transition: background 0.2s, transform 0.2s;
}
.contact-link:hover { background: rgba(255, 255, 255, 0.09); transform: translateX(4px); }
.contact-link .icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }

#back-to-top {
  position: fixed; bottom: 28px; right: 28px; z-index: 70;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, background 0.2s;
  color: var(--fg);
}
#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover { background: rgba(255, 255, 255, 0.18); }

/* ============ About drawer ============ */
#about-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 5, 4, 0.45);
  backdrop-filter: blur(0px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease, backdrop-filter 0.4s ease;
}
#about-backdrop.open { opacity: 1; pointer-events: auto; backdrop-filter: blur(10px); }

#about-drawer {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: min(440px, 92vw);
  z-index: 95;
  box-sizing: border-box;
  transform: translateX(105%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(18, 16, 15, 0.86);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  padding: clamp(24px, 3vw, 40px);
  padding-bottom: clamp(48px, 6vw, 80px);
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto;
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
}
#about-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-photo-row { display: flex; gap: 14px; align-items: stretch; height: clamp(180px, 20vw, 220px); }
.vertical-label {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: 'Archivo', Helvetica, sans-serif; font-weight: 800;
  font-size: clamp(16px, 1.8vw, 22px); letter-spacing: 2px; text-transform: uppercase;
  color: #d8d8d8; flex-shrink: 0;
}
.drawer-photo { flex: 1; border-radius: var(--radius); overflow: hidden; }
.drawer-photo img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.bio-text { font-size: 14px; line-height: 1.65; color: #c9c9c9; margin: 0; }
.info-blocks { display: flex; flex-direction: column; gap: 12px; }
.info-block { background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 16px 18px; }
.info-block .label { font-weight: 700; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.info-block .body { font-size: 13px; line-height: 1.6; color: #b8b8b8; }

/* ============ Project detail modal ============ */
#detail-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 5, 4, 0.82);
  backdrop-filter: blur(24px);
  display: none; align-items: center; justify-content: center;
  padding: clamp(16px, 3vw, 40px);
}
#detail-modal.open { display: flex; }
.detail-inner {
  width: 100%; max-width: 1100px; max-height: 92vh;
  overflow-y: auto; box-sizing: border-box;
  background: rgba(18, 16, 15, 0.82);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 40px);
  position: relative;
  animation: popIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.detail-close {
  position: absolute; top: 20px; right: 20px;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; z-index: 2; border: none; color: var(--fg);
}
.detail-close:hover { background: rgba(255, 255, 255, 0.18); }
.detail-eyebrow { font-size: 12px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.detail-title { font-family: 'Archivo', Helvetica, sans-serif; font-weight: 800; font-size: clamp(24px, 3.4vw, 36px); text-transform: uppercase; margin-bottom: 4px; }
.detail-url { font-size: 14px; color: var(--muted); }
.detail-image { margin-top: 22px; border-radius: var(--radius); overflow: hidden; height: clamp(220px, 42vw, 460px); background: #151412; }
.detail-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 24px; }
.detail-cms { flex: 0 0 140px; }
.detail-cms .label, .detail-role .label { font-size: 12px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.detail-cms .value { font-weight: 700; font-size: 15px; }
.detail-role { flex: 1 1 320px; }
.detail-role .role-text, .detail-role .desc-text { font-size: 14px; line-height: 1.65; color: #c9c9c9; }
.detail-role .desc-text { margin-top: 10px; }
.detail-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; }
.detail-counter { font-size: 13px; color: var(--muted); }

/* ============ Animations ============ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .glass, #logo-img, #lang-toggle, #side-nav { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============ Mobile ============ */
@media (max-width: 760px) {
  :root {
    --side-pad: 8px;
    --header-clearance: 76px;
  }

  #home { padding-left: 8px; padding-right: 8px; padding-bottom: 96px; }
  #contact { padding-left: 8px; padding-right: 8px; padding-bottom: 112px; }
  #page { max-width: 100%; }

  .hero-cards { gap: 10px; }
  .project-card { flex: 0 0 78%; }

  /* Side nav becomes a fixed horizontal bar at the bottom */
  #side-nav {
    left: 8px; right: 8px; top: auto; bottom: 10px;
    transform: none;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 10px 18px;
    background: rgba(20, 18, 17, 0.72);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    z-index: 80;
  }
  #nav-progress-track {
    width: auto; flex: 1 1 60px; max-width: 90px;
    height: 2px; margin-top: 0;
    align-items: stretch;
  }
  #nav-progress-fill { width: 0%; height: 100%; transition: width 0.1s linear; }

  #back-to-top { bottom: 78px; right: 14px; width: 40px; height: 40px; font-size: 16px; }

  #logo-img { width: clamp(76px, 26vw, 100px); top: 14px; }
  #lang-toggle { top: 14px; right: 12px; padding: 5px 10px; font-size: 11px; }

  .name-title { font-size: clamp(24px, 7.4vw, 30px); }
  .header-icons .icon-btn { width: 36px; height: 36px; }

  #about-drawer { width: 100%; }
  .detail-meta { gap: 20px; }
}
