/* ─────────────────────────────────────────────────────────────────────────────
   DESIGN TOKENS
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  --electric:       #3B3CF7;
  --electric-dark:  #2928C8;
  --electric-xdark: #1e1da0;
  --electric-glow:  rgba(59, 60, 247, 0.15);
  --lime:           #C8EF5A;
  --lime-dark:      #a8cf3a;
  --coral:          #FF6B9D;
  --coral-light:    #FFE4EF;

  --ink:            #0F0F1A;
  --ink-soft:       #54546E;
  --ink-lighter:    #9898B8;
  --surface:        #F5F5FF;
  --surface-mid:    #EBEBFA;
  --white:          #FFFFFF;
  --border:         #E4E4F4;

  --radius-sm:  8px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-xl:  32px;
  --radius-pill:100px;

  --shadow-xs:   0 1px 3px rgba(59, 60, 247, 0.06);
  --shadow-sm:   0 2px 12px rgba(59, 60, 247, 0.08);
  --shadow-md:   0 6px 24px rgba(59, 60, 247, 0.12);
  --shadow-card: 0 2px 8px rgba(15, 15, 26, 0.06), 0 0 0 1px rgba(15,15,26,0.05);
  --shadow-hover:0 8px 32px rgba(59, 60, 247, 0.18), 0 0 0 1px rgba(59,60,247,0.1);

  --font-body:    'Inter', 'Helvetica Neue', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  --transition: 0.18s ease;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--electric); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--electric-dark); }

/* ─────────────────────────────────────────────────────────────────────────────
   HEADER — big bold rounded panel, electric blue
   ───────────────────────────────────────────────────────────────────────────── */
.site-header {
  margin: 20px 20px 0;
  background: var(--electric);
  border-radius: var(--radius-xl);
  padding: 64px 32px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* subtle radial highlight */
.site-header::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 300px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* decorative lime blob */
.site-header::after {
  content: '';
  position: absolute;
  bottom: -40px; right: -40px;
  width: 200px; height: 200px;
  background: var(--lime);
  border-radius: 50%;
  opacity: 0.18;
  pointer-events: none;
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.site-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 5.5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 20px;
}

/* lime underline on second line */
.site-title em {
  font-style: normal;
  position: relative;
  display: inline-block;
}
.site-title em::after {
  content: '';
  position: absolute;
  left: 0; bottom: 2px;
  width: 100%; height: 4px;
  background: var(--lime);
  border-radius: 2px;
}

.site-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
}

.site-subtitle a {
  color: var(--lime);
  border-bottom: 1.5px solid rgba(200,239,90,0.4);
  transition: border-color var(--transition), color var(--transition);
}
.site-subtitle a:hover {
  color: var(--white);
  border-color: var(--white);
}

/* ─────────────────────────────────────────────────────────────────────────────
   CONTROLS BAR
   ───────────────────────────────────────────────────────────────────────────── */
.controls-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.controls-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Search */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-lighter);
  pointer-events: none;
  display: flex;
}

#search {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
#search::placeholder { color: var(--ink-lighter); }
#search:focus {
  border-color: var(--electric);
  box-shadow: 0 0 0 4px var(--electric-glow);
  background: var(--white);
}

/* Selects */
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  padding: 9px 34px 9px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239898B8' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat calc(100% - 13px) center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filter-select:focus {
  border-color: var(--electric);
  box-shadow: 0 0 0 4px var(--electric-glow);
}

/* Clear button */
#clear-btn {
  padding: 9px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
#clear-btn:hover {
  border-color: var(--electric);
  color: var(--electric);
  background: var(--electric-glow);
}

