/*
Theme Name: Dahoo
Theme URI: https://dahoo.fr
Author: Fabacks
Author URI: https://dahoo.fr
Description: Thème sur mesure pour D@hoo, la taverne du geek. Moderne, épuré, orienté lisibilité.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: dahoo
*/

/* ==========================================================================
   Design tokens
   ========================================================================== */

* { box-sizing: border-box; }

:root {
  --page-bg: oklch(0.985 0.006 80);
  --surface: #ffffff;
  --hero-wash: oklch(0.97 0.012 45);
  --border: oklch(0.9 0.008 80);
  --text: oklch(0.24 0.015 80);
  --text-muted: oklch(0.48 0.02 80);
  --text-muted-2: oklch(0.58 0.02 80);
  --search-bg: oklch(0.97 0.006 80);
  --shadow-color: oklch(0.2 0.02 80 / 0.12);
  --accent: #bf5f22;
  --accent-hover: oklch(0.4 0.16 45);

  --test-bg: oklch(0.95 0.035 45);
  --test-ink: oklch(0.42 0.15 45);
  --tuto-bg: oklch(0.95 0.035 150);
  --tuto-ink: oklch(0.4 0.13 150);
  --news-bg: oklch(0.95 0.035 250);
  --news-ink: oklch(0.42 0.13 250);
  --default-bg: oklch(0.94 0.008 80);
  --default-ink: oklch(0.45 0.015 80);
}

html[data-theme="dark"] {
  --page-bg: oklch(0.18 0.012 80);
  --surface: oklch(0.23 0.013 80);
  --hero-wash: oklch(0.26 0.03 45);
  --border: oklch(0.34 0.016 80);
  --text: oklch(0.93 0.006 80);
  --text-muted: oklch(0.7 0.012 80);
  --text-muted-2: oklch(0.6 0.01 80);
  --search-bg: oklch(0.27 0.014 80);
  --shadow-color: oklch(0 0 0 / 0.45);
  --accent-hover: oklch(0.72 0.16 45);

  --test-bg: oklch(0.32 0.05 45);
  --test-ink: oklch(0.86 0.08 45);
  --tuto-bg: oklch(0.3 0.05 150);
  --tuto-ink: oklch(0.84 0.1 150);
  --news-bg: oklch(0.3 0.05 250);
  --news-ink: oklch(0.85 0.1 250);
  --default-bg: oklch(0.28 0.01 80);
  --default-ink: oklch(0.8 0.012 80);
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--page-bg);
  color: var(--text);
}

h1, h2, h3, h4, .brand-word {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 64px; }

/* Category pill helper classes, output by dahoo_category_badge() */
.cat-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.cat-tests { background: var(--test-bg); color: var(--test-ink); }
.cat-tutos { background: var(--tuto-bg); color: var(--tuto-ink); }
.cat-news  { background: var(--news-bg); color: var(--news-ink); }
.cat-default { background: var(--default-bg); color: var(--default-ink); }

.thumb-tests { background: var(--test-bg); color: var(--test-ink); }
.thumb-tutos { background: var(--tuto-bg); color: var(--tuto-ink); }
.thumb-news  { background: var(--news-bg); color: var(--news-ink); }
.thumb-default { background: var(--default-bg); color: var(--default-ink); }

.kicker {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kicker.is-featured { color: var(--accent); }
.kicker svg { flex-shrink: 0; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 0 64px;
  height: 92px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; text-decoration: none; }
.site-logo-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 19px;
  font-family: 'Space Grotesk', sans-serif;
}
.site-logo-image { height: 38px; width: auto; max-width: 200px; border-radius: 4px; }
.site-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.site-logo-text .brand-word { font-size: 22px; font-weight: 700; color: var(--text); }
.site-logo-tagline { font-size: 10px; font-weight: 500; letter-spacing: 0.12em; color: var(--text-muted); text-transform: uppercase; }

