/* ============================================
   Palvos Thrive - Premium Dark Theme
   ============================================ */

:root {
  --bg-dark: #06060a;
  --bg-card: #0c0c12;
  --bg-elevated: #12121a;
  --text-primary: #f4f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.15);
  --accent-glow: rgba(0, 212, 170, 0.4);
  --accent-secondary: #7c3aed;
  --accent-secondary-glow: rgba(124, 58, 237, 0.35);
  --border: rgba(255, 255, 255, 0.06);
  --radius: 12px;
  --radius-lg: 20px;
  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --font-serif: "Cormorant Garamond", serif;
  --header-height: 72px;
  --section-padding: clamp(4rem, 10vw, 8rem);
  --container: min(1200px, 92vw);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Anchor scroll offset: header height so sections don't hide behind fixed header */
#hero, #about, #ikigai, #services, #portfolio, #contact {
  scroll-margin-top: 80px;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-dark);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Noise overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  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");
}

/* Thunder flash overlay */
.thunder-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  background: rgba(255, 255, 255, 0);
  opacity: 0;
  transition: none;
}

.thunder-overlay.flash {
  animation: thunderFlash 0.35s ease-out forwards;
}

/* Slightly reduced thunder intensity to avoid harsh white-out */
@keyframes thunderFlash {
  0% { opacity: 0; background-color: rgba(255, 255, 255, 0); }
  12% { opacity: 1; background-color: rgba(255, 255, 255, 0.32); }
  25% { opacity: 0.3; background-color: rgba(255, 255, 255, 0.15); }
  40% { opacity: 0.6; background-color: rgba(255, 255, 255, 0.2); }
  100% { opacity: 0; background-color: rgba(255, 255, 255, 0); }
}

/* ========== Glass crack intro overlay ========== */
.glass-intro {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 10, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  outline: none;
  contain: layout style paint;
}

.glass-intro:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Hidden: do not show again (30-day TTL) or after dismiss */
.glass-intro.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.02);
}

.glass-intro-surface {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Soft highlight/glare */
.glass-intro-glare {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  pointer-events: none;
}

/* Subtle grain overlay */
.glass-intro-grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Crack SVG: paths animate stroke-dashoffset */
.glass-intro-crack {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 0.35;
  fill: none;
  stroke-linecap: round;
  transform: translateZ(0);
}

.glass-intro-crack path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: crackDraw 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes crackDraw {
  to { stroke-dashoffset: 0; }
}

/* Optional light particles */
.glass-intro-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glass-intro-particles span {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: particleFade 0.6s ease-out forwards;
}

@keyframes particleFade {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.3) translate(var(--px, 0), var(--py, 0)); }
}

/* Hint label */
.glass-intro-hint {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

/* ========== Glass shatter overlay (after crack) ========== */
.glass-shatter {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.15));
}

/* Above intro so glass pieces are visible when they fly out */
body.glass-shatter-active .glass-shatter {
  z-index: 10002;
  visibility: visible;
  animation: shatterSpread 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes shatterSpread {
  0% { opacity: 0; transform: scale(0.98); filter: blur(0px); }
  20% { opacity: 1; }
  70% { opacity: 0.85; filter: blur(0.2px); }
  100% { opacity: 0; transform: scale(1.06); filter: blur(0.4px); }
}

.glass-shatter-crack {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 0.35;
  fill: none;
  stroke-linecap: round;
}

.glass-shatter-crack path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: crackDrawLong 1.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes crackDrawLong {
  to { stroke-dashoffset: 0; }
}

.glass-shatter-shards {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glass-shatter-shards span {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.08) 40%,
    rgba(200, 220, 255, 0.12) 100%
  );
  box-shadow:
    inset 0 0 20px rgba(255, 255, 255, 0.2),
    inset -2px -2px 8px rgba(0, 0, 0, 0.15),
    0 0 15px rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.6);
  opacity: 0;
  animation: shardBurst 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: var(--delay, 0s);
  transform-origin: center center;
}

@keyframes shardBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.2);
  }
  15% {
    opacity: 1;
  }
  75% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) rotate(calc(var(--rot, 0deg) + 220deg)) scale(1.15);
  }
}

