:root {
  --bg: #ffffff;
  --fg: #000000;
  --fg-muted: rgba(0, 0, 0, 0.56);
  --hairline: rgba(0, 0, 0, 0.14);
  --hairline-strong: rgba(0, 0, 0, 0.28);
  --surface: rgba(0, 0, 0, 0.04);
  --surface-elevated: #ffffff;
  --inv-bg: #000000;
  --inv-fg: #ffffff;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-editorial: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: clamp(3.5rem, 7svh, 4.75rem);
  --gutter: clamp(1rem, 4vw, 3.5rem);
}

html[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, 0.58);
  --hairline: rgba(255, 255, 255, 0.16);
  --hairline-strong: rgba(255, 255, 255, 0.34);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-elevated: #000000;
  --inv-bg: #ffffff;
  --inv-fg: #000000;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  background-color: var(--bg);
  color: var(--fg);
  scrollbar-width: none;
  -ms-overflow-style: none;
  overflow-x: hidden;
  transition: color 0.38s var(--ease-editorial), background-color 0.01s linear;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: transparent;
  color: var(--fg);
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.is-loading {
  overflow: hidden;
}

button,
a {
  font: inherit;
  color: inherit;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

svg,
svg * {
  transition:
    color 0.45s var(--ease-editorial),
    fill 0.45s var(--ease-editorial),
    stroke 0.45s var(--ease-editorial);
}

.brand-mark,
.section-title,
.about-copy,
.marquee-track,
.contact-row,
.contact-channel,
.contact-handle,
.contact-arrow,
.translate-toggle,
.helix-frame,
.desktop-chrome,
.wire-block,
.wire-col,
.wire-hero-band,
.wire-card,
.wire-circle,
.wire-bar,
.iphone-body,
.iphone-dynamic-island,
.iphone-screen,
.m-bar,
.m-hero-box,
.m-pill,
.m-ring,
.m-grid-2 div,
.m-wide {
  transition:
    color 0.45s var(--ease-editorial),
    background-color 0.45s var(--ease-editorial),
    border-color 0.45s var(--ease-editorial);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* Tactile Spring Micro-Interaction */
.spring-tap {
  transition: transform 0.36s var(--spring), opacity 0.24s ease, border-color 0.24s ease;
}

.spring-tap:hover {
  transform: scale(1.035);
}

.spring-tap:active {
  transform: scale(0.94);
}

/* =========================================================
   FAST MONOCHROME SKELETON (< 1s, per-section without image boxes)
   ========================================================= */
.skeleton-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 var(--gutter) clamp(1rem, 3svh, 1.5rem);
  transition: opacity 0.35s var(--ease-editorial), visibility 0.35s ease;
}

.skeleton-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.skeleton-box {
  background: linear-gradient(
    90deg,
    var(--hairline) 0%,
    var(--surface) 50%,
    var(--hairline) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 0.9s linear infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.skeleton-logo {
  width: clamp(4.5rem, 12vw, 6.5rem);
  height: 1.5rem;
  border-radius: 4px;
}

.skeleton-nav-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skeleton-nav-inline .skeleton-pill {
  display: none;
}

.skeleton-toggle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}

.skeleton-nav-mobile {
  display: flex;
  justify-content: center;
}

.skeleton-pill {
  width: min(calc(100vw - 20px), 460px);
  height: 2.6rem;
  border-radius: 999px;
}

@media (min-width: 768px) {
  .skeleton-nav-inline .skeleton-pill {
    display: block;
    width: 24rem;
    height: 2.3rem;
  }

  .skeleton-nav-mobile {
    display: none;
  }
}

.sk-view {
  display: none;
  flex: 1;
  min-height: 0;
}

.sk-view.is-active {
  display: flex;
  flex-direction: column;
}

.skeleton-hero {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.skeleton-marquee {
  width: 92vw;
  height: clamp(3.5rem, 12vw, 7rem);
  border-radius: 6px;
}

.sk-section {
  width: 100%;
  max-width: 90rem;
  margin: 0 auto;
  padding-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sk-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sk-title {
  width: clamp(9rem, 24vw, 15rem);
  height: clamp(2rem, 4.5vw, 3.2rem);
  border-radius: 6px;
}

.sk-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
}

.sk-lines {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 44rem;
}

.sk-line { height: 1.15rem; border-radius: 4px; }
.sk-line.w90 { width: 92%; }
.sk-line.w85 { width: 85%; }
.sk-line.w78 { width: 78%; }
.sk-line.w60 { width: 58%; }

.sk-helix-wire {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
}

.sk-frame {
  width: clamp(12rem, 28vw, 19rem);
  aspect-ratio: 16 / 10;
  border-radius: 8px;
}

.sk-frame.f1 { transform: translateX(-12vw); }
.sk-frame.f2 { transform: translateX(10vw); }
.sk-frame.f3 { transform: translateX(-6vw); }

.sk-phones-wire {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 4vw, 2.5rem);
  margin-top: 1.5rem;
}

.sk-phone {
  width: clamp(8rem, 22vw, 12rem);
  aspect-ratio: 9 / 19;
  border-radius: 26px;
}

.sk-phone.side {
  transform: scale(0.92);
  opacity: 0.65;
}

.sk-rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 42rem;
}

.sk-row {
  width: 100%;
  height: 2.4rem;
  border-radius: 6px;
}

/* =========================================================
   MULTI-CREST LIQUID WAVE CANVAS (z-index: 0, behind ALL text)
   ========================================================= */
.liquid-wave-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* =========================================================
   HEADER & APPLE-STYLE SPRING ICON TOGGLE
   ========================================================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(0.6rem, 1.5vw, 1.1rem);
  pointer-events: none;
  transition: transform 0.36s var(--ease-editorial);
}

