/*
Theme Name: Panache Twenty-Six
Author: Christophe
Description: Minimal running and reading theme with a day/night Panache palette
Version: 4.0 (Panache 2.0)
*/

/* ============================================================
   TABLE OF CONTENTS
   ------------------------------------------------------------
   01. Palette: day, night and system night mode
   02. Base and reset
   03. Typography and fonts
   04. Layout containers
   05. Header and navigation
   06. Footer
   07. Shared components (legend, entry boxes, countdown, selector)
   08. Home page
   09. Reading page
   10. Running page
   11. About page
   12. Blog: notes and articles
   13. Accessibility and motion
   14. Responsive
   ============================================================ */


/* ============================================================
   01. PALETTE: DAY, NIGHT AND SYSTEM NIGHT MODE
   ------------------------------------------------------------
   Day is the default. Night applies when body has .theme-night,
   or automatically when the visitor's system is set to dark and
   body has no explicit .theme-day class.
   The night values appear twice (media query + class) because
   plain CSS cannot share one block between the two.
   ============================================================ */

:root,
body.theme-day {
  --header-h: 60px;
  --footer-h: 50px;

  --font-heading: "Bricolage Grotesque Variable", "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Literata Variable", "Literata", Georgia, "Times New Roman", serif;
  --heading-weight: 500;

  --bg-main: #F6F1E7;
  --text-main: #1E1A17;
  --text-muted: #6B635A;
  --title-color: #14110F;
  --accent-color: #C8321B;
  --signature-color: #8E2210;

  --box-bg-color: rgba(255, 255, 255, 0.5);
  --border-color: rgba(30, 26, 23, 0.2);

  /* Reading */
  --accent-fiction-color: #3949C9;
  --accent-nonfiction-color: #2F7D4F;

  /* Running */
  --accent-regular-color: #3A3F4B;
  --accent-superhalforiginals-color: #A16207;
  --accent-superhalfeuropa-color: #C7322A;
  --accent-greathalf-color: #B5176B;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  body:not(.theme-day) {
    --bg-main: #121016;
    --text-main: #E9E3D8;
    --text-muted: #A39B90;
    --title-color: #FFF7E8;
    --accent-color: #FF6B4A;
    --signature-color: #FF9A80;

    --box-bg-color: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.15);

    --accent-fiction-color: #7C8CFF;
    --accent-nonfiction-color: #5FCB8B;

    --accent-regular-color: #AEB4C2;
    --accent-superhalforiginals-color: #F2B84B;
    --accent-superhalfeuropa-color: #FF6B61;
    --accent-greathalf-color: #FF5FA8;

    color-scheme: dark;
  }
}

body.theme-night {
  --bg-main: #121016;
  --text-main: #E9E3D8;
  --text-muted: #A39B90;
  --title-color: #FFF7E8;
  --accent-color: #FF6B4A;
  --signature-color: #FF9A80;

  --box-bg-color: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.15);

  --accent-fiction-color: #7C8CFF;
  --accent-nonfiction-color: #5FCB8B;

  --accent-regular-color: #AEB4C2;
  --accent-superhalforiginals-color: #F2B84B;
  --accent-superhalfeuropa-color: #FF6B61;
  --accent-greathalf-color: #FF5FA8;

  color-scheme: dark;
}


/* ============================================================
   02. BASE AND RESET
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg-main);
  color: var(--text-main);
  transition: background 0.4s ease, color 0.4s ease;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--signature-color);
}

img {
  max-width: 100%;
  height: auto;
}


/* ============================================================
   03. TYPOGRAPHY AND FONTS
   ------------------------------------------------------------
   Headings: Bricolage Grotesque. Body and UI text: Literata.
   Both are variable fonts, self-hosted from the /fonts folder
   next to this file (SIL Open Font License, see fonts/README.txt).
   If a font file fails to load, the fallback stacks in section 01
   take over.
   ============================================================ */

