/* frikwork v0.0.8 — https://frikwork.com */
/* --- src/css/00-tokens.css --- */
/* frikwork design tokens — dark-first, with a full light theme */

:root {
  /* brand */
  --fw-brand: #94c83e;
  --fw-brand-text: #94c83e;      /* legible-on-background brand variant */
  --fw-brand-2: #3aaabe;         /* teal secondary */

  /* surfaces */
  --fw-bg: #101010;
  --fw-bg-2: #1a1a1a;
  --fw-bg-card: #1f1f1f;
  --fw-bg-hover: #262626;
  --fw-border: #333333;

  /* text */
  --fw-text: #ffffff;
  --fw-text-2: #cfcfcf;
  --fw-text-muted: #8a8a8a;

  /* glass */
  --fw-glass-bg: rgba(31, 31, 31, 0.55);
  --fw-glass-border: rgba(255, 255, 255, 0.08);
  --fw-glass-shadow: rgba(0, 0, 0, 0.35);

  /* status */
  --fw-success: #94c83e;
  --fw-warning: #f59e0b;
  --fw-danger: #ef4444;
  --fw-info: #3b82f6;

  /* severity ramp */
  --fw-sev-critical: #ff3860;
  --fw-sev-high: #ff7849;
  --fw-sev-medium: #f59e0b;
  --fw-sev-low: #3b82f6;

  /* categorical chart palette */
  --fw-chart-1: #2a78d6;
  --fw-chart-2: #1baf7a;
  --fw-chart-3: #eda100;
  --fw-chart-4: #008300;
  --fw-chart-5: #4a3aa7;
  --fw-chart-6: #e34948;
  --fw-chart-7: #e87ba4;
  --fw-chart-other: #55534c;

  /* button gradients — all coloured buttons use a 135deg gradient for a cohesive set */
  --fw-gradient-primary:        linear-gradient(135deg, #a5d94f, #7fb52e);
  --fw-gradient-primary-hover:  linear-gradient(135deg, #b2e35d, #8cc231);
  --fw-gradient-secondary:      linear-gradient(135deg, #1a5ddf, #2580a7);
  --fw-gradient-secondary-hover: linear-gradient(135deg, #1550c5, #1f6d90);
  --fw-gradient-danger:         linear-gradient(135deg, #f05252, #dc2626);
  --fw-gradient-danger-hover:   linear-gradient(135deg, #f56b6b, #e02d2d);
  --fw-gradient-warning:        linear-gradient(135deg, #fbbf24, #f59e0b);
  --fw-gradient-warning-hover:  linear-gradient(135deg, #fccb47, #f9a825);
  /* back-compat aliases (secondary was the original gradient) */
  --fw-gradient: var(--fw-gradient-secondary);
  --fw-gradient-hover: var(--fw-gradient-secondary-hover);

  /* spacing */
  --fw-space-xs: 0.25rem;
  --fw-space-sm: 0.5rem;
  --fw-space-md: 1rem;
  --fw-space-lg: 1.5rem;
  --fw-space-xl: 2rem;

  /* radii */
  --fw-radius-sm: 0.375rem;
  --fw-radius-md: 0.5rem;
  --fw-radius-lg: 0.65rem;
  --fw-radius-xl: 1rem;
  --fw-radius-pill: 9999px;

  /* shadows */
  --fw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --fw-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --fw-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
  --fw-shadow-glass: 0 8px 32px var(--fw-glass-shadow);
  --fw-shadow-glow: 0 0 20px rgba(148, 200, 62, 0.3);

  /* motion */
  --fw-ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --fw-ease-draw: cubic-bezier(0.16, 1, 0.3, 1);
  --fw-ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fw-dur-fast: 0.15s;
  --fw-dur: 0.2s;
  --fw-dur-slow: 0.3s;

  /* type */
  --fw-font: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --fw-font-mono: 'Fira Code', Consolas, monospace;

  color-scheme: dark light;
}

/* Light theme: explicit user choice */
[data-fw-theme="light"] {
  --fw-brand-text: #5c8a1e;
  --fw-brand-2: #2d8a9b;

  --fw-bg: #f5f4f1;
  --fw-bg-2: #ffffff;
  --fw-bg-card: #ffffff;
  --fw-bg-hover: #eeece7;
  --fw-border: #ddd9d0;

  --fw-text: #17160f;
  --fw-text-2: #4b4a42;
  --fw-text-muted: #86847a;

  --fw-glass-bg: rgba(255, 255, 255, 0.55);
  --fw-glass-border: rgba(23, 22, 15, 0.08);
  --fw-glass-shadow: rgba(23, 22, 15, 0.12);

  --fw-success: #5c8a1e;
  --fw-warning: #b45309;
  --fw-danger: #dc2626;
  --fw-info: #2563eb;

  --fw-sev-critical: #e11d48;
  --fw-sev-high: #ea580c;
  --fw-sev-medium: #b45309;
  --fw-sev-low: #2563eb;

  --fw-shadow-sm: 0 1px 2px rgba(23, 22, 15, 0.1);
  --fw-shadow-md: 0 4px 6px rgba(23, 22, 15, 0.1);
  --fw-shadow-lg: 0 10px 15px rgba(23, 22, 15, 0.12);
}

/* Light theme: system preference, only before an explicit choice is set */
@media (prefers-color-scheme: light) {
  :root:not([data-fw-theme]) {
    --fw-brand-text: #5c8a1e;
    --fw-brand-2: #2d8a9b;
    --fw-bg: #f5f4f1;
    --fw-bg-2: #ffffff;
    --fw-bg-card: #ffffff;
    --fw-bg-hover: #eeece7;
    --fw-border: #ddd9d0;
    --fw-text: #17160f;
    --fw-text-2: #4b4a42;
    --fw-text-muted: #86847a;
    --fw-glass-bg: rgba(255, 255, 255, 0.55);
    --fw-glass-border: rgba(23, 22, 15, 0.08);
    --fw-glass-shadow: rgba(23, 22, 15, 0.12);
    --fw-success: #5c8a1e;
    --fw-warning: #b45309;
    --fw-danger: #dc2626;
    --fw-info: #2563eb;
  }
}

/* Animatable angle for the rotating card border ring (lively tier) */
@property --fw-card-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* --- src/css/01-reset.css --- */
/* frikwork reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
img, picture, svg, video, canvas { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul[class], ol[class] { list-style: none; padding: 0; }

/* --- src/css/02-elements.css --- */
/* frikwork base elements — unclassed HTML looks like frikwork */
body {
  background: var(--fw-bg);
  color: var(--fw-text);
  font-family: var(--fw-font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--fw-dur-slow) ease, color var(--fw-dur-slow) ease;
}

h1, h2, h3, h4, h5, h6 { line-height: 1.2; font-weight: 600; color: var(--fw-text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fw-text-muted); }

p { color: var(--fw-text-2); }

a:not([class]) { color: var(--fw-brand-text); }
a:not([class]):hover { text-decoration: underline; }

ul:not([class]), ol:not([class]) { padding-left: 1.25rem; color: var(--fw-text-2); }

hr { border: none; border-top: 1px solid var(--fw-border); margin: var(--fw-space-lg) 0; }

blockquote {
  border-left: 3px solid var(--fw-brand);
  padding-left: var(--fw-space-md);
  color: var(--fw-text-2);
  font-style: italic;
}

code, pre, kbd, samp { font-family: var(--fw-font-mono); font-size: 0.9em; }
code { background: var(--fw-bg-card); padding: 0.1em 0.35em; border-radius: var(--fw-radius-sm); }
pre { background: var(--fw-bg-card); border: 1px solid var(--fw-border); border-radius: var(--fw-radius-md); padding: var(--fw-space-md); overflow-x: auto; }
pre code { background: none; padding: 0; }
kbd {
  background: var(--fw-bg-2);
  border: 1px solid var(--fw-border);
  border-bottom-width: 2px;
  border-radius: var(--fw-radius-sm);
  padding: 0.1em 0.4em;
  font-size: 0.8em;
}

::selection { background: rgba(148, 200, 62, 0.3); color: var(--fw-text); }

:focus-visible { outline: 2px solid var(--fw-brand); outline-offset: 2px; }

/* forms follow accent at the element level only; full styling is opt-in via .fw-* */
input, textarea, select { accent-color: var(--fw-brand); }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fw-border); border-radius: var(--fw-radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--fw-text-muted); }

/* --- src/css/03-typography.css --- */
/* frikwork typography — self-hosted Schibsted Grotesk (variable, latin subset).
   Two physical files cover the whole weight axis via font-weight ranges. */
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('fonts/schibsted-grotesk-regular.woff2') format('woff2');
  font-weight: 400 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('fonts/schibsted-grotesk-italic.woff2') format('woff2');
  font-weight: 400 700; font-style: italic; font-display: swap;
}

/* type-scale utilities */
.fw-lead { font-size: 1rem; color: var(--fw-text-2); }
.fw-muted { color: var(--fw-text-muted); }
.fw-micro { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fw-text-muted); font-weight: 500; }
.fw-num { font-variant-numeric: tabular-nums; }

/* --- src/css/04-layout.css --- */
/* frikwork layout primitives */
.fw-container { max-width: 1900px; margin: 0 auto; padding: 0 var(--fw-space-lg); }

.fw-grid { display: grid; gap: var(--fw-space-md); }
.fw-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.fw-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.fw-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1000px) {
  .fw-grid--cols-3, .fw-grid--cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .fw-grid--cols-2, .fw-grid--cols-3, .fw-grid--cols-4 { grid-template-columns: 1fr; }
}

.fw-stack { display: flex; flex-direction: column; gap: var(--fw-space-md); }
.fw-stack--lg { gap: var(--fw-space-lg); }

/* Sticky-footer page shell — put on the top-level wrapper (or <body>) so header/content/footer
   stack in a full-height column. Paired with .fw-footer { margin-top: auto }, the footer sits
   at the bottom of the viewport even when the content is short (not floating mid-page). Opt-in,
   so it never changes a consumer's existing body layout unless they ask for it. */
.fw-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* --- src/css/10-buttons.css --- */
/* frikwork buttons */
.fw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fw-space-sm);
  padding: var(--fw-space-sm) var(--fw-space-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--fw-radius-md);
  border: 1px solid transparent;
  transition: all var(--fw-dur) ease;
}
.fw-btn:hover { transform: translateY(-1px); box-shadow: var(--fw-shadow-md); }
.fw-btn:active { transform: translateY(0); }

/* coloured buttons use gradients; outline/ghost stay flat */
.fw-btn--primary { background-image: var(--fw-gradient-primary); color: #101010; }
.fw-btn--primary:hover { background-image: var(--fw-gradient-primary-hover); }

.fw-btn--secondary { background-image: var(--fw-gradient-secondary); color: #fff; }
.fw-btn--secondary:hover { background-image: var(--fw-gradient-secondary-hover); }

.fw-btn--danger { background-image: var(--fw-gradient-danger); color: #fff; }
.fw-btn--danger:hover { background-image: var(--fw-gradient-danger-hover); }

.fw-btn--warning { background-image: var(--fw-gradient-warning); color: #101010; }
.fw-btn--warning:hover { background-image: var(--fw-gradient-warning-hover); }

.fw-btn--outline { background: transparent; border-color: var(--fw-border); color: var(--fw-text-2); }
.fw-btn--outline:hover { background: var(--fw-bg-hover); border-color: var(--fw-brand); color: var(--fw-brand-text); }

.fw-btn--ghost { background: transparent; color: var(--fw-text-2); }
.fw-btn--ghost:hover { background: var(--fw-bg-hover); color: var(--fw-text); box-shadow: none; }

.fw-btn--sm { padding: var(--fw-space-xs) var(--fw-space-sm); font-size: 0.8rem; }
.fw-btn--lg { padding: var(--fw-space-md) var(--fw-space-lg); font-size: 1rem; }
.fw-btn--block { display: flex; width: 100%; }

.fw-btn[disabled], .fw-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

/* icon button — square, bordered (salesdash) */
.fw-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: transparent;
  color: var(--fw-text-2);
  transition: all var(--fw-dur) ease;
}
.fw-icon-btn:hover { border-color: var(--fw-brand); color: var(--fw-brand-text); }
.fw-icon-btn.is-active { border-color: var(--fw-brand); color: var(--fw-brand-text); background: rgba(148, 200, 62, 0.1); }
.fw-icon-btn svg { width: 16px; height: 16px; }

/* --- src/css/11-cards.css --- */
/* frikwork cards — glass by default (salesdash frosted surface) */
.fw-card {
  background: var(--fw-glass-bg);
  border: 1px solid var(--fw-glass-border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: var(--fw-radius-lg);
  box-shadow: var(--fw-shadow-glass);
  padding: var(--fw-space-lg);
  position: relative;
  overflow: hidden;
}
/* fallback: no backdrop-filter → the semi-opaque surface above still reads as a panel */

/* opt out of glass for dense/nested contexts (opaque, flat) */
.fw-card--solid {
  background: var(--fw-bg-card);
  border-color: var(--fw-border);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

/* back-compat: cards are glass by default now, so this is a no-op alias */
.fw-card--glass { /* alias — see .fw-card */ }

/* Every card carries an accent colour (brand by default). Status variants below override it,
   and .fw-card--hover highlights in whatever the accent is — so a danger card glows red, an
   online card glows green, a plain card glows brand. */
.fw-card { --fw-card-accent: var(--fw-brand); }

.fw-card--hover { transition: transform var(--fw-dur) ease, border-color var(--fw-dur) ease, box-shadow var(--fw-dur) ease; cursor: pointer; }
.fw-card--hover:hover {
  transform: translateY(-2px);
  border-color: var(--fw-card-accent);
  box-shadow:
    0 0 0 1px var(--fw-card-accent),
    0 8px 24px -6px color-mix(in srgb, var(--fw-card-accent) 45%, transparent),
    var(--fw-shadow-lg);
}

/* stat card */
.fw-stat-card { padding: 1.5rem 1.8rem; }
.fw-stat-card__value { font-size: 3rem; font-weight: 700; line-height: 1; color: var(--fw-text); font-variant-numeric: tabular-nums; }
.fw-stat-card__value--brand { color: var(--fw-brand-text); }
.fw-stat-card__label { margin-top: 0.4rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fw-text-muted); font-weight: 500; }

/* status variants: set the accent colour + a left edge. `--edge-*` and the short
   `--success/--warning/--danger/--info` names are equivalent aliases. Combine with
   .fw-card--hover for a status-coloured hover highlight. */
.fw-card--edge-success, .fw-card--success { --fw-card-accent: var(--fw-success); border-left: 3px solid var(--fw-success); }
.fw-card--edge-warning, .fw-card--warning { --fw-card-accent: var(--fw-warning); border-left: 3px solid var(--fw-warning); }
.fw-card--edge-danger,  .fw-card--danger  { --fw-card-accent: var(--fw-danger);  border-left: 3px solid var(--fw-danger); }
.fw-card--edge-info,    .fw-card--info     { --fw-card-accent: var(--fw-info);    border-left: 3px solid var(--fw-info); }

/* --- src/css/12-forms.css --- */
/* frikwork forms */
.fw-field { display: flex; flex-direction: column; gap: var(--fw-space-xs); margin-bottom: var(--fw-space-md); }
.fw-label { font-size: 0.75rem; font-weight: 500; color: var(--fw-text-2); }
.fw-help { font-size: 0.75rem; color: var(--fw-text-muted); }
.fw-error { font-size: 0.75rem; color: var(--fw-danger); }

.fw-input, .fw-select, .fw-textarea {
  width: 100%;
  padding: var(--fw-space-sm) var(--fw-space-md);
  font-size: 0.875rem;
  background: var(--fw-bg);
  color: var(--fw-text);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  transition: border-color var(--fw-dur-fast) ease;
}
.fw-input::placeholder, .fw-textarea::placeholder { color: var(--fw-text-muted); }
.fw-input:focus, .fw-select:focus, .fw-textarea:focus { outline: none; border-color: var(--fw-brand); }
.fw-textarea { resize: vertical; min-height: 5rem; }

.fw-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.is-invalid { border-color: var(--fw-danger) !important; }

/* toggle switch */
.fw-switch {
  appearance: none;
  position: relative;
  width: 48px; height: 24px;
  background: var(--fw-border);
  border-radius: var(--fw-radius-pill);
  cursor: pointer;
  transition: background var(--fw-dur) ease;
  flex-shrink: 0;
}
.fw-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--fw-dur) ease;
}
.fw-switch:checked { background: var(--fw-brand); }
.fw-switch:checked::after { transform: translateX(24px); }
.fw-switch--danger:checked { background: var(--fw-danger); }

/* checkbox */
.fw-checkbox { width: 1rem; height: 1rem; accent-color: var(--fw-brand); cursor: pointer; }

/* --- src/css/13-header.css --- */
/* frikwork header — frosted glass, sticky */
.fw-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fw-space-md);
  padding: var(--fw-space-md) var(--fw-space-lg);
  background: var(--fw-glass-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--fw-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* brand-tint gradient layered over the glass */
.fw-header--tint-brand {
  background:
    linear-gradient(135deg, rgba(148, 200, 62, 0.12), rgba(37, 128, 167, 0.12)),
    var(--fw-glass-bg);
  border-bottom: 2px solid var(--fw-brand);
}

/* custom tint: set --fw-header-tint to any accent color on the element */
.fw-header--tint-custom {
  --fw-header-tint: #ff9900;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--fw-header-tint) 12%, transparent), rgba(37, 128, 167, 0.12)),
    var(--fw-glass-bg);
  border-bottom: 2px solid var(--fw-header-tint);
}

/* --- src/css/14-nav.css --- */
/* frikwork nav tabs */
.fw-tabs { display: flex; gap: var(--fw-space-xs); flex-wrap: wrap; }
.fw-tab {
  padding: var(--fw-space-sm) var(--fw-space-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fw-text-muted);
  border-radius: var(--fw-radius-md);
  transition: all var(--fw-dur) ease;
}
.fw-tab:hover { background: var(--fw-bg-hover); color: var(--fw-text); }
.fw-tab.is-active { color: var(--fw-brand-text); background: rgba(148, 200, 62, 0.1); }

/* underline variant */
.fw-tabs--underline { gap: var(--fw-space-md); border-bottom: 1px solid var(--fw-border); }
.fw-tabs--underline .fw-tab { border-radius: 0; border-bottom: 2px solid transparent; background: none; padding-left: 0; padding-right: 0; }
.fw-tabs--underline .fw-tab.is-active { background: none; border-bottom-color: var(--fw-brand); }

/* panes */
.fw-tab-pane { display: none; }
.fw-tab-pane.is-active { display: block; }

/* segmented tab bar (Option B): an enclosed group with a track + optional count badges */
.fw-tabs--segmented {
  display: inline-flex;
  gap: var(--fw-space-xs);
  background: var(--fw-bg-2);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  padding: var(--fw-space-xs);
  flex-wrap: nowrap;
}
.fw-tabs--segmented .fw-tab { border-radius: var(--fw-radius-sm); }
.fw-tab__count {
  font-size: 0.72rem; font-weight: 700;
  background: var(--fw-bg-card); color: var(--fw-text-2);
  padding: 0.05em 0.5em; border-radius: var(--fw-radius-pill); margin-left: 0.4rem;
}
.fw-tab.is-active .fw-tab__count { background: rgba(148, 200, 62, 0.18); color: var(--fw-brand-text); }

/* card-tabs (Option A): a tab group styled as full cards — one active at a time. Use for
   stat/filter selectors where you want the numbers big but the behaviour of tabs. Only the
   active tab goes lively (see motion tier), because a selector isn't content. */
.fw-cardtabs { display: grid; grid-template-columns: repeat(var(--fw-cardtabs-cols, 4), 1fr); gap: var(--fw-space-md); }
.fw-cardtab {
  position: relative;
  background: var(--fw-bg-card);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-lg);
  padding: var(--fw-space-lg);
  cursor: pointer;
  transition: border-color var(--fw-dur) ease, background var(--fw-dur) ease, transform var(--fw-dur) ease;
}
.fw-cardtab:hover { border-color: var(--fw-text-muted); }
.fw-cardtab.is-active {
  border-color: var(--fw-brand);
  background: linear-gradient(135deg, rgba(148, 200, 62, 0.10), transparent 60%), var(--fw-bg-card);
}
@media (max-width: 1000px) { .fw-cardtabs { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .fw-cardtabs { grid-template-columns: 1fr; } }

/* --- src/css/15-dropdown.css --- */
/* frikwork dropdown / settings panel */
.fw-dropdown { position: relative; display: inline-block; }
.fw-dropdown__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 400;
  width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--fw-space-sm);
  background: var(--fw-bg-card);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  animation: fw-panel-in 160ms ease-out;
}
.fw-dropdown__panel[hidden] { display: none; }
.fw-dropdown__title { padding: var(--fw-space-sm); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fw-text-muted); font-weight: 600; }
.fw-dropdown__divider { height: 1px; background: var(--fw-border); margin: var(--fw-space-sm) 0; }

