/* ============================================================
   dendrologie.css — Journal Botanique de Terrain
   Palette : #f7f1e7 parchemin | #1a3d2b vert forêt | #8b4513 bois | #d4a843 or
   Polices  : Playfair Display (titres) + Crimson Pro (corps) + Fira Code
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Fira+Code:wght@400;500&display=swap');

:root {
  --parchment: #f7f1e7;
  --parchment2: #f0e8d5;
  --parchment3: #e6d9c0;
  --forest:   #1a3d2b;
  --forest2:  #24573d;
  --forest3:  #2f6e4e;
  --wood:     #8b4513;
  --wood2:    #a0522d;
  --gold:     #d4a843;
  --gold2:    #b8881e;
  --rust:     #c0392b;
  --sage:     #7a9e7e;
  --text:     #2d1f0e;
  --text2:    #4a3422;
  --muted:    #7a6550;
  --border:   #c8b89a;
  --border2:  #d4c4aa;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Crimson Pro', Georgia, serif;
  background: var(--parchment);
  color: var(--text);
  line-height: 1.82;
  font-size: 1.06rem;
  overflow-x: hidden;
}

/* ── PAPER TEXTURE ────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ── PROGRESS BAR ─────────────────────────────── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--forest), var(--gold));
  z-index: 1000;
  transition: width .1s linear;
}

/* ── NAV ──────────────────────────────────────── */
nav {
  position: fixed;
  top: 4px; left: 0; right: 0;
  z-index: 900;
  background: rgba(26,61,43,.97);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 32px;
  height: 54px;
  overflow-x: auto;
}
.nav-logo {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: .02em;
  margin-right: 20px;
  flex-shrink: 0;
}
nav a:not(.nav-logo) {
  font-family: 'Fira Code', monospace;
  font-size: .68rem;
  color: rgba(212,168,67,.65);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 3px;
  white-space: nowrap;
  transition: color .2s, background .2s;
  letter-spacing: .04em;
}
nav a:not(.nav-logo):hover,
nav a.active {
  color: var(--gold);
  background: rgba(212,168,67,.12);
}

/* ── HERO ─────────────────────────────────────── */
.hero {
  position: relative;
  background: var(--forest);
  padding: 110px 60px 80px;
  overflow: hidden;
  z-index: 1;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 100% at 85% 50%, rgba(212,168,67,.12), transparent),
    radial-gradient(ellipse 50% 80% at 5% 80%, rgba(47,110,78,.5), transparent);
  pointer-events: none;
}
/* Decorative tree rings pattern */
.hero::after {
  content: '';
  position: absolute;
  right: -100px; top: 50%;
  transform: translateY(-50%);
  width: 500px; height: 500px;
  border-radius: 50%;
  border: 1px solid rgba(212,168,67,.08);
  box-shadow:
    0 0 0 40px rgba(212,168,67,.05),
    0 0 0 80px rgba(212,168,67,.04),
    0 0 0 120px rgba(212,168,67,.03),
    0 0 0 160px rgba(212,168,67,.02);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 2; max-width: 800px; }

.hero-genus {
  display: inline-block;
  font-family: 'Fira Code', monospace;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(212,168,67,.3);
  padding: 5px 16px;
  border-radius: 2px;
  margin-bottom: 22px;
}
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(3.5rem, 7vw, 6rem);
  font-weight: 900;
  line-height: 1;
  color: var(--parchment);
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.hero h1 em {
  font-style: italic;
  color: var(--gold);
  font-size: .55em;
  display: block;
  font-weight: 400;
  letter-spacing: .04em;
  margin-top: 8px;
}
.hero .tagline {
  font-size: 1.1rem;
  color: rgba(247,241,231,.75);
  max-width: 600px;
  margin-top: 18px;
  font-style: italic;
}

/* ── HERO STATS ───────────────────────────────── */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid rgba(212,168,67,.25);
}
.h-stat {
  text-align: center;
}
.h-stat .hv {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  display: block;
}
.h-stat .hl {
  font-family: 'Fira Code', monospace;
  font-size: .62rem;
  color: rgba(212,168,67,.6);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 4px;
  display: block;
}

/* ── LAYOUT ───────────────────────────────────── */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 64px 40px;
  position: relative;
  z-index: 1;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 40px;
}
@media (max-width: 920px) { .two-col { grid-template-columns: 1fr; } }

/* ── SECTIONS ─────────────────────────────────── */
.section {
  margin-bottom: 72px;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease, transform .6s ease;
}
.section.visible { opacity: 1; transform: none; }

.sec-number {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: .9rem;
  color: var(--gold2);
  margin-bottom: 4px;
}
.section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border2);
  position: relative;
}
.section h2::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  height: 2px; width: 70px;
  background: var(--forest3);
}
.section h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--forest2);
  margin: 26px 0 10px;
}