.site-header > * {
  pointer-events: auto;
}

.brand-mark,
.theme-toggle {
  transition: transform 0.36s var(--ease-editorial), opacity 0.28s ease;
}

@media (max-width: 767px) {
  .site-header.is-hidden .brand-mark,
  .site-header.is-hidden .theme-toggle {
    transform: translateY(-150%);
    opacity: 0;
    pointer-events: none;
  }
}

@media (min-width: 768px) {
  .site-header.is-hidden {
    transform: translateY(-105%);
  }
}

.brand-mark {
  font-family: "Rubik Bubbles", "Space Grotesk", sans-serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 3.2vw, 1.95rem);
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--fg);
  margin-right: auto;
  user-select: none;
}

/* Icon-only theme toggle: NO outer circular border or background container */
.theme-toggle {
  position: relative;
  width: clamp(2.1rem, 4.5vw, 2.5rem);
  height: clamp(2.1rem, 4.5vw, 2.5rem);
  display: grid;
  place-items: center;
  color: var(--fg);
  padding: 0;
}

.theme-icon {
  position: absolute;
  width: clamp(1.45rem, 3.2vw, 1.75rem);
  height: clamp(1.45rem, 3.2vw, 1.75rem);
  transition:
    transform 0.62s var(--spring),
    opacity 0.34s var(--ease-editorial);
}

/* Light Mode: Sun rises UP into its fixed position (matching white wave rising up) */
html[data-theme="light"] .icon-sun {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
  animation: sunRiseIn 0.62s var(--spring) forwards;
}

html[data-theme="light"] .icon-sun .sun-rays {
  transform-origin: center;
  animation: raysPop 0.6s var(--spring) forwards;
}

html[data-theme="light"] .icon-moon {
  opacity: 0;
  transform: translateY(-10px) scale(0.42);
}

/* Dark Mode: Crescent Moon drops DOWN into its fixed position (matching dark wave flowing down) */
html[data-theme="dark"] .icon-sun {
  opacity: 0;
  transform: translateY(10px) scale(0.42);
}

html[data-theme="dark"] .icon-moon {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
  animation: moonDropIn 0.62s var(--spring) forwards;
}

html[data-theme="dark"] .icon-moon .moon-stars {
  transform-origin: center;
  animation: starsPop 0.64s var(--spring) forwards;
}

