/* ── Reset & tokens ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0b0f;
  --bg-elevated: #12141c;
  --surface:   #181b26;
  --border:    rgba(255, 255, 255, 0.08);
  --text:      #e8eaef;
  --text-muted:#8b919e;
  --accent:    #22D3EE;
  --accent-dim: rgba(34, 211, 238, 0.15);
  --accent-glow: rgba(34, 211, 238, 0.12);
  --serif:     'Instrument Serif', Georgia, serif;
  --sans:      'Outfit', system-ui, sans-serif;
  --radius:    clamp(14px, 3vw, 20px);
  --transition: 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  --page-pad:  clamp(1rem, 4vw, 2rem);
  --page-pad-full: clamp(0.35rem, 1vw, 0.65rem);
  --page-width: 90%;
  --resume-width: 70%;
  --header-h:  clamp(3.5rem, 10vw, 4.5rem);
}

html { scroll-behavior: smooth; }

html[lang="ja"] body {
  font-family: 'Noto Sans JP', var(--sans), system-ui, sans-serif;
}

html[lang="ja"] .hero-title,
html[lang="ja"] .card-title,
html[lang="ja"] .resume-title {
  font-family: 'Noto Sans JP', var(--serif), serif;
  letter-spacing: 0.02em;
}

html[lang="ja"] .hero-title {
  line-height: 1.2;
  max-width: min(100%, 28ch);
}

html[lang="ko"] body {
  font-family: 'Noto Sans KR', var(--sans), system-ui, sans-serif;
}

html[lang="ko"] .hero-title,
html[lang="ko"] .card-title,
html[lang="ko"] .resume-title {
  font-family: 'Noto Sans KR', var(--serif), serif;
  letter-spacing: 0.01em;
}

html[lang="zh"] body {
  font-family: 'Noto Sans SC', var(--sans), system-ui, sans-serif;
}

html[lang="zh"] .hero-title,
html[lang="zh"] .card-title,
html[lang="zh"] .resume-title {
  font-family: 'Noto Sans SC', var(--serif), serif;
  letter-spacing: 0.01em;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a { color: inherit; text-decoration: none; }

/* ── Ambient layers ─────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.ambient-a {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -100px;
  background: radial-gradient(circle, var(--accent-glow, rgba(34, 211, 238, 0.12)), transparent 70%);
  transition: background 0.6s ease;
}

.ambient-b {
  width: 500px;
  height: 500px;
  bottom: 10%;
  left: -150px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.1), transparent 70%);
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px) saturate(1.4);
  background: rgba(10, 11, 15, 0.75);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  width: var(--page-width);
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0.75rem 0;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  width: clamp(38px, 10vw, 44px);
  height: clamp(38px, 10vw, 44px);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  transition: border-color 0.45s ease, color 0.45s ease;
}

.brand-name {
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-role {
  font-size: clamp(0.7rem, 2vw, 0.78rem);
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
  width: 100%;
}

@media (min-width: 640px) {
  .header-actions {
    width: auto;
    flex-wrap: nowrap;
  }
}

.lang-dropdown {
  position: relative;
  flex-shrink: 0;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.lang-trigger:hover,
.lang-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.lang-trigger-flag {
  display: inline-flex;
  line-height: 0;
}

.lang-code {
  min-width: 1.25rem;
}

.lang-chevron {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.lang-trigger[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 120;
  min-width: 11rem;
  max-height: min(70vh, 22rem);
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: 14px;
  background: rgba(10, 11, 15, 0.96);
  backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.lang-menu[hidden] {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.lang-option.is-active {
  background: var(--accent-dim);
  color: var(--accent);
}

.lang-flag {
  width: 26px;
  height: 17px;
  border-radius: 3px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  object-fit: cover;
}

@media (max-width: 640px) {
  .lang-flag {
    width: 22px;
    height: 15px;
  }

  .lang-trigger {
    padding: 0.4rem 0.65rem;
  }
}

@media (min-width: 640px) {
  .header-nav {
    flex-wrap: nowrap;
  }
}

.nav-link {
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: clamp(0.78rem, 2vw, 0.85rem);
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.nav-link--accent {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  transition: color 0.45s ease, background 0.45s ease, border-color 0.45s ease;
}

.nav-link--accent:hover {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: #fff;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: clamp(2rem, 6vw, 3.5rem) clamp(1rem, 3vw, 2rem) clamp(1.5rem, 4vw, 2.5rem);
  isolation: isolate;
  border-bottom: 1px solid var(--border);
  min-height: clamp(22rem, 52vh, 34rem);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.hero-slides {
  position: absolute;
  inset: 0;
  width: 90%;
  left: 5%;
  right: 5%;
}

.hero-site-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0a0b0f;
}

.hero-site-stage__loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(10, 11, 15, 0.72);
  transition: opacity 0.35s ease;
}

.hero-site-stage__loader.is-hidden,
.hero-site-stage__loader[hidden] {
  display: none !important;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
  will-change: opacity;
}

.hero-slide.is-active {
  opacity: 1;
}

.hero-slide__scroll-track {
  position: absolute;
  inset: 0;
  left: 50%;
  width: 1440px;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-50%) scale(var(--hero-site-scale, 0.9));
  transform-origin: top center;
}

.hero-slide__scroll-track.is-ready .hero-slide__scroll-mover {
  animation: heroSiteScroll var(--scroll-duration, 18s) ease-in-out infinite alternate;
}

.hero-slide__scroll-mover {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  will-change: transform;
}

.hero-slide__iframe {
  display: block;
  width: 1440px;
  min-height: 900px;
  height: auto;
  border: 0;
  pointer-events: none;
  background: #fff;
}

@keyframes heroSiteScroll {
  from { transform: translateY(0); }
  to { transform: translateY(var(--scroll-y, -720px)); }
}

.hero-visual-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(10, 11, 15, 0.72) 0%, rgba(10, 11, 15, 0.38) 45%, rgba(10, 11, 15, 0.78) 100%),
    radial-gradient(ellipse 90% 70% at 50% 50%, rgba(10, 11, 15, 0.15) 0%, rgba(10, 11, 15, 0.55) 100%),
    linear-gradient(135deg, rgba(34, 211, 238, 0.06) 0%, transparent 50%, rgba(114, 9, 183, 0.08) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(100%, 54rem);
  margin: 0 auto;
  padding: clamp(1.35rem, 3.5vw, 2.25rem) clamp(1.15rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-radius: calc(var(--radius) + 4px);
  background: rgba(10, 11, 15, 0.58);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.22;
  transition: opacity 0.6s ease;
}

.hero-orb--cyan {
  width: clamp(240px, 50vw, 520px);
  height: clamp(240px, 50vw, 520px);
  top: -15%;
  left: 5%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.45), transparent 70%);
}

.hero-orb--violet {
  width: clamp(220px, 45vw, 460px);
  height: clamp(220px, 45vw, 460px);
  bottom: -5%;
  right: 8%;
  background: radial-gradient(circle, rgba(114, 9, 183, 0.35), transparent 70%);
}

.hero-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: clamp(0.75rem, 2vw, 1.15rem);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: clamp(0.68rem, 1.8vw, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-badge--location {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-badge--available {
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.28);
}

.hero-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.5);
  animation: hero-pulse 2s ease infinite;
}

@keyframes hero-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(34, 211, 238, 0); }
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.35rem, 6.5vw, 4.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
  max-width: min(100%, 18ch);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  color: #f8fafc;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}

.hero-title-row {
  display: block;
}

.hero-title-row--final {
  margin-top: 0.05em;
}

.hero-highlight {
  font-style: italic;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  position: relative;
}

.hero-highlight--cyan {
  background-image: linear-gradient(120deg, #67e8f9 0%, #22d3ee 45%, #06b6d4 100%);
}

.hero-highlight--violet {
  background-image: linear-gradient(120deg, #c084fc 0%, #a855f7 50%, #7c3aed 100%);
}

.hero-highlight--blue {
  background-image: linear-gradient(120deg, #93c5fd 0%, #60a5fa 40%, #3b82f6 100%);
}

.hero-highlight--gold {
  background-image: linear-gradient(120deg, #fde68a 0%, #fbbf24 45%, #f59e0b 100%);
}

.hero-comma,
.hero-dot {
  font-style: normal;
  color: var(--text-muted);
  opacity: 0.5;
}

.hero-dot {
  color: var(--accent);
  opacity: 1;
}

.hero-lead {
  max-width: min(100%, 46rem);
  font-size: clamp(0.95rem, 2.2vw, 1.12rem);
  color: rgba(232, 234, 239, 0.88);
  margin-bottom: clamp(1rem, 2.5vw, 1.35rem);
  line-height: 1.65;
  text-align: center;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.hero-lead strong {
  color: #fff;
  font-weight: 600;
}

.hero-lead-accent {
  color: color-mix(in srgb, var(--accent) 70%, var(--text) 30%);
  transition: color 0.45s ease;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.hero-tag {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: clamp(0.72rem, 1.9vw, 0.8rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-tag:hover {
  transform: translateY(-2px);
}

.hero-tag--cyan {
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.28);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.08);
}

.hero-tag--amber {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.28);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.08);
}

.hero-tag--purple {
  color: #d8b4fe;
  background: rgba(155, 93, 229, 0.12);
  border-color: rgba(155, 93, 229, 0.28);
  box-shadow: 0 0 20px rgba(155, 93, 229, 0.08);
}

.hero-tag--indigo {
  color: #c4b5fd;
  background: rgba(114, 9, 183, 0.14);
  border-color: rgba(114, 9, 183, 0.32);
  box-shadow: 0 0 20px rgba(114, 9, 183, 0.1);
}

.hero-slide-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: clamp(0.85rem, 2vw, 1.15rem);
}

.hero-slide-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, width 0.2s ease;
}

.hero-slide-dot.is-active {
  width: 22px;
  background: var(--dot-color, var(--accent));
}

.hero-slide-dot:hover {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.5);
}

.hero-photo-credit {
  margin: 0.55rem 0 0;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  .hero-slide {
    transition: none;
  }

  .hero-slide__scroll-mover {
    animation: none !important;
  }
}

@media (min-width: 768px) {
  .hero-title {
    max-width: min(100%, 16ch);
  }
}

@media (max-width: 480px) {
  .hero-title {
    max-width: 100%;
  }

  .hero-highlight--blue {
    display: inline;
  }
}

/* ── Projects section ───────────────────────────────────────── */
.projects {
  position: relative;
  z-index: 1;
  width: var(--page-width);
  max-width: var(--page-width);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2rem) 0 clamp(2.5rem, 8vw, 5rem);
}

