/* ═══════════════════════════════════════════════════════════════
   ASIPHYX PORTFOLIO — DEEP NAVY / CYAN / LAVENDER PALETTE
   Phyxian Observatory aesthetic: celestial depth, ocean-serpent lore
   ═══════════════════════════════════════════════════════════════ */

@layer base {
  :root {
    /* ── Deep space base ── */
    --bg-void:    #050810;
    --bg-deep:    #080d1a;
    --bg-navy:    #0a1229;
    --bg-surface: #0d1635;

    /* ── Primary accent palette ── */
    --color-cyan:    #00e5ff;   /* Phyxware mark / primary */
    --color-lavender:#b388ff;   /* Celestial / secondary */
    --color-teal:    #00bcd4;   /* Mid-depth tones */
    --color-sky:     #40c4ff;   /* Highlight variant */

    /* ── Status / semantic ── */
    --color-green:   #50fa7b;   /* Calm / online */
    --color-amber:   #ffcc66;   /* Warning (restrained) */
    --color-ruby:    #ff5c7a;   /* Critical (sparingly) */

    /* ── Text ── */
    --text-primary:  rgba(255,255,255,0.92);
    --text-muted:    rgba(255,255,255,0.55);
    --text-ghost:    rgba(255,255,255,0.30);
    --text-void:     rgba(255,255,255,0.15);

    /* ── Glow ── */
    --glow-cyan:    0 0 8px rgba(0,229,255,0.5), 0 0 24px rgba(0,229,255,0.18);
    --glow-lavender:0 0 8px rgba(179,136,255,0.5), 0 0 24px rgba(179,136,255,0.18);
    --glow-green:   0 0 8px rgba(80,250,123,0.4), 0 0 20px rgba(80,250,123,0.15);
    --glow-amber:   0 0 8px rgba(255,204,102,0.4), 0 0 20px rgba(255,204,102,0.15);

    /* ── Card & layout ── */
    --card-bg:      rgba(10,18,41,0.92);
    --card-border:  rgba(0,229,255,0.12);
    --radius-card:  20px;
    --radius-pill:  9999px;
  }
}

/* ═══ Typography ═══ */
.font-grotesk  { font-family: 'Space Grotesk', sans-serif; }
.font-mono     { font-family: 'Space Mono', monospace; }
.font-orbitron { font-family: 'Orbitron', sans-serif; }

/* ═══ Custom color utilities (Tailwind CDN custom colors supplement) ═══ */
.text-cyan     { color: var(--color-cyan); }
.text-lavender { color: var(--color-lavender); }
.text-teal     { color: var(--color-teal); }
.text-sky-blue { color: var(--color-sky); }
.text-emerald  { color: var(--color-green); }
.text-amber    { color: var(--color-amber); }
.text-ruby     { color: var(--color-ruby); }

/* ═══ Glow utilities ═══ */
.glow-cyan     { filter: drop-shadow(0 0 6px rgba(0,229,255,0.6)) drop-shadow(0 0 20px rgba(0,229,255,0.2)); }
.glow-lavender { filter: drop-shadow(0 0 6px rgba(179,136,255,0.6)) drop-shadow(0 0 20px rgba(179,136,255,0.2)); }
.glow-green    { filter: drop-shadow(0 0 6px rgba(80,250,123,0.5)) drop-shadow(0 0 18px rgba(80,250,123,0.15)); }
.glow-amber    { filter: drop-shadow(0 0 6px rgba(255,204,102,0.5)) drop-shadow(0 0 18px rgba(255,204,102,0.15)); }
.text-glow-cyan    { text-shadow: var(--glow-cyan); }
.text-glow-lavender{ text-shadow: var(--glow-lavender); }

/* ═══ Card ═══ */
.phyx-card {
  border-radius: var(--radius-card);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7), inset 0 1px 0 rgba(0,229,255,0.06);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s cubic-bezier(0.175,0.885,0.32,1.1);
}
.phyx-card:hover {
  border-color: rgba(0,229,255,0.30);
  box-shadow: 0 12px 40px rgba(0,229,255,0.10), 0 4px 16px rgba(0,0,0,0.8), inset 0 1px 0 rgba(0,229,255,0.10);
  transform: translateY(-3px);
}
/* Lavender variant */
.phyx-card-lavender:hover {
  border-color: rgba(179,136,255,0.30);
  box-shadow: 0 12px 40px rgba(179,136,255,0.10), 0 4px 16px rgba(0,0,0,0.8);
}
/* Teal variant (was green in the old palette) */
.phyx-card-teal:hover {
  border-color: rgba(0,188,212,0.30);
  box-shadow: 0 12px 40px rgba(0,188,212,0.10), 0 4px 16px rgba(0,0,0,0.8);
}

