/* ===========================================================================
   Linkerr custom styles.
   Tailwind (via CDN) provides the utility layer; this file holds the design
   tokens (CSS variables) for light/dark theming and a handful of component
   helpers that are awkward to express purely with utilities.
   =========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
}

.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #818cf8;
  --accent-hover: #6366f1;
}

/* Prevent the flash of un-styled Alpine content before Alpine initializes. */
[x-cloak] {
  display: none !important;
}

/* Smooth color transitions when toggling dark mode. */
html {
  transition: background-color 0.2s ease, color 0.2s ease;
}

body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* ---------------------------------------------------------------------------
   Multi-line truncation helpers (used by link cards / descriptions).
   --------------------------------------------------------------------------- */
.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;
}

/* ---------------------------------------------------------------------------
   Link card hiding for client-side search. When app.js filters results it
   sets `hidden` on non-matching cards; this guarantees they collapse fully
   regardless of the display utility Tailwind applied.
   --------------------------------------------------------------------------- */
.link-card[hidden] {
  display: none !important;
}

/* A whole category section is hidden when none of its cards match the query. */
.category-section[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------------------
   Drag-and-drop reorder affordance for the admin category list.
   --------------------------------------------------------------------------- */
.cat-item.dragging {
  opacity: 0.5;
}

.cat-item.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Nicer scrollbars in dark mode for overflow tables. */
.dark ::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}
.dark ::-webkit-scrollbar-track {
  background: transparent;
}

/* Search input: hide the native clear button for a cleaner look. */
input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