.fw-check-row {
  display: flex;
  align-items: center;
  gap: var(--fw-space-sm);
  padding: var(--fw-space-sm);
  border-radius: var(--fw-radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
}
.fw-check-row:hover { background: var(--fw-bg-hover); }
.fw-check-row input { accent-color: var(--fw-brand); }

@keyframes fw-panel-in {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* --- src/css/16-modal.css --- */
/* frikwork modal */
.fw-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  align-items: center;
  justify-content: center;
  padding: var(--fw-space-lg);
}
.fw-modal.is-open { display: flex; }
.fw-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); }
.fw-modal__content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--fw-bg-card);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-lg);
  box-shadow: var(--fw-shadow-lg);
  animation: fw-panel-in 200ms var(--fw-ease-settle);
}
.fw-modal__content--sm { max-width: 400px; }
.fw-modal__content--lg { max-width: 640px; }
.fw-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--fw-space-lg);
  border-bottom: 1px solid var(--fw-border);
  font-weight: 600;
}
.fw-modal__body { padding: var(--fw-space-lg); }
.fw-modal__footer {
  display: flex; gap: var(--fw-space-sm); justify-content: flex-end;
  padding: var(--fw-space-lg);
  border-top: 1px solid var(--fw-border);
}
.fw-modal__close {
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fw-text-muted);
  border-radius: var(--fw-radius-sm);
  font-size: 1.25rem; line-height: 1;
}
.fw-modal__close:hover { background: var(--fw-bg-hover); color: var(--fw-text); }

