/* ==========================================================================
   Gruen's Grimoire — Design System
   Replaces Tailwind CDN (~3MB) with a lightweight semantic CSS (~6KB)
   ========================================================================== */

/* --- Design Tokens --- */
:root {
  --bg-primary: #111827;
  --bg-surface: #1f2937;
  --bg-surface-2: #374151;
  --bg-surface-3: #4b5563;
  --bg-input: #1f2937;
  --border: #374151;
  --border-light: #4b5563;
  --border-focus: #fbbf24;
  --text-primary: #e5e7eb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --accent-cyan: #22d3ee;
  --accent-cyan-hover: #06b6d4;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f97316;
  --info: #3b82f6;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --shadow: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.35);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  margin: 0; padding: 0;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }
svg { display: inline-block; }

/* --- Typography --- */
.text-accent { color: var(--accent); }
.text-cyan { color: var(--accent-cyan); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.italic { font-style: italic; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-x-1 > * + * { margin-left: 0.25rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }

/* --- Spacing Utilities --- */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }

/* --- Display --- */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-0 { min-height: 0; }
.min-w-0 { min-width: 0; }
.whitespace-nowrap { white-space: nowrap; }
.object-contain { object-fit: contain; }
.aspect-video { aspect-ratio: 16 / 9; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Transition Utilities --- */
.transition { transition: all 0.2s ease; }
.transition-colors { transition: background 0.2s, color 0.2s, border-color 0.2s; }
.transition-transform { transition: transform 0.2s; }
.transition-shadow { transition: box-shadow 0.2s; }
.duration-300 { transition-duration: 0.3s; }
.ease-in-out { transition-timing-function: ease-in-out; }

/* --- Nav --- */
.nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 1rem;
  display: flex; align-items: center;
  height: 4rem; gap: 0.75rem;
}
.nav-logo-link { display: flex; align-items: center; flex-shrink: 0; }
.nav-logo { width: 4rem; height: 4rem; transition: transform 0.3s; }
.nav-logo:hover { transform: scale(1.1); }
.nav-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--accent); margin-left: 0.5rem; white-space: nowrap;
}
.nav-links { margin-left: auto; display: flex; gap: 0.25rem; }
.nav-links a {
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover { background: var(--bg-surface-2); color: white; text-decoration: none; }
.nav-links a.active { background: var(--bg-surface-2); color: var(--accent); }

/* --- Cards / Surfaces --- */
.surface { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.surface-sm { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); }
.surface-2 { background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l-4 { border-left-width: 4px; border-left-style: solid; }
.border-l-4.border-accent { border-left-color: var(--accent); }
.border-l-4.border-cyan { border-left-color: var(--accent-cyan); }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1rem; border: none;
  border-radius: var(--radius); font-weight: 700;
  font-size: 0.875rem; cursor: pointer;
  transition: background 0.2s;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #111827; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-surface-2); color: var(--text-muted); }
.btn-secondary:hover { background: var(--bg-surface-3); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* --- Form Elements --- */
input[type="search"], input[type="text"], input[type="number"], select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}
input::placeholder { color: var(--text-dim); }
select { cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); }

/* --- Semantic form controls --- */
.input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}
.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* --- Spinner / Loading --- */
.spinner {
  display: inline-block;
  width: 1.25rem; height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-sm { width: 0.875rem; height: 0.875rem; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

/* --- Compact Daemon Pill --- */
.daemon-bar {
  position: fixed; bottom: 0.75rem;
  left: 50%; transform: translateX(-50%);
  z-index: 100;
  font-family: var(--font-mono); font-size: 0.6875rem;
}
.daemon-pill {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.3rem 0.75rem;
  background: rgba(31, 41, 55, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-muted); white-space: nowrap; user-select: none;
}
.daemon-pill:hover { border-color: rgba(251, 191, 36, 0.3); background: rgba(31, 41, 55, 0.96); }
.daemon-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex-shrink: 0; }
.daemon-dot.online { background: var(--success); box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.daemon-dot.busy { background: var(--accent); animation: pulse 1.5s infinite; }
.daemon-dot.offline { background: var(--error); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.daemon-label { font-weight: 700; color: var(--accent); }
.daemon-divider { color: var(--border); }
.daemon-task { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; color: var(--text-dim); }
.daemon-extra { display: none; gap: 0.75rem; }
.daemon-pill.expanded .daemon-extra { display: inline-flex; }
.daemon-extra strong { color: var(--text-primary); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th {
  text-align: left; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--bg-surface-2); padding: 0.5rem 0.75rem;
}
table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
table tr:hover td { background: rgba(55, 65, 81, 0.3); }
table th:first-child { border-radius: var(--radius) 0 0 0; }
table th:last-child { border-radius: 0 var(--radius) 0 0; }

/* --- Card Explorer --- */
.explorer-layout { display: flex; flex-direction: column; gap: 2rem; }
@media (min-width: 1024px) { .explorer-layout { flex-direction: row; } }
.explorer-sidebar { width: 100%; flex-shrink: 0; }
@media (min-width: 1024px) { .explorer-sidebar { width: 260px; } }

.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.filter-panel h2 {
  font-size: 1.125rem; font-weight: 700;
  color: var(--accent); margin-bottom: 1.25rem;
}
.filter-group { margin-bottom: 1.125rem; }
.filter-group:last-child { margin-bottom: 0; }
.filter-label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.5rem;
}
.search-input-wrap { position: relative; }
.search-input-wrap input {
  width: 100%; padding-right: 2rem;
}
.search-input-wrap .search-icon {
  position: absolute; right: 0.625rem; top: 50%;
  transform: translateY(-50%); color: var(--text-dim);
  pointer-events: none;
}
.checkbox-list { display: flex; flex-direction: column; gap: 0.375rem; }
.checkbox-item {
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer; padding: 0.25rem 0.375rem;
  border-radius: 4px; transition: background 0.2s;
  font-size: 0.875rem; color: var(--text-muted);
}
.checkbox-item:hover { background: rgba(55, 65, 81, 0.5); }
.filter-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.filter-actions button { flex: 1; }

.results-header {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1rem 1.5rem;
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: 1rem;
}
.results-header h2 { font-size: 1.125rem; font-weight: 700; }
.results-header h2 span { color: var(--accent); }

.card-grid-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 1.5rem;
  min-height: 400px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .card-grid { grid-template-columns: repeat(5, 1fr); } }

.explorer-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
  display: flex; flex-direction: column;
}
.explorer-card:hover {
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}
.explorer-card-img {
  width: 100%; aspect-ratio: 2/3;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.75rem;
  position: relative; overflow: hidden;
}
.explorer-card-img img { width: 100%; height: 100%; object-fit: cover; }
.explorer-card-body { padding: 0.5rem 0.625rem; flex: 1; display: flex; flex-direction: column; }
.explorer-card-name {
  font-size: 0.8125rem; font-weight: 600; color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.3;
}
.explorer-card-meta {
  margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  padding-top: 0.375rem;
}
.explorer-card-type {
  font-size: 0.6875rem; color: var(--text-dim);
  padding: 0.0625rem 0.375rem; border-radius: 3px;
  background: rgba(55, 65, 81, 0.5);
}
.explorer-card-rarity { font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.rarity-common { color: var(--text-muted); }
.rarity-uncommon { color: var(--success); }
.rarity-rare { color: var(--accent-cyan); }
.rarity-special { color: #a78bfa; }

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem; margin-top: 1.5rem; color: var(--text-muted); font-size: 0.875rem;
}
.pagination button {
  padding: 0.5rem 1rem; background: var(--bg-surface-2); color: var(--text-muted);
  border: none; border-radius: var(--radius); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.pagination button:hover { background: var(--accent); color: #111827; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination button:disabled:hover { background: var(--bg-surface-2); color: var(--text-muted); }
.pagination .page-num {
  display: inline-block; padding: 0.25rem 0.625rem; border-radius: 4px; cursor: pointer;
  transition: background 0.2s;
}
.pagination .page-num:hover { background: rgba(55, 65, 81, 0.5); }
.pagination .page-num.active { background: var(--accent); color: #111827; font-weight: 700; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 2rem; font-weight: 700; color: var(--accent); margin-bottom: 0.5rem; }
.page-header p { color: var(--text-muted); }

/* --- Custom Scrollbar --- */
.custom-scrollbar::-webkit-scrollbar { width: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: var(--bg-primary); }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--bg-surface-2); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--bg-surface-3); }

/* --- Misc --- */
.border-dashed { border-style: dashed; }
.opacity-40 { opacity: 0.4; }
.opacity-60 { opacity: 0.6; }
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }
.line-through { text-decoration: line-through; }