.projects-layout {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 4vw, 2rem);
}

@media (min-width: 960px) {
  .projects-layout {
    display: grid;
    grid-template-columns: minmax(280px, 364px) minmax(260px, 1fr) minmax(432px, 612px);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: start;
  }
}

.project-nav {
  order: 2;
  min-width: 0;
}

@media (min-width: 960px) {
  .project-nav { order: 0; }
}

.project-stage {
  order: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.5rem);
  width: 100%;
}

@media (min-width: 960px) {
  .project-stage {
    order: 0;
    align-self: center;
    justify-content: center;
  }
}

.project-list-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--page-pad));
  padding: 0 var(--page-pad) 0.25rem;
}

.project-list-scroll::-webkit-scrollbar { display: none; }

@media (min-width: 960px) {
  .project-list-scroll {
    overflow: visible;
    margin: 0;
    padding: 0;
  }
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  width: max-content;
  min-width: 100%;
}

@media (min-width: 960px) {
  .project-list {
    flex-direction: column;
    width: 100%;
    gap: 0.35rem;
  }
}

.project-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  min-height: 44px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform 0.2s;
  outline: none;
  flex-shrink: 0;
}

@media (min-width: 960px) {
  .project-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
}

.project-name {
  font-size: clamp(0.82rem, 2.2vw, 0.92rem);
  font-weight: 500;
  white-space: nowrap;
}

