/* Warehouse Plan — base CSS.
 *
 * THEMING: the entire `ink` palette is exposed as CSS variables. Default = dark
 * (current look). Setting `data-theme="light"` on <html> swaps every shade so
 * every existing Tailwind class (bg-ink-950, text-ink-100, etc.) flips at once
 * without touching any markup. SVG plan colours are also pulled from the same
 * variables via CSS rules further down.
 */
/* Dark = both `:root` (no attribute yet) and `[data-theme="dark"]` (explicit).
   Light = `[data-theme="light"]` overrides everything. The toggle script ALWAYS
   sets `data-theme` explicitly so both branches always pick the right values. */
:root,
html[data-theme="dark"] {
  --ink-50:  #F8FAFC;
  --ink-100: #F1F5F9;
  --ink-200: #E2E8F0;
  --ink-300: #CBD5E1;
  --ink-400: #94A3B8;
  --ink-500: #64748B;
  --ink-600: #475569;
  --ink-700: #334155;
  --ink-800: #1E293B;
  --ink-900: #0F172A;
  --ink-950: #020617;

  --plan-bg:        #020617;
  --plan-wall:      #F8FAFC;
  --plan-grid-fine: #1E293B;
  --plan-grid-major:#334155;
  --plan-room-stroke:#475569;
  --plan-room-fill: #334155;
  --plan-label:     #94A3B8;
}

html[data-theme="light"] {
  /* LIGHT theme — inverted with a few tweaks so contrast stays readable.
     Primary background is white, primary text is near-black, borders are slate-200. */
  --ink-50:  #0F172A;   /* primary text  → near-black */
  --ink-100: #1E293B;   /* secondary text → dark slate */
  --ink-200: #334155;   /* tertiary text */
  --ink-300: #475569;
  --ink-400: #64748B;   /* mid-grey labels */
  --ink-500: #94A3B8;
  --ink-600: #CBD5E1;
  --ink-700: #E2E8F0;   /* input borders */
  --ink-800: #F1F5F9;   /* section borders / hover */
  --ink-900: #FFFFFF;   /* panels / cards */
  --ink-950: #F8FAFC;   /* page background */

  --plan-bg:        #F8FAFC;
  --plan-wall:      #0F172A;
  --plan-grid-fine: #E2E8F0;
  --plan-grid-major:#CBD5E1;
  --plan-room-stroke:#CBD5E1;
  --plan-room-fill: #F1F5F9;
  --plan-label:     #475569;
}

/* Make the html background follow the theme so there's no flash. */
html { background: var(--ink-950); }

[x-cloak] { display: none !important; }

html, body { height: 100%; margin: 0; }

#plan-svg { background-color: var(--plan-bg); }

/* SVG fills/strokes — CSS rules win over the inline fill/stroke attributes,
   so the plan flips theme with the page. */
#plan-svg .plan-bg                 { fill: var(--plan-bg); }
#plan-svg .plan-wall-stroke        { stroke: var(--plan-wall); }
#plan-svg pattern#grid-fine path   { stroke: var(--plan-grid-fine); }
#plan-svg pattern#grid-major path  { stroke: var(--plan-grid-major); }
#plan-svg .zone-room rect          { fill: var(--plan-room-fill); stroke: var(--plan-room-stroke); }
#plan-svg .zone-room text          { fill: var(--plan-label); }

/* No text selection while drawing/calibrating. */
.zone-line text, .zone-room text { user-select: none; }

@media (max-width: 640px) {
  aside { width: 100% !important; }
}

aside::-webkit-scrollbar { width: 8px; }
aside::-webkit-scrollbar-thumb { background: var(--ink-700); border-radius: 4px; }
aside::-webkit-scrollbar-track { background: var(--ink-900); }

/* Theme-toggle icon transitions. */
.theme-toggle svg { transition: transform 200ms ease; }
.theme-toggle:hover svg { transform: rotate(15deg); }
