/* ===== CSS Variables ===== */
:root {
  /* ── Font stack ── */
  --font-display:  "Playfair Display", "Noto Serif SC", serif;
  --font-heading:  "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --font-body:     "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-ui:       "DM Sans", "Sora", -apple-system, BlinkMacSystemFont, sans-serif;

  --bg-deep:      #1a1930;
  --bg-primary:   #2f2e4c;
  --bg-card:      rgba(47, 46, 76, 0.6);
  --accent:       #9680a0;
  --accent-light: #b8a3c2;
  --amber:        #c49558;
  --amber-light:  #e2bc80;
  --text-primary:    #eae6df;
  --text-secondary:  rgba(234, 230, 223, 0.7);
  --text-muted:      rgba(234, 230, 223, 0.45);
  --border-subtle: rgba(150, 128, 160, 0.2);
  --border-active: rgba(150, 128, 160, 0.5);
  --gradient-hero:  linear-gradient(135deg, #1a1930 0%, #2f2e4c 40%, #9680a0 100%);
  --gradient-card:  linear-gradient(145deg, rgba(47, 46, 76, 0.8), rgba(150, 128, 160, 0.15));
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== P3: Light Mode Theme ===== */
[data-theme="light"] {
  --bg-deep:      #f7f5f2;
  --bg-primary:   #ede8f0;
  --bg-card:      rgba(255, 255, 255, 0.78);
  --accent:       #7a6690;
  --accent-light: #8e7a9e;
  --text-primary:    #2d2a38;
  --text-secondary:  rgba(45, 42, 56, 0.62);
  --text-muted:      rgba(45, 42, 56, 0.38);
  --border-subtle: rgba(122, 102, 144, 0.14);
  --border-active: rgba(122, 102, 144, 0.35);
  --gradient-hero:  linear-gradient(135deg, #f7f5f2 0%, #ede8f0 40%, #c4b8d0 100%);
  --gradient-card:  linear-gradient(145deg, rgba(255,255,255,0.92), rgba(150,130,170,0.06));
}

/* Light mode — noise overlay more subtle */
[data-theme="light"] body::before {
  opacity: 0.015;
}

/* Light mode — premium paper texture */
[data-theme="light"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.32;
  background-image:
    /* Subtle diagonal linen weave */
    repeating-linear-gradient(
      25deg,
      transparent,
      transparent 2px,
      rgba(122, 102, 144, 0.018) 2px,
      rgba(122, 102, 144, 0.018) 3px
    ),
    repeating-linear-gradient(
      -25deg,
      transparent,
      transparent 2px,
      rgba(180, 160, 190, 0.015) 2px,
      rgba(180, 160, 190, 0.015) 3px
    ),
    /* Fine grain overlay */
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1px,
      rgba(45, 42, 56, 0.012) 1px,
      rgba(45, 42, 56, 0.012) 2px
    ),
    /* Micro horizontal striation */
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 1px,
      rgba(45, 42, 56, 0.008) 1px,
      rgba(45, 42, 56, 0.008) 2px
    );
}

/* Light mode — hero section paper texture enhancement */
[data-theme="light"] .page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(200, 190, 210, 0.18) 0%, transparent 70%),
    repeating-linear-gradient(
      25deg,
      transparent,
      transparent 3px,
      rgba(122, 102, 144, 0.02) 3px,
      rgba(122, 102, 144, 0.02) 4px
    );
}

/* Light mode — card hover background */
[data-theme="light"] .content-card:hover {
  background: rgba(245, 242, 248, 0.95);
}

/* Light mode — header & footer overrides */
[data-theme="light"] .header {
  background:
    linear-gradient(180deg, rgba(247,245,242,0.96) 0%, rgba(237,232,240,0.82) 45%, rgba(220,210,230,0.45) 100%),
    radial-gradient(ellipse 70% 50% at 15% 15%, rgba(122,102,144,0.08) 0%, transparent 60%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 24px -8px rgba(122,102,144,0.08);
}
[data-theme="light"] .header::after {
  background: linear-gradient(90deg, transparent, rgba(122,102,144,0.2), transparent);
}
[data-theme="light"] .footer {
  background:
    linear-gradient(180deg, rgba(245,240,238,0.97) 0%, rgba(240,235,242,0.92) 35%, rgba(232,225,238,0.80) 100%),
    radial-gradient(ellipse 60% 30% at 50% 100%, rgba(122,102,144,0.05) 0%, transparent 70%);
}
[data-theme="light"] .footer::before {
  background: linear-gradient(90deg, transparent, rgba(122,102,144,0.2), transparent);
}

/* Light mode — page-hero */
[data-theme="light"] .page-hero {
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(122,102,144,0.06) 0%, transparent 70%),
    var(--bg-deep);
}