@media (min-width: 960px) {
  .project-name {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.project-period {
  display: none;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (min-width: 960px) {
  .project-period { display: block; }
}

.project-nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.project-item:hover,
.project-item:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.project-item.is-active {
  background: color-mix(in srgb, var(--project-color, var(--accent)) 15%, transparent);
  border-color: color-mix(in srgb, var(--project-color, var(--accent)) 30%, transparent);
}

.project-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--dot-color, var(--accent));
  box-shadow: 0 0 12px var(--dot-color, var(--accent));
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.project-item.is-active .project-dot {
  opacity: 1;
  transform: scale(1.3);
}

.project-nav-hint {
  margin-top: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.75rem);
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.5;
}

.hint-touch { display: none; }

@media (hover: none) and (pointer: coarse) {
  .hint-hover { display: none; }
  .hint-touch { display: inline; }
}

/* ── Flip card stage ─────────────────────────────────────────── */
.stage-frame {
  width: 82.5%;
  max-width: min(429px, 100%);
  margin-inline: auto;
  perspective: 1400px;
}

@media (min-width: 960px) {
  .project-stage .stage-frame {
    max-width: min(429px, 100%);
  }
}

.flip-card {
  width: 100%;
  min-height: clamp(314px, 57.75vw, 429px);
  aspect-ratio: 4 / 5;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--transition);
  transform: rotateY(0deg);
}

.flip-card.no-transition .flip-card-inner {
  transition: none;
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transform-style: preserve-3d;
}

