/* ===== CinemaOS Design Tokens =====
   Aesthetic: cinema-noir + iridescent/chromatic glitch + neon gold
*/

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* ---- Foundation: cinema-noir ---- */
  --ink-000: #000000;       /* pure black, projector void */
  --ink-050: #030508;       /* page bg */
  --ink-100: #0a0a0d;       /* panel bg */
  --ink-200: #111114;       /* card bg */
  --ink-300: #18181d;       /* elevated */
  --ink-400: #232329;       /* border subtle */
  --ink-500: #353540;       /* border */
  --ink-600: #4a4a55;       /* divider */
  --ink-700: #6e6e7a;       /* muted text */
  --ink-800: #9a9aa6;       /* secondary text */
  --ink-900: #d8d8de;       /* primary text */
  --ink-999: #f5f5f7;       /* high emphasis */

  /* ---- Signal: cinema gold (REAL brand value) ---- */
  --gold-50:  #fdf8ee;
  --gold-100: #f8edcf;
  --gold-200: #f0d899;
  --gold-300: #e3c06a;
  --gold-400: #d4a84b;
  --gold-500: #c6a15b;      /* core */
  --gold-600: #b39050;
  --gold-700: #8c6d35;
  --gold-800: #5e4820;
  --gold-900: #2e2210;

  /* ---- Iridescent triad (logo, hero moments) ---- */
  --iri-magenta: #ff2bd6;
  --iri-violet:  #8b5cff;
  --iri-cyan:    #00e5ff;
  --iri-mint:    #4dffb8;
  --iri-amber:   #ffb84d;

  /* ---- Status ---- */
  --ok:    #10b981;
  --warn:  #f59e0b;
  --err:   #ef4444;
  --info:  #6366f1;

  /* ---- Type ---- */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --font-serif:   'Instrument Serif', Georgia, serif;

  /* ---- Spacing (4px grid) ---- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px;

  /* ---- Radii ---- */
  --r-1: 4px; --r-2: 8px; --r-3: 12px; --r-4: 16px; --r-5: 20px; --r-pill: 999px;

  /* ---- Shadows / glows ---- */
  --glow-gold: 0 0 24px rgba(198,161,91,.45), 0 0 60px rgba(198,161,91,.15);
  --glow-iri:  0 0 22px rgba(139,92,255,.45), 0 0 60px rgba(0,229,255,.18);
  --shadow-card: 0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px rgba(0,0,0,.5);

  /* ---- Motion ---- */
  --ease-smooth: cubic-bezier(.22,.61,.36,1);
  --ease-snap:   cubic-bezier(.5,0,.1,1);
}

/* ===== Base ===== */
.cos-root {
  background: var(--ink-050);
  color: var(--ink-999);
  font-family: var(--font-display);
  font-feature-settings: 'ss01','cv11';
  letter-spacing: -0.01em;
}

.cos-root * { box-sizing: border-box; }

/* ===== Iridescent foil (text + surfaces) ===== */
.cos-iri-text {
  background: linear-gradient(
    100deg,
    var(--iri-magenta) 0%,
    var(--iri-violet) 22%,
    var(--iri-cyan) 45%,
    var(--iri-mint) 65%,
    var(--iri-amber) 82%,
    var(--iri-magenta) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: iri-shift 9s linear infinite;
}
@keyframes iri-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}

.cos-iri-surface {
  background: conic-gradient(
    from 220deg,
    #ff2bd6, #8b5cff, #00e5ff, #4dffb8, #ffb84d, #ff2bd6
  );
  filter: saturate(1.2);
}