/* Light mode — insight callout */
[data-theme="light"] .insight-callout::before {
  background: var(--accent);
}

/* Light mode — shadow tokens */
[data-theme="light"] {
  --shadow-card-hover:
    0 2px 8px rgba(0,0,0,0.06),
    0 8px 24px rgba(0,0,0,0.10),
    0 16px 48px rgba(0,0,0,0.08),
    0 0 80px rgba(122,102,144,0.06);
  --shadow-card-hover-strong:
    0 2px 10px rgba(0,0,0,0.08),
    0 10px 32px rgba(0,0,0,0.14),
    0 24px 64px rgba(0,0,0,0.10),
    0 0 100px rgba(122,102,144,0.08);
}

/* Light mode — carousel nav */
[data-theme="light"] .carousel-nav {
  background: rgba(247,245,242,0.9);
}

/* Light mode — contact form inputs */
[data-theme="light"] .contact-field input,
[data-theme="light"] .contact-field textarea {
  background: rgba(45,42,56,0.03);
}

/* ===== P3: Theme Toggle Button ===== */
.theme-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9997;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-active);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s var(--ease-spring);
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
.theme-toggle:hover {
  transform: scale(1.12);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(150,128,160,0.25);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.6;
  transition: all 0.35s ease;
}
/* Sun shown in dark, Moon shown in light */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.85;
  font-size: 1.1rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* Touch device tap highlight disable */
button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* ===== Heading defaults ===== */
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
h4 { font-size: 1.1rem; }

/* Lead paragraph — guided text between heading and body */
.lead {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 720px;
  margin-bottom: 32px;
}

/* Pull quote — editorial accent */
.pull-quote {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  color: var(--accent-light);
  border-left: 2px solid var(--accent);
  padding: 8px 0 8px 24px;
  margin: 40px 0;
}

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ===== Section Common ===== */
.section {
  position: relative;
  padding: 120px 24px;
  max-width: 1280px;
  margin: 0 auto;
  contain: layout style; /* isolate reflows within section */
  /* Off-screen sections skip rendering until they approach viewport */
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}
.section-label {
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  font-weight: 500;
}
.section-label::before {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--accent);
}
.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 24px;
}
.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.8;
}

/* ===== P3: Enhanced Cursor Glow — dual-layer hotspot + aura ===== */
.cursor-glow {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background:
    radial-gradient(circle 80px at 50% 50%, rgba(180, 160, 195, 0.13) 0%, transparent 100%),
    radial-gradient(circle, rgba(150, 128, 160, 0.08) 0%, transparent 60%);
  /* centering offset now handled in JS via calc(x - 50%) */
  transition: opacity 0.35s ease;
  opacity: 0;
  will-change: transform, opacity;
}
.cursor-glow.visible { opacity: 1; }

/* ===== P3: Amber Gold Flowing Border on Card Hover ===== */
/* ===== Buttons ===== */
.btn-primary {
  padding: 14px 36px;
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.35s;
  background: var(--accent);
  color: var(--bg-deep);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(150, 128, 160, 0.35);
}
.btn-primary:active {
  transform: scale(0.96);
  transition: transform 0.1s;
}
.btn-outline {
  padding: 14px 36px;
  border: 1px solid var(--accent);
  border-radius: 50px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.35s;
}
.btn-outline:hover {
  border-color: var(--accent-light);
  color: var(--accent-light);
  box-shadow: 0 0 20px rgba(150, 128, 160, 0.2);
}
.btn-outline:active {
  transform: scale(0.96);
  transition: transform 0.1s;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  transition: all 0.4s;
  background:
    linear-gradient(180deg, rgba(22, 20, 42, 0.96) 0%, rgba(34, 30, 58, 0.78) 45%, rgba(50, 42, 75, 0.4) 100%),
    radial-gradient(ellipse 70% 50% at 15% 15%, rgba(150, 128, 160, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 25%, rgba(130, 110, 155, 0.06) 0%, transparent 70%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 32px -12px rgba(150, 128, 160, 0.08);
}
.header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150, 128, 160, 0.25), transparent);
  pointer-events: none;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo:hover .logo-img { opacity: 0.85; }

