/*
 * TFM Scripts CSS — Script-Template Styling
 * /wp-content/themes/blocksy-child/css/tfm-scripts.css
 *
 * Wird nur auf Script-Seiten geladen (via php/tfm-scripts.php).
 *
 * Hinweis zu Redundanzen mit tfm-global.css:
 *   - .tfm-parallax-orb wird bereits global gerendert (tfm-global.css)
 *     → hier NICHT erneut definiert
 *   - .tfm-cursor-dot ist nur für älteres Cursor-Trail-System — die
 *     Konstellation läuft über Canvas in tfm-global.js — hier trotzdem
 *     enthalten falls dieses Script-Template noch alte Referenzen hat
 */

/* ============================================================
   1. LOKALE CSS-VARIABLEN
   ============================================================ */

.tfm-script-page {
  --bg-page:         #0d0a1a;
  --bg-container:    rgba(20, 12, 40, 0.88);
  --border-glow:     rgba(140, 60, 255, 0.35);
  --border-subtle:   rgba(140, 60, 255, 0.18);
  --purple-bright:   #b06eff;
  --purple-mid:      #7c3aed;
  --purple-soft:     #c4a0ff;
  --cream:           #f0e8d8;
  --text-body:       #ddd4f0;
  --text-dim:        #9a8fbb;
  --tag-sfw-bg:      rgba(60, 180, 120, 0.15);
  --tag-sfw-border:  rgba(60, 180, 120, 0.5);
  --tag-sfw-color:   #7dddaa;
  --tag-warn-bg:     rgba(255, 160, 60, 0.12);
  --tag-warn-border: rgba(255, 160, 60, 0.45);
  --tag-warn-color:  #ffc97a;
  --tag-info-bg:     rgba(140, 60, 255, 0.12);
  --tag-info-border: rgba(140, 60, 255, 0.45);
  --tag-info-color:  #c4a0ff;
}

/* Fallback: Variablen auch auf :root falls kein Wrapper vorhanden ist */
:root {
  --tag-sfw-bg:      rgba(60, 180, 120, 0.15);
  --tag-sfw-border:  rgba(60, 180, 120, 0.5);
  --tag-sfw-color:   #7dddaa;
  --tag-warn-bg:     rgba(255, 160, 60, 0.12);
  --tag-warn-border: rgba(255, 160, 60, 0.45);
  --tag-warn-color:  #ffc97a;
  --tag-info-bg:     rgba(140, 60, 255, 0.12);
  --tag-info-border: rgba(140, 60, 255, 0.45);
  --tag-info-color:  #c4a0ff;
  --purple-bright:   #b06eff;
  --purple-mid:      #7c3aed;
  --purple-soft:     #c4a0ff;
  --cream:           #f0e8d8;
  --text-body:       #ddd4f0;
  --text-dim:        #9a8fbb;
  --border-glow:     rgba(140, 60, 255, 0.35);
  --border-subtle:   rgba(140, 60, 255, 0.18);
}

/* ============================================================
   2. TAG PILLS + Tag Liste
   ============================================================ */

.tfm-tag {
  display: inline-block;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border: 1px solid;
  transition: filter 0.2s, box-shadow 0.2s;
  cursor: default;
  white-space: nowrap;
  font-family: 'Jost', sans-serif;
}
.tfm-tag:hover {
  filter: brightness(1.25);
  box-shadow: 0 0 8px currentColor;
}
.tfm-tag--warn { background: var(--tag-warn-bg); border-color: var(--tag-warn-border); color: var(--tag-warn-color); }
.tfm-tag--info { background: var(--tag-info-bg); border-color: var(--tag-info-border); color: var(--tag-info-color); }
.tfm-tag--safe { background: var(--tag-sfw-bg);  border-color: var(--tag-sfw-border);  color: var(--tag-sfw-color); }

.tfm-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tfm-tag-group-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  display: block;
}

/* ============================================================
   3. BUTTONS
   ============================================================ */

/* Generic small button */
.tfm-btn-small {
  background: transparent;
  border: 1px solid var(--border-glow);
  color: var(--purple-soft);
  font-family: 'Jost', sans-serif;
  font-size: 0.77rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  padding: 0.58rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
  text-align: center;
  width: 100%;
  display: block;
}
.tfm-btn-small:hover {
  background: rgba(140, 60, 255, 0.14);
  color: var(--cream);
  box-shadow: 0 0 14px rgba(140, 60, 255, 0.22);
}

