/* ════════════════════════════════════════════════════════════
   ApprendreCoder — Feuille de style principale
   Design : éditorial moderne, sobre, ultra-lisible
════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg:          #F9F7F4;
  --bg-alt:      #F2EFE9;
  --bg-dark:     #131210;
  --ink:         #1A1916;
  --ink-mid:     #4A4740;
  --ink-soft:    #8A8780;
  --accent:      #2A6B3F;
  --accent-lt:   #E8F3EC;
  --accent-2:    #C4813A;
  --accent-2-lt: #FBF2E8;
  --border:      rgba(26,25,22,0.10);
  --radius:      10px;
  --radius-lg:   18px;
  --shadow:      0 2px 16px rgba(26,25,22,0.07);
  --shadow-md:   0 6px 30px rgba(26,25,22,0.11);
  --ff-display:  'Syne', sans-serif;
  --ff-body:     'Instrument Sans', sans-serif;
  --max-w:       1160px;
}

/* ── Reset minimal ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ── Utilitaires ──────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Skip link (accessibilité) ────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 9999;
}
.skip-link:focus { top: 8px; }

/* ════════════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(249,247,244,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-mid);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.25s;
}

/* ════════════════════════════════════════════════════════════
   HERO
════════════════════════════════════════════════════════════ */
.hero {
  padding: 80px 0 72px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-lt);
  color: var(--accent);
  border: 1px solid rgba(42,107,63,0.2);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}
