* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  font-family: 'General Sans', 'Pretendard', sans-serif;
  color: #1a1a1a;
}

a { color: #1a1a1a; text-decoration: none; }
a:hover { color: #8a8a8a; }

/* custom glow cursor */
html.has-custom-cursor,
html.has-custom-cursor * {
  cursor: none !important;
}
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  background: radial-gradient(circle, rgba(159,222,242,0.7) 0%, rgba(159,222,242,0.32) 45%, rgba(159,222,242,0) 75%);
  filter: blur(2.5px);
  transform: translate3d(-100px, -100px, 0);
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: transform;
}
.cursor-glow.active { opacity: 1; }

/* touch devices have no cursor position to track — always hide the glow */
@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none !important; }
}

/* door-opening intro (load/refresh only) */
html.door-intro-active,
html.door-intro-active body {
  overflow: hidden;
}
.door-intro {
  position: fixed;
  inset: 0;
  z-index: 100000;
  overflow: hidden;
  background: #ffffff;
}
.door-panel {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: #ffffff;
  will-change: transform;
}
.door-left {
  left: 0;
  animation: doorOpenLeft 0.9s cubic-bezier(.65, 0, .35, 1) 1s forwards;
}
.door-right {
  right: 0;
  animation: doorOpenRight 0.9s cubic-bezier(.65, 0, .35, 1) 1s forwards;
}
@keyframes doorOpenLeft {
  to { transform: translateX(-100%); }
}
@keyframes doorOpenRight {
  to { transform: translateX(100%); }
}
.door-glow {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(to bottom,
    rgba(159,222,242,0) 0%,
    rgba(159,222,242,0.9) 12%,
    rgba(255,255,255,0.95) 50%,
    rgba(159,222,242,0.9) 88%,
    rgba(159,222,242,0) 100%);
  box-shadow: 0 0 14px 4px rgba(159,222,242,0.5), 0 0 26px 10px rgba(255,255,255,0.3);
  opacity: 0;
  will-change: opacity;
  animation: doorGlowIn 0.3s ease 0s forwards,
             doorGlowOut 0.25s ease 1s forwards;
}
@keyframes doorGlowIn {
  to { opacity: 1; }
}
@keyframes doorGlowOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(1.1em); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.page {
  font-family: 'General Sans', 'Pretendard', sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  width: 100%;
  position: relative;
  overflow-x: hidden;
}

/* progress bar */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #f0f0ee;
  z-index: 100;
}
.progress-fill {
  height: 100%;
  background: #1a1a1a;
  width: 0%;
  transition: width 0.05s linear;
}

/* nav */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 28px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 90;
  mix-blend-mode: difference;
}
.nav-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.nav-title {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #ffffff;
}
.nav-lang-toggle {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  user-select: none;
  display: none;
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 3px;
  background: rgba(159,222,242,0.12);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.nav-lang-toggle:hover {
  background: rgba(159,222,242,0.2);
  border-color: rgba(255,255,255,0.5);
}
.nav-lang-toggle.visible { display: inline-block; }
.nav-num {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
}
.nav-right {
  display: flex;
  gap: 28px;
}
.nav-link {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #ffffff;
  cursor: pointer;
}

/* dropdown */
.dropdown {
  position: fixed;
  background: #ffffff;
  border: 1px solid #ececec;
  min-width: 100px;
  z-index: 200;
  padding: 6px 0;
  display: none;
}
.dropdown.open { display: block; }
.dropdown-link {
  display: block;
  padding: 8px 18px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #1a1a1a;
}
.dropdown-current {
  color: #c4c4c4;
}

/* project 01 grid */
.hero {
  height: 100vh;
  box-sizing: border-box;
  padding: 120px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: repeat(5, min(calc((78vw - 192px) / 5 * 0.62), calc((100vh - 200px) / 2 * 0.62)));
  grid-template-rows: repeat(2, min(calc((78vw - 192px) / 5 * 0.62), calc((100vh - 200px) / 2 * 0.62)));
  gap: 48px;
  justify-content: center;
}
.hero-grid img {
  width: 100%;
  height: 100%;
  background: #ffffff;
  filter: brightness(1.1);
  object-fit: cover;
  display: block;
}

/* project 02 — 9:16 frame with hard-cut scroll-snap between photos */
#project-02 {
  position: relative;
  height: 100vh;
  background: #000000;
}
.snap-gallery {
  height: 100%;
  width: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #000000;
}
.snap-gallery::-webkit-scrollbar {
  display: none;
}
.snap-slide {
  height: 100%;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
}
.frame {
  --frame-w: min(92vw, calc(80vh * 9 / 16));
  width: var(--frame-w);
  height: calc(var(--frame-w) * 16 / 9);
  overflow: hidden;
  background: #000000;
}
.frame img {
  width: 100%;
  height: 100%;
  background: #000000;
  filter: brightness(1.1);
  object-fit: cover;
  display: block;
}
.slide-label {
  position: absolute;
  right: 24px;
  bottom: 20px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.45);
  z-index: 20;
  pointer-events: none;
}