.flip-card-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 5vw, 2.5rem);
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-elevated) 100%);
  text-align: center;
  transform: rotateY(0deg) translateZ(1px);
  z-index: 2;
}

.flip-card-back {
  transform: rotateY(180deg) translateZ(1px);
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: linear-gradient(160deg, #1a1d2e 0%, var(--bg-elevated) 100%);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
  transition: border-color 0.55s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 1;
}

.card-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(80px);
  opacity: 0.18;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  transition: background 0.55s ease, opacity 0.4s ease;
}

.logo-wrap {
  width: clamp(80px, 22vw, 120px);
  height: clamp(80px, 22vw, 120px);
  margin-bottom: clamp(0.75rem, 3vw, 1.5rem);
  position: relative;
  z-index: 1;
  transition: color 0.4s;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(2px);
}

.logo-wrap--image {
  width: min(280px, 88%);
  height: auto;
  min-height: 60px;
}

.logo-wrap--image img {
  width: 100%;
  height: auto;
  max-height: clamp(72px, 18vw, 120px);
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

.card-title {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  font-weight: 400;
  margin-bottom: 0.35rem;
  position: relative;
  z-index: 1;
}

.card-meta {
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.flip-hint {
  position: absolute;
  bottom: clamp(0.75rem, 3vw, 1.5rem);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  font-size: clamp(0.65rem, 2vw, 0.72rem);
  color: var(--text-muted);
  opacity: 0.6;
  letter-spacing: 0.04em;
  text-align: center;
}

.hint-hover { display: inline; }

@media (hover: none) and (pointer: coarse) {
  .flip-hint .hint-hover { display: none; }
  .flip-hint .hint-touch { display: inline; }
}

.back-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--accent);
  margin-bottom: 1rem;
}

.back-desc {
  font-size: clamp(0.82rem, 2.3vw, 0.92rem);
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.back-highlights {
  list-style: none;
  margin-bottom: 1rem;
  flex: 1;
  min-height: 0;
}

.back-highlights li {
  position: relative;
  padding-left: 1.1rem;
  font-size: clamp(0.75rem, 2.1vw, 0.82rem);
  color: var(--text);
  margin-bottom: 0.45rem;
  line-height: 1.45;
}

.back-highlights li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.back-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.back-tech span {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: clamp(0.62rem, 1.8vw, 0.68rem);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.logo-wrap svg {
  width: 100%;
  height: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  padding: 0.65rem 1.15rem;
  min-height: 44px;
  border-radius: 999px;
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  font-weight: 600;
  background: var(--accent);
  color: #0a0b0f;
  transition: transform 0.2s, box-shadow 0.2s, background 0.45s ease;
  flex-shrink: 0;
}

.back-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.stage-counter {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

#counter-current { color: var(--accent); font-size: 1.4rem; }
.counter-sep { margin: 0 0.25rem; opacity: 0.4; }

/* ── Resume section ──────────────────────────────────────────── */
.resume {
  position: relative;
  z-index: 1;
  width: var(--resume-width);
  max-width: var(--resume-width);
  margin: 0 auto;
  padding: 0 0 clamp(3rem, 10vw, 6rem);
}

.resume-card {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 5vw, 3rem);
  align-items: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(24, 27, 38, 0.6) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  text-align: center;
}

@media (min-width: 768px) {
  .resume-card {
    display: grid;
    grid-template-columns: minmax(180px, 280px) 1fr;
    align-items: center;
    text-align: left;
  }
}

.resume-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%);
  pointer-events: none;
}