@font-face {
  font-family: "Bricolage Grotesque Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Bricolage Grotesque Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("fonts/bricolage-grotesque-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Literata Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("fonts/literata-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Literata Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("fonts/literata-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Literata Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url("fonts/literata-latin-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Literata Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url("fonts/literata-latin-ext-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.section-title,
.page-title,
.site-title,
.month,
.entry-title {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
}

.section-title,
.page-title {
  color: var(--accent-color);
  letter-spacing: 0.01em;
  text-align: center;
  margin: 0 0 2rem;
}


/* ============================================================
   04. LAYOUT CONTAINERS
   ------------------------------------------------------------
   Every page container clears the fixed header and footer.
   ============================================================ */

.page-content,
.calendar-container,
.home-container,
.books-page,
.running-page,
.about-page {
  max-width: 800px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 2.5rem) 1.25rem calc(var(--footer-h) + 2.5rem);
}


/* ============================================================
   05. HEADER AND NAVIGATION
   ============================================================ */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-main);
  border-bottom: 2px solid var(--accent-color);
  transition: background 0.4s ease;
}

.site-title {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  color: var(--title-color);
}

.menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.menu a {
  position: relative;
  padding: 4px 0;
  color: var(--text-main);
}

.menu a:hover {
  color: var(--accent-color);
}

.menu a[aria-current="page"],
.menu .current-menu-item > a,
.menu .current_page_item > a {
  color: var(--accent-color);
  box-shadow: inset 0 -2px 0 var(--accent-color);
}

.threads-link svg {
  vertical-align: middle;
}


/* ============================================================
   06. FOOTER
   ============================================================ */

.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--footer-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-main);
  border-top: 1px solid var(--border-color);
  transition: background 0.4s ease;
}


/* ============================================================
   07. SHARED COMPONENTS
   ============================================================ */

/* --- Legend (Reading and Running) --- */

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.5rem;
  margin: 1.25rem 0 2rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-fiction            { background: var(--accent-fiction-color); }
.legend-nonfiction         { background: var(--accent-nonfiction-color); }
.legend-regular            { background: var(--accent-regular-color); }
.legend-superhalforiginals { background: var(--accent-superhalforiginals-color); }
.legend-superhalfeuropa    { background: var(--accent-superhalfeuropa-color); }
.legend-greathalf          { background: var(--accent-greathalf-color); }

/* Backward compatibility: the old class name maps to Originals */
.legend-superhalf          { background: var(--accent-superhalforiginals-color); }

/* --- Month headings --- */

.book-list .month,
.race-list .month {
  margin: 2rem 0 0.9rem;
  font-size: 1.5rem;
  color: var(--accent-color);
}

/* --- Entry box: one design for books and races ---
   The category colour sits on the left edge of the box.
   Set it with a class on the entry itself, for example:
   <div class="book-entry fiction"> or <div class="race-entry superhalfeuropa">
   Books whose category class sits on an inner element
   (<div class="book-entry"><span class="fiction">…) are
   handled too. */

.book-entry,
.race-entry {
  --entry-color: var(--accent-regular-color);

  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--box-bg-color);
  border: 1px solid var(--border-color);
  border-left: 6px solid var(--entry-color);
  border-radius: 6px;
}

/* Books: title first, date second */
.book-entry span:first-child {
  font-weight: 500;
}