/* --- src/css/17-toast.css --- */
/* frikwork toast */
.fw-toast-stack {
  position: fixed;
  top: var(--fw-space-lg);
  right: var(--fw-space-lg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--fw-space-sm);
  max-width: 420px;
}
.fw-toast {
  padding: var(--fw-space-md);
  background: var(--fw-bg-card);
  border: 1px solid var(--fw-border);
  border-left: 4px solid var(--fw-info);
  border-radius: var(--fw-radius-md);
  color: var(--fw-text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: fw-toast-in 300ms ease-out;
  cursor: pointer;
}
.fw-toast--success { border-left-color: var(--fw-success); }
.fw-toast--warning { border-left-color: var(--fw-warning); }
.fw-toast--danger  { border-left-color: var(--fw-danger); }
.fw-toast--info    { border-left-color: var(--fw-info); }
.fw-toast.is-leaving { animation: fw-toast-out 400ms ease forwards; }

@keyframes fw-toast-in {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fw-toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(30px); opacity: 0; }
}

/* --- src/css/18-badges.css --- */
/* frikwork badges */
.fw-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--fw-space-xs);
  padding: 0.2em 0.6em;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--fw-radius-pill);
  background: var(--fw-bg-hover);
  color: var(--fw-text-2);
}
.fw-badge--primary { background: rgba(148, 200, 62, 0.12); color: var(--fw-brand-text); }
.fw-badge--success { background: rgba(148, 200, 62, 0.12); color: var(--fw-success); }
.fw-badge--warning { background: rgba(245, 158, 11, 0.12); color: var(--fw-warning); }
.fw-badge--danger  { background: rgba(239, 68, 68, 0.12); color: var(--fw-danger); }
.fw-badge--info    { background: rgba(59, 130, 246, 0.12); color: var(--fw-info); }