/* Mobile: reduce glass blur for performance */
@media (max-width: 768px) {
  .glass-intro {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
}

/* Reduced motion: skip crack animation, instant fade */
@media (prefers-reduced-motion: reduce) {
  .glass-intro-crack path {
    animation: none !important;
    stroke-dashoffset: 0 !important;
  }
  .glass-intro.is-dismissed {
    transition-duration: 0.1s;
  }
  .glass-intro-particles span {
    animation: none;
    opacity: 0;
  }
  .glass-shatter-crack path {
    animation: none !important;
    stroke-dashoffset: 0 !important;
  }
  body.glass-shatter-active .glass-shatter {
    animation-duration: 0.1s;
  }
  .glass-shatter-shards span {
    animation: none;
    opacity: 0;
  }
}

/* Video-synced color themes */
body.theme-amber {
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.15);
  --accent-glow: rgba(245, 158, 11, 0.4);
}

body.theme-steel {
  --accent: #94a3b8;
  --accent-dim: rgba(148, 163, 184, 0.15);
  --accent-glow: rgba(148, 163, 184, 0.35);
}

body.theme-copper {
  --accent: #ea580c;
  --accent-dim: rgba(234, 88, 12, 0.15);
  --accent-glow: rgba(234, 88, 12, 0.4);
}

body.theme-cyan {
  --accent: #06b6d4;
  --accent-dim: rgba(6, 182, 212, 0.15);
  --accent-glow: rgba(6, 182, 212, 0.4);
}

/* ========== Header ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  padding-left: max(clamp(1.5rem, 4vw, 3rem), env(safe-area-inset-left));
  padding-right: max(clamp(1.5rem, 4vw, 3rem), env(safe-area-inset-right));
  z-index: 100;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.header.scrolled {
  background: rgba(6, 6, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  text-decoration: none;
  color: inherit;
}

.logo-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  padding: 0.5rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

.nav-cta {
  background: transparent;
  color: var(--text-primary) !important;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  border: 1.5px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-cta:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent) !important;
}

/* Visible keyboard focus states */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav a:focus-visible,
.footer-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ========== Hero ========== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--header-height) 2rem 4rem;
  overflow: hidden;
}

.hero-video-wrap {
  position: absolute;
  top: -15%;
  left: 0;
  width: 100%;
  height: 130%;
  z-index: 0;
  will-change: transform;
  overflow: hidden;
}

.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 1;
  opacity: 1;
}

.hero-video-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #0a0a0f 0%, #0f0f1a 30%, #12122a 60%, #0a0a14 100%);
  animation: heroGradientShift 12s ease-in-out infinite alternate;
  opacity: 0;
  pointer-events: none;
}

@keyframes heroGradientShift {
  0% { opacity: 1; filter: brightness(0.9); }
  100% { opacity: 1; filter: brightness(1); }
}

.hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.5) 0%, rgba(6, 6, 10, 0.65) 40%, rgba(6, 6, 10, 0.8) 70%, var(--bg-dark) 100%);
  pointer-events: none;
}

.hero-video-wrap.hero-video-unavailable .hero-gradient {
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.15) 0%, rgba(6, 6, 10, 0.3) 50%, rgba(6, 6, 10, 0.45) 100%);
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 2;
}

.hero-glow-1 {
  width: 600px;
  height: 600px;
  background: var(--accent-glow);
  top: -20%;
  right: -10%;
  animation: float 15s ease-in-out infinite;
}

.hero-glow-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-secondary-glow);
  bottom: -10%;
  left: -5%;
  animation: float 18s ease-in-out infinite reverse;
}

.hero-glow-3 {
  width: 300px;
  height: 300px;
  background: rgba(0, 212, 170, 0.2);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 8s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.05); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

.hero-content {
  position: relative;
  z-index: 10;
  max-width: 800px;
  text-align: center;
}

.hero-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

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

.hero-title .accent {
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow);
}

