/* Dark is the base here. Light applies when the system asks for it and the
   visitor hasn't chosen otherwise, or when they pick it with the toggle. */
:root {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161a20;
  --surface-hover: #1d222a;
  --border: #262c34;
  --text: #e8eaed;
  --text-muted: #9aa5b5;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --header-glow: rgba(91, 140, 255, 0.18);
  --h1-from: #e8eaed;
  --logo-bg: #fff;
  --logo-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  --t-company: #7da4ff;
  --t-startup: #4fd8a4;
  --t-movement: #b68cff;
  --t-idea: #ffb96b;
  --t-service: #56cfe1;
  --t-initiative: #ff8fab;
  --t-product: #f9c74f;
}

/* light palette, applied in both of the cases described above */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-hover: #f0f2f5;
    --border: #e6e9ee;
    --text: #1a1d21;
    --text-muted: #5b6675;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.10);
    --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
    --header-glow: rgba(37, 99, 235, 0.10);
    --h1-from: #1a1d21;
    --logo-bg: #f2f5fa;
    --logo-shadow: 0 4px 14px rgba(15, 23, 42, 0.10);
    --t-company: #2456c9;
    --t-startup: #0f8659;
    --t-movement: #7534d4;
    --t-idea: #a85f04;
    --t-service: #0d7d92;
    --t-initiative: #c22e57;
    --t-product: #8a6a00;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-hover: #f0f2f5;
  --border: #e6e9ee;
  --text: #1a1d21;
  --text-muted: #5b6675;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --header-glow: rgba(37, 99, 235, 0.10);
  --h1-from: #1a1d21;
  --logo-bg: #f2f5fa;
  --logo-shadow: 0 4px 14px rgba(15, 23, 42, 0.10);
  --t-company: #2456c9;
  --t-startup: #0f8659;
  --t-movement: #7534d4;
  --t-idea: #a85f04;
  --t-service: #0d7d92;
  --t-initiative: #c22e57;
  --t-product: #8a6a00;
}

/* theme toggle button (shared pattern across all fedecuci.com pages) */
.theme-toggle {
  position: fixed; top: 1rem; right: 1rem; z-index: 99;
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  cursor: pointer; border-radius: 999px;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  transition: color .12s ease, border-color .12s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }
.theme-toggle svg { width: 18px; height: 18px; }
/* show the icon for the theme you would switch TO (dark is the base here) */
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: none; }
}
:root[data-theme="light"] .theme-toggle .moon { display: block; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }

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

body {
  font-family: system-ui, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  /* Left/right only — a `padding` shorthand here would override the
     bottom spacing that `main` sets, since .container outranks it. */
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------- Header ---------- */
.site-header {
  padding: 64px 0 40px;
  background:
    radial-gradient(ellipse 70% 120% at 50% -20%, var(--header-glow), transparent);
  text-align: center;
}

.site-header h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--h1-from) 40%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  margin: 10px auto 28px;
  max-width: 520px;
}

#search {
  width: 100%;
  max-width: 420px;
  padding: 12px 18px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

#search::placeholder { color: var(--text-muted); }

/* ---------- Grid ---------- */
/* Bottom spacing matches the grid gap, so the last row clears the
   footer by the same distance cards clear each other. */
main { flex: 1; padding-bottom: 20px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 20px;
}

@media (max-width: 820px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: var(--surface-hover);
  outline: none;
}

.logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--logo-bg);
  overflow: hidden;
  box-shadow: var(--logo-shadow);
}

.logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.logo.fallback {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
}

.card h2 {
  font-size: 1.08rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card .tagline {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.badges {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.type-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.type-company  { color: var(--t-company); background: rgba(91, 140, 255, 0.14); border-color: rgba(91, 140, 255, 0.35); }
.type-startup  { color: var(--t-startup); background: rgba(56, 199, 147, 0.14); border-color: rgba(56, 199, 147, 0.35); }
.type-movement { color: var(--t-movement); background: rgba(157, 107, 255, 0.14); border-color: rgba(157, 107, 255, 0.35); }
.type-idea     { color: var(--t-idea); background: rgba(255, 169, 77, 0.14); border-color: rgba(255, 169, 77, 0.35); }
.type-service  { color: var(--t-service); background: rgba(34, 184, 207, 0.14); border-color: rgba(34, 184, 207, 0.35); }
.type-initiative { color: var(--t-initiative); background: rgba(255, 107, 139, 0.14); border-color: rgba(255, 107, 139, 0.35); }
.type-product  { color: var(--t-product); background: rgba(249, 199, 79, 0.14); border-color: rgba(249, 199, 79, 0.35); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover { color: var(--text); }

.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-logo {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-logo img { width: 38px; height: 38px; object-fit: contain; }

.modal-logo.fallback { color: #fff; font-weight: 700; font-size: 1.3rem; }

.modal h2 { font-size: 1.3rem; margin-bottom: 4px; }

.modal-summary { color: var(--text); margin-bottom: 24px; }

.modal-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.muted { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 14px; }

.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.15s, background 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