.fw-badge--dot::before {
  content: '';
  width: 0.5em; height: 0.5em;
  border-radius: 50%;
  background: currentColor;
}

/* severity chips */
.fw-sev--critical { background: rgba(255, 56, 96, 0.14); color: var(--fw-sev-critical); }
.fw-sev--high     { background: rgba(255, 120, 73, 0.14); color: var(--fw-sev-high); }
.fw-sev--medium   { background: rgba(245, 158, 11, 0.14); color: var(--fw-sev-medium); }
.fw-sev--low      { background: rgba(59, 130, 246, 0.14); color: var(--fw-sev-low); }

/* --- src/css/19-table.css --- */
/* frikwork table */
.fw-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.fw-table th {
  text-align: left;
  padding: var(--fw-space-sm) var(--fw-space-md);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fw-text-muted);
  border-bottom: 1px solid var(--fw-border);
}
.fw-table td { padding: var(--fw-space-sm) var(--fw-space-md); border-bottom: 1px solid var(--fw-border); color: var(--fw-text-2); }
.fw-table tbody tr { transition: background var(--fw-dur-fast) ease; }
.fw-table tbody tr:hover { background: var(--fw-bg-hover); }
.fw-table--sticky th { position: sticky; top: 0; background: var(--fw-bg-2); z-index: 1; }

