@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Sans+3:ital,wght@0,300;0,400;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;600&display=swap');

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

:root {
  --ink: #0d0d0d;
  --paper: #f5f0e8;
  --cream: #ece5d8;
  --warm-gray: #b8a99a;
  --mid-gray: #8a7d70;
  --cool-gray: #6b6360;
  --accent-red: #c41e1e;
  --accent-red-light: #f8e8e8;
  --accent-orange: #d4600a;
  --accent-orange-light: #fdf0e4;
  --accent-gold: #a68b1e;
  --accent-gold-light: #f9f3de;
  --rule: #c9bfb0;
  --rule-heavy: #1a1a1a;
  --serif: 'Playfair Display', 'Georgia', serif;
  --sans: 'Source Sans 3', 'Helvetica Neue', sans-serif;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; width: 100%; }

/* ===== HEADER — Editorial masthead ===== */
.site-header {
  background: var(--ink);
  color: var(--paper);
  padding: 0;
  position: relative;
  overflow: hidden;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,255,255,0.015) 3px, rgba(255,255,255,0.015) 4px),
    radial-gradient(ellipse at 20% 80%, rgba(196,30,30,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(166,139,30,0.06) 0%, transparent 50%);
  pointer-events: none;
}
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--warm-gray);
  font-family: var(--mono);
}
.site-title {
  color: var(--paper);
  text-decoration: none;
  display: block;
  text-align: center;
  padding: 2.5rem 0 1rem;
  position: relative;
}
.site-title h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-transform: uppercase;
}
.site-title h1 span {
  display: block;
  font-size: 0.35em;
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--warm-gray);
  margin-bottom: 0.5rem;
}
.site-subtitle {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--warm-gray);
  margin-top: 0.75rem;
  letter-spacing: 0.02em;
}
.header-rule {
  display: block;
  height: 4px;
  background: var(--accent-red);
  border: none;
  margin: 0;
}

/* ===== STATS DASHBOARD ===== */
.stats-section {
  background: var(--ink);
  color: var(--paper);
  padding: 1.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
}
.stat {
  text-align: center;
  padding: 0.75rem 0.5rem;
  position: relative;
}
.stat:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: rgba(255,255,255,0.1);
}
.stat-number {
  display: block;
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.stat-number.is-red { color: var(--accent-red); }
.stat-number.is-orange { color: var(--accent-orange); }
.stat-number.is-gold { color: var(--accent-gold); }
.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--warm-gray);
  font-family: var(--mono);
}

/* ===== EDITORIAL INTRO ===== */
.editorial-intro {
  max-width: 780px;
  margin: 3rem auto;
  text-align: center;
  position: relative;
}
.editorial-intro::before,
.editorial-intro::after {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: var(--rule);
  margin: 0 auto 1.5rem;
}
.editorial-intro::after { margin: 1.5rem auto 0; }
.editorial-intro .lead {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--cool-gray);
  font-style: italic;
}
.editorial-intro .lead strong {
  font-style: normal;
  color: var(--ink);
  font-weight: 700;
}

/* ===== YEAR TIMELINE ===== */
.year-timeline {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 2.5rem auto 1rem;
  max-width: 600px;
  position: relative;
}
.year-timeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--rule);
  transform: translateY(-50%);
}
.year-marker {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
}
.year-marker .dot {
  display: block;
  width: 10px;
  height: 10px;
  background: var(--ink);
  border: 2px solid var(--paper);
  border-radius: 50%;
  margin: 0 auto 0.4rem;
  box-shadow: 0 0 0 2px var(--rule);
}
.year-marker .yr {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--cool-gray);
}
.year-marker .count {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--accent-red);
  margin-top: 0.15rem;
}

/* ===== CSS-ONLY FILTERS ===== */
.filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0 2.5rem;
  flex-wrap: wrap;
}
.filter-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--cool-gray);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.filter-btn[data-type="liquidation"].active { background: var(--accent-red); border-color: var(--accent-red); }
.filter-btn[data-type="redressement"].active { background: var(--accent-orange); border-color: var(--accent-orange); }
.filter-btn[data-type="sauvegarde"].active { background: var(--accent-gold); border-color: var(--accent-gold); }

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0 1.5rem;
}
.section-header h2 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  white-space: nowrap;
}
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule-heavy);
}
.section-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--cool-gray);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ===== COMPANY CARDS — Case file aesthetic ===== */
.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-bottom: 4rem;
}
.company-card {
  background: #fff;
  border: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}
.company-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}
.company-card[data-procedure="liquidation"]::before { background: var(--accent-red); }
.company-card[data-procedure="redressement"]::before { background: var(--accent-orange); }
.company-card[data-procedure="sauvegarde"]::before { background: var(--accent-gold); }

.company-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}
.card-content { padding: 1.5rem 1.5rem 1.25rem; flex: 1; display: flex; flex-direction: column; }
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.card-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  flex: 1;
  margin-right: 0.75rem;
}
.card-year {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cool-gray);
  line-height: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.card-badge {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid;
}
.card-badge.is-liquidation {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: var(--accent-red-light);
}
.card-badge.is-redressement {
  color: var(--accent-orange);
  border-color: var(--accent-orange);
  background: var(--accent-orange-light);
}
.card-badge.is-sauvegarde {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
}
.card-sector {
  font-size: 0.78rem;
  color: var(--cool-gray);
  font-style: italic;
}
.card-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--cool-gray);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--cream);
  background: rgba(245,240,232,0.4);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--mid-gray);
  letter-spacing: 0.05em;
}
.card-footer-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.card-footer-stat svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-arrow {
  font-size: 1rem;
  color: var(--rule);
  transition: transform 0.2s, color 0.2s;
}
.company-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--ink);
}

