/* Fabric View: a woven quilt web around one Fiori app (after the dQuilt quilt web, Woven layout).
   Uses the tokens from site.css and adds one fabric colour per CRAFTED group. */
:root {
  --fx-c: #0e7c86; --fx-r: #6a4bc4; --fx-a: #c25412; --fx-t: #b3306a; --fx-e: #6b7a1f; --fx-d: #1f7a46;
  --fx-seam: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --fx-c: #3cc3cc; --fx-r: #a58dff; --fx-a: #f08a4b; --fx-t: #f06aa4; --fx-e: #b5c75a; --fx-d: #5cc98b; --fx-seam: #0e1420; }
}
:root[data-theme="dark"] { --fx-c: #3cc3cc; --fx-r: #a58dff; --fx-a: #f08a4b; --fx-t: #f06aa4; --fx-e: #b5c75a; --fx-d: #5cc98b; --fx-seam: #0e1420; }

.fx-page .wrap { max-width: 1440px; }
.site-nav a[aria-current="page"] { color: var(--ink); }
.fx-hero { box-shadow: inset 0 4px 0 var(--accent); padding-block: 24px 24px; }
.fx-hero h1 { font-size: var(--step-3); }
.mono { font-family: var(--font-mono); }

/* Toolbar */
.fx-section { padding-block: 18px 48px; }
.fx-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 10px; }
.fx-field, .fx-seg, .fx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.fx-field > span, .fx-seg > span, .fx-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.fx-field select { font: inherit; font-size: 0.85rem; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.fx-seg button { font: 500 0.8rem var(--font-body); padding: 6px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.fx-seg button:first-of-type { border-radius: 999px 0 0 999px; }
.fx-seg button:last-of-type { border-radius: 0 999px 999px 0; margin-left: -1px; }
.fx-seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fx-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-gt { --c: var(--accent); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 500 0.78rem var(--font-body); cursor: pointer; }
.fx-gt i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 700 0.7rem var(--font-display); font-style: normal; background: var(--surface-2); color: var(--muted); }
.fx-gt[aria-pressed="true"] { color: var(--ink); border-color: color-mix(in srgb, var(--c) 50%, var(--line)); }
.fx-gt[aria-pressed="true"] i { background: var(--c); color: var(--surface); }
.fx-check { cursor: pointer; color: var(--muted); }

.fx-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.82rem; margin-bottom: 12px; min-height: 26px; }
.fx-trail button { font: 500 0.82rem var(--font-body); color: var(--accent); background: none; border: 0; padding: 2px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.fx-trail .sep { color: var(--muted); }
.fx-trail .fx-backbtn { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; background: var(--surface); margin-left: 6px; }

/* Stage: canvas + side panel */
.fx-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .fx-stage { grid-template-columns: 1fr; } }
.fx-canvas { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.fx-canvas svg { display: block; width: 100%; height: auto; user-select: none; }

/* Fabric */
.fx-stitch { fill: none; stroke: var(--fx-seam); stroke-width: 1.1; stroke-dasharray: 2 4; opacity: .75; }
.fx-seam-under { fill: none; stroke: var(--fx-seam); stroke-width: 4; }
.fx-seam { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 5 4; }
[data-cell] { transition: fill-opacity .2s; }
[data-cell].is-focus { fill-opacity: .26; }
.fx-gtitle { font: 900 12px var(--font-body); letter-spacing: .08em; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.fx-gtitle.is-empty { opacity: .55; }
.fx-glow { fill: var(--accent); opacity: .06; }

/* Threads */
.fx-thread { fill: none; stroke: var(--muted); stroke-width: 1; opacity: .35; transition: opacity .2s; }
.fx-thread.to-spider { opacity: .2; }
.fx-thread.is-quiet { opacity: .1; }
.fx-thread.is-hot { stroke: var(--hot, var(--accent)); stroke-width: 2.3; opacity: 1; stroke-dasharray: 7 7; animation: fx-flow 1.05s linear infinite; }
@keyframes fx-flow { to { stroke-dashoffset: -28; } }

/* Nodes */
.fx-node { cursor: pointer; outline: none; transition: transform .7s cubic-bezier(.2, .7, .2, 1), opacity .3s; }
.fx-node.is-new { opacity: 0; }
.fx-node.is-fade { opacity: .25; }
.fx-focus-ring { fill: none; stroke: var(--signal); stroke-width: 2; stroke-dasharray: 4 3; opacity: 0; }
.fx-node.is-focus .fx-focus-ring, .fx-node:focus-visible .fx-focus-ring { opacity: 1; }
.fx-label { fill: var(--ink); font-family: var(--font-body); font-weight: 500; paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; }
.fx-r2 .fx-label { font-weight: 700; }
.fx-glyph-t { font-family: var(--font-display); font-weight: 700; pointer-events: none; }
.fx-dashed { stroke-dasharray: 3 2; }
.fx-ghost { fill: var(--surface); stroke-dasharray: 3 3; stroke-width: 1.5; }
.fx-k-ghost .fx-label { fill: var(--muted); font-style: italic; }
.fx-halo { fill: var(--accent); opacity: .18; transform-box: fill-box; transform-origin: center; animation: fx-pulse 2.6s ease-out infinite; }
@keyframes fx-pulse { from { transform: scale(.9); opacity: .25; } to { transform: scale(1.9); opacity: 0; } }
.fx-sp-eyebrow { fill: var(--accent-ink); font-family: var(--font-body); font-weight: 600; letter-spacing: .1em; }
.fx-sp-name { fill: var(--ink); font-family: var(--font-display); font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .fx-node, [data-cell], .fx-thread { transition: none; }
  .fx-thread.is-hot { animation: none; stroke-dasharray: none; }
  .fx-halo { animation: none; opacity: .12; }
}

/* Side panel */
.fx-panel { --c: var(--accent); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 16px 18px 18px; display: grid; gap: 10px; min-width: 0; }
.fx-eyebrow { display: flex; align-items: center; gap: 10px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fx-badge { width: 30px; height: 30px; border-radius: 8px; background: var(--c); color: var(--surface); display: grid; place-items: center; font: 700 1.05rem var(--font-display); }
.fx-panel h2 { font-weight: 600; font-size: 1.25rem; line-height: 1.2; }
.fx-panel p { margin: 0; }
.fx-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.fx-tabs button { font: 500 0.82rem var(--font-body); padding: 7px 10px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fx-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--c); }
.fx-tabbody { display: grid; gap: 10px; }
.fx-src, .fx-rel { font-size: 0.8rem; color: var(--muted); }
.fx-rel { font-family: var(--font-mono); font-size: 0.74rem; }
.fx-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 0.88rem; }
.fx-kv dt { color: var(--muted); }
.fx-kv dd { margin: 0; }
.fx-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fx-pill { display: inline-block; font: 500 0.7rem var(--font-mono); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.fx-pill.is-live { background: var(--signal-soft); border-color: color-mix(in srgb, var(--signal) 50%, transparent); color: var(--ink); }
.fx-th-h { font: 600 0.72rem var(--font-body); text-transform: uppercase; letter-spacing: .08em; margin: 4px 0 0; }
.fx-th { list-style: none; margin: 0; padding: 0; display: grid; }
.fx-th button { width: 100%; display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 6px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: 400 0.85rem var(--font-body); cursor: pointer; }
.fx-th button span { color: var(--muted); font: 400 0.72rem var(--font-mono); white-space: nowrap; }
.fx-th button:hover b { color: var(--accent); }
.fx-story { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; display: grid; gap: 8px; }
.fx-link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.fx-back-spider { justify-self: start; font-size: 0.82rem; }
.req-note { font-size: 0.75rem; color: var(--muted); }

/* Legend */
.fx-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 2px 0; font-size: 0.75rem; color: var(--muted); align-items: center; }
.fx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fx-hint { flex-basis: 100%; }
.lg { width: 12px; height: 12px; display: inline-block; }
.lg-app { background: var(--accent); border-radius: 3px; }
.lg-C { background: var(--fx-c); clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.lg-R { border: 2px solid var(--fx-r); border-radius: 50%; }
.lg-A { background: var(--fx-a); border-radius: 6px; width: 18px; height: 10px; }
.lg-T { background: var(--fx-t); transform: rotate(45deg) scale(.8); }
.lg-E { background: var(--fx-e); border-radius: 2px; }
.lg-D { background: var(--fx-d); border-radius: 50% / 30%; }
.lg-ghost { border: 1.5px dashed var(--muted); border-radius: 50%; }

.fx-tools button:focus-visible, .fx-trail button:focus-visible, .fx-tabs button:focus-visible, .fx-link:focus-visible, .fx-th button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.fx-steps { margin: 0; padding-left: 22px; display: grid; gap: 3px; font-size: 0.85rem; }