.badge-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.hero-title {
  font-family: var(--ff-display);
  font-size: clamp(36px, 4.5vw, 58px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 18px;
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
}
.hero-desc {
  font-size: 17px;
  color: var(--ink-mid);
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 28px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--ff-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}
.stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* ── Code window (hero) ───────────────────────────────────── */
.code-window {
  background: #1c1e24;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255,255,255,0.05);
}
.code-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #2a2d35;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.dot-red    { background: #FF5F57; }
.dot-yellow { background: #FFBD2E; }
.dot-green  { background: #28C840; }
.code-filename {
  margin-left: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  font-family: 'Courier New', monospace;
}
.code-body {
  padding: 24px 22px;
  margin: 0;
  overflow: auto;
}
.code-body code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.75;
  color: #abb2bf;
  white-space: pre;
}
.c-kw  { color: #c678dd; }
.c-fn  { color: #61afef; }
.c-str { color: #98c379; }
.c-cmt { color: #5c6370; font-style: italic; }

/* ════════════════════════════════════════════════════════════
   BOUTONS
════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(42,107,63,0.3);
}
.btn-primary:hover {
  background: #215733;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(42,107,63,0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-mid);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
}
.btn-large { padding: 14px 28px; font-size: 16px; }

/* ════════════════════════════════════════════════════════════
   SECTIONS — en-têtes partagés
════════════════════════════════════════════════════════════ */
.section-head {
  text-align: center;
  margin-bottom: 48px;
}
.section-title {
  font-family: var(--ff-display);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 12px;
}
.section-desc {
  font-size: 17px;
  color: var(--ink-mid);
  max-width: 520px;
  margin: 0 auto;
}

/* ════════════════════════════════════════════════════════════
   THÈMES
════════════════════════════════════════════════════════════ */
.themes-section {
  padding: 80px 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.themes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.theme-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: box-shadow 0.25s, transform 0.25s;
}
.theme-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.theme-icon { font-size: 28px; margin-bottom: 14px; }
.theme-name {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--ink);
}
.theme-desc {
  font-size: 14px;
  color: var(--ink-mid);
  line-height: 1.65;
  margin-bottom: 16px;
}
.theme-topics {
  margin-bottom: 20px;
}
.theme-topics li {
  font-size: 13px;
  color: var(--ink-mid);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.theme-topics li::before {
  content: "→ ";
  color: var(--accent);
}
.theme-count {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 3px 10px;
  border-radius: 100px;
}
.theme-python .theme-name { color: #2563eb; }
.theme-html  .theme-name { color: #c2410c; }
.theme-js    .theme-name { color: #a16207; }
.theme-git   .theme-name { color: var(--accent); }

/* ════════════════════════════════════════════════════════════
   ARTICLES
════════════════════════════════════════════════════════════ */
.articles-section { padding: 80px 0; }
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.article-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s, transform 0.25s;
}
.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.article-card.featured {
  grid-column: span 3;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}
.article-card.featured .article-title a,
.article-card.featured .article-excerpt { color: rgba(255,255,255,0.9); }
.article-card.featured .article-date,
.article-card.featured .read-time { color: rgba(255,255,255,0.5); }
.article-card.featured .read-link { color: #6ee7a0; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.article-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag-python      { background: #dbeafe; color: #1d4ed8; }
.tag-html        { background: #ffedd5; color: #c2410c; }
.tag-css         { background: #ede9fe; color: #7c3aed; }
.tag-js          { background: #fef9c3; color: #854d0e; }
.tag-git         { background: var(--accent-lt); color: var(--accent); }
.tag-debutant    { background: #f0fdf4; color: #166534; }
.tag-intermediaire { background: #fef9c3; color: #854d0e; }

.article-date {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: auto;
}
.article-title {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  flex: 1;
}
.article-title a { transition: color 0.2s; }
.article-title a:hover { color: var(--accent); }
.article-card.featured .article-title { font-size: 22px; }

.article-excerpt {
  font-size: 14px;
  color: var(--ink-mid);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 18px;
}
.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.article-card.featured .article-footer {
  border-top-color: rgba(255,255,255,0.1);
}
.read-time { font-size: 13px; color: var(--ink-soft); }
.read-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: gap 0.2s;
}
.read-link:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════
   POURQUOI
════════════════════════════════════════════════════════════ */
.why-section {
  padding: 80px 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.why-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
.why-lead {
  font-size: 18px;
  color: var(--ink-mid);
  margin-bottom: 32px;
  line-height: 1.65;
}
.why-list { display: flex; flex-direction: column; gap: 22px; }
.why-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.why-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}
.why-item strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.why-item p { font-size: 14px; color: var(--ink-mid); }

/* ── Terminal visuel ──────────────────────────────────────── */
.terminal {
  background: #1c1e24;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.terminal-bar {
  padding: 10px 16px;
  background: #2a2d35;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  font-family: monospace;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.terminal-body {
  padding: 20px 18px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 2;
}
.terminal-body p { color: rgba(255,255,255,0.7); }
.t-prompt { color: #28C840; margin-right: 8px; }
.t-output { color: #61afef; padding-left: 20px; }
.t-cursor {
  display: inline-block;
  animation: blink 1s step-end infinite;
  color: #fff;
}
@keyframes blink { 50% { opacity: 0; } }

/* ════════════════════════════════════════════════════════════
   CONTACT
════════════════════════════════════════════════════════════ */
.contact-section { padding: 80px 0; }
.contact-inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.contact-desc {
  font-size: 17px;
  color: var(--ink-mid);
  margin: 16px 0 28px;
  line-height: 1.7;
}
.contact-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ════════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,0.7);
  padding-top: 56px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-footer .logo { color: #fff; }
.site-footer .logo-icon { background: rgba(255,255,255,0.1); }
.footer-tagline {
  font-size: 14px;
  color: rgba(255,255,255,0.4);
  margin-top: 10px;
  max-width: 260px;
}
.footer-nav {
  display: flex;
  gap: 48px;
}
.footer-heading {
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 14px;
}
.footer-nav li { margin-bottom: 10px; }
.footer-nav a {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  transition: color 0.2s;
}
.footer-nav a:hover { color: #fff; }
.footer-bottom {
  padding: 20px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.3);
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .themes-grid { grid-template-columns: repeat(2, 1fr); }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .article-card.featured { grid-column: span 2; }
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 48px;
    padding-bottom: 48px;
    gap: 36px;
  }
  .hero-visual { order: -1; }
  .code-window { max-width: 100%; }
  .nav-links {
    display: none;
    position: fixed;
    inset: 64px 0 0;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 20px; }
  .nav-toggle { display: flex; }
  .themes-grid { grid-template-columns: 1fr; }
  .articles-grid { grid-template-columns: 1fr; }
  .article-card.featured { grid-column: span 1; }
  .why-inner { grid-template-columns: 1fr; }
  .why-visual { order: -1; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { flex-wrap: wrap; gap: 32px; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

/* ── Focus visible (accessibilité) ────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Sélection texte ──────────────────────────────────────── */
::selection { background: var(--accent-lt); color: var(--accent); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--ink-soft); border-radius: 6px; }
