/* Fyluro-specific visual tokens and ephemeral accent switcher styles. */

/* Candidate accent palettes (ephemeral until one final color is chosen). */
:root,
:root[data-accent="forest"] {
  --accent: light-dark(#2d6a4f, #52b788);
  --accent-hover: light-dark(#22543d, #74c69d);
  --accent-soft: light-dark(rgba(45, 106, 79, 0.12), rgba(82, 183, 136, 0.16));
  --accent-ink: light-dark(#ffffff, #0b1c14);
}

:root[data-accent="amber"] {
  --accent: light-dark(#b45309, #f59e0b);
  --accent-hover: light-dark(#92400e, #fbbf24);
  --accent-soft: light-dark(rgba(180, 83, 9, 0.12), rgba(245, 158, 11, 0.16));
  --accent-ink: light-dark(#ffffff, #1c1304);
}

:root[data-accent="terracotta"] {
  --accent: light-dark(#b84a32, #e07a5f);
  --accent-hover: light-dark(#993b26, #ea947d);
  --accent-soft: light-dark(rgba(184, 74, 50, 0.12), rgba(224, 122, 95, 0.16));
  --accent-ink: light-dark(#ffffff, #1f0e0a);
}

:root[data-accent="slate"] {
  --accent: light-dark(#3b5b7c, #7da2c8);
  --accent-hover: light-dark(#2d4762, #9bb9d8);
  --accent-soft: light-dark(rgba(59, 91, 124, 0.12), rgba(125, 162, 200, 0.16));
  --accent-ink: light-dark(#ffffff, #0c1621);
}

/* Ephemeral accent preview switcher (remove once final accent is picked). */

.accent-preview-bar {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-subtle);
  padding-block: var(--space-2);
  font-size: var(--text-xs);
}

.accent-preview-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.accent-preview-label {
  color: var(--text-subtle);
  font-weight: 500;
}

.accent-swatch {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-pill);
  display: inline-block;
  margin-right: 5px;
  vertical-align: -1px;
}

.accent-swatch-forest { background-color: light-dark(#2d6a4f, #52b788); }
.accent-swatch-amber { background-color: light-dark(#b45309, #f59e0b); }
.accent-swatch-terracotta { background-color: light-dark(#b84a32, #e07a5f); }
.accent-swatch-slate { background-color: light-dark(#3b5b7c, #7da2c8); }

/* Fyluro animated mascot icon (idle eye blink + quiet tail breathe). */

.hero-eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.hero-mascot-frame {
  display: inline-flex;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background-color: #0a0a0a;
  flex-shrink: 0;
  transition: transform 200ms ease;
}

.hero-mascot-frame:hover {
  transform: translateY(-2px) rotate(-2deg);
}

.hero-mascot-svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes mascot-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%, 97% { transform: scaleY(0.08); }
}

@keyframes mascot-tail {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-1.5deg); }
}

.fyluro-mascot-svg .mascot-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: mascot-blink 4.6s ease-in-out infinite;
}

.fyluro-mascot-svg .mascot-tail {
  transform-box: fill-box;
  transform-origin: 75% 88%;
  animation: mascot-tail 3.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero-mascot-frame {
    transition: none;
  }

  .fyluro-mascot-svg .mascot-eye,
  .fyluro-mascot-svg .mascot-tail {
    animation: none;
  }

  .mycelium-pulses {
    display: none;
  }
}

/* Fyluro modular active background (v3: Space Colonization + Pipe Model network). */

.mycelium-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--text);
}

.mycelium-soil-line {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.8;
  stroke-dasharray: 4 7;
  opacity: 0.1;
}

.mycelium-soil-subline {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.55;
  stroke-dasharray: 2 8;
  opacity: 0.065;
}

.mycelium-trunk {
  fill: url(#mycelium-trunk-grad);
  opacity: 0.05;
}

.mycelium-bark {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.9;
  stroke-linecap: round;
  opacity: 0.11;
}

.mycelium-bark-fine {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.55;
  stroke-linecap: round;
  opacity: 0.07;
}

.mycelium-sap-vein {
  fill: none;
  stroke: url(#mycelium-sap-grad);
  stroke-width: 1.9;
  stroke-linecap: round;
}

.mycelium-root-o1 {
  fill: none;
  stroke: var(--text-subtle);
  stroke-linecap: round;
  opacity: 0.15;
}

.mycelium-root-o2 {
  fill: none;
  stroke: var(--text-subtle);
  stroke-linecap: round;
  opacity: 0.115;
}

.mycelium-root-o3 {
  fill: none;
  stroke: var(--text-subtle);
  stroke-linecap: round;
  opacity: 0.085;
}

.mycelium-hypha {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.45;
  opacity: 0.07;
}

.mycelium-hypha-dotted {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.52;
  stroke-dasharray: 1.6 4.2;
  opacity: 0.085;
}

.mycelium-hypha-cord {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.72;
  opacity: 0.095;
}

.mycelium-route-hidden {
  fill: none;
  stroke: none;
}

.mycelium-junction-dot {
  fill: var(--text-subtle);
  opacity: 0.17;
}

.mycelium-junction-spark {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.1;
}

.mycelium-cluster-halo {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.55;
  stroke-dasharray: 1.5 2.5;
  opacity: 0.12;
  transition: stroke 300ms ease, opacity 300ms ease;
}

.mycelium-cluster-core {
  fill: var(--text-subtle);
  opacity: 0.24;
  transition: fill 300ms ease, opacity 300ms ease;
}

.mycelium-cluster-stem {
  fill: none;
  stroke: var(--text-subtle);
  stroke-width: 0.6;
  stroke-linecap: round;
  opacity: 0.15;
  transition: stroke 300ms ease, opacity 300ms ease;
}

.mycelium-cluster-spore {
  fill: var(--text-subtle);
  opacity: 0.2;
  transition: fill 300ms ease, opacity 300ms ease;
}

.mycelium-folder-cluster.is-blooming .mycelium-cluster-core,
.mycelium-folder-cluster.is-blooming .mycelium-cluster-spore {
  fill: var(--accent);
  opacity: 0.72;
}

.mycelium-folder-cluster.is-blooming .mycelium-cluster-stem,
.mycelium-folder-cluster.is-blooming .mycelium-cluster-halo {
  stroke: var(--accent);
  opacity: 0.45;
}

.mycelium-cluster-ring-outer {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.9;
}

.mycelium-cluster-ring-inner {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.35;
}

.mycelium-pulse-streak-glow {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  opacity: 0.15;
}

.mycelium-pulse-streak-core {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  opacity: 0.56;
}

.mycelium-pulse-aura {
  fill: url(#mycelium-pulse-glow);
}

.mycelium-pulse-head {
  fill: var(--accent);
  opacity: 0.9;
}

/* Fyluro ingest state machine diagram (expandable disclosure + interactive SVG). */

:root {
  --sm-abort: light-dark(#b43e3e, #e57373);
  --sm-abort-soft: light-dark(rgba(180, 62, 62, 0.09), rgba(229, 115, 115, 0.14));
}

.sm-disclosure {
  margin-top: var(--space-5);
  border-radius: var(--radius-lg);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sm-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  transition: background-color 140ms ease;
}

.sm-summary::-webkit-details-marker {
  display: none;
}

.sm-summary:hover {
  background-color: var(--bg-subtle);
}

.sm-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.sm-summary-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sm-summary-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.sm-summary-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.sm-summary-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 180ms ease, color 140ms ease, border-color 140ms ease;
}

.sm-disclosure[open] .sm-summary-chevron {
  transform: rotate(180deg);
  color: var(--accent);
  border-color: var(--accent);
}

.sm-panel {
  border-top: 1px solid var(--border);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.sm-legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.sm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sm-legend-swatch {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top: 2px solid var(--border-strong);
}

.sm-legend-main {
  border-top-color: var(--accent);
}

.sm-legend-dry {
  border-top-style: dashed;
  border-top-color: var(--text-subtle);
}

.sm-legend-abort {
  border-top-style: dashed;
  border-top-color: var(--sm-abort);
}

.sm-canvas {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  background-color: var(--bg);
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-2);
}

.sm-svg {
  display: block;
  width: 100%;
  min-width: 740px;
  height: auto;
  font-family: var(--font-sans);
}

/* SVG markers & edges */

.sm-marker-default {
  fill: var(--text-subtle);
}

.sm-marker-accent {
  fill: var(--accent);
}

.sm-marker-abort {
  fill: var(--sm-abort);
}

.sm-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease;
}

.sm-edge-dry {
  stroke-dasharray: 4 3;
}

.sm-edge-abort {
  stroke-dasharray: 3 3;
  opacity: 0.85;
}

.sm-edge.is-highlighted {
  stroke: var(--accent);
  stroke-width: 2.1;
  opacity: 1;
}

.sm-edge-abort.is-highlighted {
  stroke: var(--sm-abort);
}

.sm-edge-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--text-subtle);
  transition: fill 140ms ease;
  user-select: none;
}

.sm-edge-label.is-highlighted {
  fill: var(--text);
  font-weight: 600;
}

/* SVG clickable state nodes */

.sm-node {
  cursor: pointer;
  outline: none;
}

.sm-node rect {
  fill: var(--bg-elevated);
  stroke: var(--border-strong);
  stroke-width: 1.4;
  transition: fill 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
}

.sm-node-title {
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--text);
  pointer-events: none;
  user-select: none;
}

.sm-node-sub {
  font-size: 10.5px;
  fill: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.sm-node-verified rect {
  stroke: var(--accent);
}

.sm-node-sub-verified {
  font-family: var(--font-mono);
  font-weight: 600;
  fill: var(--accent);
}

.sm-node-branch rect {
  fill: var(--bg-subtle);
  stroke-dasharray: 4 3;
}

.sm-node-abort rect {
  fill: var(--bg-subtle);
  stroke: color-mix(in srgb, var(--sm-abort) 55%, var(--border-strong));
}

.sm-node:hover rect,
.sm-node:focus-visible rect {
  stroke: var(--accent);
  stroke-width: 2;
}

.sm-node-abort:hover rect,
.sm-node-abort:focus-visible rect {
  stroke: var(--sm-abort);
}

.sm-node.is-active rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-dasharray: none;
}

.sm-node-abort.is-active rect {
  fill: var(--sm-abort-soft);
  stroke: var(--sm-abort);
}

/* Always-on bottom invariants rail */

.sm-rail rect {
  fill: var(--bg-subtle);
  stroke: var(--border);
  stroke-width: 1;
}

.sm-rail-text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-muted);
  user-select: none;
}

/* Detail inspector card */

.sm-inspector {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
}

.sm-inspector-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.sm-inspector-title {
  font-size: var(--text-lg);
  color: var(--text);
}

.sm-phase-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  background-color: var(--accent-soft);
  color: var(--accent);
}

.sm-phase-pill[data-sm-kind="abort"] {
  background-color: var(--sm-abort-soft);
  color: var(--sm-abort);
}

.sm-phase-pill[data-sm-kind="branch"],
.sm-phase-pill[data-sm-kind="gate"] {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.sm-inspector-summary {
  font-size: var(--text-sm);
  color: var(--text);
}

.sm-inspector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.sm-fact {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sm-fact-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
}

.sm-fact-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.sm-invariants {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-1);
}

.sm-inv-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 780px) {
  .sm-inspector-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .sm-panel {
    padding: var(--space-4);
  }

  .sm-inspector {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sm-summary,
  .sm-summary-chevron,
  .sm-edge,
  .sm-edge-label,
  .sm-node rect {
    transition: none;
  }
}