/* ── V3-Solid Theme-aware logo ──
   Both logos occupy exactly the same 64px container height.
   White (dark mode) and black (light mode) switch via [data-theme].
   Sized larger for better visual presence. */
.logo-img {
  width: auto;
  height: 64px;
  display: block;
  flex-shrink: 0;
  transition: opacity 0.4s ease;
  object-fit: contain;
  image-rendering: auto;
}
.logo-img.logo-dark  { display: none; }            /* black hidden by default (dark mode) */
.logo-img.logo-light { display: block; }           /* white shown by default (dark mode) */
[data-theme="light"] .logo-img.logo-dark  { display: block; }
[data-theme="light"] .logo-img.logo-light { display: none; }
.nav { display: flex; gap: 28px; align-items: center; flex-shrink: 1; min-width: 0; }
.nav a {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all 0.3s;
  position: relative;
  padding: 6px 0;
  white-space: nowrap;
}
.nav a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(150, 128, 160, 0.4);
}
.nav a:hover::after { width: 100%; }
.nav a.active { color: var(--text-primary); }
.nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}
.header-cta {
  font-family: var(--font-ui);
  padding: 10px 24px;
  border: 1px solid var(--accent);
  border-radius: 50px;
  font-size: 0.82rem;
  color: var(--accent);
  transition: all 0.3s;
  cursor: pointer;
  background: transparent;
}
.header-cta:hover {
  background: var(--accent);
  color: var(--bg-deep);
  box-shadow: 0 0 24px rgba(150, 128, 160, 0.3);
}

/* ===== Sub-page Hero ===== */
.page-hero {
  padding: 160px 24px 80px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(150, 128, 160, 0.08) 0%, transparent 70%),
    var(--bg-deep);
  border-bottom: 1px solid var(--border-subtle);
}
.page-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
}
.page-hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 540px;
  line-height: 1.8;
  margin: 0 auto;
}

/* ===== Footer ===== */
.footer {
  padding: 60px 40px 40px;
  border-top: 1px solid var(--border-subtle);
  background:
    linear-gradient(180deg, rgba(20, 18, 38, 0.97) 0%, rgba(28, 25, 48, 0.90) 35%, rgba(38, 34, 60, 0.78) 100%),
    radial-gradient(ellipse 60% 30% at 50% 100%, rgba(150, 128, 160, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 80% 20%, rgba(130, 110, 155, 0.05) 0%, transparent 80%);
  position: relative;
}
.footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150, 128, 160, 0.3), transparent);
  pointer-events: none;
}
.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 40px;
}
.footer-brand h3 { font-size: 1.2rem; margin-bottom: 8px; }
.footer-brand p { color: var(--text-secondary); font-size: 0.9rem; }
.footer-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
/* ── V3-Solid QR Code: circular frame ── */
.footer-qr-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-active);
  padding: 4px;
  background: rgba(234, 230, 223, 0.95);
  transition: all 0.4s;
}
.footer-qr-circle:hover {
  transform: scale(1.08);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(150, 128, 160, 0.25);
}
.footer-qr-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}
.footer-qr span {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-align: center;
  max-width: 100px;
}
.footer-links { display: flex; gap: 60px; }
.footer-col h4 { font-family: var(--font-ui); font-size: 0.75rem; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 16px; text-transform: uppercase; }
.footer-col a { font-family: var(--font-ui); display: block; font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 8px; transition: color 0.3s; }
.footer-col a:hover { color: var(--accent); }
/* ── Footer contact items (structured address) ── */
.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.footer-contact-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 44px;
  padding-top: 1px;
}
.footer-bottom {
  max-width: 1280px;
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-wrap: wrap;
  gap: 16px;
}

