/* shared.css: theme tokens and shared idioms for every Synion view.
   Same token vocabulary as the sibling trading apps so components port between them unchanged;
   Synion's identity is the violet accent. */
/* ── PSYCHO (default) ──────────────────────────────────────────────────────
   Black, white and one crimson. Hard edges, hard cuts, title-card type (owner, 2026-09-10: "a Psycho
   (Hitchcock) style… and maybe a Barbie as alternative; those styles take the place of Dark and Light").
   The token NAMES are the platform's: every component keeps working under both themes. */
:root {
  --color-bg-primary: #000000;
  --color-bg-secondary: #0a0a0a;
  --color-bg-tertiary: #161616;
  /* The page canvas every view sits on. */
  --color-canvas: #000000;
  /* Lines are drawn, not implied: a hairline on black reads at 30 % white, a card's edge at 45 %. */
  --color-border: #4d4d4d;
  --color-border-light: #5c5c5c;
  --color-text-primary: #ffffff;
  --color-text-secondary: #cfcfcf;
  --color-text-muted: #9c9c9c;
  --color-accent: #e10600;
  --color-accent-hover: #ff2a1f;
  /* Status in a black-and-white world: ready is white, waiting is grey, failed is the crimson. */
  --color-success: #ffffff;
  --color-success-bg: rgba(255,255,255,0.12);
  --color-warning: #b5b5b5;
  --color-danger: #e10600;
  --color-danger-bg: rgba(225,6,0,0.16);

  /* Adaptive text opacity scale (use instead of rgba(255,255,255,N)) */
  --color-text-hi:   rgba(255,255,255,0.96);
  --color-text-med:  rgba(255,255,255,0.8);
  --color-text-lo:   rgba(255,255,255,0.62);
  --color-text-xlo:  rgba(255,255,255,0.3);

  /* Adaptive surface tints (use instead of rgba(255,255,255,0.0N) backgrounds) */
  --color-surface-hover:  rgba(255,255,255,0.12);
  --color-surface-tint:   rgba(255,255,255,0.06);
  --color-surface-subtle: rgba(255,255,255,0.14);

  /* Modals / overlays */
  --color-modal-bg:      #070707;
  --color-modal-border:  rgba(255,255,255,0.22);
  --color-backdrop:      rgba(0,0,0,0.8);

  /* component-level vars */
  --color-row-active-bg:    rgba(225,6,0,0.18);
  --color-row-active-border: #e10600;
  --color-row-hover-bg:     rgba(255,255,255,0.1);
  --color-logo-text: #ffffff;
  --color-btn-ghost-bg: transparent;
  --color-btn-ghost-bg-hover: #1a1a1a;
  --color-btn-ghost-border: #5c5c5c;
  --color-btn-ghost-border-hover: #ffffff;
  --color-btn-ghost-text: #b8b8b8;
  --color-btn-ghost-text-hover: #ffffff;
  --color-btn-action-bg: #1a1a1a;
  --color-btn-action-border: #2a2a2a;
  --color-btn-action-bg-hover: #242424;
  --color-input-bg: #000000;
  --color-input-border: #6b6b6b;
  --color-input-text: #ffffff;
  /* Cards read as an elevation step above BOTH page backgrounds. */
  --color-card-bg: #101010;
  --color-card-border: #737373;
  --color-overlay-bg: rgba(0, 0, 0, 0.8);

  /* Type: title cards in a condensed grotesque, body in a neutral sans, timecodes in a mono. */
  --font-display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-transform: uppercase;
  --display-tracking: 0.03em;
  --display-weight: 400;
  /* Shape: none. Every edge is a cut. */
  --radius-card: 0;
  --radius-btn: 0;
  --radius-chip: 0;
  --radius-input: 0;
  --shadow-card: none;
  /* Motion: a hard cut (0.1 s, no easing) — never a fade. */
  --cut: 0.1s steps(1, end);
  --cut-bg: #ffffff;
  --cut-fg: #000000;
  /* The film strip's stock. */
  --film: #ffffff;
  /* A script page: paper in the black margins of the set. */
  --page-bg: #f4f1e8;
  --page-fg: #111111;
  --page-rule: #c9c3b4;
  /* The poster shadow a pressed button throws (the hover): a hard offset, never a blur. */
  --btn-shadow-hover: 8px 8px 0 #ffffff;
  --btn-shift-hover: translate(-2px, -2px);

  font-family: var(--font-body);
  line-height: 1.5;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── BARBIE ────────────────────────────────────────────────────────────────
   Pink on pink, round everything, soft shadows, rounded type. Same token names. */
:root[data-theme="barbie"] {
  --color-bg-primary: #fff0f7;
  --color-bg-secondary: #ffffff;
  --color-bg-tertiary: #ffd6ea;
  --color-canvas: #fff0f7;
  --color-border: #f6bcd8;
  --color-border-light: #fbd9ea;
  --color-text-primary: #3d0a2a;
  --color-text-secondary: #7a2a58;
  --color-text-muted: #b06a92;
  --color-accent: #e0218a;
  --color-accent-hover: #c2186f;
  --color-success: #17a673;
  --color-success-bg: rgba(23,166,115,0.12);
  --color-warning: #f2a30f;
  --color-danger: #d7263d;
  --color-danger-bg: rgba(215,38,61,0.1);

  --color-text-hi:   #3d0a2a;
  --color-text-med:  #7a2a58;
  --color-text-lo:   #b06a92;
  --color-text-xlo:  #e2b6cf;

  --color-surface-hover:  #ffe1ef;
  --color-surface-tint:   #fff7fb;
  --color-surface-subtle: #ffd6ea;

  --color-modal-bg:     #ffffff;
  --color-modal-border: #f6bcd8;
  --color-backdrop:     rgba(61,10,42,0.45);

  --color-row-active-bg:    #ffd6ea;
  --color-row-active-border: #e0218a;
  --color-row-hover-bg:     #fff0f7;

  --color-logo-text: #3d0a2a;
  --color-btn-ghost-bg: transparent;
  --color-btn-ghost-bg-hover: #ffe1ef;
  --color-btn-ghost-border: #f6bcd8;
  --color-btn-ghost-border-hover: #e0218a;
  --color-btn-ghost-text: #7a2a58;
  --color-btn-ghost-text-hover: #3d0a2a;
  --color-btn-action-bg: #ffe1ef;
  --color-btn-action-border: #f6bcd8;
  --color-btn-action-bg-hover: #ffd6ea;
  --color-input-bg: #ffffff;
  --color-input-border: #f6bcd8;
  --color-input-text: #3d0a2a;
  --color-card-bg: #ffffff;
  --color-card-border: #f6bcd8;
  --color-overlay-bg: rgba(61,10,42,0.4);

  --font-display: 'Fredoka', 'Nunito', 'Segoe UI', sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display-transform: none;
  --display-tracking: 0;
  --display-weight: 600;
  --radius-card: 18px;
  --radius-btn: 999px;
  --radius-chip: 999px;
  --radius-input: 12px;
  --shadow-card: 0 6px 24px rgba(224,33,138,0.12);
  --cut: 0.2s ease;
  --cut-bg: #e0218a;
  --cut-fg: #ffffff;
  --film: #e0218a;
  --page-bg: #ffffff;
  --page-fg: #3d0a2a;
  --page-rule: #f6bcd8;
  --btn-shadow-hover: 6px 6px 0 #ffb3d5;
  --btn-shift-hover: translate(-2px, -2px);
}

html, body {
  font-family: var(--font-body);
  line-height: inherit;
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
}

/* Title cards: every heading is set in the display face of the theme. */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  text-transform: var(--display-transform);
  letter-spacing: var(--display-tracking);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-accent-hover);
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* ── Shared card idioms ─────────────────────────────────────────────────────
   One implementation for the small furniture every card uses: chips, status
   dots and lines, warning callouts, inline spinners, icon buttons. Pages must
   use these instead of redeclaring per-page copies — scoped styles carry only
   layout, never colors. All values are theme tokens, correct in both themes. */