/* ===== Chromatic aberration (glitch text) ===== */
.cos-glitch {
  position: relative;
  display: inline-block;
  color: var(--ink-999);
  text-shadow:
    -1.5px 0 0 rgba(255,43,214,.85),
     1.5px 0 0 rgba(0,229,255,.85);
}
.cos-glitch[data-glitch]::before,
.cos-glitch[data-glitch]::after {
  content: attr(data-glitch);
  position: absolute; inset: 0;
  pointer-events: none;
}
.cos-glitch[data-glitch]::before {
  color: var(--iri-magenta);
  mix-blend-mode: screen;
  transform: translate(-1.5px,0);
  clip-path: inset(0 0 55% 0);
  animation: glitch-a 3.6s steps(2,end) infinite;
}
.cos-glitch[data-glitch]::after {
  color: var(--iri-cyan);
  mix-blend-mode: screen;
  transform: translate(1.5px,0);
  clip-path: inset(55% 0 0 0);
  animation: glitch-b 4.2s steps(2,end) infinite;
}
@keyframes glitch-a {
  0%,92%,100% { transform: translate(-1.5px,0); }
  93% { transform: translate(-3px,1px); clip-path: inset(0 0 70% 0); }
  95% { transform: translate(2px,-1px); clip-path: inset(20% 0 40% 0); }
  97% { transform: translate(-2px,0); clip-path: inset(40% 0 10% 0); }
}
@keyframes glitch-b {
  0%,90%,100% { transform: translate(1.5px,0); }
  91% { transform: translate(3px,-1px); clip-path: inset(60% 0 0 0); }
  94% { transform: translate(-2px,1px); clip-path: inset(30% 0 30% 0); }
  98% { transform: translate(2px,0); clip-path: inset(70% 0 0 0); }
}

/* ===== Scanlines overlay ===== */
.cos-scanlines {
  position: relative;
  isolation: isolate;
}
.cos-scanlines::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0) 0px,
    rgba(255,255,255,0) 2px,
    rgba(255,255,255,.025) 3px,
    rgba(255,255,255,0) 4px
  );
  mix-blend-mode: overlay;
  z-index: 2;
}

/* ===== Grid backdrop (for editorial frames) ===== */
.cos-grid-bg {
  background-color: var(--ink-050);
  background-image:
    linear-gradient(rgba(234,179,8,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(234,179,8,.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ===== Buttons ===== */
.cos-btn {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border-radius: var(--r-2);
  border: 1px solid var(--ink-500);
  background: var(--ink-200);
  color: var(--ink-999);
  cursor: pointer;
  transition: all .18s var(--ease-smooth);
  display: inline-flex; align-items: center; gap: 8px;
}
.cos-btn:hover { border-color: var(--gold-500); color: var(--gold-300); }
.cos-btn-primary {
  background: var(--gold-500);
  border-color: var(--gold-500);
  color: var(--ink-000);
  font-weight: 600;
  box-shadow: var(--glow-gold);
}
.cos-btn-primary:hover { background: var(--gold-300); color: var(--ink-000); }
.cos-btn-ghost { background: transparent; border-color: transparent; color: var(--ink-800); }
.cos-btn-ghost:hover { color: var(--gold-300); border-color: transparent; }

/* ===== Cards ===== */
.cos-card {
  background: var(--ink-200);
  border: 1px solid var(--ink-400);
  border-radius: var(--r-3);
  padding: var(--s-6);
  box-shadow: var(--shadow-card);
}

/* ===== Pills / Tags ===== */
.cos-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-500);
  color: var(--ink-800);
  background: rgba(255,255,255,.02);
}
.cos-tag-gold { color: var(--gold-300); border-color: rgba(234,179,8,.4); background: rgba(234,179,8,.08); }
.cos-tag-ok   { color: var(--ok);       border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.08); }
.cos-tag-err  { color: var(--err);      border-color: rgba(239,68,68,.4);  background: rgba(239,68,68,.08); }

/* ===== Mono labels (engineered/UI captions) ===== */
.cos-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-700);
}

/* ===== Aperture logo (CSS-only) ===== */
.cos-aperture {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 50%;
}
.cos-aperture .ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background:
    conic-gradient(from 220deg, #ff2bd6, #8b5cff, #00e5ff, #4dffb8, #ffb84d, #ff2bd6) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}
.cos-aperture .blade {
  position: absolute;
  left: 50%; top: 50%;
  width: 38%; height: 38%;
  transform-origin: 0% 0%;
  background:
    conic-gradient(from 220deg, #ff2bd6, #8b5cff, #00e5ff, #4dffb8, #ffb84d, #ff2bd6);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  filter: saturate(1.3) brightness(1.05);
  box-shadow: 0 0 0 0.5px rgba(255,255,255,.18) inset;
}

/* ===== Utility ===== */
.cos-hairline { background: linear-gradient(90deg, transparent, var(--ink-500), transparent); height: 1px; }
.cos-noise::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  mix-blend-mode: overlay;
}
