/* Praetorian Forge v5 Studio Preview — Obsidian Palettes, 3D Spotlight Borders & Compositor Scroll Motion */

@property --inner-size {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 0px;
}

@property --outer-size {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 0px;
}

@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

/* === 4 OBSIDIAN NOIR COLOR PALETTES === */
:root,
html[data-palette="obsidian-acier"] {
  --pf-bg: #03050a;
  --pf-surface: #070b14;
  --pf-card-bg: rgba(11, 16, 29, 0.78);
  --pf-card-solid: #0a0f1d;
  --pf-border: rgba(148, 163, 184, 0.14);
  --pf-accent: #3b82f6;
  --pf-accent-bright: #60a5fa;
  --pf-accent-ink: #040914;
  --pf-secondary: #10b981;
  --pf-secondary-soft: rgba(16, 185, 129, 0.14);
  --pf-glow: rgba(59, 130, 246, 0.24);
  --pf-spotlight: rgba(96, 165, 250, 0.16);
  --pf-grid-line: rgba(148, 163, 184, 0.04);
}

html[data-palette="obsidian-or"] {
  --pf-bg: #040305;
  --pf-surface: #0b090e;
  --pf-card-bg: rgba(18, 15, 20, 0.84);
  --pf-card-solid: #110e14;
  --pf-border: rgba(212, 175, 55, 0.17);
  --pf-accent: #d4af37;
  --pf-accent-bright: #fde68a;
  --pf-accent-ink: #0c0802;
  --pf-secondary: #34d399;
  --pf-secondary-soft: rgba(52, 211, 153, 0.12);
  --pf-glow: rgba(212, 175, 55, 0.2);
  --pf-spotlight: rgba(251, 191, 36, 0.14);
  --pf-grid-line: rgba(212, 175, 55, 0.038);
}

html[data-palette="obsidian-cyan"] {
  --pf-bg: #020408;
  --pf-surface: #050a12;
  --pf-card-bg: rgba(7, 15, 26, 0.8);
  --pf-card-solid: #070f1b;
  --pf-border: rgba(34, 211, 238, 0.16);
  --pf-accent: #06b6d4;
  --pf-accent-bright: #67e8f9;
  --pf-accent-ink: #021017;
  --pf-secondary: #818cf8;
  --pf-secondary-soft: rgba(129, 140, 248, 0.15);
  --pf-glow: rgba(6, 182, 212, 0.22);
  --pf-spotlight: rgba(34, 211, 238, 0.15);
  --pf-grid-line: rgba(34, 211, 238, 0.036);
}

html[data-palette="monochrome-resend"] {
  --pf-bg: #000000;
  --pf-surface: #08080a;
  --pf-card-bg: rgba(14, 14, 17, 0.86);
  --pf-card-solid: #0d0d10;
  --pf-border: rgba(255, 255, 255, 0.12);
  --pf-accent: #e2e8f0;
  --pf-accent-bright: #ffffff;
  --pf-accent-ink: #030305;
  --pf-secondary: #34d399;
  --pf-secondary-soft: rgba(52, 211, 153, 0.12);
  --pf-glow: rgba(255, 255, 255, 0.14);
  --pf-spotlight: rgba(255, 255, 255, 0.11);
  --pf-grid-line: rgba(255, 255, 255, 0.035);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--pf-bg);
  color: #f1f5f9;
  overflow-x: hidden;
  padding-bottom: 5.5rem;
}