.resume-visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.resume-doc {
  width: clamp(140px, 40vw, 180px);
  height: clamp(186px, 52vw, 240px);
  padding: clamp(1rem, 3vw, 1.5rem) clamp(0.85rem, 2.5vw, 1.25rem);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  transform: rotate(-4deg);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.doc-line {
  height: 6px;
  border-radius: 3px;
  background: #e2e4ea;
}

.doc-line--title {
  height: 10px;
  width: 70%;
  background: #1a1d2e;
  margin-bottom: 0.25rem;
}

.doc-line--short { width: 55%; }

.doc-block {
  flex: 1;
  border-radius: 6px;
  background: #f0f1f5;
  margin: 0.25rem 0;
}

.resume-badge {
  position: absolute;
  bottom: -8px;
  right: clamp(8px, 4vw, 20px);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  background: var(--accent);
  color: #0a0b0f;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: background 0.45s ease, box-shadow 0.45s ease;
}

.resume-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.resume-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.resume-title em { font-style: italic; color: var(--accent); }

.resume-text {
  font-size: clamp(0.88rem, 2.4vw, 0.95rem);
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

@media (min-width: 768px) {
  .resume-text { margin-left: 0; margin-right: 0; }
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

@media (min-width: 768px) {
  .resume-actions { justify-content: flex-start; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  min-height: 44px;
  border-radius: 999px;
  font-size: clamp(0.82rem, 2.2vw, 0.9rem);
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  border: none;
  flex: 1 1 auto;
  min-width: min(100%, 160px);
}

@media (min-width: 480px) {
  .btn { flex: 0 1 auto; min-width: 0; }
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn-primary {
  background: var(--accent);
  color: #0a0b0f;
  transition: transform 0.2s, box-shadow 0.2s, background 0.45s ease;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  width: var(--page-width);
  max-width: var(--page-width);
  margin: 0 auto;
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  text-align: center;
}

.footer p {
  font-size: clamp(0.72rem, 2vw, 0.8rem);
  color: var(--text-muted);
  line-height: 1.6;
  word-break: break-word;
}

.footer a {
  color: var(--accent);
  transition: opacity 0.2s;
}

.footer a:hover { opacity: 0.8; }

/* ── Responsive extras ─────────────────────────────────────────── */
@media (min-width: 640px) {
  .header-inner {
    flex-wrap: nowrap;
  }

  .brand { flex: 1; }
}

.ambient-a {
  width: clamp(280px, 60vw, 600px);
  height: clamp(280px, 60vw, 600px);
}

.ambient-b {
  width: clamp(220px, 50vw, 500px);
  height: clamp(220px, 50vw, 500px);
}

@media (max-width: 959px) {
  .flip-card {
    aspect-ratio: auto;
    min-height: clamp(297px, 70.125vw, 396px);
  }
}

@media (max-width: 380px) {
  .hero-tag {
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
  }

  .brand-role { display: none; }
}

@media (min-width: 960px) and (max-width: 1100px) {
  .projects-layout {
    grid-template-columns: minmax(266px, 308px) minmax(220px, 1fr) minmax(360px, 468px);
  }
}

/* ── Project World globe embed ─────────────────────────────── */
.project-globe {
  order: 3;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

@media (min-width: 960px) {
  .project-globe { order: 0; }
}

.project-globe__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.project-globe__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.project-globe__maximize {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  border: 1px solid rgba(155, 93, 229, 0.35);
  background: rgba(155, 93, 229, 0.1);
  color: #c4b5fd;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.project-globe__maximize:hover {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.4);
  color: #67e8f9;
}

.project-globe__body {
  position: relative;
  width: 100%;
}

.project-globe__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  min-height: 504px;
  max-height: 756px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(34, 211, 238, 0.06), transparent 70%),
    rgba(8, 10, 18, 0.92);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 50px rgba(0, 0, 0, 0.35),
    0 0 40px rgba(34, 211, 238, 0.06);
}

.project-globe__hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.75;
  line-height: 1.45;
}

.project-globe-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(4, 5, 10, 0.96);
  backdrop-filter: blur(18px);
}

.project-globe-fullscreen[hidden] {
  display: none !important;
}

body.globe-fullscreen-open {
  overflow: hidden;
}

.project-globe-fullscreen__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.project-globe-fullscreen__title {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #e8eaef, #a5f3fc 50%, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.project-globe-fullscreen__close {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
}

.project-globe-fullscreen__close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.project-globe-fullscreen__stage {
  position: relative;
  min-height: 0;
  padding: 0.75rem;
}

.project-globe-fullscreen__stage .project-globe__body {
  width: 100%;
  height: 100%;
}

.project-globe-fullscreen__stage .project-globe__frame {
  max-height: none;
  height: calc(100vh - 5.5rem);
  min-height: 320px;
  aspect-ratio: auto;
  border-radius: 20px;
}

.pw-globe-embed.is-fullscreen {
  min-height: 100%;
}

.pw-globe-embed.is-fullscreen .detail-overlay {
  z-index: 10002;
}

@media (max-width: 959px) {
  .project-globe__frame {
    max-height: 648px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hero { padding-top: 1.5rem; padding-bottom: 1rem; }

  .flip-card {
    min-height: 240px;
    aspect-ratio: 16 / 11;
  }
}

/* ── Vision showcase section (Kling-style, separate from flip cards) ── */
.vision-showcase {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(2rem, 4vw, 3rem);
  overflow: hidden;
}

.vision-showcase__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(34, 211, 238, 0.06), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 100%, rgba(129, 140, 248, 0.05), transparent 50%),
    linear-gradient(180deg, #0c0d12 0%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}

.vision-showcase__header {
  position: relative;
  text-align: center;
  width: var(--page-width);
  max-width: min(56rem, var(--page-width));
  margin: 0 auto clamp(1.25rem, 3vw, 2rem);
  padding: 0;
}

.vision-showcase__stage-wrap {
  position: sticky;
  top: calc(var(--header-h) + 0.35rem);
  z-index: 8;
  width: var(--page-width);
  max-width: var(--page-width);
  margin: 0 auto clamp(0.5rem, 1.5vw, 0.75rem);
}

.vision-showcase__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}

.vision-showcase__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.35rem);
  font-weight: 400;
  line-height: 1.08;
  margin: 0 0 0.75rem;
}