/* --- src/css/20-accordion.css --- */
/* frikwork accordion — native <details> */
.fw-accordion {
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  overflow: hidden;
}
.fw-accordion + .fw-accordion { margin-top: var(--fw-space-sm); }
.fw-accordion > summary {
  display: flex;
  align-items: center;
  gap: var(--fw-space-sm);
  padding: var(--fw-space-md);
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.fw-accordion > summary::-webkit-details-marker { display: none; }
.fw-accordion__caret {
  transition: transform var(--fw-dur) ease;
  color: var(--fw-text-muted);
}
.fw-accordion[open] > summary .fw-accordion__caret { transform: rotate(90deg); }
.fw-accordion[open] { border-color: var(--fw-brand); }
.fw-accordion__body { padding: 0 var(--fw-space-md) var(--fw-space-md); color: var(--fw-text-2); }

/* --- src/css/21-progress.css --- */
/* frikwork progress + spinner */
.fw-meter {
  width: 100%;
  height: 6px;
  background: var(--fw-bg-hover);
  border-radius: var(--fw-radius-pill);
  overflow: hidden;
}
.fw-meter__fill {
  height: 100%;
  width: 0;
  background: var(--fw-success);
  border-radius: inherit;
  transition: width var(--fw-dur-slow) ease;
}
.fw-meter__fill--warn { background: var(--fw-warning); }
.fw-meter__fill--critical { background: var(--fw-danger); }

.fw-spinner {
  display: inline-block;
  width: 1.25rem; height: 1.25rem;
  border: 2px solid var(--fw-border);
  border-top-color: var(--fw-brand);
  border-radius: 50%;
  animation: fw-spin 0.7s linear infinite;
}
@keyframes fw-spin { to { transform: rotate(360deg); } }

/* --- src/css/22-tooltip.css --- */
/* frikwork tooltip — JS positions it at the cursor */
.fw-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  padding: var(--fw-space-xs) var(--fw-space-sm);
  background: var(--fw-bg-2);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-sm);
  color: var(--fw-text);
  font-size: 0.76rem;
  box-shadow: var(--fw-shadow-md);
  opacity: 0;
  transition: opacity var(--fw-dur-fast) ease;
}
.fw-tooltip.is-visible { opacity: 1; }