.hero-desc {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.75rem;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-primary:hover {
  background: #00e6b8;
  box-shadow: 0 0 45px var(--accent-glow);
  transform: translateY(-2px);
}

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

.btn-ghost:hover {
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.btn-large {
  padding: 1.1rem 2.25rem;
  font-size: 1rem;
}

/* Hero brand */
.hero-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* Stamp / machined reveal animation */
.stamp-in {
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  animation: stampReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-content .stamp-in:nth-child(1) { animation-delay: 0.1s; }
.hero-content .stamp-in:nth-child(2) { animation-delay: 0.2s; }
.hero-content .stamp-in:nth-child(3) { animation-delay: 0.25s; }
.hero-content .stamp-in:nth-child(4) { animation-delay: 0.35s; }
.hero-content .stamp-in:nth-child(5) { animation-delay: 0.45s; }
.hero-content .stamp-in:nth-child(6) { animation-delay: 0.55s; }
.hero-content .stamp-in:nth-child(7) { animation-delay: 0.65s; }

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

/* Hero entry animation (legacy) */
.animate-in {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 0.8s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.1s; }
.animate-in:nth-child(2) { animation-delay: 0.2s; }
.animate-in:nth-child(3) { animation-delay: 0.3s; }
.animate-in:nth-child(4) { animation-delay: 0.4s; }
.animate-in:nth-child(5) { animation-delay: 0.5s; }
.animate-in:nth-child(6) { animation-delay: 0.6s; }
.animate-in:nth-child(7) { animation-delay: 0.7s; }
.animate-in:nth-child(8) { animation-delay: 0.8s; }
.animate-in:nth-child(9) { animation-delay: 0.9s; }
.animate-in:nth-child(10) { animation-delay: 1s; }
.animate-in:nth-child(11) { animation-delay: 1.1s; }

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

/* ========== Sections wrap (background + floating objects) ========== */
.sections-wrap {
  position: relative;
  isolation: isolate;
}

.sections-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("Gemini_Generated_Image_201uj9201uj9201u%20(1).png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.sections-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 2, 4, 0.92) 0%, rgba(1, 1, 3, 0.95) 50%, rgba(0, 0, 2, 0.97) 100%);
  z-index: 1;
}

.sections-floats {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  perspective: 800px;
}

.float-obj {
  position: absolute;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.5;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
}

.float-obj-1 {
  width: 60px;
  height: 60px;
  top: 15%;
  left: 8%;
  animation: float3d-1 18s ease-in-out infinite;
  transform: rotateX(12deg) rotateY(25deg);
}

.float-obj-2 {
  width: 40px;
  height: 40px;
  top: 35%;
  right: 12%;
  animation: float3d-2 14s ease-in-out infinite 2s;
  transform: rotateX(-8deg) rotateY(-15deg);
}

.float-obj-3 {
  width: 50px;
  height: 50px;
  bottom: 25%;
  left: 15%;
  animation: float3d-3 16s ease-in-out infinite 1s;
  transform: rotateX(5deg) rotateY(30deg);
}

.float-obj-4 {
  width: 35px;
  height: 35px;
  top: 55%;
  right: 25%;
  animation: float3d-4 20s ease-in-out infinite 0.5s;
  transform: rotateX(-12deg) rotateY(10deg);
}

.float-obj-5 {
  width: 45px;
  height: 45px;
  top: 70%;
  left: 8%;
  animation: float3d-5 15s ease-in-out infinite 3s;
  transform: rotateX(8deg) rotateY(-20deg);
}

.float-obj-6 {
  width: 30px;
  height: 30px;
  top: 20%;
  right: 30%;
  animation: float3d-6 12s ease-in-out infinite 1.5s;
  transform: rotateX(-5deg) rotateY(18deg);
}

.float-obj-7 {
  width: 55px;
  height: 55px;
  bottom: 35%;
  right: 8%;
  animation: float3d-7 19s ease-in-out infinite 2.5s;
  transform: rotateX(15deg) rotateY(-25deg);
}

@keyframes float3d-1 {
  0%, 100% { transform: rotateX(12deg) rotateY(25deg) translate(0, 0); }
  33% { transform: rotateX(12deg) rotateY(25deg) translate(20px, -30px); }
  66% { transform: rotateX(12deg) rotateY(25deg) translate(-15px, 20px); }
}

@keyframes float3d-2 {
  0%, 100% { transform: rotateX(-8deg) rotateY(-15deg) translate(0, 0); }
  50% { transform: rotateX(-8deg) rotateY(-15deg) translate(-25px, 25px); }
}

@keyframes float3d-3 {
  0%, 100% { transform: rotateX(5deg) rotateY(30deg) translate(0, 0); }
  50% { transform: rotateX(5deg) rotateY(30deg) translate(15px, -20px); }
}

@keyframes float3d-4 {
  0%, 100% { transform: rotateX(-12deg) rotateY(10deg) translate(0, 0); }
  33% { transform: rotateX(-12deg) rotateY(10deg) translate(-10px, -15px); }
  66% { transform: rotateX(-12deg) rotateY(10deg) translate(20px, 10px); }
}

@keyframes float3d-5 {
  0%, 100% { transform: rotateX(8deg) rotateY(-20deg) translate(0, 0); }
  50% { transform: rotateX(8deg) rotateY(-20deg) translate(-20px, -25px); }
}

@keyframes float3d-6 {
  0%, 100% { transform: rotateX(-5deg) rotateY(18deg) translate(0, 0); }
  50% { transform: rotateX(-5deg) rotateY(18deg) translate(30px, 15px); }
}

@keyframes float3d-7 {
  0%, 100% { transform: rotateX(15deg) rotateY(-25deg) translate(0, 0); }
  50% { transform: rotateX(15deg) rotateY(-25deg) translate(-15px, -30px); }
}

/* Thunder strike reaction on floating objects */
body.thunder-impact .float-obj {
  animation-play-state: paused;
}

body.thunder-impact .float-obj-1 { transform: rotateX(25deg) rotateY(45deg) scale(1.15) translate(-8px, 5px); }
body.thunder-impact .float-obj-2 { transform: rotateX(-20deg) rotateY(-30deg) scale(0.9) translate(12px, -8px); }
body.thunder-impact .float-obj-3 { transform: rotateX(15deg) rotateY(50deg) scale(1.1) translate(5px, 10px); }
body.thunder-impact .float-obj-4 { transform: rotateX(-25deg) rotateY(20deg) scale(0.95) translate(-10px, -5px); }
body.thunder-impact .float-obj-5 { transform: rotateX(20deg) rotateY(-40deg) scale(1.08) translate(8px, -12px); }
body.thunder-impact .float-obj-6 { transform: rotateX(-15deg) rotateY(35deg) scale(0.92) translate(-5px, 8px); }
body.thunder-impact .float-obj-7 { transform: rotateX(30deg) rotateY(-35deg) scale(1.12) translate(-12px, -10px); }

/* ========== Sections ========== */
.section {
  padding: var(--section-padding) 0;
  position: relative;
  z-index: 1;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 2rem);
}

.section-header {
  margin-bottom: 3rem;
  max-width: 640px;
}

.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-desc {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ========== About ========== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.about-viewer {
  position: relative;
  overflow: visible;
  aspect-ratio: 1;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1800px;
}

.brand-3d {
  --brand-tilt-x: 0deg;
  --brand-tilt-y: 0deg;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1600px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  transform: rotateX(var(--brand-tilt-x)) rotateY(var(--brand-tilt-y));
  transition: transform 0.35s ease;
  will-change: transform;
}

.brand-3d-inner {
  position: relative;
  width: 320px;
  height: 380px;
  transform-style: preserve-3d;
  animation: brand3dRotate 26s linear infinite;
  will-change: transform;
}

.brand-slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260px;
  height: 320px;
  transform-style: preserve-3d;
}

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

.brand-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-face-back {
  transform: rotateY(180deg);
}

.brand-slide:nth-child(1) {
  transform: translate(-50%, -50%) rotateY(0deg) translateZ(220px) rotateY(0deg);
}

.brand-slide:nth-child(2) {
  transform: translate(-50%, -50%) rotateY(120deg) translateZ(220px) rotateY(-120deg);
}

.brand-slide:nth-child(3) {
  transform: translate(-50%, -50%) rotateY(240deg) translateZ(220px) rotateY(-240deg);
}

.brand-face img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

@keyframes brand3dRotate {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

.about-lead {
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.about-block h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.about-list {
  list-style: none;
}

.about-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.about-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ========== Ikigai ========== */
.ikigai-section {
  background: transparent;
}

.ikigai-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-template-rows: auto auto;
  gap: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ikigai-card {
  position: relative;
  padding: 1.75rem 2rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.35s ease;
  overflow: hidden;
}

/* Card entrance: scale + lift when revealed */
.ikigai-card.reveal {
  transform: translateY(28px) scale(0.96);
}

.ikigai-card.reveal.revealed {
  transform: translateY(0) scale(1);
}

/* Mouse-follow glow overlay */
.ikigai-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.04), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

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

.ikigai-card-1 {
  background: linear-gradient(145deg, var(--bg-elevated) 0%, rgba(0, 212, 170, 0.04) 100%);
  border-radius: 4px 24px 24px 4px;
  border-left: 3px solid var(--accent);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.ikigai-card-2 {
  background: var(--bg-elevated);
  border-radius: 24px 4px 4px 24px;
  border: 1px solid var(--border);
  align-self: start;
  margin-top: 0.5rem;
}

.ikigai-card-3 {
  background: var(--bg-elevated);
  border-radius: 4px 24px 24px 4px;
  border: 1px solid var(--border);
  align-self: end;
  margin-bottom: 0.5rem;
}

.ikigai-card-4 {
  background: linear-gradient(225deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.06) 100%);
  border-radius: 24px 4px 4px 24px;
  border-right: 3px solid var(--accent-secondary);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.ikigai-card:hover {
  border-color: rgba(0, 212, 170, 0.3);
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.5), 0 0 40px var(--accent-dim);
}

.ikigai-card-1:hover {
  box-shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.5), 0 0 45px rgba(0, 212, 170, 0.15), 0 0 60px -20px var(--accent-glow);
}

.ikigai-card-4:hover {
  border-right-color: var(--accent-secondary);
  box-shadow: 0 16px 48px -12px rgba(0, 0, 0, 0.5), 0 0 45px rgba(124, 58, 237, 0.15), 0 0 60px -20px var(--accent-secondary-glow);
}

/* Number: subtle pulse + glow */
.ikigai-num {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent);
  opacity: 0.8;
  margin-bottom: 0.75rem;
  transition: opacity 0.3s ease, text-shadow 0.3s ease;
  animation: ikigaiNumPulse 5s ease-in-out infinite;
}

.ikigai-card-4 .ikigai-num {
  color: var(--accent-secondary);
}

.ikigai-card:hover .ikigai-num {
  opacity: 1;
  text-shadow: 0 0 20px var(--accent-glow);
  animation: none;
}

.ikigai-card-4:hover .ikigai-num {
  text-shadow: 0 0 20px var(--accent-secondary-glow);
}

@keyframes ikigaiNumPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.ikigai-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  transition: transform 0.3s ease, color 0.3s ease;
}