.vision-showcase__lead {
  font-size: clamp(0.92rem, 2.2vw, 1.05rem);
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 auto;
  max-width: 42rem;
}

.vision-cinema {
  width: 100%;
}

.vision-cinema--hero .vision-cinema__chrome {
  aspect-ratio: 2 / 1;
  min-height: clamp(280px, 50vh, 620px);
  border-radius: clamp(16px, 2.5vw, 28px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 32px 100px rgba(0, 0, 0, 0.65),
    0 0 80px color-mix(in srgb, var(--vision-glow, var(--accent)) 20%, transparent);
}

.vision-cinema__open {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  pointer-events: auto;
}

.vision-cinema__open:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.vision-cinema--hero .vision-website__iframe {
  transform: translateX(-50%) scale(var(--vision-site-scale, 0.9));
}

.vision-grid-label {
  position: relative;
  width: var(--page-width);
  max-width: var(--page-width);
  margin: clamp(0.75rem, 2vw, 1rem) auto clamp(0.35rem, 1vw, 0.5rem);
  padding: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.85;
}

.vision-showcase__carousel {
  position: relative;
  width: var(--page-width);
  max-width: var(--page-width);
  margin: 0 auto;
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 5%,
    #000 95%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 5%,
    #000 95%,
    transparent 100%
  );
}

.vision-showcase__grid {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.55rem;
  width: max-content;
  padding: 3px 0 0.35rem;
  animation: visionCarouselScroll 52s linear infinite;
}

.vision-showcase__carousel:hover .vision-showcase__grid,
.vision-showcase__carousel:focus-within .vision-showcase__grid {
  animation-play-state: paused;
}

@keyframes visionCarouselScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.vision-showcase__grid .vision-tile {
  flex: 0 0 clamp(132px, 12.5vw, 188px);
  width: clamp(132px, 12.5vw, 188px);
  scroll-snap-align: start;
}

.vision-tile {
  position: relative;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.vision-tile:hover,
.vision-tile:focus-visible,
.vision-tile.is-active {
  z-index: 2;
}

.vision-tile__poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    radial-gradient(ellipse 80% 70% at 30% 20%, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.35), transparent),
    linear-gradient(145deg, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.12), #0a0b0f 65%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.35s, box-shadow 0.35s;
}

.vision-tile__mode {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 3;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.vision-tile__duration {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 3;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.45);
  font-family: ui-monospace, monospace;
}

.vision-tile__info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 2.25rem 0.7rem 0.65rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.35) 55%, transparent);
  min-width: 0;
}

.vision-tile__meta {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Vision cinema (Kling-style sticky preview) ─────────────── */
.vision-cinema {
  width: 100%;
  max-width: none;
  margin-bottom: 0;
  position: relative;
  top: auto;
}

.vision-cinema__chrome {
  position: relative;
  border-radius: clamp(18px, 3vw, 28px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #050608;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 60px color-mix(in srgb, var(--vision-glow, var(--accent)) 18%, transparent);
  aspect-ratio: 16 / 9;
}

.vision-cinema__glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(
    circle at 50% 40%,
    color-mix(in srgb, var(--vision-glow, var(--accent)) 22%, transparent),
    transparent 55%
  );
  pointer-events: none;
  z-index: 0;
  transition: background 0.6s ease;
}

.vision-cinema__viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.vision-cinema__grain,
.vision-cinema__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.vision-cinema__grain {
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vision-cinema__vignette {
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.65) 100%);
}

.vision-cinema__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: clamp(2.5rem, 8vw, 4rem) clamp(1rem, 3vw, 1.5rem) clamp(0.85rem, 2.5vw, 1.1rem);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.35) 55%, transparent);
  pointer-events: none;
}

