/* LYTENO — Complete Personal Digital Universe Design System */

:root {
  --bg-obsidian: #06080d;
  --bg-charcoal: #0e121b;
  --bg-elevated: #141926;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --accent-blue: #3b82f6;
  --accent-violet: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-primary: #3b82f6;
  --accent-secondary: #06b6d4;
}

html[data-accent="violet"] {
  --accent-primary: #8b5cf6;
  --accent-secondary: #3b82f6;
}

html[data-accent="cyan"] {
  --accent-primary: #06b6d4;
  --accent-secondary: #3b82f6;
}

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

.accent-bg {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

/* Visitor Reading Preferences */
html[data-reading="compact"] .journal-prose {
  font-size: 0.875rem;
  line-height: 1.55;
}

html[data-reading="comfortable"] .journal-prose {
  font-size: 1.075rem;
  line-height: 1.85;
}

/* Visitor Reduced Motion Override */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

html.reduce-motion #lyteno-cursor {
  display: none !important;
}

/* Branded Splash Loader */
#lyteno-loader {
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#lyteno-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Skeleton Loading Placeholder */
.skeleton {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.12) 25%, rgba(148, 163, 184, 0.22) 50%, rgba(148, 163, 184, 0.12) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  overflow-x: hidden;
}

.dark body {
  background-color: var(--bg-obsidian);
  color: #e2e8f0;
}

/* Subtle Architectural Grid */
.bg-grid-pattern {
  background-size: 32px 32px;
  background-image: radial-gradient(rgba(15, 23, 42, 0.07) 1px, transparent 1px);
}

.dark .bg-grid-pattern {
  background-image: radial-gradient(rgba(148, 163, 184, 0.09) 1px, transparent 1px);
}

/* Glass Surface Cards */
.surface-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              background-color 0.25s ease;
}

.dark .surface-card {
  background: rgba(14, 18, 27, 0.8);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 6px 28px -8px rgba(0, 0, 0, 0.45);
}

.surface-card-interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.38);
  box-shadow: 0 14px 32px -12px rgba(59, 130, 246, 0.16);
}

.dark .surface-card-interactive:hover {
  background: rgba(20, 25, 38, 0.92);
  border-color: rgba(6, 182, 212, 0.38);
  box-shadow: 0 14px 32px -12px rgba(6, 182, 212, 0.14);
}

/* Active Nav Link */
.nav-link.active {
  color: #2563eb;
  background-color: rgba(59, 130, 246, 0.08);
}

.dark .nav-link.active {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #232a3b;
}

/* Custom Desktop Cursor (disabled on touch/mobile & reduced motion) */
#lyteno-cursor {
  display: none;
}

@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
  #lyteno-cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    border: 1.5px solid rgba(6, 182, 212, 0.65);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.18s ease, height 0.18s ease, border-color 0.18s ease, opacity 0.2s ease;
    opacity: 0;
  }

  #lyteno-cursor.cursor-visible {
    opacity: 1;
  }

  #lyteno-cursor.cursor-hover {
    width: 34px;
    height: 34px;
    border-color: rgba(139, 92, 246, 0.8);
    background: rgba(59, 130, 246, 0.08);
  }
}

/* SVG Chart Draw-in */
@media (prefers-reduced-motion: no-preference) {
  .chart-line-animate {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawChartLine 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .chart-point-animate {
    opacity: 0;
    animation: fadeInPoint 0.35s ease forwards;
  }
}

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

@keyframes fadeInPoint {
  to { opacity: 1; }
}

/* ---------------- Cinematic Hero Identity Animation ---------------- */
.hero-atmosphere {
  position: relative;
  --hero-mx: 35%;
  --hero-my: 45%;
}

.dark .hero-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(620px circle at var(--hero-mx) var(--hero-my), rgba(59, 130, 246, 0.11), rgba(139, 92, 246, 0.06) 40%, transparent 72%),
    radial-gradient(480px circle at 80% 25%, rgba(6, 182, 212, 0.08), transparent 70%);
  transition: background 0.35s ease;
}

@media (pointer: coarse) {
  .dark .hero-atmosphere::before {
    animation: heroAmbientDrift 16s ease-in-out infinite alternate;
  }
}

