/* surfaçd — theme.css
 * Design system unifié. Inclus par tous les HTML.
 * Terminal minimaliste : bordures fines, blur, 4 accents, dark/light.
 */

/* ═══ TOKENS ═══ */

:root, [data-theme="dark"] {
  --bg: #000;
  --bg-solid: #0a0a0a;
  --surface: rgba(0,0,0,0.5);
  --surface-solid: #111;
  --border: #333;
  --border-hover: #555;
  --text: #b0b0b0;
  --text-dim: #666;
  --text-bright: #fff;
  --accent-1: #5fd4d4; /* turquoise */
  --accent-2: #d45f5f; /* rouge */
  --accent-3: #9b59b6; /* violet */
  --accent-4: #d4c35f; /* jaune */
  --grid-line: rgba(255,255,255,0.39);
  --grid-w: 12px; /* SF Mono character width */
  --grid-h: 20px; /* SF Mono line height */
  --overlay: rgba(0,0,0,0.6);
}

[data-theme="light"] {
  --bg: #fff;
  --bg-solid: #f5f5f5;
  --surface: rgba(255,255,255,0.5);
  --surface-solid: #eee;
  --border: #ccc;
  --border-hover: #999;
  --text: #333;
  --text-dim: #999;
  --text-bright: #000;
  --accent-1: #2ba5a5;
  --accent-2: #c0392b;
  --accent-3: #8e44ad;
  --accent-4: #b8960f;
  --grid-line: rgba(0,0,0,0.39);
  --grid-w: 12px;
  --grid-h: 20px;
  --overlay: rgba(255,255,255,0.6);
}

/* ═══ BASE ═══ */

* { margin:0; padding:0; box-sizing:border-box; }

html { height:100%; }

body {
  height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:ui-monospace, 'SF Mono', monospace;
  -webkit-font-smoothing:none;
  transition:background 0.2s, color 0.2s;
}

/* ═══ SHARED COMPONENT STYLES ═══ */

/* Glass panel (backdrop blur + border) */
.glass {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:4px;
  -webkit-backdrop-filter:blur(16px);
  backdrop-filter:blur(16px);
}

/* Interactive button base */
.btn {
  background:var(--surface);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:4px;
  -webkit-backdrop-filter:blur(16px);
  backdrop-filter:blur(16px);
  font-family:ui-monospace, 'SF Mono', monospace;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
  touch-action:none;
  -webkit-tap-highlight-color:transparent;
  transition:border-color 0.1s, color 0.1s;
}
.btn:active { border-color:var(--border-hover); color:var(--text-bright); }
.btn.active { color:var(--accent-1); border-color:var(--accent-1); }

/* Grid background (Excalidraw style) */
.grid-bg {
  background:var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size:24px 24px;
}

/* Modal overlay */
.modal-backdrop {
  position:fixed; top:0; left:0; width:100%; height:100%;
  background:var(--overlay);
  opacity:0; pointer-events:none;
  transition:opacity 0.25s ease;
}
.modal-backdrop.open { opacity:1; pointer-events:auto; }

/* Label / tag style */
.label {
  font-size:10px;
  letter-spacing:1.5px;
  text-transform:uppercase;
  color:var(--text-dim);
}

/* ═══ THEME TOGGLE HELPER ═══ */

/* Auto-detect system preference if no manual override */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fff;
    --bg-solid: #f5f5f5;
    --surface: rgba(255,255,255,0.5);
    --surface-solid: #eee;
    --border: #ccc;
    --border-hover: #999;
    --text: #333;
    --text-dim: #999;
    --text-bright: #000;
    --accent-1: #2ba5a5;
    --accent-2: #c0392b;
    --accent-3: #8e44ad;
    --accent-4: #b8960f;
    --grid-line: rgba(0,0,0,0.39);
    --overlay: rgba(255,255,255,0.6);
  }
}