/* --- src/css/23-footer.css --- */
/* frikwork footer */
.fw-footer {
  margin-top: auto;   /* inside a .fw-page flex column, pins the footer to the viewport bottom */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fw-space-md);
  padding: var(--fw-space-md) var(--fw-space-lg);
  border-top: 1px solid var(--fw-border);
  color: var(--fw-text-muted);
  font-size: 0.8rem;
}
.fw-build-tag { cursor: help; font-size: 0.65rem; color: var(--fw-text-muted); }

/* --- src/css/24-misc.css --- */
/* frikwork misc */
.fw-empty {
  text-align: center;
  padding: var(--fw-space-xl);
  color: var(--fw-text-muted);
}
.fw-divider { height: 1px; background: var(--fw-border); border: none; margin: var(--fw-space-md) 0; }

.fw-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--fw-brand); }
.fw-dot--pulse { box-shadow: 0 0 10px rgba(148, 200, 62, 0.6); animation: fw-pulse 2s ease-in-out infinite; }

@keyframes fw-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- src/css/90-motion.css --- */
/* frikwork LIVELY motion tier.
   Opt in by adding data-fw-motion="lively" to any ancestor (usually <html>): every
   .fw-card inside then gains a breathing glow, a rotating border ring, and a drop-in
   entrance. The same effects are also available as explicit per-element modifiers
   (.fw-card--breathe, .fw-card--ring, .fw-anim-drop) when you want one without the
   global toggle. */