.ikigai-card:hover h3 {
  transform: translateX(6px);
  color: var(--accent);
}

.ikigai-card-4:hover h3 {
  color: var(--accent-secondary);
}

.ikigai-card-1 h3,
.ikigai-card-4 h3 {
  font-size: 1.15rem;
}

.ikigai-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  transition: opacity 0.3s ease;
}

.ikigai-card:hover p {
  opacity: 0.95;
}

/* Footer: subtle underline reveal */
.ikigai-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-style: italic;
  position: relative;
  display: inline-block;
  transition: color 0.3s ease;
}

.ikigai-footer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transition: width 0.4s ease, left 0.4s ease;
}

.ikigai-footer:hover::after {
  left: 0;
  width: 100%;
}

/* ========== Services ("What we create") - kinetic list + engine core ========== */
.services {
  position: relative;
}

.services::before {
  content: "";
  position: absolute;
  inset: -18% -6% -12%;
  background:
    radial-gradient(42% 42% at 18% 25%, rgba(255, 255, 255, 0.08) 0%, transparent 65%),
    radial-gradient(45% 45% at 80% 55%, rgba(0, 212, 170, 0.14) 0%, transparent 70%),
    radial-gradient(40% 40% at 60% 85%, rgba(255, 255, 255, 0.05) 0%, transparent 65%);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

.services::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 0%, rgba(0, 0, 0, 0.18) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.services .container {
  position: relative;
  z-index: 1;
}

.services .section-title {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.services .section-label {
  color: rgba(244, 244, 246, 0.7);
  letter-spacing: 0.32em;
}

.services-scene {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 2.5rem;
  align-items: center;
  padding: 2rem 0 0;
  --engine-accent: rgba(0, 212, 170, 0.9);
  --engine-speed: 14s;
  --engine-tilt-x: 10deg;
  --engine-tilt-y: -12deg;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.service-line {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  padding: 1.2rem 1.5rem 1.2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.4s ease, color 0.3s ease;
}

.service-line:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.service-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--engine-accent), transparent);
  opacity: 0;
  transition: width 0.4s ease, opacity 0.4s ease;
}