/* ===== Animations ===== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.3); }
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(60px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Directional variants ── */
.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Staggered child reveals — grid/card children fade in sequentially */
.reveal.visible > .forms-grid > *,
.reveal.visible > .content-grid > *,
.reveal.visible > .problems-strip > *,
.reveal.visible > .category-detail-grid > *,
.reveal.visible > .stat-grid > *,
.reveal.visible > .principles-grid > *,
.reveal.visible > .form-card.span-full > .form-icon {
  opacity: 0;
  animation: staggerIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.reveal.visible > .forms-grid > *:nth-child(1),
.reveal.visible > .content-grid > *:nth-child(1),
.reveal.visible > .problems-strip > *:nth-child(1),
.reveal.visible > .category-detail-grid > *:nth-child(1),
.reveal.visible > .stat-grid > *:nth-child(1),
.reveal.visible > .principles-grid > *:nth-child(1),
.reveal.visible > .form-card.span-full > .form-icon:nth-child(1) { animation-delay: 0s; }
.reveal.visible > .forms-grid > *:nth-child(2),
.reveal.visible > .content-grid > *:nth-child(2),
.reveal.visible > .problems-strip > *:nth-child(2),
.reveal.visible > .category-detail-grid > *:nth-child(2),
.reveal.visible > .stat-grid > *:nth-child(2),
.reveal.visible > .principles-grid > *:nth-child(2) { animation-delay: 0.1s; }
.reveal.visible > .forms-grid > *:nth-child(3),
.reveal.visible > .content-grid > *:nth-child(3),
.reveal.visible > .problems-strip > *:nth-child(3),
.reveal.visible > .category-detail-grid > *:nth-child(3),
.reveal.visible > .stat-grid > *:nth-child(3),
.reveal.visible > .principles-grid > *:nth-child(3) { animation-delay: 0.2s; }
.reveal.visible > .forms-grid > *:nth-child(4),
.reveal.visible > .content-grid > *:nth-child(4),
.reveal.visible > .category-detail-grid > *:nth-child(4),
.reveal.visible > .stat-grid > *:nth-child(4),
.reveal.visible > .principles-grid > *:nth-child(4) { animation-delay: 0.3s; }
.reveal.visible > .content-grid > *:nth-child(5) { animation-delay: 0.35s; }
.reveal.visible > .content-grid > *:nth-child(6) { animation-delay: 0.4s; }
@keyframes staggerIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== P2: Shadow & Material Depth Tokens ===== */
:root {
  --shadow-card-rest:
    0 1px 4px rgba(0,0,0,0.12),
    0 0 0 1px rgba(150,128,160,0.04);
  --shadow-card-hover:
    0 2px 8px rgba(0,0,0,0.14),
    0 8px 28px rgba(0,0,0,0.22),
    0 20px 56px rgba(0,0,0,0.16),
    0 0 100px rgba(150,128,160,0.08);
  --shadow-card-hover-strong:
    0 2px 10px rgba(0,0,0,0.16),
    0 10px 32px rgba(0,0,0,0.26),
    0 24px 64px rgba(0,0,0,0.20),
    0 0 120px rgba(150,128,160,0.10);
  --shadow-card-active:
    0 1px 4px rgba(0,0,0,0.16),
    0 0 0 1px rgba(150,128,160,0.2);
  --shadow-button-hover:
    0 4px 16px rgba(150,128,160,0.3),
    0 8px 32px rgba(0,0,0,0.2);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== Card Base Styles (position:relative required for ::after amber border) ===== */
.stat-item,
.pricing-card,
.timeline-item,
.state-box {
  position: relative;
  border-radius: 12px;
}
.timeline-item { border-radius: 8px; }

/* ===== P2: Card Amber Flowing Border — thin gold sweep on hover ===== */
.content-card::after,
.form-card::after,
.principle-card::after,
.category-detail::after,
.pillar-card::after,
.eco-card::after,
.service-card-wide::after,
.research-home-card::after,
.research-card::after,
.method-card::after,
.area-card::after,
.matrix-card::after,
.package-card::after,
.news-item::after,
.photo-frame::after,
.value-item::after,
.problem-item::after,
.stat-item::after,
.pricing-card::after,
.timeline-item::after,
.state-box::after,
.insight-callout::after {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--edge-angle, 0deg),
    transparent 55%,
    transparent 70%,
    var(--amber) 73%,
    var(--amber-light) 76%,
    var(--amber) 79%,
    transparent 85%,
    transparent
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@property --edge-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.content-card:hover::after,
.form-card:hover::after,
.principle-card:hover::after,
.category-detail:hover::after,
.pillar-card:hover::after,
.eco-card:hover::after,
.service-card-wide:hover::after,
.research-home-card:hover::after,
.research-card:hover::after,
.method-card:hover::after,
.area-card:hover::after,
.matrix-card:hover::after,
.package-card:hover::after,
.news-item:hover::after,
.photo-frame:hover::after,
.value-item:hover::after,
.problem-item:hover::after,
.stat-item:hover::after,
.pricing-card:hover::after,
.timeline-item:hover::after,
.state-box:hover::after,
.insight-callout:hover::after {
  opacity: 1;
  animation: edge-sweep 3.5s linear infinite;
}
@keyframes edge-sweep {
  to { --edge-angle: 360deg; }
}

/* Fallback for browsers without @property support */
@supports not (background: conic-gradient(from var(--edge-angle, 0deg), red, blue)) {
  .content-card::after,
  .form-card::after,
  .principle-card::after,
  .category-detail::after,
  .pillar-card::after,
  .eco-card::after,
  .service-card-wide::after,
  .research-home-card::after,
  .research-card::after,
  .method-card::after,
  .area-card::after,
  .matrix-card::after,
  .package-card::after,
  .news-item::after,
  .photo-frame::after,
  .value-item::after,
  .problem-item::after { display: none; }
  .stat-item::after,
  .pricing-card::after,
  .timeline-item::after,
  .state-box::after { display: none; }
}

/* ===== P2: Unified Active/Press Feedback ===== */
.btn-primary:active,
.btn-outline:active,
.header-cta:active,
.package-cta:active,
.contact-submit:active,
.card-link:active,
.rh-link:active,
.news-arrow:active,
.filter-btn:active {
  transform: scale(0.96) !important;
  transition: transform 0.08s ease !important;
}

/* ===== P2: Icon micro-interactions ===== */
.pillar-icon,
.eco-icon,
.method-icon,
.value-icon,
.matrix-icon {
  transition: all 0.35s var(--ease-spring);
}
.pillar-card:hover .pillar-icon,
.eco-card:hover .eco-icon,
.method-card:hover .method-icon,
.value-item:hover .value-icon {
  transform: scale(1.12);
  background: rgba(150,128,160,0.18);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(150,128,160,0.15);
}

/* ===== P2: Link underline refinement ===== */
.nav a::after {
  height: 2px;
  bottom: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transition: width 0.4s var(--ease-smooth);
}

/* Footer links subtle hover lift */
.footer-col a {
  transition: all 0.25s ease;
}
.footer-col a:hover {
  transform: translateX(4px);
}

/* ===== P2: Brand chip press ===== */
.brand-chip:active {
  transform: scale(0.94);
  transition: transform 0.08s ease;
}

/* ===== P2: Filter btn refinement ===== */
.filter-btn {
  transition: all 0.25s var(--ease-smooth);
}
.filter-btn:hover {
  transform: translateY(-1px);
}

/* ===== P3: Ensure position:relative on all card types for edge-light/tilt ===== */
.pillar-card,
.eco-card,
.research-home-card,
.research-card,
.method-card,
.area-card,
.matrix-card,
.news-item {
  position: relative;
  overflow: hidden;
}

/* ===== P1: Typographic Hierarchy Refinement ===== */

/* Paragraph rhythm — gentle spacing between consecutive paragraphs */
p + p { margin-top: 0.6em; }

/* Semantic emphasis in body text */
strong { font-weight: 600; color: var(--text-primary); }
em { font-style: italic; }

/* Subsection title — internal section break within long content pages */
.subsection-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: -0.01em;
}

/* ===== P1: Insight Callout — narrow centered highlight block ===== */
.insight-callout {
  max-width: 680px;
  margin: 64px auto;
  padding: 48px 40px;
  text-align: center;
  position: relative;
  border-radius: var(--radius-lg);
}
.insight-callout::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--accent);
}
.insight-callout .insight-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-top: 32px;
  margin-bottom: 16px;
}
.insight-callout .insight-text {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--accent-light);
  letter-spacing: -0.01em;
}