/* project 03 */
#project-03 {
  position: relative;
  background: #ffffff;
  padding: 0;
}
.word-field {
  position: relative;
  width: 100%;
  height: 200vh;
  overflow: hidden;
  touch-action: none;
}
.word {
  position: absolute;
  font-weight: 500;
  font-family: 'General Sans', 'Pretendard', sans-serif;
  letter-spacing: 0.01em;
  white-space: nowrap;
  user-select: none;
  touch-action: none;
}
.word-inner {
  display: inline-block;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-play-state: paused;
}
.word-inner.idle {
  animation-name: wordIdleBob;
  animation-play-state: running;
}
@keyframes wordIdleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(var(--bob, -3px)); }
}

.ink-bloom {
  position: absolute;
  left: 0;
  top: 0;
  width: 90px;
  height: 90px;
  transform: translate(-50%, -50%) scale(0.2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61,187,234,0.55) 0%, rgba(61,187,234,0.18) 55%, rgba(61,187,234,0) 76%);
  filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: transform 900ms cubic-bezier(.16,.84,.44,1), opacity 900ms ease;
  z-index: 15;
}
.ink-bloom.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.reaction-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) scale(0.6);
  color: #3dbbea;
  font-weight: 600;
  font-size: 20px;
  font-family: 'General Sans', 'Pretendard', sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: transform 700ms cubic-bezier(.16,.84,.44,1) 150ms, opacity 700ms ease 150ms;
  z-index: 25;
}
.reaction-label.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* contact */
#contact-section {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18vh 24px 16vh;
  box-sizing: border-box;
}
.contact-line {
  max-width: 520px;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  margin: 0 0 5.5vh;
}
.contact-link {
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #1a1a1a;
}
.contact-footer {
  margin-top: 11vh;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #c4c4c4;
}

/* ============================================================
   Mobile (phones, ~375px-430px) — desktop layout above is untouched
   ============================================================ */
@media (max-width: 600px) {

  /* 1. nav */
  .nav {
    padding: 16px 16px;
  }
  .nav-title {
    font-size: 11px;
  }
  .nav-lang-toggle {
    font-size: 8px;
    padding: 2px 5px;
  }
  .nav-num {
    font-size: 9px;
  }
  .nav-right {
    gap: 14px;
  }
  .nav-link {
    font-size: 11px;
  }

  /* 2. project 01 grid: keep 5x2 layout, just shrink each tile to fit the width */
  .hero {
    padding: 88px 14px 24px;
  }
  .hero-grid {
    grid-template-columns: repeat(5, min(calc((100vw - 28px - 32px) / 5), calc((100vh - 160px) / 2)));
    grid-template-rows: repeat(2, min(calc((100vw - 28px - 32px) / 5), calc((100vh - 160px) / 2)));
    gap: 8px;
  }

  /* 3. project 02 frame + slide label */
  .frame {
    --frame-w: min(88vw, calc(78vh * 9 / 16));
  }
  .slide-label {
    right: 16px;
    bottom: 14px;
    font-size: 9px;
  }

  /* 4. project 03 word scatter reaction fx (word sizing/density handled in script.js) */
  .ink-bloom {
    width: 60px;
    height: 60px;
  }
  .reaction-label {
    font-size: 14px;
  }

  /* 5. contact section */
  #contact-section {
    padding: 14vh 20px 10vh;
  }
  .contact-line {
    font-size: clamp(18px, 5.5vw, 22px);
    margin: 0 0 4vh;
  }
  .contact-link {
    font-size: 13px;
  }
  .contact-footer {
    margin-top: 7vh;
    font-size: 10px;
  }
}