.service-line::after {
  content: "";
  position: absolute;
  left: -2.2rem;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: radial-gradient(circle at 30% 30%, var(--engine-accent), transparent 60%);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
  opacity: 0.35;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.service-line:hover {
  transform: translateX(12px);
}

.service-line:hover::before {
  width: 170px;
  opacity: 1;
}

.service-line:hover::after {
  opacity: 0.9;
  transform: translate(4px, -50%);
}

.service-line:focus-visible {
  outline: 1px solid rgba(0, 212, 170, 0.45);
  outline-offset: 6px;
  border-radius: 8px;
}

.service-index {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.35rem;
}

.service-content h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.service-line:hover h3 {
  color: var(--engine-accent);
}

.service-content p {
  font-size: 0.95rem;
  color: rgba(205, 212, 220, 0.78);
  line-height: 1.6;
}

.services-engine {
  position: relative;
  width: min(42vw, 420px);
  aspect-ratio: 1;
  margin-left: auto;
  display: grid;
  place-items: center;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.engine-core {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--engine-tilt-x)) rotateY(var(--engine-tilt-y));
  transition: transform 0.35s ease;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.6));
}

.engine-core::before {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.08), transparent 65%);
  filter: blur(6px);
}

.engine-core::after {
  content: "";
  position: absolute;
  inset: 42%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--engine-accent), transparent 60%);
  box-shadow: 0 0 25px var(--engine-accent);
  transform: translateZ(30px);
}