.site-search { flex: 1; display: flex; justify-content: center; }
.site-search-inner { position: relative; width: 100%; max-width: 380px; }
.site-search-inner svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); }
.site-search-input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 8px; font-size: 14px;
  font-family: inherit; border: 1px solid var(--border); background: var(--search-bg); color: var(--text);
}
.site-search-input::placeholder { color: var(--text-muted); }
.site-search-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.primary-nav { display: flex; align-items: center; gap: 32px; flex-shrink: 0; }
.primary-nav a { color: var(--text); font-weight: 500; font-size: 15px; }
.primary-nav a.is-current, .primary-nav a:hover { color: var(--accent); }
.primary-nav ul { list-style: none; display: flex; gap: 32px; margin: 0; padding: 0; }

.theme-toggle, .mobile-menu-toggle, .mobile-search-toggle {
  width: 44px; height: 44px; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text);
  border-radius: 8px;
}
.theme-toggle:hover, .mobile-menu-toggle:hover, .mobile-search-toggle:hover { background: var(--hero-wash); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.mobile-menu-toggle, .mobile-search-toggle, .mobile-search-bar { display: none; }
.mobile-nav { display: none; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero-section { padding: 36px 64px 36px; background: var(--hero-wash); display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; }

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card.is-hoverable:hover { box-shadow: 0 8px 24px var(--shadow-color); transform: translateY(-2px); }

.hero-main { overflow: hidden; display: flex; flex-direction: column; }
.hero-main-thumb { width: 100%; height: 210px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hero-main-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 10px; }
.hero-main-body h2 { font-size: 22px; font-weight: 700; line-height: 1.25; }
.hero-main-body p.excerpt {
  margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.hero-main-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; font-size: 13px; color: var(--text-muted-2); }
.hero-main-meta .read-more { color: var(--accent); font-weight: 600; font-size: 14px; }
.hero-main-meta .read-more:hover { color: var(--accent-hover); }

.hero-side { display: flex; flex-direction: column; gap: 18px; }
.hero-side-card { padding: 16px; display: flex; gap: 16px; }
.hero-side-thumb { width: 88px; height: 88px; flex-shrink: 0; border-radius: 4px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hero-side-body { display: flex; flex-direction: column; gap: 5px; justify-content: center; min-width: 0; }
.hero-side-body h3 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.tag-line { font-size: 11.5px; color: var(--text-muted-2); }
.meta-line { font-size: 12.5px; color: var(--text-muted-2); }

/* ==========================================================================
   Content + sidebar
   ========================================================================== */

.content-wrap { padding: 40px 64px 56px; display: flex; gap: 48px; }
.main-col { flex: 1; min-width: 0; order: 0; }
.sidebar { flex: 0 0 280px; display: flex; flex-direction: column; gap: 24px; order: 1; }
body.sidebar-left .main-col { order: 1; }
body.sidebar-left .sidebar { order: 0; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-heading h3 { font-size: 20px; font-weight: 700; }

.filter-pills { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 15px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); color: var(--text-muted);
}
.filter-pill.is-active { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.filter-pill:hover { opacity: 0.85; }

.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.article-card { overflow: hidden; display: flex; flex-direction: column; }
.article-card-thumb { width: 100%; height: 148px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.article-card-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.article-card-body h4 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.article-card-body p.excerpt {
  margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.article-card-body .meta-line { margin-top: auto; }

.pagination-wrap, .nav-links {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 32px;
}
.page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text);
}
a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.page-numbers.current { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.page-numbers.dots { border-color: transparent; color: var(--text-muted-2); }

.sidebar-block { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.sidebar-block.rss-block { background: var(--hero-wash); gap: 10px; }
.sidebar-block h4 { font-size: 13px; font-weight: 600; color: var(--text); }
.category-list { display: flex; flex-direction: column; gap: 4px; }
.category-list a {
  font-size: 14px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px;
}
.category-list .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.rss-link { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 14px; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 32px 64px; display: flex; flex-direction: column; gap: 20px; }
.site-footer-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.site-footer-brand { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.site-footer-brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; font-family: 'Space Grotesk', sans-serif; }
.footer-logo-image { height: 26px; width: auto; max-width: 120px; border-radius: 4px; }
.footer-nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 28px; flex-wrap: wrap; }
.site-footer-nav a { font-size: 13px; color: var(--text); }
.site-footer-copy { font-size: 12px; color: var(--text-muted-2); }

.site-footer-right { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-social-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; }
.footer-social-link {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: none;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.footer-social-link:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================================
   Single article
   ========================================================================== */

.breadcrumb { padding: 20px 64px 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted-2); flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted-2); }
.breadcrumb a:hover { color: var(--accent); }

.article-header { max-width: 760px; margin: 0 auto; padding: 24px 64px 0; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.article-header h1 { font-size: 38px; font-weight: 700; line-height: 1.18; }
.article-byline { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-muted-2); flex-wrap: wrap; }

.article-featured-image { max-width: 1000px; margin: 28px auto 0; padding: 0 64px; }
.article-featured-image .thumb-frame { width: 100%; height: 460px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }

.article-body { max-width: 720px; margin: 0 auto; padding: 40px 64px 0; }
.article-body p { margin: 0 0 20px; font-size: 17px; line-height: 1.75; color: var(--text); }
.article-body h2 { font-size: 22px; font-weight: 700; margin: 36px 0 16px; }
.article-lead { font-size: 19px; line-height: 1.65; color: var(--text-muted); }

.callout {
  display: flex; gap: 14px; align-items: flex-start; background: var(--hero-wash);
  border-radius: 8px; padding: 18px 20px; margin: 8px 0 28px; font-size: 14.5px; line-height: 1.6;
}
.callout svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 32px; font-size: 13px; color: var(--text-muted-2); }
.article-share { display: flex; align-items: center; gap: 12px; padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 44px; }
.article-share span.label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.share-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

.related-articles { max-width: 1200px; margin: 0 auto; padding: 0 64px 64px; }
.related-articles h3 { font-size: 20px; font-weight: 700; margin-bottom: 22px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .site-header { padding: 0 16px; gap: 10px; height: 64px; }
  .site-logo-tagline { display: none; }
  .site-logo-image { height: 30px; }
  .site-search { display: none; }
  .primary-nav { display: none; }
  .mobile-menu-toggle, .mobile-search-toggle { display: flex; }

  /*
   * Fixed (not static) so these panels always appear right under the
   * header — otherwise, as plain siblings of a sticky header, they sit at
   * their original spot in the document and open off-screen once the page
   * has been scrolled past that point.
   */
  .mobile-search-bar {
    display: none; position: fixed; top: 64px; left: 0; right: 0; z-index: 49;
    padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
  }
  .mobile-search-bar.is-open { display: block; }

  .mobile-nav {
    display: none; position: fixed; top: 64px; left: 0; right: 0; z-index: 49;
    max-height: calc(100vh - 64px); overflow-y: auto;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 16px;
    box-shadow: 0 8px 24px var(--shadow-color);
  }
  .mobile-nav.is-open { display: block; }
  .mobile-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
  .mobile-nav a { padding: 10px 0; font-size: 15px; color: var(--text); border-bottom: 1px solid var(--border); display: block; }
  .mobile-nav li:last-child a { border-bottom: none; }

  .hero-section { padding: 18px 16px 24px; grid-template-columns: 1fr; }
  .hero-main-thumb { height: 150px; }
  .hero-main-body { padding: 14px; gap: 8px; }
  .hero-main-body h2 { font-size: 18px; }
  .hero-side { gap: 14px; }
  .hero-side-thumb { width: 64px; height: 64px; }

  .content-wrap { padding: 24px 16px 32px; flex-direction: column; }
  .sidebar { order: 2 !important; flex: none; }
  .main-col { order: 1 !important; }

  .filter-pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-pill { flex-shrink: 0; }

  .article-grid { grid-template-columns: 1fr; }
  .article-card-thumb { height: 120px; }
  .pagination-wrap, .nav-links { margin-top: 20px; }
  .page-numbers { min-width: 34px; height: 34px; padding: 0 8px; font-size: 13px; }

  .site-footer { padding: 24px 16px; align-items: center; text-align: center; }
  .site-footer-top { flex-direction: column; }
  .site-footer-right { justify-content: center; }

  .breadcrumb, .article-header, .article-featured-image, .article-body, .related-articles { padding-left: 16px; padding-right: 16px; }
  .article-header h1 { font-size: 26px; }
  .article-featured-image .thumb-frame { height: 220px; }
  .related-articles .article-grid { grid-template-columns: 1fr; }
}