/* ===== P1: Staggered Grids — break uniform card rhythm ===== */

/* Variant A: first card spans full width */
.content-grid.staggered {
  grid-template-columns: repeat(2, 1fr);
}
.content-grid.staggered > *:first-child {
  grid-column: 1 / -1;
}

/* Variant B: first card is sidebar (1 col), rest fill 2nd col */
@media (min-width: 769px) {
  .content-grid.featured-left {
    grid-template-columns: 1.2fr 2fr;
  }
  .content-grid.featured-left > *:first-child {
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(145deg, rgba(47,46,76,0.9), rgba(150,128,160,0.2));
    border-color: var(--accent);
  }
}

/* Variant C: alternating wide/narrow (2-col, odd items wide) */
@media (min-width: 769px) {
  .content-grid.rhythm {
    grid-template-columns: 1fr 1fr;
  }
  .content-grid.rhythm > *:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* ===== Content Cards (sub-pages) ===== */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 40px;
  transition: all 0.35s;
  position: relative;
  overflow: hidden;
}
/* Spotlight glow on hover */
.content-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-md);
  background: radial-gradient(700px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(180, 160, 195, 0.22), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 0;
  pointer-events: none;
}
.content-card:hover::before {
  opacity: 1;
}
.content-card > * {
  position: relative;
  z-index: 1;
}
.content-card:hover {
  border-color: var(--border-active);
  background: rgba(47, 46, 76, 0.8);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.content-card h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.content-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 48px;
}