.engine-ring {
  --ring-z: 0px;
  --ring-speed: var(--engine-speed);
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    conic-gradient(from 0deg,
      transparent 0 12%,
      var(--engine-accent) 12% 18%,
      transparent 18% 38%,
      var(--engine-accent) 38% 44%,
      transparent 44% 66%,
      var(--engine-accent) 66% 72%,
      transparent 72% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(50% - 2px), #000 calc(50% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(50% - 2px), #000 calc(50% - 1px));
  transform-style: preserve-3d;
  transform: rotateX(68deg) translateZ(var(--ring-z));
  animation: engineSpin var(--ring-speed) linear infinite;
  will-change: transform;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.4);
}

.engine-ring::after {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 60%);
  filter: blur(10px);
  opacity: 0.7;
}

.ring-1 { --ring-z: 0px; --ring-speed: var(--engine-speed); }
.ring-2 { inset: 18%; --ring-z: 18px; --ring-speed: calc(var(--engine-speed) * 0.8); opacity: 0.85; }
.ring-3 { inset: 28%; --ring-z: 36px; --ring-speed: calc(var(--engine-speed) * 1.1); opacity: 0.7; }
.ring-4 { inset: 38%; --ring-z: 54px; --ring-speed: calc(var(--engine-speed) * 0.7); opacity: 0.6; }

@keyframes engineSpin {
  to { transform: rotateX(68deg) translateZ(var(--ring-z)) rotateZ(360deg); }
}

.engine-orbit {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  transform-style: preserve-3d;
  transform: rotateX(72deg) translateZ(64px);
  animation: engineOrbit 7s linear infinite;
  will-change: transform;
  opacity: 0.6;
}

.engine-orbit::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--engine-accent);
  box-shadow: 0 0 18px var(--engine-accent);
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes engineOrbit {
  to { transform: rotateX(72deg) translateZ(64px) rotateZ(360deg); }
}

/* Service reveal */
.service-reveal.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.service-reveal.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.service-line-1.reveal { transition-delay: 0.02s; }
.service-line-2.reveal { transition-delay: 0.1s; }
.service-line-3.reveal { transition-delay: 0.06s; }
.service-line-4.reveal { transition-delay: 0.14s; }

@media (max-width: 1024px) {
  .services-scene {
    grid-template-columns: 1fr;
  }
  .services-engine {
    order: -1;
    margin: 0 auto 2rem;
    width: min(70vw, 420px);
  }
}