.font-mono-tech {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

.pf-display {
  letter-spacing: -0.034em;
}

/* Transparent Brand Emblem via CSS Mask (adapts smoothly to every Obsidian Palette without white box!) */
.pf-brand-emblem {
  width: 34px;
  height: 38px;
  display: inline-block;
  flex: none;
  background: linear-gradient(145deg, var(--pf-accent-bright) 0%, var(--pf-accent) 100%);
  -webkit-mask: url("/img/logo-mark.png") no-repeat center / contain;
  mask: url("/img/logo-mark.png") no-repeat center / contain;
  filter: drop-shadow(0 0 12px var(--pf-glow));
  forced-color-adjust: none;
}

.pf-accent-text {
  color: var(--pf-accent-bright);
}

.pf-gradient-text {
  background-image: linear-gradient(115deg, #ffffff 10%, var(--pf-accent-bright) 60%, var(--pf-secondary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pf-btn-primary {
  background-color: var(--pf-accent);
  color: var(--pf-accent-ink);
  box-shadow: 0 12px 32px -10px var(--pf-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.2s ease;
}

.pf-btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.pf-btn-secondary {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.pf-btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--pf-accent-bright);
}

/* Architectural Hero & 3D WebGL Canvas layering */
.pf-stage {
  position: relative;
  background-color: var(--pf-bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 65% 20%, var(--pf-glow), transparent 72%),
    linear-gradient(to right, var(--pf-grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--pf-grid-line) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
}

.pf-3d-canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* Top beam accent divider */
.pf-horizon-beam {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, var(--pf-border) 20%, var(--pf-accent-bright) 50%, var(--pf-border) 80%, transparent 100%);
  opacity: 0.65;
}

/* === INTERACTIVE SPOTLIGHT CARD SYSTEM (modern-web-guidance: interactive-content-reveal) === */
.pf-card {
  position: relative;
  background: var(--pf-card-bg);
  border: 1px solid var(--pf-border);
  border-radius: 1.2rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 24px 48px -28px rgba(0, 0, 0, 0.95);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.pf-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--pf-spotlight) var(--inner-size, 0px),
    transparent var(--outer-size, 0px)
  );
  -webkit-mask-image: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    black var(--inner-size, 0%),
    transparent var(--outer-size, 0%)
  );
  mask-image: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    black var(--inner-size, 0%),
    transparent var(--outer-size, 0%)
  );
  transition: --inner-size 0.22s ease-out, --outer-size 0.25s ease-out;
}

.pf-card:hover {
  --inner-size: 90px;
  --outer-size: 260px;
  border-color: color-mix(in srgb, var(--pf-accent-bright) 38%, rgba(255, 255, 255, 0.08));
}

/* === OPTION C ISOMETRIC TILT SHOWCASE === */
.pf-iso-wrapper {
  perspective: 1400px;
}

.pf-iso-card {
  transform: rotateX(var(--tilt-x, 7deg)) rotateY(var(--tilt-y, -8deg));
  transform-style: preserve-3d;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 40px 90px -25px rgba(0, 0, 0, 0.95), 0 0 60px -20px var(--pf-glow);
}

/* === SCROLL REVEALS (Compositor-only transform & opacity, guarded) === */
@media (prefers-reduced-motion: no-preference) {
  .pf-reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .pf-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  @keyframes pf-pulse-line {
    0% { stroke-dashoffset: 36; }
    100% { stroke-dashoffset: 0; }
  }
  .pf-flow-dash {
    stroke-dasharray: 6 6;
    animation: pf-pulse-line 1.6s linear infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pf-card::before {
    transition: none !important;
  }
  .pf-iso-card {
    transform: none !important;
    transition: none !important;
  }
  .pf-reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* === ACCESSIBLE TABS === */
.pf-tablist-scroller {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: inline proximity;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.pf-tablist-scroller::-webkit-scrollbar {
  display: none;
}

.pf-tab {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.pf-tab:hover {
  color: #f8fafc;
}

.pf-tab[aria-selected="true"] {
  color: var(--pf-accent-bright);
}

.pf-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0.35rem 0;
  border-block-end: 2.5px solid var(--pf-accent-bright);
}

.pf-tabpanels-stack {
  display: grid;
  grid-template-areas: "panel";
}

.pf-tabpanels-stack > [role="tabpanel"] {
  grid-area: panel;
}

/* === FLOATING STUDIO OPTION & PALETTE DOCK === */
.pf-studio-dock {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 1.5rem);
  background: rgba(7, 9, 15, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.pf-swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.pf-swatch[aria-checked="true"] {
  border-color: #ffffff;
  transform: scale(1.16);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* === PRODUCTION COMPACT PALETTE & 3D CONTROL === */
.pf-prod-dock {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(7, 10, 17, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  padding: 0.35rem 0.5rem;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.78);
}

.pf-palette-menu {
  position: fixed;
  bottom: 4.1rem;
  left: 1rem;
  z-index: 60;
  width: 15.5rem;
  background: rgba(8, 12, 20, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.9rem;
  padding: 0.4rem;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.92);
}

/* === INTERACTIVE SVG DATAFLOW INFOGRAPHIC === */
.pf-flow-node {
  transition: transform 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}
.pf-flow-node:hover {
  filter: brightness(1.15);
}

@media (prefers-reduced-motion: reduce) {
  .pf-svg-packet {
    display: none !important;
  }
}