/* Suppress card hover transform for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .phyx-card, .phyx-card:hover { transform: none !important; transition: border-color 0.2s, box-shadow 0.2s; }
}

/* ═══ Buttons ═══ */
.phyx-btn {
  border-radius: var(--radius-pill);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: all 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
  cursor: pointer;
}
.phyx-btn:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .phyx-btn { transition: background 0.15s, color 0.15s; }
}

/* ═══ Celestial retro-grid (now deep-navy tinted) ═══ */
.retro-grid {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    linear-gradient(rgba(0,229,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}
.retro-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,229,255,0.04) 0%, transparent 70%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(179,136,255,0.05) 0%, transparent 60%);
}

/* ═══ Celestial depth orb (hero decoration) ═══ */
.celestial-orb {
  position: relative;
  isolation: isolate;
}
.celestial-orb::before {
  content: '';
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,255,0.06) 0%, rgba(179,136,255,0.04) 50%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ═══ Ocean serpent ring animation ═══ */
.serpent-ring-outer {
  animation: serpent-spin-cw 9s linear infinite;
}
.serpent-ring-mid {
  animation: serpent-spin-ccw 6s linear infinite;
}
.serpent-ring-inner {
  animation: serpent-spin-cw 12s linear infinite;
}
@keyframes serpent-spin-cw  { to { transform: rotate(360deg); } }
@keyframes serpent-spin-ccw { to { transform: rotate(-360deg); } }

@media (prefers-reduced-motion: reduce) {
  .serpent-ring-outer,
  .serpent-ring-mid,
  .serpent-ring-inner { animation: none !important; }
}

/* ═══ Hero cinematic reveal ═══ */
.hero-reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: hero-in 0.8s cubic-bezier(0.22,1,0.36,1) forwards;
}
.hero-reveal-delay-1 { animation-delay: 0.12s; }
.hero-reveal-delay-2 { animation-delay: 0.26s; }
.hero-reveal-delay-3 { animation-delay: 0.42s; }
.hero-reveal-delay-4 { animation-delay: 0.60s; }
.hero-reveal-delay-5 { animation-delay: 0.80s; }

@keyframes hero-in {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-reveal { animation: none !important; opacity: 1; transform: none; }
}

/* ═══ Surface fade-in (view transitions) ═══ */
.surface-enter {
  animation: surface-fade-in 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes surface-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .surface-enter { animation: none; }
}

/* ═══ Scanline ═══ */
.scanline {
  width: 100%; height: 80px;
  position: fixed;
  top: -80px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg, transparent 0%, rgba(0,229,255,0.025) 50%, transparent 100%);
  animation: scanline 12s linear infinite;
}
@keyframes scanline { 100% { top: 110%; } }
@media (prefers-reduced-motion: reduce) {
  .scanline { animation: none; display: none; }
}

/* ═══ Glitch (ASIPHYX hero title) ═══ */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.glitch::before {
  left: 2px;
  text-shadow: -2px 0 var(--color-lavender);
  clip: rect(24px, 9999px, 90px, 0);
  animation: glitch-a 4s infinite linear alternate-reverse;
}
.glitch::after {
  left: -2px;
  text-shadow: 2px 0 var(--color-cyan);
  clip: rect(85px, 9999px, 140px, 0);
  animation: glitch-b 3.5s infinite linear alternate-reverse;
}
@keyframes glitch-a {
  0%  { clip: rect(20px, 9999px, 80px, 0);  transform: skew(0.3deg); }
  20% { clip: rect(55px, 9999px, 30px, 0);  transform: skew(-0.2deg); }
  40% { clip: rect(90px, 9999px, 20px, 0);  transform: skew(0.4deg); }
  60% { clip: rect(32px, 9999px, 8px, 0);   transform: skew(-0.1deg); }
  80% { clip: rect(68px, 9999px, 110px, 0); transform: skew(0.2deg); }
 100% { clip: rect(10px, 9999px, 88px, 0);  transform: skew(0deg); }
}
@keyframes glitch-b {
  0%  { clip: rect(62px, 9999px, 15px, 0);  transform: skew(-0.3deg); }
  25% { clip: rect(18px, 9999px, 70px, 0);  transform: skew(0.2deg); }
  50% { clip: rect(44px, 9999px, 95px, 0);  transform: skew(-0.4deg); }
  75% { clip: rect(77px, 9999px, 40px, 0);  transform: skew(0.1deg); }
 100% { clip: rect(28px, 9999px, 60px, 0);  transform: skew(-0.2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after { animation: none; display: none; }
}

/* ═══ Typing cursor ═══ */
.typing-cursor::after {
  content: '▋';
  animation: blink 1.1s step-start infinite;
  color: var(--color-cyan);
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .typing-cursor::after { animation: none; }
}

/* ═══ Serpent divider ═══ */
.serpent-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--color-cyan) 30%, var(--color-lavender) 70%, transparent 100%);
  opacity: 0.3;
  position: relative;
}
.serpent-divider::before {
  content: '⬡';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  color: var(--color-lavender);
  font-size: 10px;
  background: var(--bg-deep);
  padding: 0 6px;
  opacity: 0.7;
}