@media (max-width: 768px) {
  .services-scene {
    gap: 2rem;
  }
  .service-line {
    padding-right: 0;
  }
  .service-line::after {
    left: -1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .engine-ring {
    animation: none;
  }
  .engine-orbit {
    animation: none;
  }
  .service-line,
  .service-reveal.reveal {
    transition: none;
  }
  .cta-inner.mirror-active::before {
    animation: none;
    opacity: 0.7;
  }
}

/* Process strip */
.process-reveal.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.65s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.process-reveal.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Process strip (3 steps) ========== */
.process-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.process-step {
  text-align: center;
  padding: 0 1rem;
}

.process-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px var(--accent-glow);
}

.process-step h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.process-step p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== Testimonials ========== */
.testimonials {
  padding: var(--section-padding) 0;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.testimonial-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 0;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.testimonial-card:hover {
  border-color: rgba(0, 212, 170, 0.2);
  box-shadow: 0 0 30px var(--accent-dim);
}

.testimonial-card p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  font-style: italic;
}

.testimonial-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: normal;
}

/* ========== Portfolio ========== */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.portfolio-item {
  display: block;
  color: inherit;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  cursor: pointer;
  position: relative;
}

.portfolio-item:hover {
  border-color: rgba(0, 212, 170, 0.3);
  box-shadow: 0 0 40px var(--accent-dim);
  transform: translateY(-4px) scale(1.02);
}

/* Subtle tilt on hover */
.portfolio-item:hover .portfolio-image {
  transform: scale(1.08);
}

.portfolio-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  position: relative;
}

.portfolio-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.portfolio-item:hover .portfolio-image img {
  transform: scale(1.05);
}

.portfolio-view {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  border-radius: 4px;
}

.portfolio-item:hover .portfolio-view {
  opacity: 1;
  transform: translateY(0);
}

.portfolio-info {
  padding: 1.25rem 1.5rem;
}

.portfolio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.portfolio-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
}

.portfolio-info h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.portfolio-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.portfolio-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.portfolio-link:hover {
  color: #00e6b8;
}

.portfolio-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ========== CTA ========== */
.cta {
  padding: var(--section-padding) 0;
}

.cta-inner {
  position: relative;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4rem 3rem;
  overflow: hidden;
  transform: translateY(12px);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.6s ease, border-color 0.6s ease;
}

.cta-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  background: var(--accent-glow);
  filter: blur(100px);
  opacity: 0.25;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.cta-inner::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background:
    linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.18) 40%, rgba(255, 255, 255, 0.06) 60%, transparent 80%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05), transparent 40%);
  transform: translateX(-120%) skewX(-12deg);
  opacity: 0;
  pointer-events: none;
}

.cta-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 55%);
  opacity: 0;
  pointer-events: none;
}

.cta-inner.mirror-active {
  transform: translateY(0);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.8);
}

.cta-inner.mirror-active::before {
  animation: mirrorSweep 1.2s ease-out forwards;
  opacity: 1;
}

.cta-inner.mirror-active::after {
  opacity: 1;
  transition: opacity 0.8s ease;
}

@keyframes mirrorSweep {
  0% { transform: translateX(-120%) skewX(-12deg); }
  60% { transform: translateX(20%) skewX(-12deg); }
  100% { transform: translateX(140%) skewX(-12deg); }
}

.cta-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.cta-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0.75rem 0 1rem;
}