.vision-cinema__mode {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.35rem;
}

.vision-cinema__title {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 3.2vw, 1.65rem);
  font-weight: 400;
  line-height: 1.15;
  margin: 0;
  color: #fff;
}

.vision-cinema__tag {
  margin: 0.35rem 0 0;
  font-size: clamp(0.72rem, 2vw, 0.82rem);
  color: rgba(255, 255, 255, 0.62);
}

.vision-cinema__dots {
  position: absolute;
  bottom: 0.65rem;
  right: 1rem;
  z-index: 5;
  display: flex;
  gap: 0.35rem;
}

.vision-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  transition: transform 0.25s, background 0.25s;
}

.vision-dot.is-active {
  background: #fff;
  transform: scale(1.35);
}

.vision-filmstrip-wrap {
  margin-top: 0.85rem;
}

.vision-filmstrip-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  opacity: 0.85;
}

.vision-filmstrip {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.vision-filmstrip::-webkit-scrollbar { height: 4px; }
.vision-filmstrip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.vision-tile__shine {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.vision-tile:hover .vision-tile__shine,
.vision-tile.is-active .vision-tile__shine {
  transform: translateX(120%);
}

.vision-tile__logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgb(var(--vision-r), var(--vision-g), var(--vision-b));
  opacity: 0.85;
  transform: scale(0.58);
  z-index: 0;
}

.vision-tile__logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.vision-tile__play {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 4;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.58rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.25s, transform 0.25s;
}

.vision-tile__name {
  display: block;
  font-size: clamp(0.78rem, 1.8vw, 0.92rem);
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s;
}

.vision-tile:hover .vision-tile__poster,
.vision-tile:focus-visible .vision-tile__poster {
  transform: scale(1.015);
  border-color: color-mix(in srgb, var(--tile-color) 55%, transparent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 24px color-mix(in srgb, var(--tile-color) 25%, transparent);
}

.vision-tile:hover .vision-tile__play,
.vision-tile.is-active .vision-tile__play {
  opacity: 1;
  transform: scale(1);
}

.vision-tile.is-active .vision-tile__poster {
  border-color: color-mix(in srgb, var(--tile-color) 70%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tile-color) 35%, transparent), 0 8px 28px rgba(0, 0, 0, 0.4);
}

.vision-tile.is-active .vision-tile__name {
  color: #fff;
}

/* Website preview */
.vision-website,
.vision-slide,
.vision-gallery-frame,
.vision-motion {
  position: absolute;
  inset: 0;
  animation: visionFadeIn 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes visionFadeIn {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: scale(1); }
}

.vision-website__chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  background: rgba(0, 0, 0, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vision-website__chrome span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.vision-website__url {
  flex: 1;
  margin-left: 0.35rem;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.45);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vision-website__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.vision-website__loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  background: #0a0b0f;
  z-index: 1;
}

.vision-website__loader[hidden],
.vision-website__loader.is-hidden {
  display: none !important;
}

.vision-website--scroll .vision-website__loader {
  z-index: 5;
}

.vision-website__iframe {
  position: absolute;
  top: 1.6rem;
  left: 50%;
  width: 1440px;
  height: 900px;
  border: 0;
  transform: translateX(-50%) scale(var(--vision-site-scale, 0.65));
  transform-origin: top center;
  pointer-events: none;
  background: #fff;
}

/* Auto-scroll website preview (LawTech pilot) */
.vision-website--scroll .vision-website__iframe {
  position: relative;
  top: 0;
  left: 0;
  width: 1440px;
  min-height: 900px;
  height: auto;
  transform: none;
}

.vision-website__scroll-track {
  position: absolute;
  top: 1.6rem;
  left: 50%;
  bottom: 0;
  width: 1440px;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-50%) scale(var(--vision-site-scale, 0.65));
  transform-origin: top center;
}

.vision-website__scroll-track:not(.is-ready) .vision-website__scroll-mover {
  animation: none;
}

.vision-website__scroll-mover {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  transform: translateY(0);
  will-change: transform;
}

.vision-website--scroll .vision-website__scroll-track.is-ready .vision-website__scroll-mover {
  animation: visionSiteScroll var(--scroll-duration, 20s) ease-in-out infinite alternate;
}

@keyframes visionSiteScroll {
  from { transform: translateY(0); }
  to { transform: translateY(var(--scroll-y, -720px)); }
}

.vision-cinema--hero .vision-website__scroll-track {
  --vision-site-scale: 0.9;
}