/* ---- breathing inner/outer brand glow ---- */
.fw-card--breathe { animation: fw-breathe 7s ease-in-out infinite; }

@keyframes fw-breathe {
  0%, 100% { box-shadow: var(--fw-shadow-glass); }
  50% {
    box-shadow:
      0 8px 40px var(--fw-glass-shadow),
      0 0 32px rgba(148, 200, 62, 0.22),
      inset 0 0 28px rgba(148, 200, 62, 0.07);
  }
}

/* ---- lively cards: breathe AND drop in ----
   Combined into one animation list so both run. The drop uses `backwards` fill so that
   AFTER it lands the card reverts to its natural resting state (transform: none) — this
   is what keeps :hover lift working. `backwards` also holds the start frame during the
   stagger delay so waiting cards stay hidden instead of flashing. */
/* Ambient: lively cards breathe (continuous). This is safe to re-apply on AJAX re-renders. */
[data-fw-motion="lively"] .fw-card { animation: fw-breathe 7s ease-in-out infinite; }

/* Entrance drop: fires ONLY inside a [data-fw-entrance] region, so it plays on page load —
   not on every AJAX re-render (remove the attribute after the first render). Breathe + drop
   are one animation list so both run. The drop is reverse-staggered via --fw-drop-i (0 = drops
   first) so a grid fills LAST-to-FIRST / bottom-to-top: set --fw-drop-i inline per card =
   (count - 1 - index) for dynamic grids, or lean on the nth-last-child fallback below for
   small static grids. --fw-drop-step tunes the gap (default 40ms; lower it for dense grids). */