/* ===== Spotlight Border — shared by all card types ===== */
.form-card,
.principle-card,
.category-detail,
.problem-item,
.pillar-card,
.eco-card,
.service-card-wide,
.research-home-card,
.research-card,
.method-card,
.area-card,
.matrix-card {
  position: relative;
  overflow: hidden;
}
.form-card::before,
.principle-card::before,
.category-detail::before,
.pillar-card::before,
.eco-card::before,
.service-card-wide::before,
.research-home-card::before,
.research-card::before,
.method-card::before,
.area-card::before,
.matrix-card::before,
.package-card:not(.featured)::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(700px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(180, 160, 195, 0.18), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 0;
  pointer-events: none;
}
.form-card:hover::before,
.principle-card:hover::before,
.category-detail:hover::before,
.pillar-card:hover::before,
.eco-card:hover::before,
.service-card-wide:hover::before,
.research-home-card:hover::before,
.research-card:hover::before,
.method-card:hover::before,
.area-card:hover::before,
.matrix-card:hover::before,
.package-card:not(.featured):hover::before {
  opacity: 1;
}
.form-card > *,
.principle-card > *,
.category-detail > *,
.content-card > * {
  position: relative;
  z-index: 1;
}

/* ===== Tablet (prevent nav overflow) ===== */
@media (max-width: 1024px) {
  .header { padding: 16px 24px; }
  .nav { gap: 14px; }
  .nav a { font-size: 0.8rem; }
  .header-cta { padding: 8px 18px; font-size: 0.78rem; }
  .logo-img { height: 48px; }
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .logo-img { height: 40px; }
  .header-cta { display: none; }
  .section { padding: 80px 16px; }
  /* ── Mobile Footer ── */
  .footer { padding: 56px 20px 32px; }
  .footer-content { flex-direction: column; align-items: center; text-align: center; gap: 44px; }
  .footer-brand h3 { font-size: 1.15rem; }
  .footer-brand p { font-size: 0.85rem; max-width: 260px; margin-inline: auto; }
  /* ── QR code centered between brand and links ── */
  .footer-qr { order: 0; }
  .footer-qr-circle { width: 100px; height: 100px; }
  /* ── Links: 2-col grid for nav+content, contact spans full width ── */
  .footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
    width: 100%;
    max-width: 420px;
    text-align: left;
  }
  .footer-links .footer-col:last-child { grid-column: 1 / -1; }
  .footer-col h4 {
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    margin-bottom: 14px;
    color: var(--text-muted);
  }
  .footer-col a {
    font-size: 0.85rem;
    margin-bottom: 12px;
    line-height: 1.5;
    padding: 2px 0;
    display: block;
  }
  /* ── Contact items: tighter label width on mobile ── */
  .footer-contact-item {
    font-size: 0.83rem;
    margin-bottom: 12px;
    line-height: 1.55;
    flex-wrap: wrap;
  }
  .footer-contact-label { min-width: 40px; font-size: 0.7rem; }
  /* ── Footer bottom ── */
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin-top: 36px;
    padding-top: 20px;
    font-size: 0.75rem;
  }
  .footer-bottom span { max-width: 320px; line-height: 1.6; }
  .page-hero { padding: 140px 20px 60px; }
  .content-grid { grid-template-columns: 1fr !important; }
  .content-grid.staggered,
  .content-grid.featured-left,
  .content-grid.rhythm { grid-template-columns: 1fr !important; }
  .content-grid.staggered > *:first-child,
  .content-grid.rhythm > *:nth-child(odd) { grid-column: 1 !important; }
  .content-grid.featured-left > *:first-child { grid-row: auto !important; }
  .insight-callout { padding: 40px 24px; margin: 48px auto; }
  .insight-callout .insight-text { font-size: 1.2rem; }
  .nav { display: none; }
}