/* ═══ Status pill (neutral/system = cyan; warning variant = amber) ═══ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid rgba(0,229,255,0.3);
  background: rgba(0,229,255,0.05);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-cyan);
}
.status-pill--info {
  border-color: rgba(0,229,255,0.3);
  background: rgba(0,229,255,0.05);
  color: var(--color-cyan);
}
.status-pill--warn {
  border-color: rgba(255,204,102,0.35);
  background: rgba(255,204,102,0.06);
  color: var(--color-amber);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-cyan);
  animation: status-pulse 2.5s ease-in-out infinite;
}
@keyframes status-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.75); }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
}

/* ═══ Code block ═══ */
.code-block {
  padding: 14px 16px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,229,255,0.12);
  border-radius: 10px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(0,229,255,0.85);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,229,255,0.2) transparent;
}

/* ═══ Tag chip ═══ */
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

/* ═══ Tri-panel clip (accent corners) ═══ */
.tri-panel {
  border: 1px solid currentColor;
  clip-path: polygon(0 6px, 6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px));
}

/* ═══ Sound consent banner ═══ */
.sound-consent {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 200;
  min-width: 220px;
  max-width: 280px;
  padding: 14px 16px;
  background: rgba(8,13,26,0.95);
  border: 1px solid rgba(179,136,255,0.35);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(179,136,255,0.08);
  animation: consent-in 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes consent-in {
  from { opacity:0; transform: translateY(16px) scale(0.96); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .sound-consent { animation: none; }
}

/* Mobile: banner is mounted in normal document flow (after the sticky header)
   and rendered as a static full-width block. It occupies its exact space in
   the layout, so it can never overlap the hero title, status pill, CTA, or
   the sticky nav; dismissal removes it with no leftover gap. */
@media (max-width: 640px) {
  .sound-consent {
    position: static;
    margin: 12px 12px 0;
    min-width: 0;
    max-width: none;
    padding: 12px 14px;
  }
}

/* ═══ Screen-reader-only (live regions etc.) ═══ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ═══ Sound controls bar ═══ */
.sound-bar {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 190;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(8,13,26,0.88);
  border: 1px solid rgba(0,229,255,0.18);
  border-radius: 9999px;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.sound-bar button:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ═══ Volume slider ═══ */
input[type="range"].vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 3px;
  border-radius: 2px;
  background: rgba(0,229,255,0.2);
  outline: none;
  cursor: pointer;
}
input[type="range"].vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 6px rgba(0,229,255,0.6);
}
input[type="range"].vol-slider:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 3px;
}

/* ═══ Nav active indicator ═══ */
.nav-active-bar {
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background: var(--color-cyan);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0,229,255,0.7);
}

/* ═══ Focus-visible global ═══ */
:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ═══ Selection ═══ */
::selection {
  background: rgba(0,229,255,0.25);
  color: #fff;
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,229,255,0.4); }

/* ═══ Mood gauge bars ═══ */
.gauge-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.22,1,0.36,1);
}
@media (prefers-reduced-motion: reduce) {
  .gauge-bar-fill { transition: none; }
}

/* ═══ Log stream ═══ */
.log-stream {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
}
.log-line { animation: log-appear 0.3s ease both; }
@keyframes log-appear {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .log-line { animation: none; }
}

/* ═══ Minimal mobile safe areas ═══ */
@supports (padding: max(0px)) {
  /* Desktop-style pinned corner placement only (mobile banner is a top
     sheet below the header and must not get a bottom edge re-pinned) */
  @media (min-width: 641px) {
    .sound-bar, .sound-consent {
      bottom: max(16px, env(safe-area-inset-bottom));
      right: max(16px, env(safe-area-inset-right));
    }
  }
  @media (max-width: 640px) {
    .sound-consent { position: static; }
  }
}

/* ═══ Print: strip decorative layers ═══ */
@media print {
  .retro-grid, .scanline, .sound-bar, .sound-consent,
  .serpent-ring-outer, .serpent-ring-mid, .serpent-ring-inner { display: none !important; }
}
