/* ===== Design System ===== */
:root {
  --bg: #FAFAF8;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --bg-alt: #F4F6FA;
  --accent: #3B82F6;
  --accent-dark: #2563EB;
  --accent-soft: #EEF4FF;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(59, 130, 246, 0.35);
  --shadow-soft: 0 20px 60px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 24px 64px rgba(15, 23, 42, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "DM Sans", "Noto Sans SC", sans-serif;
  --section-padding: clamp(5rem, 12vw, 8rem);
  --header-offset: 88px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-offset);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(59, 130, 246, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(139, 92, 246, 0.05), transparent 45%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(59, 130, 246, 0.04), transparent 40%);
  pointer-events: none;
  z-index: -2;
}

.grain {
  position: fixed;
  inset: 0;
  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");
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  image-rendering: auto;
}

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

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ===== Glass Card ===== */
.glass-card {
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

/* ===== Header Capsule ===== */
.site-header {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 32px);
  max-width: 900px;
  transition: transform var(--transition), top var(--transition);
}

.site-header.scrolled .header-capsule {
  box-shadow: var(--shadow-soft);
  border-color: rgba(15, 23, 42, 0.06);
}

.site-header.scrolled {
  top: 12px;
}

.header-capsule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: box-shadow var(--transition), transform var(--transition);
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

.main-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ===== Layout ===== */
.section {
  position: relative;
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
  padding-left: max(clamp(1.25rem, 5vw, 2.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1.25rem, 5vw, 2.5rem), env(safe-area-inset-right, 0px));
}

.section-alt {
  background: var(--bg-alt);
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.section-head {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-index {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-index::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--border);
  margin-top: 0.75rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-offset) + 2rem);
  padding-bottom: 5rem;
  overflow: hidden;
}

.hero-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.05) 1px, transparent 0);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 75%);
}

.hero-dot {
  position: absolute;
  border-radius: 50%;
  animation: dotFloat 10s ease-in-out infinite;
  opacity: 0.2;
}

.hero-dot--1 {
  width: 8px;
  height: 8px;
  top: 18%;
  left: 12%;
  background: var(--accent);
  animation-duration: 9s;
}

.hero-dot--2 {
  width: 12px;
  height: 12px;
  top: 62%;
  right: 18%;
  background: #8B5CF6;
  animation-duration: 11s;
  animation-delay: -3s;
}

.hero-dot--3 {
  width: 6px;
  height: 6px;
  bottom: 22%;
  left: 28%;
  background: #06B6D4;
  animation-duration: 8s;
  animation-delay: -5s;
}

.hero-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.15), transparent);
  transform-origin: center;
  opacity: 0.2;
}

.hero-line--1 {
  width: 120px;
  top: 28%;
  right: 8%;
  transform: rotate(-24deg);
}

.hero-line--2 {
  width: 80px;
  bottom: 30%;
  left: 6%;
  transform: rotate(18deg);
}

@keyframes dotFloat {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(8px, -13px); }
  66% { transform: translate(-6px, 10px); }
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(3rem, 8vw, 6rem);
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.15);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 9rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-dark) 55%, #8B5CF6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 0.5rem;
}

.hero-name {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}

.hero-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.hero-skill {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.5);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.hero-skill:hover {
  border-color: var(--border-hover);
  color: var(--accent-dark);
}

.hero-tagline {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  display: inline-block;
  margin-bottom: 0;
}

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  overflow: visible;
  transition: transform 0.15s ease-out;
  will-change: transform;
}

.hero-geometry-scene {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  animation: geometryFloat 8s ease-in-out infinite;
}

.hero-geometry-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(59, 130, 246, 0.32), transparent 62%),
    radial-gradient(circle at 52% 52%, rgba(139, 92, 246, 0.14), transparent 56%);
  filter: blur(40px);
  animation: glowPulse 6s ease-in-out infinite;
}

.hero-geometry-rotate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ringSpin 90s linear infinite;
}