/* Focus Mode Button */
.tfm-btn-focus {
  width: 100%;
  padding: 0.62rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(140, 60, 255, 0.35);
  background: transparent;
  color: var(--purple-soft);
  font-family: 'Jost', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  position: relative;
  overflow: hidden;
  transition: background 0.3s, box-shadow 0.3s, color 0.3s;
}
.tfm-btn-focus::before {
  content: '';
  position: absolute; top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(180,120,255,0.1), transparent);
  transition: left 0.5s ease;
}
.tfm-btn-focus:hover::before { left: 140%; }
.tfm-btn-focus:hover {
  background: rgba(120,40,255,0.14);
  box-shadow: 0 0 18px rgba(120,40,255,0.22);
  color: var(--cream);
}
.tfm-btn-focus.active {
  background: rgba(120,40,255,0.2);
  border-color: var(--purple-bright);
  color: var(--cream);
  box-shadow: 0 0 22px rgba(176,110,255,0.35);
}
.tfm-btn-focus.active .tfm-focus-icon {
  animation: tfmBlink 2.4s ease-in-out infinite;
}
@keyframes tfmBlink { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* ============================================================
   4. COLLAPSIBLE PANEL
   ============================================================ */

.tfm-collapse-panel {
  display: none;
  padding: 0.9rem 1rem;
  background: rgba(12, 5, 28, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  flex-direction: column;
  gap: 0.9rem;
}
.tfm-collapse-panel.open { display: flex; }
.tfm-collapse-panel.desc-panel {
  font-size: 0.82rem;
  color: var(--text-body);
  line-height: 1.65;
  font-style: italic;
  font-family: 'Jost', sans-serif;
}

/* ============================================================
   5. TOGGLE SWITCH (Script-lokal, kleiner als global)
   ============================================================ */

.tfm-toggle-switch { position: relative; width: 38px; height: 20px; flex-shrink: 0; }
.tfm-toggle-switch input { display: none; }
.tfm-toggle-track {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: rgba(140,60,255,0.12);
  border: 1px solid var(--border-glow);
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
}
.tfm-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.3s, background 0.3s;
}
.tfm-toggle-switch input:checked + .tfm-toggle-track {
  background: rgba(124,58,237,0.35);
  border-color: var(--purple-bright);
}
.tfm-toggle-switch input:checked + .tfm-toggle-track::after {
  transform: translateX(18px);
  background: var(--purple-bright);
}

/* ============================================================
   6. IMMERSION SETTINGS ROWS
   ============================================================ */

.tfm-imm-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.tfm-imm-row-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.tfm-setting-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: 'Jost', sans-serif;
}
.tfm-setting-sublabel {
  font-size: 0.67rem;
  color: var(--text-dim);
  opacity: 0.7;
  margin-top: 0.1rem;
  font-style: italic;
  font-family: 'Jost', sans-serif;
}

/* Save row */
.tfm-save-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.5rem;
  background: rgba(140, 60, 255, 0.06);
  border-radius: 6px;
  border: 1px solid rgba(140, 60, 255, 0.12);
  margin-top: -0.3rem;
}
.tfm-save-row input[type="checkbox"] {
  width: 12px;
  height: 12px;
  accent-color: var(--purple-mid);
  cursor: pointer;
  flex-shrink: 0;
}
.tfm-save-row span {
  font-size: 0.66rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  font-style: italic;
  font-family: 'Jost', sans-serif;
}

/* ============================================================
   7. SOUND PILLS
   ============================================================ */

.tfm-sound-pills {
  display: flex;
  gap: 0.4rem;
}
.tfm-sound-pill {
  flex: 1;
  padding: 0.38rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border-glow);
  background: transparent;
  color: var(--text-dim);
  font-family: 'Jost', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tfm-sound-pill:hover {
  background: rgba(140,60,255,0.1);
  color: var(--text-body);
}
.tfm-sound-pill.active {
  background: rgba(124,58,237,0.22);
  color: var(--purple-soft);
  border-color: var(--purple-bright);
  box-shadow: 0 0 10px rgba(176,110,255,0.2);
}

/* ============================================================
   8. LEGACY CURSOR TRAIL DOT
   (nur falls das Script-Template noch alte Referenzen hat —
    das moderne Trail läuft über Canvas in tfm-global.js)
   ============================================================ */