/* Slides */
.vision-slide__bg,
.vision-gallery-frame__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 20% 15%, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.35), transparent),
    linear-gradient(160deg, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.08), #06080c 50%);
}

.vision-slide__content {
  position: absolute;
  left: clamp(1rem, 4vw, 2rem);
  right: 40%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.vision-slide__kicker {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(var(--vision-r), var(--vision-g), var(--vision-b));
  margin-bottom: 0.5rem;
}

.vision-slide__title {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 3vw, 1.75rem);
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 0.65rem;
  color: #fff;
}

.vision-slide__body {
  font-size: clamp(0.75rem, 2vw, 0.88rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

.vision-slide__logo,
.vision-gallery-frame__logo,
.vision-motion__logo {
  position: absolute;
  right: clamp(0.75rem, 3vw, 1.5rem);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(80px, 18vw, 140px);
  height: clamp(80px, 18vw, 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgb(var(--vision-r), var(--vision-g), var(--vision-b));
  opacity: 0.35;
}

.vision-slide__logo svg,
.vision-gallery-frame__logo svg,
.vision-motion__logo svg {
  width: 100%;
  height: 100%;
}

/* Gallery frames */
.vision-gallery-frame__idx {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
}

.vision-gallery-frame__label {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(var(--vision-r), var(--vision-g), var(--vision-b));
}

.vision-gallery-frame__title {
  position: absolute;
  left: clamp(1rem, 4vw, 2rem);
  right: clamp(1rem, 4vw, 2rem);
  bottom: 28%;
  font-family: var(--serif);
  font-size: clamp(1rem, 2.8vw, 1.5rem);
  line-height: 1.25;
  margin: 0;
  color: #fff;
  z-index: 2;
}

/* Motion / cinematic */
.vision-motion__mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 30% 40%, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.4), transparent 45%),
    radial-gradient(circle at 70% 60%, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.2), transparent 40%);
  animation: visionMeshDrift 8s ease-in-out infinite alternate;
}

@keyframes visionMeshDrift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(3%, -2%) scale(1.08); }
}

.vision-motion__orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.5;
  animation: visionOrbFloat 6s ease-in-out infinite;
}

.vision-motion__orb--a {
  width: 40%;
  height: 40%;
  top: 10%;
  left: 5%;
  background: rgb(var(--vision-r), var(--vision-g), var(--vision-b));
}

.vision-motion__orb--b {
  width: 30%;
  height: 30%;
  bottom: 15%;
  right: 10%;
  background: rgba(255, 255, 255, 0.15);
  animation-delay: -3s;
}

@keyframes visionOrbFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(12px, -8px); }
}

.vision-motion__scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(var(--vision-r), var(--vision-g), var(--vision-b), 0.06) 48%, transparent 52%);
  animation: visionScan 3.5s linear infinite;
  opacity: 0.6;
}

@keyframes visionScan {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

.vision-motion__ui {
  position: absolute;
  left: 8%;
  bottom: 22%;
  width: 38%;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 2;
}

.vision-motion__bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  animation: visionBarPulse 2.4s ease-in-out infinite;
}

.vision-motion__bar--short { width: 55%; animation-delay: 0.3s; }
.vision-motion__bar--mid { width: 78%; animation-delay: 0.6s; }

@keyframes visionBarPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

.vision-motion__caption {
  position: absolute;
  left: 8%;
  bottom: 12%;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  z-index: 2;
}

.vision-motion--gesture .vision-motion__orb--a {
  animation: visionOrbFloat 4s ease-in-out infinite, visionGesturePulse 2s ease-in-out infinite;
}

@keyframes visionGesturePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@media (max-width: 959px) {
  .vision-showcase__stage-wrap {
    position: relative;
    top: auto;
  }

  .vision-cinema--hero .vision-cinema__chrome {
    aspect-ratio: 16 / 10;
    min-height: clamp(220px, 42vw, 380px);
  }

  .vision-cinema--hero .vision-website__iframe {
    transform: translateX(-50%) scale(var(--vision-site-scale, 0.9));
  }

  .vision-cinema--hero .vision-website__scroll-track {
    --vision-site-scale: 0.9;
  }

  .vision-slide__content {
    right: 28%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .vision-showcase__carousel {
    mask-image: none;
    -webkit-mask-image: none;
  }

  .vision-showcase__grid {
    animation: none;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  }

  .vision-showcase__grid::-webkit-scrollbar { height: 4px; }
  .vision-showcase__grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
  }

  .hero-pulse {
    animation: none;
    box-shadow: none;
  }

  html { scroll-behavior: auto; }
}