@keyframes sunRiseIn {
  0% { transform: translateY(11px) scale(0.48) rotate(-25deg); opacity: 0; }
  65% { transform: translateY(-2px) scale(1.08) rotate(4deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes moonDropIn {
  0% { transform: translateY(-11px) scale(0.48) rotate(20deg); opacity: 0; }
  65% { transform: translateY(2px) scale(1.08) rotate(-4deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes raysPop {
  0% { transform: scale(0.45); opacity: 0; }
  65% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes starsPop {
  0% { transform: scale(0.3) rotate(-20deg); opacity: 0; }
  70% { transform: scale(1.22) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* =========================================================
   FLOATING BUBBLE NAVIGATION (impulsif-style: Bottom on Mobile, Header-Inline on PC)
   ========================================================= */
.bubble-nav-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  top: auto;
  z-index: 55;
  width: min(calc(100vw - 20px), 460px);
}

.bubble-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.28rem;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

html[data-theme="dark"] .bubble-nav {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

.bubble-indicator {
  position: absolute;
  top: 0.28rem;
  bottom: 0.28rem;
  left: 0.28rem;
  border-radius: 999px;
  background: var(--inv-bg);
  z-index: 0;
  transition:
    transform 0.52s var(--spring),
    width 0.42s var(--spring),
    background-color 0.3s ease;
}

.nav-item {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
  padding: clamp(0.45rem, 1.4vw, 0.56rem) clamp(0.28rem, 1vw, 0.65rem);
  font-size: clamp(0.64rem, 2.5vw, 0.78rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--fg);
  border-radius: 999px;
  transition: color 0.3s ease, transform 0.32s var(--spring);
}

.nav-item.is-active {
  color: var(--inv-fg);
}

@media (min-width: 768px) {
  .site-header {
    padding-right: 1rem;
    gap: 0.5rem;
  }

  .theme-toggle {
    order: 1;
  }

  .bubble-nav-wrap {
    order: 2;
    position: relative;
    left: auto;
    bottom: auto;
    top: auto;
    transform: none;
    width: auto;
  }

  .bubble-nav {
    width: auto;
    box-shadow: none;
    padding: 0.26rem;
    gap: 0.12rem;
  }

  .bubble-indicator {
    top: 0.26rem;
    bottom: 0.26rem;
    left: 0.26rem;
  }

  .nav-item {
    flex: none;
    padding: 0.48rem 1rem;
    font-size: 0.82rem;
  }
}

/* =========================================================
   MAIN & SECTIONS (z-index: 10+ above liquid wave canvas)
   ========================================================= */
.site-main {
  position: relative;
  z-index: 10;
}

.section {
  position: relative;
  width: 100%;
  min-height: 100svh;
}

.section-inner {
  width: 100%;
  max-width: 90rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.section-title {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

/* =========================================================
   SECTION 1: HOME (HERO)
   ========================================================= */
.section-home {
  height: 100svh;
  min-height: 540px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.hero-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* z-index: 5 — Strictly BEHIND the portrait body/shoulders */
.marquee-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: clamp(46%, 51svh, 56%);
  transform: translateY(-50%);
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.marquee-track {
  display: inline-block;
  white-space: nowrap;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(3.4rem, 11.5vw, 9.5rem);
  letter-spacing: -0.04em;
  line-height: 0.94;
  text-transform: uppercase;
  color: var(--fg);
  will-change: transform;
}

/* z-index: 10 — Foreground Cutout Portrait */
.hero-portrait-wrap {
  position: relative;
  z-index: 10;
  flex: none;
  width: clamp(25rem, 92vw, 56rem);
  height: clamp(28rem, 88svh, 58rem);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.hero-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: grayscale(100%) contrast(1.1);
  -webkit-mask-image: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.55) 1.5%, #000 3.5%, #000 100%);
  mask-image: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.55) 1.5%, #000 3.5%, #000 100%);
}

.hero-portrait-wrap .portrait-bottom-fade {
  display: none;
}

.portrait-bottom-fade {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -1px;
  height: clamp(1.75rem, 4.5svh, 3rem);
  background: linear-gradient(to top, var(--bg) 15%, transparent 100%);
  pointer-events: none;
  z-index: 12;
  transition: background 0.38s var(--ease-editorial);
}

/* =========================================================
   SECTION 2: ABOUT ME
   ========================================================= */
.section-about {
  min-height: 100svh;
  padding-top: calc(var(--header-h) + 0.25rem);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.about-inner {
  position: relative;
  z-index: 10;
}

.about-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
}

/* Clean icon-only translate button; subtle circular ring ONLY when active (ID) */
.translate-toggle {
  width: clamp(2rem, 5vw, 3.6rem);
  height: clamp(2rem, 5vw, 3.6rem);
  flex: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  transition:
    transform 0.38s var(--spring),
    border-color 0.28s ease,
    background-color 0.28s ease;
}

.translate-toggle svg {
  width: 74%;
  height: 74%;
}

.translate-toggle.is-indonesian {
  border-color: var(--hairline-strong);
  background: var(--surface);
}

.about-copy {
  margin-top: clamp(0.5rem, 1.4svh, 1rem);
  max-width: 48rem;
  font-size: clamp(1.02rem, 2.3vw, 1.62rem);
  font-weight: 400;
  line-height: 1.46;
  letter-spacing: -0.02em;
}

.about-word {
  display: inline-block;
  margin-right: 0.28em;
  will-change: transform, opacity;
}

.about-visual-wrap {
  position: relative;
  width: clamp(15rem, 58vw, 28rem);
  height: clamp(17rem, 40svh, 28rem);
  margin: auto auto 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

/* Layered JavaScript code backdrop strictly behind the About Me portrait */
.about-code-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(0.66rem, 1.75vw, 0.84rem);
  font-weight: 500;
  line-height: 1.32;
  color: #0ea5e9;
  /* Mobile default: smooth top fade + bottom edge fade matching portrait */
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0%, #000 18%, #000 96.5%, transparent 100%),
    linear-gradient(to right, transparent 0%, #000 6%, #000 94%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent 0%, #000 18%, #000 96.5%, transparent 100%),
    linear-gradient(to right, transparent 0%, #000 6%, #000 94%, transparent 100%);
  mask-composite: intersect;
}

.code-layer {
  position: absolute;
  margin: 0;
  white-space: pre;
  transition: color 0.45s var(--ease-editorial);
}

.code-layer.layer-top-1,
.code-layer.layer-top-2,
.code-layer.layer-top-3 {
  display: none;
}

.code-layer.layer-base {
  top: 2%;
  left: -2%;
  opacity: 0.42;
}

.code-layer.layer-a {
  top: 8%;
  right: -6%;
  opacity: 0.62;
}

.code-layer.layer-b {
  top: 26%;
  left: 4%;
  opacity: 0.76;
}

.code-layer.layer-c {
  top: 46%;
  right: -2%;
  opacity: 0.72;
}

.code-layer.layer-d {
  bottom: 22%;
  left: -3%;
  opacity: 0.86;
}

.code-layer.layer-e {
  bottom: 2%;
  left: 14%;
  opacity: 0.78;
}

.code-layer.layer-f {
  top: 64%;
  left: 8%;
  opacity: 0.64;
}

.code-layer.layer-g {
  bottom: 10%;
  right: 2%;
  opacity: 0.7;
}

/* Vibrant IDE syntax colors (no gray, consistent in Light & Dark) */
.tk-kw { color: #ef4444; }
.tk-fn { color: #10b981; }
.tk-str { color: #f59e0b; }
.tk-num { color: #a855f7; }

.about-portrait {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: grayscale(100%) contrast(1.14) drop-shadow(0 2px 12px rgba(0, 0, 0, 0.08));
  -webkit-mask-image: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.55) 1.5%, #000 3.5%, #000 100%);
  mask-image: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0.55) 1.5%, #000 3.5%, #000 100%);
}

.about-visual-wrap .portrait-bottom-fade {
  display: none;
}

@media (min-width: 768px) {
  .section-about {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    max-width: 90rem;
    margin: 0 auto;
    padding-inline: var(--gutter);
  }

  .about-inner {
    padding-inline: 0;
    margin: 0;
  }

  .about-visual-wrap {
    width: 100%;
    max-width: 38rem;
    height: 100%;
    margin: 0 0 0 auto;
    align-self: stretch;
    justify-self: end;
  }

  .about-portrait {
    max-height: clamp(26rem, 72svh, 44rem);
    align-self: flex-end;
  }

  .code-layer.layer-top-1 {
    display: block;
    top: 1%;
    left: 2%;
    opacity: 0.44;
  }

  .code-layer.layer-top-2 {
    display: block;
    top: 10%;
    right: -4%;
    opacity: 0.56;
  }

  .code-layer.layer-top-3 {
    display: block;
    top: 16%;
    left: 12%;
    opacity: 0.64;
  }

  .code-layer.layer-base {
    top: 24%;
  }

  /* PC: smooth top, left, and bottom edge fades matching portrait bottom */
  .about-code-bg {
    -webkit-mask-image:
      linear-gradient(to bottom, transparent 0%, #000 12%, #000 96.5%, transparent 100%),
      linear-gradient(to right, transparent 0%, #000 22%, #000 96%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(to bottom, transparent 0%, #000 12%, #000 96.5%, transparent 100%),
      linear-gradient(to right, transparent 0%, #000 22%, #000 96%, transparent 100%);
    mask-composite: intersect;
  }
}

/* =========================================================
   SECTION 3: MY PROJECTS
   ========================================================= */
.section-projects {
  min-height: 100svh;
  padding-top: calc(var(--header-h) + 0.25rem);
  padding-bottom: clamp(1rem, 3svh, 2rem);
  overflow-x: clip;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.projects-header-wrap {
  position: relative;
  z-index: 2;
  margin-bottom: clamp(0.25rem, 1svh, 0.5rem);
}

/* Part 1: 3D Helical Snake-Coil Desktop Showcase */
.helix-stage {
  position: relative;
  width: 100vw;
  height: calc(100svh - var(--header-h) - 5.5rem);
  margin: 0 auto;
  perspective: 1500px;
  perspective-origin: 50% 50%;
  overflow-x: clip;
  overflow-y: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
}

.helix-cylinder {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.helix-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(11.5rem, 27vw, 19.5rem);
  aspect-ratio: 16 / 10;
  margin-left: calc(clamp(11.5rem, 27vw, 19.5rem) * -0.5);
  margin-top: calc(clamp(11.5rem, 27vw, 19.5rem) * 10 / 32 * -1);
  border: 1px solid var(--hairline-strong);
  border-radius: clamp(6px, 1vw, 10px);
  background: transparent;
  overflow: hidden;
  display: block;
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform, opacity;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}

html[data-theme="dark"] .helix-frame {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

.desktop-chrome {
  height: clamp(14px, 2.2vw, 20px);
  border-bottom: 1px solid var(--hairline);
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.desktop-chrome span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  border: 1px solid var(--fg-muted);
}

.desktop-screen {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.desktop-screen-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Minimalist Swiss Monochrome UI Wireframes (Zero fake text/labels) */
.wire-top-bar {
  height: 14%;
  width: 100%;
  border-bottom: 1px solid var(--hairline);
}

.wire-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.45rem;
}

.wire-block.solid {
  background: var(--fg);
  border-radius: 2px;
}

.wire-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
}

.wire-lines span {
  display: block;
  height: 3px;
  background: var(--hairline-strong);
}

.wire-lines span:nth-child(2) { width: 78%; }
.wire-lines span:nth-child(3) { width: 52%; }

.wire-grid-3 {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.wire-col {
  border: 1px solid var(--hairline-strong);
  border-radius: 2px;
}

.wire-col.solid {
  background: var(--fg);
  border-color: var(--fg);
}

.wire-hero-band {
  height: 46%;
  background: var(--fg);
  border-radius: 2px;
}

.wire-row-2 {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.wire-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 2px;
}

.wire-card.outline {
  background: transparent;
  border-color: var(--hairline-strong);
}

.screen-editorial-4 {
  flex-direction: row;
}

.wire-sidebar {
  width: 24%;
  border-right: 1px solid var(--hairline);
}

.wire-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.wire-circle {
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid var(--fg);
}

.wire-bar {
  width: 58%;
  height: 4px;
  background: var(--fg);
}

.wire-swiss-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.wire-swiss-rows span {
  display: block;
  height: 1px;
  background: var(--hairline-strong);
}

.wire-swiss-rows span:nth-child(2) {
  height: 22%;
  background: var(--fg);
}

/* =========================================================
   SECTION 4: REFLECTION (Full-Page Concave iPhone Carousel)
   ========================================================= */
.section-reflection {
  min-height: 100svh;
  padding-top: calc(var(--header-h) + 0.25rem);
  padding-bottom: clamp(1.5rem, 4svh, 3rem);
  overflow-x: clip;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.reflection-header-wrap {
  margin-bottom: clamp(0.5rem, 1.5svh, 1rem);
}

/* Full-Width Edge-to-Edge Concave Cylindrical Wall iPhone Carousel */
.concave-stage {
  position: relative;
  width: 100vw;
  height: clamp(26rem, 68svh, 42rem);
  margin: auto;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.concave-stage:active {
  cursor: grabbing;
}

@media (min-width: 768px) {
  .concave-stage,
  .concave-stage:active {
    cursor: pointer;
  }
}

.concave-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Full-Screen Blurred Reflection Detail Overlay (covers header & nav; PC: Left Phone / Right Text; Mobile: Top Phone / Bottom Text) */
.reflection-detail[hidden] {
  display: none;
}

html.is-detail-open,
html.is-detail-open body {
  overflow: hidden !important;
  touch-action: none;
}

html.is-detail-open .site-header,
html.is-detail-open .bubble-nav-wrap {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.is-detail-open .site-main {
  z-index: 120;
}

.reflection-detail {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4svh, 2.5rem) var(--gutter);
  cursor: pointer;
}

.reflection-detail-inner {
  width: 100%;
  max-width: 84rem;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 3svh, 2rem);
  pointer-events: none;
}

.reflection-detail-media {
  flex: none;
  height: clamp(18rem, 48svh, 30rem);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: default;
}

.reflection-detail-canvas {
  height: 100%;
  width: auto;
  max-width: 100%;
  display: block;
}

.reflection-detail-content {
  width: 100%;
  max-width: 38rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: auto;
  cursor: default;
}

.reflection-detail-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
}

.reflection-detail-title {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(1.35rem, 3vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.reflection-translate {
  width: clamp(2rem, 3.6vw, 2.6rem);
  height: clamp(2rem, 3.6vw, 2.6rem);
}

.reflection-detail-copy {
  font-size: clamp(0.95rem, 2vw, 1.4rem);
  line-height: 1.5;
  letter-spacing: -0.015em;
  color: var(--fg);
}

@media (min-width: 768px) {
  .reflection-detail-inner {
    display: grid;
    grid-template-columns: 0.88fr 1.12fr;
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
  }

  .reflection-detail-media {
    height: clamp(26rem, 76svh, 44rem);
    justify-content: center;
  }

  .reflection-detail-content {
    max-width: none;
    gap: clamp(0.9rem, 2.2svh, 1.5rem);
  }
}

.iphone-body {
  width: 100%;
  height: 100%;
  border-radius: clamp(20px, 4.5vw, 34px);
  border: 1.5px solid var(--fg);
  background: var(--bg);
  padding: clamp(6px, 1.2vw, 10px);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.14);
}

html[data-theme="dark"] .iphone-body {
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.72);
}

.iphone-dynamic-island {
  position: absolute;
  top: clamp(11px, 2.2vw, 16px);
  left: 50%;
  transform: translateX(-50%);
  width: 32%;
  height: clamp(8px, 1.5vw, 12px);
  border-radius: 999px;
  background: var(--fg);
  z-index: 3;
}

.iphone-screen {
  flex: 1;
  border-radius: clamp(14px, 3.4vw, 24px);
  border: 1px solid var(--hairline);
  padding: clamp(1.6rem, 4vw, 2.3rem) clamp(0.55rem, 1.4vw, 0.85rem) 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

.m-bar {
  height: 6px;
  width: 48%;
  background: var(--fg);
}

.m-hero-box {
  flex: 1;
  background: var(--fg);
  border-radius: 6px;
}

.m-lines {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.m-lines span {
  height: 4px;
  background: var(--hairline-strong);
}

.m-lines span:last-child { width: 65%; }

.m-pill {
  height: 12%;
  border-radius: 999px;
  border: 1px solid var(--fg);
}

.m-ring {
  width: 58%;
  aspect-ratio: 1;
  margin: auto;
  border-radius: 50%;
  border: 2px solid var(--fg);
}

.m-stack {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.m-stack span {
  height: 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
}

.m-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  height: 42%;
}

.m-grid-2 div {
  border: 1px solid var(--fg);
  border-radius: 5px;
}

.m-grid-2 div:first-child {
  background: var(--fg);
}

.m-wide {
  flex: 1;
  border: 1px solid var(--hairline-strong);
  border-radius: 5px;
}

/* =========================================================
   SECTION 5: CONTACT (1-Page Split Layout)
   ========================================================= */
.section-contact {
  height: 100svh;
  min-height: 100svh;
  padding-top: calc(var(--header-h) + 0.25rem);
  padding-bottom: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contact-layout {
  width: 100%;
  max-width: 90rem;
  height: 100%;
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.contact-left {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.8svh, 1.25rem);
}

.contact-rows {
  border-top: 1px solid var(--hairline);
}

.contact-row {
  display: grid;
  grid-template-columns: auto minmax(4.75rem, 0.9fr) 1.3fr auto;
  align-items: center;
  gap: clamp(0.55rem, 1.4vw, 1rem);
  padding: clamp(0.5rem, 1.25svh, 0.9rem) 0;
  border-bottom: 1px solid var(--hairline);
  transition: padding-inline 0.35s var(--spring), border-color 0.24s ease;
}

.contact-row:hover {
  padding-inline: 0.35rem;
  border-bottom-color: var(--fg);
}

.contact-icon {
  width: clamp(1.35rem, 2.8vw, 1.75rem);
  height: clamp(1.35rem, 2.8vw, 1.75rem);
  display: grid;
  place-items: center;
  flex: none;
}

.contact-icon svg {
  width: 100%;
  height: 100%;
}

.contact-channel {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(0.88rem, 1.8vw, 1.18rem);
  letter-spacing: -0.02em;
}

.contact-handle {
  font-size: clamp(0.78rem, 1.45vw, 0.95rem);
  color: var(--fg-muted);
  justify-self: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-arrow {
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  transition: transform 0.35s var(--spring);
}

.contact-row:hover .contact-arrow {
  transform: translate(3px, -3px);
}

.contact-visual-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100vw;
  margin-inline: calc(var(--gutter) * -1);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.contact-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  border-radius: 0;
  filter: contrast(1.04);
  /* Mobile: gradient fade ONLY on the top edge */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 24%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 24%, #000 100%);
}

@media (min-width: 768px) {
  .contact-layout {
    max-width: none;
    padding-right: 0;
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    align-items: stretch;
    gap: clamp(1.5rem, 3.5vw, 3rem);
  }

  .contact-left {
    justify-content: flex-start;
    gap: clamp(1rem, 2.4svh, 1.75rem);
    padding-top: 0;
    padding-bottom: clamp(1.5rem, 4svh, 2.75rem);
  }

  .contact-rows {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .contact-row {
    flex: 1;
    gap: clamp(0.9rem, 1.6vw, 1.4rem);
    padding: clamp(0.9rem, 2.2svh, 1.5rem) 0;
  }

  .contact-icon {
    width: clamp(2rem, 2.9vw, 2.5rem);
    height: clamp(2rem, 2.9vw, 2.5rem);
  }

  .contact-channel {
    font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  }

  .contact-handle {
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  }

  .contact-arrow {
    font-size: clamp(1.15rem, 1.75vw, 1.45rem);
  }

  .contact-visual-wrap {
    width: 100%;
    height: 100%;
    margin-inline: 0;
    align-self: stretch;
    align-items: stretch;
    justify-content: flex-end;
  }

  .contact-portrait {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    object-position: center;
    /* PC: gradient fade ONLY on the left and top edges (flush right & bottom) */
    -webkit-mask-image:
      linear-gradient(to bottom, transparent 0%, #000 18%, #000 100%),
      linear-gradient(to right, transparent 0%, #000 22%, #000 100%);
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(to bottom, transparent 0%, #000 18%, #000 100%),
      linear-gradient(to right, transparent 0%, #000 22%, #000 100%);
    mask-composite: intersect;
  }
}

/* Mobile spacing & Home framing (placed at end of cascade) */
@media (max-width: 767px) {
  .section-home {
    padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
  }

  .hero-portrait-wrap {
    flex: none;
    width: 126vw;
    height: 126vw;
    max-height: 78svh;
  }

  .marquee-layer {
    top: 63%;
  }

  .marquee-track {
    font-size: clamp(7.5rem, 34vw, 11rem);
  }

  .section-about,
  .section-projects,
  .section-reflection,
  .section-contact {
    padding-top: calc(var(--header-h) + 0.25rem);
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .about-visual-wrap {
    flex: 1;
    width: 112vw;
    height: auto;
    min-height: 46svh;
    max-height: none;
    align-self: center;
    margin: 0.75rem auto 0;
  }

  .about-code-bg {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 96.5%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 96.5%, transparent 100%);
  }

  .about-portrait {
    max-height: 50svh;
    align-self: flex-end;
  }

  .helix-stage {
    height: calc(100svh - var(--header-h) - 7.5rem);
    margin: 0 auto;
  }

  .section-contact {
    padding-bottom: 0;
  }
}