/* View toggle */
.view-toggle {
  display: flex;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.view-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
}
.view-btn.active {
  background: var(--electric);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(59,60,247,0.3);
}
.view-btn:not(.active):hover {
  background: var(--surface-mid);
  color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESULTS META
   ───────────────────────────────────────────────────────────────────────────── */
.results-meta {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.results-count {
  font-size: 13px;
  color: var(--ink-soft);
}
.results-count strong { color: var(--ink); font-weight: 600; }

.active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 12px;
  background: var(--electric);
  color: var(--white);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.filter-pill button {
  background: rgba(255,255,255,0.25);
  border: none;
  cursor: pointer;
  color: var(--white);
  padding: 0 2px;
  line-height: 1;
  font-size: 14px;
  border-radius: 50%;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.filter-pill button:hover { background: rgba(255,255,255,0.4); }

/* ─────────────────────────────────────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 72px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CARD GRID
   ───────────────────────────────────────────────────────────────────────────── */
#card-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(316px, 1fr));
  gap: 18px;
}

.tool-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.tool-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

/* coloured top bar per category */
.card-top-bar {
  height: 5px;
  width: 100%;
  flex-shrink: 0;
}

.card-body {
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-name {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  color: var(--ink-lighter);
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  transition: all var(--transition);
}
.card-link:hover {
  background: var(--electric);
  border-color: var(--electric);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(59,60,247,0.3);
}

.card-category {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.card-description {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.65;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 5px;
  margin-top: auto;
  padding-top: 4px;
}

.tag {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: all var(--transition);
}
.tag:hover {
  background: var(--electric);
  color: var(--white);
  border-color: var(--electric);
}
.tag.active {
  background: var(--electric);
  color: var(--white);
  border-color: var(--electric);
}

/* ── Category colour system ─────────────────────────────────────────────────── */

/* Productivity & Scheduling — teal */
.cat-productivity { background: #DFF5F0; color: #0D7A62; }
.top-bar-cat-productivity { background: #0D7A62; }

/* AI Assistants & Knowledge — electric blue */
.cat-ai { background: #E4E4FF; color: var(--electric-dark); }
.top-bar-cat-ai { background: var(--electric); }

/* Academic & Research — violet */
.cat-academic { background: #EDE5FF; color: #6B36CC; }
.top-bar-cat-academic { background: #6B36CC; }

/* Content Creation & Editing — coral/pink */
.cat-content { background: #FFE8F2; color: #C42772; }
.top-bar-cat-content { background: #C42772; }

/* Dev Tools — Advanced — dark slate */
.cat-dev-adv { background: #E4E9F2; color: #2C3E6B; }
.top-bar-cat-dev-adv { background: #2C3E6B; }

/* Build & No-Code — lime */
.cat-nocode { background: #EEFAC8; color: #4A6A00; }
.top-bar-cat-nocode { background: var(--lime-dark); }

/* Data & Market Insights — amber */
.cat-data { background: #FFF4DC; color: #7A5200; }
.top-bar-cat-data { background: #E09000; }

/* Productivity & Collaboration — sky */
.cat-collab { background: #E0F2FF; color: #0C5A8A; }
.top-bar-cat-collab { background: #0C7ABF; }

/* ─────────────────────────────────────────────────────────────────────────────
   TABLE VIEW
   ───────────────────────────────────────────────────────────────────────────── */
#table-view {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  background: var(--white);
}

#table-view table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

#table-view thead {
  background: var(--surface);
}

#table-view th {
  padding: 14px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
#table-view th:hover { color: var(--electric); }

#table-view th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.35;
  font-size: 10px;
  vertical-align: middle;
}
#table-view th.sorted { color: var(--electric); }
#table-view th.sorted .sort-icon { opacity: 1; }

#table-view tbody tr {
  border-bottom: 1px solid var(--surface-mid);
  transition: background var(--transition);
}
#table-view tbody tr:last-child { border-bottom: none; }
#table-view tbody tr:hover { background: var(--surface); }

#table-view td {
  padding: 13px 18px;
  vertical-align: top;
  color: var(--ink-soft);
  line-height: 1.5;
}

#table-view td:first-child {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}

.table-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--electric);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--electric-glow);
  border: 1px solid rgba(59,60,247,0.15);
  transition: all var(--transition);
}
.table-link:hover {
  background: var(--electric);
  color: var(--white);
  border-color: var(--electric);
}

.table-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 4px;
  max-width: 260px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--ink-soft);
}
.empty-state svg {
  opacity: 0.2;
  margin-bottom: 16px;
  stroke: var(--electric);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; }

/* ─────────────────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  margin: 0 20px 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 28px 24px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}
.site-footer a { color: rgba(255,255,255,0.75); transition: color var(--transition); }
.site-footer a:hover { color: var(--lime); }
.site-footer code {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--lime);
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY
   ───────────────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─────────────────────────────────────────────────────────────────────────────
   ANIMATIONS
   ───────────────────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tool-card, #table-view tbody tr {
  animation: fadeUp 0.22s ease both;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-header { margin: 12px 12px 0; padding: 48px 24px 44px; border-radius: var(--radius-lg); }
  .site-footer { margin: 0 12px 12px; border-radius: var(--radius-md); }
}

@media (max-width: 700px) {
  .controls-inner { padding: 12px 16px; gap: 8px; }
  .filter-group { width: 100%; }
  .filter-select { flex: 1; min-width: 0; }
  #search { font-size: 16px; }
  .results-meta { padding: 14px 16px 0; }
  .main-content { padding: 18px 16px 56px; }
  #card-view { grid-template-columns: 1fr; gap: 14px; }
  .view-btn span.label { display: none; }
}

@media (max-width: 480px) {
  .controls-inner { flex-direction: column; align-items: stretch; }
  .view-toggle { align-self: flex-end; }
}