/* ===== COMPANY DETAIL PAGE ===== */
.company-detail { padding: 0 0 4rem; }

.detail-hero {
  background: var(--ink);
  color: var(--paper);
  padding: 3rem 2rem 2.5rem;
  margin: 0 -2rem 3rem;
  position: relative;
  overflow: hidden;
  width: calc(100% + 4rem);
}
.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 119px, rgba(255,255,255,0.02) 119px, rgba(255,255,255,0.02) 120px);
  pointer-events: none;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--warm-gray);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--paper); }
.back-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.detail-hero h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.detail-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.detail-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border: 1px solid;
}
.detail-badge.is-liquidation {
  color: var(--accent-red);
  border-color: rgba(196,30,30,0.5);
  background: rgba(196,30,30,0.1);
}
.detail-badge.is-redressement {
  color: var(--accent-orange);
  border-color: rgba(212,96,10,0.5);
  background: rgba(212,96,10,0.1);
}
.detail-badge.is-sauvegarde {
  color: var(--accent-gold);
  border-color: rgba(166,139,30,0.5);
  background: rgba(166,139,30,0.1);
}
.detail-year-tag {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--warm-gray);
}
.detail-sector-tag {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--warm-gray);
  font-style: italic;
}

.detail-stats-bar {
  display: flex;
  gap: 2.5rem;
}
.detail-stat { text-align: left; }
.detail-stat-number {
  display: block;
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--paper);
}
.detail-stat-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--warm-gray);
  margin-top: 0.25rem;
}

/* Detail body */
.detail-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
}

.detail-section {
  margin-bottom: 2.5rem;
  animation: fadeUp 0.5s ease both;
}
.detail-section:nth-child(1) { animation-delay: 0.05s; }
.detail-section:nth-child(2) { animation-delay: 0.1s; }
.detail-section:nth-child(3) { animation-delay: 0.15s; }

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

.detail-section h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.detail-section h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.detail-section p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #3a3530;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-red), var(--rule));
}
.timeline-event {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 0.5rem;
  animation: fadeUp 0.4s ease both;
}
.timeline-event:nth-child(1) { animation-delay: 0.1s; }
.timeline-event:nth-child(2) { animation-delay: 0.2s; }
.timeline-event:nth-child(3) { animation-delay: 0.3s; }
.timeline-event:nth-child(4) { animation-delay: 0.4s; }
.timeline-event:nth-child(5) { animation-delay: 0.5s; }
.timeline-event::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  background: var(--paper);
  border: 2px solid var(--accent-red);
  border-radius: 50%;
  z-index: 1;
}
.timeline-event:last-child::before {
  background: var(--accent-red);
}
.timeline-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-red);
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.15rem;
}
.timeline-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #3a3530;
}

/* Sources */
.sources-list {
  list-style: none;
}
.sources-list li {
  margin-bottom: 0.6rem;
  padding-left: 1rem;
  position: relative;
  font-size: 0.85rem;
}
.sources-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 4px;
  height: 4px;
  background: var(--rule);
  border-radius: 50%;
}
.sources-list a {
  color: var(--accent-red);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.sources-list a:hover {
  border-bottom-color: var(--accent-red);
}
.sources-list time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--mid-gray);
  margin-left: 0.3rem;
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: auto;
  background: var(--ink);
  color: var(--warm-gray);
  padding: 2rem 0;
  font-size: 0.75rem;
  line-height: 1.6;
  border-top: 4px solid var(--accent-red);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}
.footer-brand {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 0.35rem;
}
.footer-legal { max-width: 500px; }
.footer-meta {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

/* ===== ANIMATIONS ===== */
.company-card {
  animation: cardReveal 0.5s ease both;
}
.company-card:nth-child(1) { animation-delay: 0.02s; }
.company-card:nth-child(2) { animation-delay: 0.04s; }
.company-card:nth-child(3) { animation-delay: 0.06s; }
.company-card:nth-child(4) { animation-delay: 0.08s; }
.company-card:nth-child(5) { animation-delay: 0.10s; }
.company-card:nth-child(6) { animation-delay: 0.12s; }
.company-card:nth-child(7) { animation-delay: 0.14s; }
.company-card:nth-child(8) { animation-delay: 0.16s; }
.company-card:nth-child(9) { animation-delay: 0.18s; }
.company-card:nth-child(10) { animation-delay: 0.20s; }
.company-card:nth-child(11) { animation-delay: 0.22s; }
.company-card:nth-child(12) { animation-delay: 0.24s; }
.company-card:nth-child(n+13) { animation-delay: 0.26s; }

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .detail-body {
    grid-template-columns: 1fr;
    padding: 0 1.5rem;
  }
}

@media (max-width: 640px) {
  .container { padding: 0 1rem; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(3)::after { display: none; }
  .stat-number { font-size: 1.4rem; }
  .companies-grid { grid-template-columns: 1fr; }
  .site-title h1 { font-size: 1.8rem; }
  .card-content { padding: 1.25rem; }
  .detail-stats-bar { gap: 1.5rem; flex-wrap: wrap; }
  .detail-stat-number { font-size: 1.6rem; }
  .footer-inner { flex-direction: column; }
  .footer-meta { text-align: left; }
  .year-timeline { gap: 0; margin: 1.5rem auto; }
  .filters { gap: 0.35rem; }
  .filter-btn { padding: 0.4rem 0.8rem; font-size: 0.6rem; }
}