@keyframes heroAmbientDrift {
  0% { opacity: 0.75; transform: translate3d(0, 0, 0); }
  100% { opacity: 1; transform: translate3d(18px, -12px, 0); }
}

.hero-eyebrow-reveal {
  opacity: 0;
  transform: translateY(6px);
  animation: heroFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0.05s) forwards;
}

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

/* Letter-by-letter cinematic reveal */
.hero-word {
  display: inline-flex;
  white-space: nowrap;
}

.hero-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  filter: blur(4px);
  animation: charReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) var(--char-delay, 0s) forwards;
}

@keyframes charReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Continuous Fluid Colour Sequence: Electric Violet -> Icy Blue -> Cyan -> Silver -> Soft White -> Violet */
.metallic-prism-name .hero-char,
.metallic-prism-brand .hero-char {
  background-size: 320% 320%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dark .metallic-prism-name .hero-char,
.dark .metallic-prism-brand .hero-char {
  background-image: linear-gradient(
    115deg,
    #8b5cf6 0%,
    #60a5fa 20%,
    #22d3ee 40%,
    #cbd5e1 60%,
    #f8fafc 75%,
    #8b5cf6 92%,
    #60a5fa 100%
  );
}

html:not(.dark) .metallic-prism-name .hero-char,
html:not(.dark) .metallic-prism-brand .hero-char {
  background-image: linear-gradient(
    115deg,
    #6d28d9 0%,
    #2563eb 25%,
    #0891b2 50%,
    #475569 75%,
    #6d28d9 100%
  );
}

.metallic-prism-name {
  animation: prismGlowName 6.5s ease-in-out infinite;
}

.metallic-prism-name .hero-char {
  animation:
    charReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) var(--char-delay, 0s) forwards,
    prismFlow 12s ease-in-out infinite;
}

.metallic-prism-brand {
  animation: prismGlowBrand 8s ease-in-out infinite -2s;
}

.metallic-prism-brand .hero-char {
  animation:
    charReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) var(--char-delay, 0s) forwards,
    prismFlow 15s ease-in-out infinite -4.5s;
}

@keyframes prismFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes prismGlowName {
  0%, 100% {
    filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.28)) drop-shadow(0 0 26px rgba(34, 211, 238, 0.14));
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.34)) drop-shadow(0 0 32px rgba(96, 165, 250, 0.2));
  }
}

@keyframes prismGlowBrand {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.26)) drop-shadow(0 0 22px rgba(96, 165, 250, 0.15));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.32)) drop-shadow(0 0 28px rgba(203, 213, 225, 0.18));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow-reveal,
  .hero-char {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }
  .metallic-prism-name,
  .metallic-prism-brand,
  .lyteno-emblem-intro,
  .lyteno-lightning-arc,
  .lyteno-lightning-spark,
  .lyteno-ambient-pulse,
  .lyteno-metallic-sweep {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .lyteno-lightning-arc,
  .lyteno-lightning-spark {
    opacity: 0 !important;
  }
}

/* =========================================================
   LYTENO Brand Emblem, Lightning Aura & Intro Choreography
   ========================================================= */

.lyteno-brand-stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lyteno-ambient-pulse {
  position: absolute;
  inset: -18%;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, rgba(37, 99, 235, 0.1) 42%, transparent 72%);
  filter: blur(18px);
  pointer-events: none;
  animation: lytenoAmbientBreath 9s ease-in-out infinite;
}

.lyteno-emblem-intro {
  position: relative;
  z-index: 2;
  animation: lytenoEmblemReveal 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.2));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
}