.book-entry span + span {
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* Races: date first, race name second */
.race-entry span:first-child {
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.race-entry span + span {
  text-align: right;
  font-weight: 500;
  color: var(--text-main);
}

/* --- Countdown and year selector --- */

.countdown-box {
  text-align: center;
}

.countdown-text {
  font-size: 1.2em;
}

.countdown-text strong {
  color: var(--signature-color);
  font-weight: 500;
}

.year-selector {
  text-align: center;
  margin: 20px 0 30px;
}

.year-selector select {
  padding: 8px 12px;
  font: inherit;
  color: var(--text-main);
  background: var(--bg-main);
  border: 1px solid var(--accent-color);
  border-radius: 4px;
}


/* ============================================================
   08. HOME PAGE
   ============================================================ */

.intro-section {
  margin-bottom: 3rem;
}

.intro-section .section-title,
.intro-section .intro-text {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.intro-section .intro-text {
  line-height: 1.7;
}

.quote-box {
  margin: 3rem 0;
}

.quote-box .quote-text,
.quote-box .quote-author {
  text-align: center;
}

.quote-box .quote-author {
  margin-top: 0.5rem;
  font-style: italic;
  color: var(--text-muted);
}

.reading-box {
  margin-top: 3rem;
}

.reading-box .reading-text {
  text-align: center;
  margin-top: 0.5rem;
}


/* ============================================================
   09. READING PAGE
   ------------------------------------------------------------
   Two categories: Fiction and Non-fiction.
   ============================================================ */

.book-entry.fiction    { --entry-color: var(--accent-fiction-color); }
.book-entry.nonfiction { --entry-color: var(--accent-nonfiction-color); }

/* Fallback for markup where the category class is on a child.
   Kept as separate rules so older browsers skip them cleanly. */
.book-entry:has(.fiction)    { --entry-color: var(--accent-fiction-color); }
.book-entry:has(.nonfiction) { --entry-color: var(--accent-nonfiction-color); }


/* ============================================================
   10. RUNNING PAGE
   ------------------------------------------------------------
   Four categories: Regular, Super Halfs Originals,
   Super Halfs Europa and Great Halfs Series.
   ============================================================ */

.running-page .countdown-box {
  margin-bottom: 30px;
  padding: 20px;
  background: var(--box-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.race-list {
  margin-top: 20px;
}

.race-entry.regular            { --entry-color: var(--accent-regular-color); }
.race-entry.superhalforiginals { --entry-color: var(--accent-superhalforiginals-color); }
.race-entry.superhalfeuropa    { --entry-color: var(--accent-superhalfeuropa-color); }
.race-entry.greathalf          { --entry-color: var(--accent-greathalf-color); }

/* Backward compatibility: the old class name maps to Originals */
.race-entry.superhalf          { --entry-color: var(--accent-superhalforiginals-color); }

.race-entry .city {
  font-weight: 500;
}


/* ============================================================
   11. ABOUT PAGE
   ============================================================ */

.about-page .profile-pic img {
  display: block;
  margin: 0 auto 2rem;
  max-width: 180px;
  border-radius: 8px;
}

.about-page .simple-quote {
  margin: 1.5rem 0 2.5rem;
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
}

.about-page .bio-text {
  max-width: 700px;
  margin: 0 auto;
  text-align: left;
  font-size: 1.05rem;
  line-height: 1.7;
}

.about-page .bio-text p {
  margin: 0 0 1.6rem;
}


/* ============================================================
   12. BLOG: NOTES AND ARTICLES
   ============================================================ */

/* Notes page: date above title */
.note-item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.note-item .post-meta {
  order: -2;                        /* date en premier */
  margin-bottom: 0.3rem !important; /* !important: écrase le style inline */
}

/* Date et heure en plus petit */
.note-item .post-meta .meta-date {
  font-size: 0.6rem;
}

.note-item .section-title {
  order: -1;                        /* titre en deuxième */
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Short rule at the end of each note on the Notes page */
.note-item::after {
  content: "";
  display: block;
  width: 40%;
  height: 1px;
  margin: 30px auto 0;
  background: var(--accent-color);
  opacity: 0.6;
  order: 99;                        /* toujours en dernier */
  align-self: center;               /* reste centré */
}

/* Article list */
.post-item {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-item .entry-title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  color: var(--accent-color);
}

.post-item .entry-title a {
  color: inherit;
}

.post-item .entry-title a:hover {
  color: var(--signature-color);
}

.entry-excerpt {
  line-height: 1.7;
  color: var(--text-main);
}


/* ============================================================
   13. ACCESSIBILITY AND MOTION
   ============================================================ */

:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* ============================================================
   14. RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .top-bar,
  .footer-bar {
    padding: 0 1rem;
  }

  .site-title {
    font-size: 1rem;
    letter-spacing: 0.05em;
  }

  .menu {
    gap: 0.9rem;
    font-size: 0.95rem;
  }

  .page-content,
  .calendar-container,
  .home-container,
  .books-page,
  .running-page,
  .about-page {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .book-entry,
  .race-entry {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
  }

  .post-item .entry-title {
    font-size: 1.4rem;
  }
}