/* House Colors — semantic classes (variables set dynamically in base.html) */
.text-house   { color: var(--house-color); }
.border-house { border-color: var(--house-color); }
.bg-house     { background: var(--house-bg); }
.icon-house   { background: var(--house-icon); }

/* --- Responsive --- */
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .nav-title { font-size: 1.125rem; }
  .nav-links a { font-size: 0.75rem; padding: 0.375rem 0.5rem; }
  .hide-mobile { display: none; }
  .grid-cols-1-mobile { grid-template-columns: 1fr; }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .hide-tablet { display: none; }
}

@media (min-width: 1024px) {
  .hide-desktop { display: none; }
}

/* ==========================================================================
   Tailwind Compatibility — maps old Tailwind classes to new design system
   These will be removed once all templates are migrated to semantic CSS.
   ========================================================================== */
.bg-gray-900 { background: var(--bg-primary); }
.bg-gray-800 { background: var(--bg-surface); }
.bg-gray-700 { background: var(--bg-surface-2); }
.bg-gray-900\/50 { background: rgba(17, 24, 39, 0.5); }
.bg-gray-800\/50 { background: rgba(31, 41, 55, 0.5); }
.bg-gray-700\/50 { background: rgba(55, 65, 81, 0.5); }
.bg-amber-600 { background: var(--accent); color: #111827; }
.bg-amber-600:hover { background: var(--accent-hover); }

.text-gray-200 { color: var(--text-primary); }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: var(--text-muted); }
.text-gray-500 { color: var(--text-dim); }
.text-amber-400 { color: var(--accent); }
.text-amber-300 { color: #fcd34d; }
.text-cyan-400 { color: var(--accent-cyan); }
.text-cyan-300 { color: #67e8f9; }
.text-white { color: white; }
.text-green-500 { color: var(--success); }
.text-red-500 { color: var(--error); }
.text-red-400 { color: #f87171; }
.text-yellow-400 { color: var(--accent); }
.text-purple-400 { color: #a78bfa; }
.text-blue-400 { color: #60a5fa; }

.border-gray-700 { border-color: var(--border); }
.border-gray-600 { border-color: var(--border-light); }
.border-amber-500 { border-color: var(--accent); }
.border-cyan-500 { border-color: var(--accent-cyan); }
.border-gray-900 { border-color: var(--bg-primary); }

.hover\:bg-gray-700:hover { background: var(--bg-surface-2); }
.hover\:bg-gray-600:hover { background: var(--bg-surface-3); }
.hover\:bg-amber-700:hover { background: var(--accent-hover); }
.hover\:text-white:hover { color: white; }
.hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }
.hover\:shadow-2xl:hover { box-shadow: 0 12px 32px rgba(0,0,0,0.4); }
.hover\:border-amber-500\/50:hover { border-color: rgba(251, 191, 36, 0.5); }
.hover\:underline:hover { text-decoration: underline; }

.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2); }
.focus\:ring-amber-500:focus { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2); }
.focus\:ring-cyan-500:focus { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2); }
.focus\:border-transparent:focus { border-color: transparent; }