/* ── CARDS ────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(45,31,14,.06);
  transition: box-shadow .25s, transform .25s;
}
.card:hover {
  box-shadow: 0 8px 24px rgba(45,31,14,.1);
  transform: translateY(-2px);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--forest);
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.card-latin {
  font-style: italic;
  color: var(--muted);
  font-size: .9rem;
}

/* ── BOX VARIANTS ─────────────────────────────── */
.box {
  border-radius: 3px;
  padding: 14px 18px;
  margin: 16px 0;
  border-left: 4px solid;
  font-size: .97rem;
}
.box-forest { background: rgba(26,61,43,.05);  border-color: var(--forest3); }
.box-gold   { background: rgba(212,168,67,.08); border-color: var(--gold); }
.box-wood   { background: rgba(139,69,19,.06);  border-color: var(--wood); }
.box-sage   { background: rgba(122,158,126,.08);border-color: var(--sage); }

/* ── IDENTIFICATION GUIDE ─────────────────────── */
.ident-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.ident-card {
  background: var(--parchment2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  transition: background .2s, transform .2s;
}
.ident-card:hover {
  background: #fff;
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(45,31,14,.08);
}
.ident-icon { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.ident-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: var(--forest);
  font-size: .95rem;
  margin-bottom: 6px;
}
.ident-desc { font-size: .86rem; color: var(--text2); line-height: 1.55; }

/* ── TREE FAMILY CARDS ────────────────────────── */
.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 20px 0;
}
.family-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(45,31,14,.05);
  position: relative;
  overflow: hidden;
}
.family-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--forest3);
}
.family-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--forest);
  margin-bottom: 4px;
}
.family-latin {
  font-style: italic;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 12px;
  display: block;
}

/* ── TABLE ────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: .94rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(45,31,14,.05);
}
th {
  background: var(--forest);
  color: var(--parchment);
  font-family: 'Fira Code', monospace;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
  color: var(--text);
  vertical-align: top;
}
tr:nth-child(even) td { background: var(--parchment2); }
tr:hover td { background: rgba(26,61,43,.04); }

/* ── TIMELINE ─────────────────────────────────── */
.timeline { padding-left: 32px; position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px;
  background: linear-gradient(to bottom, var(--forest), var(--gold));
}
.tl-item {
  position: relative;
  margin-bottom: 26px;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -39px; top: 5px;
  width: 10px; height: 10px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--parchment);
  box-shadow: 0 0 0 2px var(--forest3);
}
.tl-year {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--wood);
  margin-bottom: 2px;
}
.tl-desc { color: var(--text2); font-size: .95rem; }
.tl-person {
  font-style: italic;
  color: var(--forest2);
  font-size: .9rem;
}

/* ── CERNES / RINGS DIAGRAM ───────────────────── */
.rings-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 24px 0;
  flex-wrap: wrap;
}
.ring-diagram {
  width: 180px; height: 180px;
  border-radius: 50%;
  background: conic-gradient(
    #c4965a 0deg 30deg,
    #a57848 30deg 70deg,
    #8b6035 70deg 120deg,
    #7a4f28 120deg 180deg,
    #9a6840 180deg 250deg,
    #b8823a 250deg 320deg,
    #c4965a 320deg 360deg
  );
  position: relative;
  box-shadow: inset 0 0 30px rgba(0,0,0,.3), 0 4px 20px rgba(0,0,0,.2);
}
.ring-diagram::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: conic-gradient(
    #c4965a 0deg 40deg,
    #a57848 40deg 100deg,
    #8b6035 100deg 200deg,
    #7a4f28 200deg 290deg,
    #b8823a 290deg 360deg
  );
}
.ring-diagram::after {
  content: '';
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #d4a843 0%, #c4965a 40%, #8b6035 70%, #6b3e1a 100%);
}

/* ── SIDEBAR ──────────────────────────────────── */
.sidebar { position: sticky; top: 72px; }
.sb-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(45,31,14,.05);
}
.sb-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border2);
}
.sb-toc a {
  display: block;
  padding: 5px 8px;
  font-family: 'Fira Code', monospace;
  font-size: .67rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 3px;
  transition: color .2s, background .2s;
  letter-spacing: .03em;
}
.sb-toc a:hover, .sb-toc a.active {
  color: var(--forest);
  background: rgba(26,61,43,.07);
}

/* ── LISTS ────────────────────────────────────── */
ul { padding-left: 22px; }
li { margin: 5px 0; }
ul li::marker { color: var(--forest3); }
strong { color: var(--text); font-weight: 600; }
em { font-style: italic; }
code {
  font-family: 'Fira Code', monospace;
  background: var(--parchment3);
  color: var(--wood);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: .87em;
}

/* ── BACK TO TOP ──────────────────────────────── */
#back-top {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 44px; height: 44px;
  background: var(--forest);
  color: var(--gold);
  border: 1px solid var(--gold2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 800;
}
#back-top.visible { opacity: 1; pointer-events: auto; }
#back-top:hover { transform: translateY(-4px); }

/* ── FOOTER ───────────────────────────────────── */
footer {
  background: var(--forest);
  padding: 32px 40px;
  text-align: center;
  color: rgba(212,168,67,.6);
  font-family: 'Fira Code', monospace;
  font-size: .68rem;
  letter-spacing: .08em;
  position: relative;
  z-index: 1;
}

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 90px 24px 60px; }
  .container { padding: 40px 20px; }
  nav { padding: 0 16px; }
}