/* Small uppercase label chip. */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-row-active-bg);
  border: 1px solid var(--color-row-active-border);
  color: var(--color-accent);
}

/* Neutral chip variant — informational tags with no accent meaning. */
.chip.neutral {
  background: var(--color-surface-subtle);
  border-color: var(--color-border);
  color: var(--color-text-med);
}

/* A module key (describe-asset): a handle the agent names assets by, shown verbatim — never uppercased. */
.chip.key {
  text-transform: none;
  letter-spacing: 0;
}

/* A tag (describe-asset, Synion.Docs#27): a word to find an asset by, as written after a hash, so it never reads as its name. */
.chip.tag {
  text-transform: none;
  letter-spacing: 0;
}
.chip.tag::before {
  content: '#';
  opacity: 0.6;
}

/* Status dot — neutral by default, .success for active/healthy, .warning for in-progress. */
.status-dot {
  display: inline-flex;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-lo);
  flex-shrink: 0;
}

.status-dot.success { background: var(--color-success); }
.status-dot.warning { background: var(--color-warning); }
.status-dot.danger { background: var(--color-danger); }

/* Inline status text, pairs with .status-dot. */
.status-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-line.success { color: var(--color-success); }
.status-line.warning { color: var(--color-warning); }
.status-line.danger { color: var(--color-danger); }

/* Ghost — the file is gone and the record is not. Hollow rather than coloured: it is not a state the studio is
   working through, and not a failure either; it is a thing that used to be here. */
.status-dot.ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--color-text-lo);
}
.status-line.ghost { color: var(--color-text-lo); }

/* The row it belongs to reads back, without hiding what it says. */
.ghost-row { opacity: 0.72; }