.rounded-md { border-radius: 6px; }
.border-2 { border-width: 2px; }
.border-4 { border-width: 4px; }
.border-t-2 { border-top-width: 2px; }
.border-b-2 { border-bottom-width: 2px; }

.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-\[280px\] { max-width: 280px; }

.p-1\.5 { padding: 0.375rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.ml-28 { margin-left: 7rem; }
.ml-10 { margin-left: 2.5rem; }

.leading-snug { line-height: 1.375; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-tighter { letter-spacing: -0.05em; }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-full { grid-column: 1 / -1; }

@media (min-width: 768px) {
  .md\:col-span-1 { grid-column: span 1 / span 1; }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:block { display: block; }
}
@media (min-width: 1024px) {
  .lg\:col-span-1 { grid-column: span 1 / span 1; }
  .lg\:col-span-3 { grid-column: span 3 / span 3; }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:flex-row { flex-direction: row; }
  .lg\:w-1\/4 { width: 25%; }
}
@media (min-width: 1280px) {
  .xl\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.object-cover { object-fit: cover; }
.list-none { list-style: none; }
.break-words { word-wrap: break-word; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.resize-none { resize: none; }
.grayscale { filter: grayscale(100%); }
.grayscale-0 { filter: grayscale(0); }

/* ==========================================================================
   ADDITIONAL COMPATIBILITY — sizing, responsive, extended utilities
   Layout primitives needed by existing templates. Not brand styling.
   Gradually removed as templates migrate to semantic classes.
   ========================================================================== */

/* --- Sizing: constrained sizes for SVGs/icons --- */
.w-3 { width: 0.75rem; } .h-3 { height: 0.75rem; }
.w-3\.5 { width: 0.875rem; } .h-3\.5 { height: 0.875rem; }
.w-4 { width: 1rem; } .h-4 { height: 1rem; }
.w-5 { width: 1.25rem; } .h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; } .h-6 { height: 1.5rem; }
.w-8 { width: 2rem; } .h-8 { height: 2rem; }
.w-10 { width: 2.5rem; } .h-10 { height: 2.5rem; }
.w-12 { width: 3rem; } .h-12 { height: 3rem; }
.w-14 { width: 3.5rem; }
.w-24 { width: 6rem; }
.w-64 { width: 16rem; }
.h-auto { height: auto; }
.h-1 { height: 0.25rem; }
.h-2\.5 { height: 0.625rem; }
.min-w-full { min-width: 100%; }
.max-h-64 { max-height: 16rem; }

/* --- Extended spacing --- */
.gap-0\.5 { gap: 0.125rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-x-4 { column-gap: 1rem; }
.gap-y-1 { row-gap: 0.25rem; }
.space-x-1\.5 > * + * { margin-left: 0.375rem; }
.p-0\.5 { padding: 0.125rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pr-2 { padding-right: 0.5rem; }
.py-0 { padding-top: 0; padding-bottom: 0; }
.py-32 { padding-top: 8rem; padding-bottom: 8rem; }
.mb-0\.5 { margin-bottom: 0.125rem; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.ml-auto { margin-left: auto; }
.mt-auto { margin-top: auto; }

/* --- Extended backgrounds with opacity --- */
.bg-gray-600 { background: #4b5563; }
.bg-amber-500 { background: #f59e0b; }
.bg-green-500 { background: #22c55e; }
.bg-red-500 { background: #ef4444; }
.bg-red-600 { background: #dc2626; }
.bg-orange-500 { background: #f97316; }
.bg-gray-800\/80 { background: rgba(31, 41, 55, 0.8); }
.bg-gray-900\/30 { background: rgba(17, 24, 39, 0.3); }
.bg-gray-900\/90 { background: rgba(17, 24, 39, 0.9); }
.bg-amber-900\/30 { background: rgba(120, 53, 15, 0.3); }

/* --- Extended text colors --- */
.text-amber-500 { color: #f59e0b; }
.text-cyan-200 { color: #a5f3fc; }
.text-gray-600 { color: #6b7280; }
.text-gray-700 { color: #374151; }
.text-left { text-align: left; }
.text-orange-300 { color: #fdba74; }

/* --- Extended borders --- */
.border-transparent { border-color: transparent; }
.border-white { border-color: white; }
.border-collapse { border-collapse: collapse; }
.border-y { border-top-width: 1px; border-bottom-width: 1px; border-style: solid; border-color: var(--border); }
.divide-y > * + * { border-top: 1px solid var(--border); }
.divide-gray-700 > * + * { border-top-color: var(--border); }

/* --- Shadow variants (Tailwind-style, used by templates) --- */
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.shadow-md { box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.shadow-xl { box-shadow: 0 12px 24px rgba(0,0,0,0.3); }
.shadow-2xl { box-shadow: 0 16px 32px rgba(0,0,0,0.4); }

/* --- Transition and animation --- */
.transition-all { transition: all 0.2s ease; }
.duration-200 { transition-duration: 0.2s; }

/* --- Extended display/position --- */
.backdrop-blur-sm { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.justify-items-center { justify-items: center; }
.font-medium { font-weight: 500; }
.flex-grow { flex-grow: 1; }
.inset-y-0 { top: 0; bottom: 0; }
.top-8 { top: 2rem; }
.right-1 { right: 0.25rem; }
.right-3 { right: 0.75rem; }
.bottom-1 { bottom: 0.25rem; }
.bottom-12 { bottom: 3rem; }
.opacity-25 { opacity: 0.25; }
.opacity-75 { opacity: 0.75; }
.translate-y-full { transform: translateY(100%); }

/* --- Group/peer utilities --- */
.group { }
.group:hover .group-hover\:grayscale-0 { filter: grayscale(0); }
.group:hover .group-hover\:text-amber-300 { color: #fcd34d; }
.peer { }
.peer:checked ~ .peer-checked\:bg-amber-600 { background: var(--accent); color: #111827; }
.disabled\:opacity-40:disabled { opacity: 0.4; }

/* --- Focus states --- */
.focus\:border-amber-500:focus { border-color: var(--accent); }
.focus\:outline-none:focus { outline: none; }

/* --- Additional hover states --- */
.hover\:bg-gray-750:hover { background: #374151; }
.hover\:border-gray-500:hover { border-color: #6b7280; }
.hover\:border-gray-700:hover { border-color: var(--border); }

/* --- Responsive variants --- */
@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:block { display: block; }
  .sm\:space-x-4 > * + * { margin-left: 1rem; }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* --- Negative positioning (house selector indicators) --- */
.-top-1 { top: -0.25rem; }
.-right-1 { right: -0.25rem; }

/* --- JS-visible indicator helpers --- */
.indicator-inc { }
.indicator-exc { }

/* --- Extra padding/margin used by templates --- */
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }

/* --- Arbitrary value classes (Tailwind JIT-style, used by templates) --- */
.text-\[10px\] { font-size: 10px; }
.min-h-\[600px\] { min-height: 600px; }
.min-h-\[9rem\] { min-height: 9rem; }
.max-h-\[600px\] { max-height: 600px; }
