/* ============================================================
   Jouri Managing Solutions — Theme V2: "Warm Heritage"
   New palette (warm espresso + terracotta + gold) with a
   completely different 3D approach: layered paper, isometric
   hover, embossed text, conic ring accents, ribbon depth.
   ============================================================ */

/* --- 1. PALETTE SHIFT -------------------------------------------------
   Override existing CSS variables so the whole site picks up the new
   warm theme without touching the compiled components.            --- */
:root {
  /* core surfaces — shifted from navy (hue 220) to warm espresso (hue 24) */
  --background: 24 30% 8%;
  --foreground: 36 20% 94%;
  --card: 22 24% 13%;
  --card-foreground: 36 20% 94%;
  --popover: 22 24% 13%;
  --popover-foreground: 36 20% 94%;
  --muted: 22 16% 18%;
  --muted-foreground: 30 12% 70%;
  --secondary: 22 16% 20%;
  --secondary-foreground: 36 20% 94%;
  --border: 24 14% 24%;
  --input: 24 14% 24%;

  /* primary & accent — warmer metal + terracotta */
  --primary: 30 20% 78%;
  --primary-foreground: 24 30% 8%;
  --accent: 15 72% 52%;
  --accent-foreground: 36 20% 94%;
  --ring: 30 20% 78%;

  /* legacy navy vars mapped to warm tones so existing classes still work */
  --navy-deep: 24 30% 8%;
  --navy-mid: 22 24% 13%;
  --navy-light: 22 16% 20%;
  --metallic-silver: 30 20% 78%;
  --metallic-gold: 42 85% 56%;

  /* morocco palette — warmer, softer */
  --morocco-gold: 42 88% 56%;
  --morocco-gold-light: 45 92% 66%;
  --morocco-gold-dark: 38 82% 46%;
  --morocco-terracotta: 15 72% 52%;
  --morocco-emerald: 155 40% 38%;
  --morocco-sapphire: 210 55% 48%;

  /* V2 signature tokens */
  --jouri-cream: 36 38% 92%;
  --jouri-espresso: 22 35% 6%;
  --jouri-coral: 10 68% 58%;
  --jouri-shine: linear-gradient(
    135deg,
    transparent 30%,
    hsla(var(--jouri-cream), 0.12) 50%,
    transparent 70%
  );

  /* stacked-paper shadow system (replaces the old perspective shadow) */
  --paper-stack:
    0 1px 0 hsla(var(--morocco-gold), 0.08),
    0 4px 0 -1px hsl(22 24% 10%),
    0 6px 12px -2px rgba(0, 0, 0, 0.4),
    0 16px 24px -8px rgba(0, 0, 0, 0.5);

  --paper-stack-hover:
    0 1px 0 hsla(var(--morocco-gold), 0.18),
    0 6px 0 -1px hsl(22 24% 11%),
    0 10px 20px -2px rgba(0, 0, 0, 0.5),
    0 28px 40px -12px rgba(0, 0, 0, 0.55);
}

/* --- 2. GLOBAL SCENE --------------------------------------------------
   Gentle grain + warm vignette behind everything for an editorial feel. */
body {
  background-color: hsl(var(--background));
  background-image:
    radial-gradient(
      ellipse 90% 60% at 50% 0%,
      hsla(var(--morocco-gold), 0.08) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 70% 50% at 100% 100%,
      hsla(var(--jouri-coral), 0.06) 0%,
      transparent 60%
    );
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.6) 0,
      rgba(255, 255, 255, 0.6) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: overlay;
}

/* --- 3. NEW 3D TECHNIQUE #1 — LAYERED PAPER CARDS ---------------------
   Instead of perspective tilt, cards now look like stacked paper
   with compounded offset shadows. On hover, the stack lifts.       --- */
[class*="rounded-xl"][class*="border"],
[class*="rounded-lg"][class*="border"],
[class*="rounded-2xl"][class*="border"] {
  position: relative;
  box-shadow: var(--paper-stack);
  transition:
    transform 0.5s cubic-bezier(0.19, 1, 0.22, 1),
    box-shadow 0.5s cubic-bezier(0.19, 1, 0.22, 1),
    border-color 0.3s ease;
  will-change: transform;
}

/* --- 4. NEW 3D TECHNIQUE #2 — ISOMETRIC LEAN ON HOVER -----------------
   Instead of rotateX/Y perspective, cards tilt along the iso-axis
   (down-right skew) like isometric illustrations.                  --- */
@media (hover: hover) and (pointer: fine) {
  [class*="rounded-xl"][class*="border"]:hover,
  [class*="rounded-lg"][class*="border"]:hover,
  [class*="rounded-2xl"][class*="border"]:hover {
    transform:
      translate3d(-3px, -6px, 0)
      skewY(-0.8deg);
    box-shadow: var(--paper-stack-hover);
    border-color: hsla(var(--morocco-gold), 0.5);
  }
}

/* --- 5. NEW 3D TECHNIQUE #3 — SHINE SWEEP -----------------------------
   Interactive elements get a diagonal light sweep on hover,
   like polished metal catching the light.                          --- */
[class*="rounded-xl"][class*="border"]::after,
[class*="rounded-lg"][class*="border"]::after,
button::after,
a[class*="bg-"][class*="rounded"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--jouri-shine);
  background-size: 250% 250%;
  background-position: 100% 100%;
  border-radius: inherit;
  transition: background-position 0.9s cubic-bezier(0.19, 1, 0.22, 1);
  pointer-events: none;
  opacity: 0;
}