.cta-desc {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* ========== Footer ========== */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  gap: 2rem;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

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

/* ========== Portfolio modal ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal.is-open .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.modal-body {
  padding: 2.5rem 2rem;
}

.modal-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.modal-summary {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.modal-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.modal-meta dt {
  color: var(--text-muted);
  font-weight: 500;
}

.modal-meta dd {
  color: var(--text-secondary);
  margin: 0;
}

.modal-screenshots {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.modal-screenshots img {
  max-height: 200px;
  width: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.modal-cta {
  display: inline-flex;
}

/* ========== Reveal animations (JS-driven) ========== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .sections-bg {
    background-attachment: scroll;
  }
  .ikigai-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    max-width: 100%;
  }

  .ikigai-card-2,
  .ikigai-card-3 {
    margin: 0;
  }


  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .process-strip {
    grid-template-columns: 1fr;
  }

  .testimonials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #hero, #about, #ikigai, #services, #portfolio, #contact {
    scroll-margin-top: 64px;
  }

  .nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .nav.open {
    display: flex;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: auto;
    flex-direction: column;
    padding: 2rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    background: rgba(6, 6, 10, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    gap: 0;
    animation: navSlideDown 0.3s ease forwards;
  }

  @keyframes navSlideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav.open a {
    padding: 1rem 0;
    min-height: 48px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav.open a:last-child {
    border-bottom: none;
  }

  .hero {
    padding: var(--header-height) 1.25rem 3rem;
    min-height: 100svh;
    min-height: 100dvh;
  }

  .hero-glow-1 {
    width: 280px;
    height: 280px;
    top: -10%;
    right: -20%;
  }

  .hero-glow-2 {
    width: 180px;
    height: 180px;
    bottom: -5%;
  }

  .hero-glow-3 {
    width: 150px;
    height: 150px;
  }

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

  .hero-desc {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .sections-floats {
    display: none;
  }

  .section {
    padding: clamp(3rem, 8vw, 5rem) 0;
  }

  .container {
    padding: 0 1.25rem;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .section-title {
    font-size: clamp(1.5rem, 6vw, 2.25rem);
  }

  .ikigai-card {
    padding: 1.25rem 1.5rem;
  }

  .service-card-inner {
    padding: 1.25rem 1.5rem 1.5rem;
  }
  .service-card-1 .service-icon-wrap,
  .service-card-2 .service-icon-wrap,
  .service-card-3 .service-icon-wrap,
  .service-card-4 .service-icon-wrap {
    margin-left: 0;
    margin-right: 0;
  }

  .portfolio-item {
    min-height: 44px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-viewer {
    min-height: 320px;
  }

  .brand-3d-inner {
    width: 220px;
    height: 280px;
  }

  .brand-slide {
    width: 180px;
    height: 220px;
  }

  .brand-slide:nth-child(1) {
    transform: translate(-50%, -50%) rotateY(0deg) translateZ(150px) rotateY(0deg);
  }

  .brand-slide:nth-child(2) {
    transform: translate(-50%, -50%) rotateY(120deg) translateZ(150px) rotateY(-120deg);
  }

  .brand-slide:nth-child(3) {
    transform: translate(-50%, -50%) rotateY(240deg) translateZ(150px) rotateY(-240deg);
  }

  .brand-face img {
    max-height: 220px;
  }

  .ikigai-grid {
    grid-template-columns: 1fr;
  }


  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .process-strip {
    margin-top: 2.5rem;
    padding-top: 2rem;
    gap: 1.5rem;
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
  }

  .cta-inner {
    padding: 3rem 1.5rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-nav {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: var(--header-height) 1rem 2.5rem;
  }

  .hero-brand {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
  }

  .hero-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
  }

  .hero-title {
    font-size: clamp(1.9rem, 9vw, 3rem);
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .cta-inner {
    padding: 2rem 1.25rem;
  }

  .cta-title {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .footer {
    padding: 2rem 0;
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

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

  .footer-nav a {
    padding: 0.5rem 0;
    min-height: 44px;
  }
}

/* Reduced motion: disable thunder, heavy parallax, long animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
  }
  .service-card:hover .service-icon {
    transform: none;
  }
  .service-card:hover .service-body {
    transform: none;
  }
  .service-card:hover .service-rail {
    transform: none;
  }
  .service-scanline {
    animation: none !important;
  }
  .ikigai-num {
    animation: none;
  }
  .ikigai-card:hover h3 {
    transform: none;
  }
  .thunder-overlay.flash {
    animation: none !important;
    opacity: 0 !important;
  }
  .stamp-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-glow {
    animation: none !important;
  }
  .float-obj {
    animation: none !important;
  }
  .brand-3d-inner {
    animation: none !important;
  }
}

/* Effects disabled by user preference (localStorage) - applied via .effects-off class */
body.effects-off .thunder-overlay {
  display: none !important;
}
body.effects-off .thunder-overlay.flash {
  animation: none !important;
}
body.effects-off .float-obj {
  animation: none !important;
}
body.effects-off .engine-ring,
body.effects-off .engine-orbit,
body.effects-off .brand-3d-inner {
  animation: none !important;
}