.tfm-cursor-dot {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(176, 110, 255, 0.75);
  box-shadow: 0 0 8px rgba(176, 110, 255, 0.55);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9999;
  animation: tfmDotFade 0.65s ease-out forwards;
}
@keyframes tfmDotFade {
  0%   { opacity: 0.85; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0;    transform: translate(-50%,-50%) scale(0.15); }
}

/* ============================================================
   9. FOCUS MODE
   ============================================================ */

body.tfm-focus-active .tfm-grid-wrapper  { opacity: 0.28; pointer-events: none; }
body.tfm-focus-active .tfm-btn-focus     { pointer-events: auto !important; opacity: 1 !important; }
body.tfm-focus-active .tfm-script-wrapper { background: rgba(5,2,14,0.94); }

/* ============================================================
   10. AMBIENT BREATHE ANIMATION
   ============================================================ */

@keyframes tfmAmbientBreathe {
  0%   { box-shadow: 0 0 28px rgba(120,40,255,0.07), 0 0 55px rgba(80,0,180,0.04); }
  41%  { box-shadow: 0 0 90px rgba(140,50,255,0.48), 0 0 160px rgba(100,20,220,0.32), 0 0 220px rgba(176,110,255,0.13); }
  49%  { box-shadow: 0 0 90px rgba(140,50,255,0.48), 0 0 160px rgba(100,20,220,0.32), 0 0 220px rgba(176,110,255,0.13); }
  90%  { box-shadow: 0 0 28px rgba(120,40,255,0.07), 0 0 55px rgba(80,0,180,0.04); }
  100% { box-shadow: 0 0 28px rgba(120,40,255,0.07), 0 0 55px rgba(80,0,180,0.04); }
}
.tfm-post-container.tfm-ambient-active {
  animation: tfmAmbientBreathe 9.6s ease-in-out infinite;
}

/* ============================================================
   11. FADE-IN ON SCROLL
   ============================================================ */

body.tfm-fadein-active .tfm-script-wrapper p {
  opacity: 0;
  transform: translateY(12px);
}
body.tfm-fadein-active .tfm-script-wrapper p.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   12. RANGE SLIDER
   ============================================================ */

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(140, 60, 255, 0.2);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--purple-bright);
  box-shadow: 0 0 8px rgba(176,110,255,0.6);
  cursor: pointer;
  transition: box-shadow 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 14px rgba(176,110,255,0.9);
}

/* ============================================================
   13. BREATH PHASE LABEL
   ============================================================ */

.tfm-breath-phase-label {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--purple-soft);
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s ease;
  min-height: 1.1em;
}
.tfm-breath-phase-label.visible { opacity: 1; }

/* ============================================================
   14. MEDIA TABS (Script/Video Toggle)
   ============================================================ */

.tfm-media-tab {
  padding: 0.35rem 0.85rem;
  background: transparent;
  border: none;
  font-family: 'Jost', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tfm-media-tab + .tfm-media-tab {
  border-left: 1px solid rgba(140, 60, 255, 0.35);
}
.tfm-media-tab.active {
  background: rgba(124, 58, 237, 0.22);
  color: var(--purple-soft);
}
.tfm-media-tab:not(.active):hover {
  background: rgba(140, 60, 255, 0.08);
  color: var(--text-body);
}

/* ============================================================
   15. SCRIPT PARAGRAPHS (Text-Größe + Line-Spacing über JS steuerbar)
   ============================================================ */

.tfm-script-wrapper p {
  font-family: 'Jost', sans-serif;
  font-size: 0.93rem;
  font-weight: 300;
  line-height: 1.92;
  color: #ddd4f0;
  margin-bottom: 1.25rem;
  transition: font-size 0.2s, line-height 0.2s, opacity 0.55s ease, transform 0.55s ease;
}
.tfm-script-wrapper p:last-child { margin-bottom: 0; }
.tfm-script-wrapper em {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.01rem;
  color: #c4a0ff;
}

/* ============================================================
   16. POST CONTAINER — z-index über Parallax Orbs
   ============================================================ */

.tfm-post-container,
#tfmPostContainer {
  position: relative;
  z-index: 80;
}
.tfm-grid-wrapper,
.tfm-script-wrapper {
  position: relative;
  z-index: 81;
}