[class*="rounded-xl"][class*="border"]:hover::after,
[class*="rounded-lg"][class*="border"]:hover::after,
button:hover::after,
a[class*="bg-"][class*="rounded"]:hover::after {
  background-position: 0% 0%;
  opacity: 1;
}

/* --- 6. NEW 3D TECHNIQUE #4 — EMBOSSED / CARVED HEADINGS --------------
   Headings get a multi-layer shadow that creates a carved-into-stone
   effect, different from the flat text-shadow of V1.               --- */
h1, h2 {
  text-shadow:
    0 1px 0 hsla(var(--jouri-cream), 0.07),
    0 -1px 0 hsla(var(--jouri-espresso), 0.8),
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.015em;
}

/* --- 7. NEW 3D TECHNIQUE #5 — ROTATING CONIC RINGS --------------------
   Icons inside rounded-full circles get a slowly rotating conic
   gradient halo behind them.                                       --- */
@keyframes jouri-ring-spin {
  to { transform: rotate(360deg); }
}

[class*="rounded-full"] {
  position: relative;
  isolation: isolate;
}

[class*="rounded-full"][class*="bg-"]::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 9999px;
  background: conic-gradient(
    from 0deg,
    hsla(var(--morocco-gold), 0) 0deg,
    hsla(var(--morocco-gold), 0.55) 120deg,
    hsla(var(--jouri-coral), 0.55) 240deg,
    hsla(var(--morocco-gold), 0) 360deg
  );
  animation: jouri-ring-spin 8s linear infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

[class*="rounded-full"][class*="bg-"]:hover::before {
  opacity: 1;
}

/* --- 8. NEW 3D TECHNIQUE #6 — RIBBON DEPTH UNDER SECTIONS -------------
   Each section gets a ribbon-style top edge with a color band,
   feels like stacked paper panels.                                 --- */
section {
  position: relative;
}

section + section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    hsla(var(--morocco-gold), 0.4) 20%,
    hsla(var(--jouri-coral), 0.5) 50%,
    hsla(var(--morocco-gold), 0.4) 80%,
    transparent 100%
  );
  box-shadow: 0 1px 6px hsla(var(--morocco-gold), 0.2);
  z-index: 2;
}

/* --- 9. NEW 3D TECHNIQUE #7 — BUTTONS WITH PHYSICAL DEPTH -------------
   Real 3D button instead of lift-on-hover: has a visible bottom
   edge that collapses on press.                                    --- */
button,
[role="button"],
a[class*="bg-"][class*="rounded"] {
  position: relative;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.2s ease;
  box-shadow:
    0 3px 0 0 hsla(var(--jouri-espresso), 0.6),
    0 4px 8px rgba(0, 0, 0, 0.3);
}

button:hover,
[role="button"]:hover,
a[class*="bg-"][class*="rounded"]:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 0 hsla(var(--jouri-espresso), 0.6),
    0 6px 14px rgba(0, 0, 0, 0.35);
  filter: brightness(1.06);
}

button:active,
[role="button"]:active,
a[class*="bg-"][class*="rounded"]:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 0 hsla(var(--jouri-espresso), 0.6),
    0 1px 3px rgba(0, 0, 0, 0.3);
  filter: brightness(0.95);
}

/* --- 10. NEW 3D TECHNIQUE #8 — NAV WITH BEVELED BASELINE --------------
   Glass nav with a gold hairline that creates a beveled edge feel. */
header, nav[class*="fixed"], nav[class*="sticky"] {
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid hsla(var(--morocco-gold), 0.2);
  box-shadow:
    inset 0 -1px 0 hsla(var(--jouri-cream), 0.04),
    0 8px 20px -8px rgba(0, 0, 0, 0.5);
}

/* --- 11. LOGO TREATMENT — uppercase letter-spacing -------------------- */
header a[href="/"] span,
nav a[href="/"] span,
footer a[href="/"] span {
  letter-spacing: 0.08em;
}

/* --- 12. IMAGE TREATMENT — warm duotone tint on hover ----------------- */
img {
  transition:
    transform 0.7s cubic-bezier(0.19, 1, 0.22, 1),
    filter 0.5s ease;
  filter: saturate(0.95) contrast(1.05);
}

[class*="overflow-hidden"]:hover img,
[class*="group"]:hover img {
  transform: scale(1.05);
  filter: saturate(1.1) contrast(1.08) brightness(1.03);
}

/* --- 13. LINKS — animated underline draw ------------------------------ */
a:not([class*="bg-"]):not([class*="rounded"]) {
  position: relative;
  background-image: linear-gradient(
    90deg,
    hsl(var(--morocco-gold)),
    hsl(var(--jouri-coral))
  );
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

a:not([class*="bg-"]):not([class*="rounded"]):hover {
  background-size: 100% 2px;
}

/* --- 14. CUSTOM SCROLLBAR — terracotta gradient ---------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: hsl(var(--background));
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    hsl(var(--morocco-gold)),
    hsl(var(--jouri-coral))
  );
  border-radius: 5px;
  border: 2px solid hsl(var(--background));
}

/* --- 15. ACCESSIBILITY — honor reduced motion + print ----------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [class*="rounded-xl"][class*="border"]:hover,
  [class*="rounded-lg"][class*="border"]:hover,
  [class*="rounded-2xl"][class*="border"]:hover {
    transform: none;
  }
  [class*="rounded-full"][class*="bg-"]::before {
    animation: none;
  }
}

@media print {
  *, *::before, *::after {
    transform: none !important;
    animation: none !important;
    box-shadow: none !important;
    background: white !important;
    color: black !important;
  }
}