.lyteno-emblem-interactive {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.lyteno-emblem-interactive:hover,
.lyteno-emblem-interactive:focus-visible,
.lyteno-brand-stage:hover .lyteno-emblem-intro {
  transform: scale(1.035);
  filter: drop-shadow(0 0 24px rgba(56, 189, 248, 0.42));
}

.lyteno-metallic-sweep {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: 9999px;
  background: linear-gradient(115deg, transparent 36%, rgba(255, 255, 255, 0.12) 48%, rgba(103, 232, 249, 0.1) 52%, transparent 64%);
  -webkit-mask-image: radial-gradient(circle, #000 35%, transparent 72%);
  mask-image: radial-gradient(circle, #000 35%, transparent 72%);
  transform: translateX(-130%);
  animation: lytenoMetallicSweep 9.5s ease-in-out 0.9s infinite;
}

.lyteno-brand-stage:hover .lyteno-metallic-sweep {
  animation-duration: 1.6s;
}

/* Irregular, natural-looking occasional outer lightning arcs */
.lyteno-lightning-overlay {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  z-index: 4;
  pointer-events: none;
}

.lyteno-lightning-arc {
  fill: none;
  stroke: #67e8f9;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px #38bdf8) drop-shadow(0 0 12px rgba(37, 99, 235, 0.7));
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  opacity: 0;
}

.lyteno-lightning-arc--1 {
  animation: lytenoArcFlash1 9.7s ease-out 0.55s infinite;
}

.lyteno-lightning-arc--2 {
  stroke: #60a5fa;
  animation: lytenoArcFlash2 13.1s ease-out 2.8s infinite;
}

.lyteno-lightning-spark {
  fill: #e0f2fe;
  filter: drop-shadow(0 0 5px #38bdf8);
  opacity: 0;
}

.lyteno-lightning-spark--1 {
  animation: lytenoSparkFlash 9.7s ease-out 0.72s infinite;
}

.lyteno-lightning-spark--2 {
  animation: lytenoSparkFlash 13.1s ease-out 2.95s infinite;
}

@keyframes lytenoEmblemReveal {
  0% { opacity: 0; transform: scale(0.9); filter: drop-shadow(0 0 0 rgba(56, 189, 248, 0)); }
  65% { opacity: 1; transform: scale(1.02); filter: drop-shadow(0 0 28px rgba(56, 189, 248, 0.45)); }
  100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 18px rgba(56, 189, 248, 0.2)); }
}

@keyframes lytenoAmbientBreath {
  0%, 100% { opacity: 0.45; transform: scale(0.96); }
  50% { opacity: 0.85; transform: scale(1.05); }
}

@keyframes lytenoMetallicSweep {
  0%, 78% { transform: translateX(-130%); opacity: 0; }
  84% { opacity: 0.9; }
  95%, 100% { transform: translateX(130%); opacity: 0; }
}

@keyframes lytenoArcFlash1 {
  0% { opacity: 0; stroke-dashoffset: 120; }
  2% { opacity: 0.95; stroke-dashoffset: 40; }
  5% { opacity: 0.35; stroke-dashoffset: 0; }
  7% { opacity: 0.9; stroke-dashoffset: -20; }
  11%, 100% { opacity: 0; stroke-dashoffset: -120; }
}

@keyframes lytenoArcFlash2 {
  0% { opacity: 0; stroke-dashoffset: 120; }
  2.5% { opacity: 0.9; stroke-dashoffset: 30; }
  6% { opacity: 0; stroke-dashoffset: -100; }
  100% { opacity: 0; stroke-dashoffset: -100; }
}

@keyframes lytenoSparkFlash {
  0%, 1% { opacity: 0; transform: scale(0.4); }
  2.5% { opacity: 1; transform: scale(1.25); }
  6%, 100% { opacity: 0; transform: scale(0.6); }
}

html.reduce-motion .lyteno-emblem-intro,
html.reduce-motion .lyteno-ambient-pulse,
html.reduce-motion .lyteno-metallic-sweep,
html.reduced-motion .lyteno-emblem-intro,
html.reduced-motion .lyteno-ambient-pulse,
html.reduced-motion .lyteno-metallic-sweep {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

html.reduce-motion .lyteno-metallic-sweep,
html.reduced-motion .lyteno-metallic-sweep,
html.reduce-motion .lyteno-lightning-arc,
html.reduce-motion .lyteno-lightning-spark,
html.reduced-motion .lyteno-lightning-arc,
html.reduced-motion .lyteno-lightning-spark {
  animation: none !important;
  opacity: 0 !important;
}

/* Focus Visibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Portfolio PDF Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  header,
  main,
  footer,
  #lyteno-cursor,
  #toast,
  #admin-modal,
  #detail-modal,
  .no-print {
    display: none !important;
  }

  #pdf-modal {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  #pdf-modal > div {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }
}