/* Expiry badge — what the studio is going to reclaim, and when. Quiet while there is time; plain once there is not. */
.expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-text-med);
  font-size: 0.72rem;
  white-space: nowrap;
}
.expiry-badge.expired {
  border-color: var(--color-text-lo);
  color: var(--color-text-lo);
  font-style: italic;
}

/* Warning callout — irreversible-action notices. */
.callout-warning {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(234, 179, 8, 0.07);
  border: 1px solid rgba(234, 179, 8, 0.28);
  border-radius: 7px;
  padding: 0.75rem 1rem;
}

.callout-warning .callout-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-warning);
}

/* Inline spinner for in-flight button/row states. */
.spinner-inline {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin-inline 0.7s linear infinite;
}

@keyframes spin-inline {
  to { transform: rotate(360deg); }
}

/* Borderless icon button (copy, dismiss, …). */
.icon-btn {
  background: none;
  border: none;
  color: var(--color-text-lo);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  color: var(--color-text-med);
  background: var(--color-surface-subtle);
}

/* Primary / secondary buttons — the two button shapes every page uses. */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  text-transform: var(--display-transform);
  letter-spacing: var(--display-tracking);
  border: 1px solid var(--color-accent);
  background: var(--color-accent);
  color: #ffffff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--cut), border-color var(--cut), opacity var(--cut), box-shadow var(--cut), transform var(--cut);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: var(--btn-shadow-hover);
  transform: var(--btn-shift-hover);
}
/* A button that is an <a>: the global a:hover (accent text) must not paint its label in its own background. */
a.btn-primary,
a.btn-primary:hover {
  color: #ffffff;
}
a.btn-secondary,
a.btn-secondary:hover {
  color: var(--color-text-hi);
}
.btn-primary:active:not(:disabled) {
  box-shadow: none;
  transform: none;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  text-transform: var(--display-transform);
  letter-spacing: var(--display-tracking);
  border: 1px solid var(--color-border);
  background: var(--color-surface-tint);
  color: var(--color-text-hi);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--cut), border-color var(--cut), box-shadow var(--cut), transform var(--cut);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
  box-shadow: var(--btn-shadow-hover);
  transform: var(--btn-shift-hover);
}
.btn-secondary:active:not(:disabled) {
  box-shadow: none;
  transform: none;
}

/* Code sample block — config snippets, script previews. */
.code-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface-tint);
  overflow: hidden;
}

.code-block .code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-lo);
}

.code-block pre {
  margin: 0;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--color-text-primary);
}

/* Segmented control — in-page tab switch. Pair with role="tablist"/role="tab". */
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--color-border);
  background: var(--color-surface-tint);
}

.segmented-btn {
  flex: 1;
  padding: 7px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-lo);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented-btn:hover { color: var(--color-text-hi); }

.segmented-btn.active {
  background: var(--color-surface-subtle);
  color: var(--color-text-hi);
}

/* Form fields — one input idiom for every form. */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-med);
}

.field input,
.field textarea,
.field select {
  font: inherit;
  /* 16px on the phone: anything smaller makes iOS zoom the page on focus. */
  font-size: 16px;
  padding: 9px 12px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  box-sizing: border-box;
  width: 100%;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-row-active-bg);
}

.field .hint {
  font-size: 0.72rem;
  color: var(--color-text-lo);
}

@media (min-width: 768px) {
  .field input,
  .field textarea,
  .field select {
    font-size: 0.9rem;
  }
}

/* ── Film-making furniture ─────────────────────────────────────────────────
   The studio makes video: its pages carry a little of the set. Theme-neutral: every value is a token. */

/* A strip of film stock with its sprocket holes — a divider between acts. */
.film-strip {
  position: relative;
  height: 26px;
  width: 100%;
  background: var(--film);
  flex-shrink: 0;
}
.film-strip::before,
.film-strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 8px, var(--color-canvas) 8px 18px, transparent 18px 24px);
}
.film-strip::before { top: 4px; }
.film-strip::after { bottom: 4px; }

/* A slate: the clapperboard's label — SCENE 01, TAKE 2 — in the mono face with the board's stripes before it. */
.slate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-med);
  white-space: nowrap;
}
.slate::before {
  content: '';
  width: 16px;
  height: 10px;
  flex-shrink: 0;
  background: repeating-linear-gradient(135deg, var(--color-text-hi) 0 3px, transparent 3px 6px);
}

/* A timecode: dates and durations set like the counter on a deck. */
.tc {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* The hard cut: a hover that swaps, never fades (Psycho); Barbie eases into its accent instead. */
.hard-cut {
  transition: background var(--cut), color var(--cut), border-color var(--cut);
}
.hard-cut:hover {
  background: var(--cut-bg);
  color: var(--cut-fg);
  border-color: var(--cut-bg);
}
.hard-cut:hover * {
  color: inherit;
}
