/* ── Fonts ─────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg:           #080808;
  --surface:      #101010;
  --surface-2:    #181818;
  --border:       #202020;
  --border-hover: #333;
  --text:         #ede9e3;
  --text-muted:   #5a5652;
  --text-dim:     #3a3734;

  /* n8n orange */
  --accent:       #ff6d3b;
  --accent-hover: #ff8558;
  --accent-dim:   rgba(255, 109, 59, 0.12);
  --accent-glow:  rgba(255, 109, 59, 0.06);

  --radius:   10px;
  --radius-lg: 16px;

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  /* grain overlay */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  /* min 20px sur mobile, 5vw sur tablette, 40px max sur desktop */
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1.5rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.logo span { color: var(--accent); } /* conservé si utilisé ailleurs */

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: color 0.18s, background 0.18s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-link.nav-accent {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

.nav-link.nav-accent:hover {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(4rem, 10vw, 6.5rem) 0 clamp(3.5rem, 8vw, 5.5rem);
  border-bottom: 1px solid var(--border);
}

/* Background layers */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 30% 50%, rgba(255, 109, 59, 0.11) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 80% 20%, rgba(255, 109, 59, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(255, 109, 59, 0.2);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hero-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.07;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 2rem;
}

.hero-sub strong {
  color: var(--text);
  font-weight: 500;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(255, 109, 59, 0.3);
}

.hero-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 109, 59, 0.4);
}

.hero-cta svg {
  transition: transform 0.2s;
}

.hero-cta:hover svg {
  transform: translateX(3px);
}

.hero-visual {
  position: relative;
  width: 240px;
  flex-shrink: 0;
}

.hero-orb {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    rgba(255, 109, 59, 0.25) 0%,
    rgba(255, 109, 59, 0.08) 50%,
    transparent 75%
  );
  border: 1px solid rgba(255, 109, 59, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.hero-orb-icon {
  font-size: 4.5rem;
  filter: drop-shadow(0 0 24px rgba(255, 109, 59, 0.5));
}

.hero-features {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

.hero-feature {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hero-feature::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Resources section ─────────────────────────────────────────────────────── */
.resources-section {
  padding: 3rem 0 5rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── Search ─────────────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 0.6rem 2.8rem 0.6rem 2.5rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

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

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: background 0.15s;
}

.search-clear:hover { background: var(--border-hover); color: var(--text); }
.search-clear.visible { display: flex; }

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: background 0.18s;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-glow);
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}

.card:hover { background: var(--surface-2); }
.card:hover::after { opacity: 1; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-thumbnail {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-2);
}

.card-thumbnail-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.card-category {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid rgba(255, 109, 59, 0.15);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.35;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
  gap: 0.5rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.card-arrow {
  color: var(--text-dim);
  transition: color 0.18s, transform 0.18s;
  flex-shrink: 0;
}

.card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── States ─────────────────────────────────────────────────────────────────── */
.state-loading,
.state-empty,
.state-error {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 5rem 2rem;
  text-align: center;
  background: var(--surface);
}

.state-loading .spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-empty-icon,
.state-error-icon { font-size: 2rem; }

.state-empty p,
.state-error p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 320px;
}

.state-error p { color: #f87171; }

/* ── Skeleton cards ─────────────────────────────────────────────────────────── */
.skeleton-card {
  background: var(--surface);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skel-sm  { height: 12px; width: 60px; }
.skel-md  { height: 14px; width: 100%; }
.skel-lg  { height: 18px; width: 80%; }
.skel-xl  { height: 18px; width: 60%; }
.skel-para{ height: 12px; width: 100%; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 2.5rem;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0 0.5rem;
}

/* ── Search context bar ─────────────────────────────────────────────────────── */
.search-context {
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-context.visible { display: flex; }

.search-context strong { color: var(--text); }

.search-context-reset {
  color: var(--accent);
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.search-context-reset:hover { background: var(--accent-dim); }

/* ── Detail page ────────────────────────────────────────────────────────────── */
.detail-hero {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text); }

.detail-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.detail-category {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 109, 59, 0.2);
  display: none;
}

.detail-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.detail-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.detail-thumbnail {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  display: none;
}

.detail-body {
  padding: 3rem 0;
}

.detail-description {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 2rem;
  white-space: pre-wrap;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2.5rem;
}

.detail-cta {
  display: none;
  align-items: center;
  gap: 0.6rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius);
  width: fit-content;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(255, 109, 59, 0.25);
}

.detail-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 109, 59, 0.35);
}

/* Detail skeleton */
.detail-skeleton {
  padding: 2.5rem 0;
}

.skel-hero-title { height: 48px; max-width: 500px; margin-bottom: 1rem; }
.skel-para-block { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 2rem; }

/* Detail error */
.detail-error {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  text-align: center;
  gap: 1rem;
}

.detail-error .error-icon { font-size: 2.5rem; }
.detail-error .error-msg  { color: var(--text-muted); font-size: 0.9rem; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 0.25rem;
}

.footer-links a {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}

.footer-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Header */
  .site-nav { gap: 0; }
  .nav-link { padding: 0.35rem 0.55rem; font-size: 0.78rem; }
  .nav-link.nav-accent { display: none; } /* masqué sur mobile, visible en footer */

  /* Hero */
  .hero-inner  { grid-template-columns: 1fr; }
  .hero-visual { display: none; }

  /* Ressources */
  .section-header  { flex-direction: column; align-items: flex-start; }
  .search-wrap     { width: 100%; }
  .resources-grid  { grid-template-columns: 1fr; }
  .tag-filters     { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.5rem; }

  /* Détail (styles dans detail.html overrident ceux-ci) */
  .detail-body-inner { max-width: 100%; }

  /* Footer */
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

@media (max-width: 480px) {
  .logo { font-size: 0.95rem; }
  .hero-title { font-size: 2rem; }
  .hero-cta   { width: 100%; justify-content: center; }
  .hero-features { display: none; }
  .card { padding: 1.25rem; }
}

/* ── Animations d'entrée ────────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-up {
  animation: fade-up 0.5s ease both;
}

.card {
  animation: fade-up 0.4s ease both;
}

/* ── Filtre par catégorie/tag ───────────────────────────────────────────────── */
.tag-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tag-filter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.tag-filter:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.tag-filter.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Lien source (détail) ───────────────────────────────────────────────────── */
.detail-source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  margin-top: 2rem;
  width: fit-content;
  transition: color 0.15s, border-color 0.15s;
}

.detail-source-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Card prix & fav ────────────────────────────────────────────────────────── */
.card-prix {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.card-fav {
  font-size: 0.75rem;
  color: #fbbf24;
}