/* ===== Very Small Screens (≤480px) ===== */
@media (max-width: 480px) {
  .footer { padding: 48px 16px 24px; }
  .footer-content { gap: 36px; }
  .footer-links {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 100%;
  }
  .footer-links .footer-col:last-child { grid-column: auto; }
  .footer-col { text-align: center; }
  .footer-col h4 { margin-bottom: 10px; }
  .footer-contact-item { justify-content: center; }
  .footer-bottom { gap: 8px; margin-top: 28px; }
  .footer-bottom span { max-width: 280px; font-size: 0.72rem; }
}

/* ===== Mobile Nav Overlay ===== */
.mobile-nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  z-index: 200;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-toggle span {
  display: block;
  width: 20px; height: 1.5px;
  background: var(--text-secondary);
  position: relative;
  transition: background 0.3s;
}
.mobile-nav-toggle span::before,
.mobile-nav-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--text-secondary);
  transition: transform 0.3s, top 0.3s;
}
.mobile-nav-toggle span::before { top: -6px; }
.mobile-nav-toggle span::after  { top: 6px; }
.mobile-nav-toggle.is-open span { background: transparent; }
.mobile-nav-toggle.is-open span::before { top: 0; transform: rotate(45deg); }
.mobile-nav-toggle.is-open span::after  { top: 0; transform: rotate(-45deg); }

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(18, 16, 36, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-nav-overlay a {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 14px 32px;
  transition: color 0.3s, transform 0.3s;
  letter-spacing: 0.04em;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-overlay a:hover,
.mobile-nav-overlay a.active {
  color: var(--text-primary);
}
.mobile-nav-overlay .mobile-nav-cta {
  margin-top: 32px;
  padding: 12px 36px;
  border: 1px solid var(--accent);
  border-radius: 50px;
  color: var(--accent);
  font-size: 1rem;
  background: transparent;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-overlay .mobile-nav-cta:hover {
  background: var(--accent);
  color: var(--bg-deep);
}

@media (max-width: 768px) {
  .mobile-nav-toggle { display: flex; }
}

/* ===== Loading & Empty Placeholders ===== */
.loading-placeholder {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  animation: pulse 2s ease-in-out infinite;
}
.empty-placeholder {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Accessibility: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .news-track { scroll-behavior: auto; }
}

/* ===== Touch Device Optimization ===== */
@media (hover: none) and (pointer: coarse) {
  .cursor-glow { display: none !important; }
}

/* ===== Safe Area (notch / dynamic island) ===== */
@supports (padding: env(safe-area-inset-top)) {
  .header { padding-top: calc(20px + env(safe-area-inset-top)); }
  .mobile-nav-overlay { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .footer { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}