.hero-geometry {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-geometry--main {
  position: relative;
  z-index: 1;
}

.hero-geometry-core {
  animation: corePulse 2.4s ease-in-out infinite;
}

.hero-visual-marker {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  animation: visualDotFloat 9s ease-in-out infinite;
  will-change: transform;
}

.hero-visual-marker--1 {
  top: 18%;
  left: 0;
  animation-duration: 8s;
}

.hero-visual-marker--2 {
  top: 32%;
  right: 0;
  flex-direction: row-reverse;
  animation-duration: 7s;
  animation-delay: -2s;
}

.hero-visual-marker--3 {
  bottom: 26%;
  left: 0;
  animation-duration: 10s;
  animation-delay: -4s;
}

.hero-visual-marker--4 {
  top: 10%;
  right: 0;
  flex-direction: row-reverse;
  animation-duration: 11s;
  animation-delay: -1s;
}

.hero-visual-marker--5 {
  bottom: 12%;
  right: 0;
  flex-direction: row-reverse;
  animation-duration: 9.5s;
  animation-delay: -3.5s;
}

.hero-visual-marker--6 {
  top: 50%;
  left: 0;
  animation-duration: 8.5s;
  animation-delay: -5s;
}

.hero-visual-dot {
  flex-shrink: 0;
  border-radius: 50%;
}

.hero-visual-marker--1 .hero-visual-dot {
  width: 11px;
  height: 11px;
  background: #3B82F6;
  opacity: 0.55;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

.hero-visual-marker--2 .hero-visual-dot {
  width: 7px;
  height: 7px;
  background: #EF4444;
  opacity: 0.7;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.hero-visual-marker--3 .hero-visual-dot {
  width: 8px;
  height: 8px;
  background: #8B5CF6;
  opacity: 0.45;
}

.hero-visual-marker--4 .hero-visual-dot {
  width: 6px;
  height: 6px;
  background: #64748B;
  opacity: 0.5;
}

.hero-visual-marker--5 .hero-visual-dot {
  width: 9px;
  height: 9px;
  background: #3B82F6;
  opacity: 0.45;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.hero-visual-marker--6 .hero-visual-dot {
  width: 7px;
  height: 7px;
  background: #06B6D4;
  opacity: 0.55;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.hero-visual-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.72;
}

@keyframes geometryFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.88; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes corePulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.25; }
}

@keyframes visualDotFloat {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(10px, -16px); }
  66% { transform: translate(-8px, 12px); }
}

.section-divider {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1;
}

.section-divider-line {
  display: block;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.section-divider-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
}

.scroll-indicator {
  position: absolute;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  z-index: 2;
}

.scroll-line {
  display: block;
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(0.8); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

/* ===== Contents ===== */
.contents {
  padding-top: clamp(3rem, 6vw, 4rem);
}

.contents-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.contents-card {
  position: relative;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  padding-left: calc(clamp(1.75rem, 4vw, 2.5rem) + 4px);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  overflow: hidden;
}

.contents-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(59, 130, 246, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.contents-card:hover::before {
  opacity: 1;
}

.contents-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.contents-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: width var(--transition), opacity var(--transition);
}

.contents-card:hover .contents-accent {
  width: 5px;
}

.contents-card--blue .contents-accent { background: #3B82F6; }
.contents-card--purple .contents-accent { background: #8B5CF6; }
.contents-card--cyan .contents-accent { background: #06B6D4; }
.contents-card--orange .contents-accent { background: #F97316; }

.contents-icon {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-size: 1rem;
  opacity: 0.25;
  transition: opacity var(--transition), transform var(--transition);
}

.contents-card:hover .contents-icon {
  opacity: 0.5;
  transform: scale(1.1);
}

.contents-card--blue .contents-icon { color: #3B82F6; }
.contents-card--purple .contents-icon { color: #8B5CF6; }
.contents-card--cyan .contents-icon { color: #06B6D4; }
.contents-card--orange .contents-icon { color: #F97316; }

.contents-num {
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.contents-label {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.contents-en {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ===== Split Layout ===== */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.split-reverse .case-content {
  order: 2;
}

.split-reverse .media-frame,
.split-reverse .media-stack {
  order: 1;
}

/* ===== Info Card ===== */
.info-card {
  padding: clamp(2rem, 4vw, 2.75rem);
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-of-type {
  border-bottom: none;
}

.info-row dt {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.info-row dd {
  font-size: 0.95rem;
  font-weight: 600;
}

.skills-block {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.skills-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.skill-tag:hover {
  background: var(--accent-soft);
  border-color: var(--border-hover);
  color: var(--accent-dark);
}

/* ===== Media Frame ===== */
.media-frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--bg-elevated);
  transition: box-shadow var(--transition), transform var(--transition);
}

.media-frame:hover {
  box-shadow: var(--shadow-hover);
}

.media-frame img {
  width: 100%;
  height: auto;
  vertical-align: middle;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.media-frame:hover img {
  transform: scale(1.02);
}

.profile-frame {
  aspect-ratio: 3 / 4;
  max-width: 420px;
  margin-left: auto;
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.media-caption {
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.5);
}

/* ===== Unified Gallery ===== */
.gallery-row {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

.gallery-row--phones {
  grid-template-columns: repeat(2, minmax(0, 260px));
  justify-content: center;
}

.gallery-row--diagrams {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
  max-width: 960px;
  margin-inline: auto;
}

.gallery-item {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--bg-elevated);
  transition: box-shadow var(--transition);
}

.gallery-item:hover {
  box-shadow: var(--shadow-hover);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover img {
  transform: scale(1.02);
}

.gallery-item--portrait {
  aspect-ratio: 9 / 16;
}

.gallery-item--landscape {
  aspect-ratio: 16 / 9;
}

.gallery-item--diagram,
.gallery-item--diagram.gallery-item--portrait {
  aspect-ratio: auto;
  max-height: 520px;
}

.gallery-item--diagram img {
  object-fit: contain;
  background: #fff;
  height: auto;
  max-height: 520px;
}

.gallery-item--contain img {
  object-fit: contain;
  background: #fff;
}

.gallery-item--showcase {
  display: flex;
  flex-direction: column;
  max-height: 480px;
}

.gallery-item--showcase img {
  flex: 1;
  min-height: 0;
  max-height: 420px;
  object-fit: contain;
  background: #fff;
}

.gallery-item--poster {
  aspect-ratio: 3 / 4;
}

.gallery-item--video {
  aspect-ratio: 16 / 9;
}

.gallery-caption {
  padding: 0.85rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.live-intro {
  margin-bottom: 0;
}

.split-layout--data {
  align-items: start;
  margin-top: 0;
}

.content-block {
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.content-block:first-of-type {
  margin-top: clamp(1.5rem, 3vw, 2rem);
}

.content-block + .content-block {
  margin-top: clamp(4rem, 8vw, 6rem);
}

.content-block .content-card {
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.poster-gallery {
  grid-template-columns: repeat(3, 1fr);
}

.video-gallery {
  grid-template-columns: repeat(6, 1fr);
}

.video-gallery .gallery-item {
  grid-column: span 2;
}

.video-gallery .gallery-item:nth-child(4) {
  grid-column: 2 / span 2;
}

.video-gallery .gallery-item:nth-child(5) {
  grid-column: 4 / span 2;
}

.content-role {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 1rem;
}

.content-card-sub {
  margin-top: 0.5rem;
}

.content-block > .gallery-row {
  margin-top: clamp(1.25rem, 2.5vw, 1.75rem);
}

/* ===== Case & Stats ===== */
.case-card {
  padding: clamp(2rem, 4vw, 2.75rem);
}

.case-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 2rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-row-single {
  grid-template-columns: 1fr;
  max-width: 320px;
}

.stat-row-triple {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .stat-row-triple {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  padding: 1.5rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-unit {
  font-size: 0.6em;
  font-weight: 600;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.stat-highlight {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.75rem 2rem;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.stat-highlight-text {
  margin-top: 1rem;
}

.stat-highlight-text .stat-highlight-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
}

.stat-highlight-value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.metric-value {
  font-variant-numeric: tabular-nums;
}

.content-card {
  padding: clamp(1.75rem, 3vw, 2.25rem);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.content-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.content-icon {
  display: block;
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: 0.8;
}

.content-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.content-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ===== Footer ===== */
.footer {
  background: linear-gradient(180deg, var(--bg-alt) 0%, rgba(238, 244, 255, 0.4) 100%);
  padding-bottom: clamp(4rem, 8vw, 6rem);
}

.footer-inner {
  text-align: left;
}

.footer-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 0.25rem;
}

.footer-subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 1.5rem;
}

.footer-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  margin-bottom: 3rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.footer-nav a {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-nav a:hover {
  color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .site-header {
    width: calc(100% - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    top: max(12px, env(safe-area-inset-top, 0px));
  }

  .section {
    padding-top: clamp(3.5rem, 8vw, 5rem);
    padding-bottom: clamp(3.5rem, 8vw, 5rem);
  }

  .case-card,
  .info-card {
    padding: clamp(1.5rem, 4vw, 2rem);
  }

  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: calc(max(12px, env(safe-area-inset-top, 0px)) + 52px);
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    flex-direction: column;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  }

  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 0.9rem;
  }

  .hero {
    min-height: auto;
    padding-top: calc(var(--header-offset) + 1.5rem);
    padding-bottom: 3rem;
  }

  .hero-inner,
  .contents-grid,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .split-layout {
    grid-template-columns: 1fr;
    gap: clamp(1.5rem, 4vw, 2rem);
  }

  .gallery-row--phones {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 520px;
    margin-inline: auto;
  }

  .gallery-row--diagrams {
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: none;
  }

  .poster-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .video-gallery {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    max-width: none;
    overflow-x: visible;
  }

  .video-gallery .gallery-item,
  .video-gallery .gallery-item:nth-child(4),
  .video-gallery .gallery-item:nth-child(5) {
    grid-column: auto;
  }

  .split-reverse .case-content,
  .split-reverse .media-frame {
    order: unset;
  }

  .profile-frame {
    max-width: 280px;
    margin-inline: auto;
    margin-left: auto;
  }

  .hero-text {
    text-align: center;
  }

  .hero-skills {
    justify-content: center;
  }

  .hero-visual {
    min-height: auto;
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
    padding: 1rem 0 2rem;
    overflow: visible;
  }

  .hero-geometry-scene {
    max-width: min(340px, 92vw);
    width: 100%;
    aspect-ratio: 1;
    margin-inline: auto;
    padding-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: geometryFloat 8s ease-in-out infinite;
  }

  .hero-geometry-glow {
    inset: 8%;
  }

  .hero-geometry-rotate {
    inset: 0;
  }

  .hero-geometry--main {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
  }

  .hero-visual-marker {
    position: absolute;
  }

  .hero-visual-marker--2,
  .hero-visual-marker--4,
  .hero-visual-marker--5 {
    flex-direction: row-reverse;
  }

  .hero-visual-label {
    font-size: 0.6rem;
  }

  .hero-line {
    display: none;
  }

  .hero-title {
    font-size: clamp(2.75rem, 12vw, 3.5rem);
  }

  .scroll-indicator {
    display: flex;
    bottom: 2rem;
  }

  .scroll-line {
    height: 32px;
  }

  .footer-nav {
    flex-direction: column;
    gap: 0.25rem;
  }

  .footer-nav a {
    display: block;
    padding: 0.65rem 0;
    font-size: 0.9rem;
  }

  .gallery-caption {
    font-size: 0.7rem;
    line-height: 1.5;
    padding: 0.75rem 0.85rem;
  }

  .info-row {
    grid-template-columns: 80px 1fr;
  }
}

@media (min-width: 520px) and (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr 1fr;
    gap: clamp(1.5rem, 4vw, 2rem);
    align-items: center;
  }
}

@media (max-width: 480px) {
  .section {
    padding-top: clamp(3rem, 8vw, 4rem);
    padding-bottom: clamp(3rem, 8vw, 4rem);
  }

  .section-inner {
    padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
  }

  .hero-title {
    font-size: clamp(2.25rem, 11vw, 2.75rem);
  }

  .hero-geometry-scene {
    max-width: min(340px, 92vw);
  }

  .hero-skills {
    gap: 0.35rem;
  }

  .hero-skill {
    font-size: 0.68rem;
    padding: 0.3rem 0.65rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .case-card,
  .info-card {
    padding: 1.25rem;
  }

  .footer-title {
    font-size: 3rem;
  }

  .gallery-row {
    gap: 1.25rem;
  }

  .gallery-caption {
    font-size: 0.68rem;
    line-height: 1.6;
  }
}

@media (hover: none) and (pointer: coarse) {
  .contents-card:hover,
  .content-card:hover,
  .glass-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }

  .contents-card:active,
  .content-card:active {
    transform: scale(0.98);
    opacity: 0.92;
  }

  .gallery-item:hover {
    box-shadow: var(--shadow-soft);
  }

  .gallery-item:hover img,
  .media-frame:hover img {
    transform: none;
  }

  .gallery-item:active {
    transform: scale(0.99);
  }

  .hero-btn--primary:hover,
  .hero-btn--ghost:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .scroll-line {
    animation: none;
  }

  .hero-dot,
  .hero-geometry-scene,
  .hero-geometry-glow,
  .hero-geometry-rotate,
  .hero-geometry-core,
  .hero-visual-marker {
    animation: none;
  }

  .hero-visual {
    transform: none !important;
  }

  .media-frame:hover img,
  .gallery-item:hover img {
    transform: none;
  }
}