[data-fw-motion="lively"] [data-fw-entrance] .fw-card {
  animation:
    fw-breathe 7s ease-in-out infinite,
    fw-drop 1.05s var(--fw-ease-settle) backwards;
  animation-delay: 0s, calc(var(--fw-drop-i, 0) * var(--fw-drop-step, 40ms));
}
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(1) { --fw-drop-i: 0; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(2) { --fw-drop-i: 1; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(3) { --fw-drop-i: 2; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(4) { --fw-drop-i: 3; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(5) { --fw-drop-i: 4; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(6) { --fw-drop-i: 5; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(7) { --fw-drop-i: 6; }
[data-fw-motion="lively"] [data-fw-entrance] .fw-card:nth-last-child(8) { --fw-drop-i: 7; }

/* explicit one-shot drop opt-in (backwards fill; honours --fw-drop-i for staggering) */
.fw-anim-drop {
  animation: fw-drop 1.05s var(--fw-ease-settle) backwards;
  animation-delay: calc(var(--fw-drop-i, 0) * var(--fw-drop-step, 40ms));
}

@keyframes fw-drop {
  0%   { opacity: 0; transform: translateY(-170px) scale(0.9) rotate(0deg); }
  42%  { opacity: 1; transform: translateY(0) scale(1.05, 0.9) rotate(0deg); }
  55%  { transform: translateY(-9px) scale(0.97, 1.05) rotate(-2.5deg); }
  66%  { transform: translateY(3px) scale(1.02, 0.98) rotate(2deg); }
  76%  { transform: translateY(-3px) scale(1, 1.01) rotate(-1.2deg); }
  86%  { transform: translateY(1px) rotate(0.7deg); }
  100% { transform: translateY(0) scale(1) rotate(0deg); }
}

/* ---- rotating conic-gradient border ring ----
   A center-emanating conic gradient maps its angular span onto a rectangle's
   perimeter unevenly, so a single thin highlight visibly compresses on the short
   edges and stretches on the long ones (badly on wide cards). Fix: TWO broad, soft
   lobes 180deg apart with gentle alpha ramps (no sharp edge to track), so the glow
   reads as an even travelling sheen rather than a lurching dot. Two lobes also make
   the pattern repeat every half-turn, so it feels ~2x livelier at the same speed. */
.fw-card--ring::before,
[data-fw-motion="lively"] .fw-card::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--fw-card-angle),
    transparent 0deg,
    rgba(148, 200, 62, 0.90) 50deg,
    rgba(58, 170, 190, 0.55) 90deg,
    transparent 140deg,
    transparent 180deg,
    rgba(148, 200, 62, 0.90) 230deg,
    rgba(58, 170, 190, 0.55) 270deg,
    transparent 320deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: fw-border-glow 8s linear infinite;
  pointer-events: none;
}
@keyframes fw-border-glow { to { --fw-card-angle: 360deg; } }
/* desynchronize adjacent rings so they don't travel in lockstep (uneven offsets < 8s) */
[data-fw-motion="lively"] .fw-card:nth-child(1)::before, .fw-card--ring:nth-child(1)::before { animation-delay: -1.6s; }
[data-fw-motion="lively"] .fw-card:nth-child(2)::before, .fw-card--ring:nth-child(2)::before { animation-delay: -5.2s; }
[data-fw-motion="lively"] .fw-card:nth-child(3)::before, .fw-card--ring:nth-child(3)::before { animation-delay: -0.9s; }
[data-fw-motion="lively"] .fw-card:nth-child(4)::before, .fw-card--ring:nth-child(4)::before { animation-delay: -3.7s; }

/* ---- active tab: subtle breathing glow in lively mode ----
   A gentle glow (no rotating ring) so it reads as "alive" at any tab size without the
   busy look a ring gives on a small pill. */
[data-fw-motion="lively"] .fw-tab.is-active { animation: fw-tab-glow 4s ease-in-out infinite; }
@keyframes fw-tab-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(148, 200, 62, 0); }
  50%      { box-shadow: 0 0 14px -2px rgba(148, 200, 62, 0.5); }
}

/* ---- card-tabs: only the ACTIVE tab goes lively (a selector, not content) ---- */
[data-fw-motion="lively"] .fw-cardtab.is-active { animation: fw-breathe 7s ease-in-out infinite; }
[data-fw-motion="lively"] .fw-cardtab.is-active::before {
  content: ''; position: absolute; inset: 0; padding: 1.5px; border-radius: inherit;
  background: conic-gradient(from var(--fw-card-angle),
    transparent 0deg, rgba(148, 200, 62, 0.9) 50deg, rgba(58, 170, 190, 0.55) 90deg, transparent 140deg,
    transparent 180deg, rgba(148, 200, 62, 0.9) 230deg, rgba(58, 170, 190, 0.55) 270deg, transparent 320deg, transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask-composite: exclude;
  animation: fw-border-glow 8s linear infinite; pointer-events: none;
}

/* ---- idle "still here" wobble (explicit opt-in) ---- */
.fw-anim-wobble { animation: fw-settle-wobble 1.4s var(--fw-ease-settle); }
@keyframes fw-settle-wobble {
  0%       { transform: translateY(0) scale(1) rotate(0deg); }
  9%       { transform: translateY(-9px) scale(0.97, 1.05) rotate(-2.5deg); }
  19%      { transform: translateY(3px) scale(1.02, 0.98) rotate(2deg); }
  29%      { transform: translateY(-3px) scale(1, 1.01) rotate(-1.2deg); }
  37%      { transform: translateY(1px) rotate(0.7deg); }
  45%, 100%{ transform: translateY(0) scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  [data-fw-motion="lively"] .fw-card,
  [data-fw-motion="lively"] .fw-card::before,
  [data-fw-motion="lively"] .fw-tab.is-active,
  [data-fw-motion="lively"] .fw-cardtab.is-active,
  [data-fw-motion="lively"] .fw-cardtab.is-active::before,
  .fw-card--breathe,
  .fw-card--ring::before,
  .fw-anim-drop,
  .fw-anim-wobble {
    animation: none !important;
  }
}
