/* ============================================
   TOKENS
============================================ */
:root{
  --bg: #000000;
  --fg: #f5f5f5;
  --muted: #8a8a8a;
  --muted-2: #5a5a5a;
  --line: #232323;
  --card: #0a0a0a;
  --ease: cubic-bezier(.16,.8,.24,1);
  --nav-h: 84px;
}

*,*::before,*::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *,*::before,*::after{ animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

body{
  margin:0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img{ max-width: 100%; display:block; }
a{ color: inherit; text-decoration: none; }
ul{ list-style: none; margin:0; padding:0; }

::selection{ background: var(--fg); color: var(--bg); }

:focus-visible{
  outline: 1px solid var(--fg);
  outline-offset: 4px;
}

.muted{ color: var(--muted); }

/* ============================================
   GRAIN — handcrafted texture over pure black
============================================ */
.grain{
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================
   LOADER
============================================ */
#loader{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.9s var(--ease);
}
#loader.fade-out{ opacity: 0; pointer-events: none; }
.loader-logo{
  width: 56px;
  height: auto;
  opacity: 0;
  transform: scale(0.92);
  animation: loaderIn 1.6s var(--ease) forwards;
}
@keyframes loaderIn{
  0%{ opacity: 0; transform: scale(0.92); }
  40%{ opacity: 1; transform: scale(1); }
  85%{ opacity: 1; transform: scale(1); }
  100%{ opacity: 0; transform: scale(1.04); }
}

body.loading{ overflow: hidden; height: 100vh; }

/* ============================================
   NAV
============================================ */
.nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: transparent;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled{
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner{
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo img{ height: 26px; width: auto; }
.nav-logo{
  transition: opacity 0.3s var(--ease);
}
.nav-logo:hover{ opacity: 0.6; }

.nav-links{
  display: flex;
  gap: 48px;
}
.nav-links a{
  position: relative;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 4px 0;
  transition: color 0.3s var(--ease);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.nav-links a .idx{
  font-size: 10px;
  color: var(--muted-2);
}
.nav-links a:hover, .nav-links a:focus-visible{ color: var(--fg); }
.nav-links a::after{
  content:'';
  position: absolute;
  left:0; right: 100%;
  bottom: -4px;
  height: 1px;
  background: var(--fg);
  transition: right 0.4s var(--ease);
}
.nav-links a:hover::after{ right: 0; }

.nav-toggle{
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span{
  width: 22px;
  height: 1px;
  background: var(--fg);
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}
.nav-toggle.open span:nth-child(1){ transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2){ opacity: 0; }
.nav-toggle.open span:nth-child(3){ transform: translateY(-6px) rotate(-45deg); }

/* ============================================
   HERO
============================================ */
.hero{
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 24px 100px;
  position: relative;
}
.hero-inner{
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-logo{
  width: 72px;
  height: auto;
  margin-bottom: 44px;
  opacity: 0;
  transform: translateY(16px);
}
.hero-roles{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  opacity: 0;
  transform: translateY(16px);
}
.hero-roles span:first-child{ color: var(--fg); }
.hero-roles span:last-child{ color: var(--muted); font-weight: 400; }
.hero-divider{
  width: 1px;
  height: 28px;
  background: var(--line);
  margin: 10px 0;
}
.hero-desc{
  margin: 28px 0 0;
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.7;
  opacity: 0;
  transform: translateY(16px);
}
.hero-desc-en{ margin-top: 6px; color: var(--muted-2); }

body:not(.loading) .hero-logo{ animation: rise 1s var(--ease) 0.2s forwards; }
body:not(.loading) .hero-roles{ animation: rise 1s var(--ease) 0.4s forwards; }
body:not(.loading) .hero-desc{ animation: rise 1s var(--ease) 0.6s forwards; }
body:not(.loading) .hero-desc-en{ animation: rise 1s var(--ease) 0.7s forwards; }

@keyframes rise{
  to{ opacity: 1; transform: translateY(0); }
}

.scroll-cue{
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 40px;
  background: var(--line);
  overflow: hidden;
}
.scroll-cue span{
  position: absolute;
  top: -40px;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--fg);
  animation: scrollCue 2.2s ease-in-out infinite;
}
@keyframes scrollCue{
  0%{ top: -40px; }
  60%{ top: 40px; }
  100%{ top: 40px; }
}

/* ============================================
   SECTION SCAFFOLDING
============================================ */
section{
  padding: 160px 24px;
  max-width: 1280px;
  margin: 0 auto;
}
.section-head{
  margin-bottom: 80px;
}
.eyebrow{
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 20px;
}
.section-head h2{
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}
.section-head h2 .muted{ font-weight: 300; }

.reveal{
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.in-view{
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   WORK GRID
============================================ */
.grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.card{
  background: var(--bg);
  cursor: pointer;
  transition: background 0.5s var(--ease);
}
.card:hover{ background: #050505; }

.card-visual{
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.card-num{
  font-size: clamp(64px, 9vw, 120px);
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  letter-spacing: -0.02em;
  transition: -webkit-text-stroke 0.5s var(--ease), transform 0.6s var(--ease);
}
.card:hover .card-num{
  -webkit-text-stroke: 1px var(--muted);
  transform: scale(1.06);
}
.card-meta{
  padding: 24px 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-meta h3{
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.tag{
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 100px;
}

/* ============================================
   ABOUT
============================================ */
.about-grid{
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 64px;
}
.about-body p{
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.6;
  font-weight: 300;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}
.skills{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}
.skills li{
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 100px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.skills li:hover{ color: var(--fg); border-color: var(--muted); }

/* ============================================
   CONTACT
============================================ */
.contact{ text-align: center; }
.contact .section-head{ display:flex; flex-direction: column; align-items: center; }
.email-btn{
  display: inline-block;
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
}
.email-btn:hover{ border-color: var(--fg); transform: translateY(-2px); }

.socials{
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 64px;
}
.socials a{
  font-size: 13px;
  color: var(--muted);
  position: relative;
  padding-bottom: 4px;
}
.socials a::after{
  content:'';
  position: absolute;
  left:0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--fg);
  transition: right 0.4s var(--ease);
}
.socials a:hover{ color: var(--fg); }
.socials a:hover::after{ right: 0; }

/* ============================================
   FOOTER
============================================ */
.footer{
  padding: 48px 24px 64px;
  text-align: center;
  border-top: 1px solid var(--line);
  max-width: 1280px;
  margin: 0 auto;
}
.footer-logo{
  height: 20px;
  width: auto;
  margin: 0 auto 16px;
  opacity: 0.6;
}
.footer p{
  font-size: 12px;
  color: var(--muted-2);
  margin: 0;
}

/* ============================================
   MODAL
============================================ */
.modal{
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.modal[hidden]{ display: none; }
.modal.show{ opacity: 1; }
.modal-inner{
  max-width: 560px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 56px 48px;
  position: relative;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.4s var(--ease);
}
.modal.show .modal-inner{ transform: translateY(0) scale(1); }
.modal-inner h3{
  font-size: 28px;
  font-weight: 600;
  margin: 16px 0 12px;
  letter-spacing: -0.01em;
}
.modal-inner p{
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  margin: 0;
}
.modal-close{
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
  transition: color 0.3s var(--ease);
}
.modal-close:hover{ color: var(--fg); }

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 860px){
  .about-grid{ grid-template-columns: 1fr; gap: 40px; }
  .grid{ grid-template-columns: 1fr; }
}

@media (max-width: 720px){
  .nav-links{
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(0,0,0,0.96);
    backdrop-filter: blur(14px);
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease);
  }
  .nav-links.open{ max-height: 260px; }
  .nav-links a{
    padding: 20px 32px;
    width: 100%;
    border-top: 1px solid var(--line);
  }
  .nav-toggle{ display: flex; }
  section{ padding: 100px 20px; }
  .section-head{ margin-bottom: 48px; }
}
