/* ============================================================
   MES DÉPÊCHES — Main Stylesheet
   ============================================================ */

/* ------------------------------------------------------------
   1. FONTS
   ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,300;0,400;0,600;1,300&family=Playfair+Display:ital,wght@0,400;0,500;0,700;1,400;1,500&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300;1,400&display=swap');

/* ------------------------------------------------------------
   2. CSS VARIABLES
   ------------------------------------------------------------ */
:root {
  /* Colors */
  --color-navy:       #1a2744;
  --color-navy-mid:   #243155;
  --color-navy-light: #344570;
  --color-ink:        #1c1c1c;
  --color-body:       #2e2e2e;
  --color-muted:      #7a7a7a;
  --color-rule:       #ddd8d0;
  --color-bg:         #f8f5f0;
  --color-white:      #ffffff;
  --color-accent:     #1a2744;   /* navy is the accent */
  --color-tag-bg:     #eceae6;

  /* Typography */
  --font-serif:  'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:   'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title:  'Josefin Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --col-width:    720px;
  --col-padding:  clamp(1.25rem, 5vw, 2.5rem);
  --section-gap:  clamp(3rem, 7vw, 5rem);
}

/* ------------------------------------------------------------
   3. RESET & BASE
   ------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-body);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ------------------------------------------------------------
   4. LAYOUT UTILITIES
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--col-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--col-padding);
  padding-right: var(--col-padding);
}

/* ------------------------------------------------------------
   5. SITE HEADER
   ------------------------------------------------------------ */
.site-header {
  border-bottom: none;
  padding: 1.75rem 0;
  background-color: var(--color-navy);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Reading progress bar — sits at bottom edge of header, single posts only */
.reading-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.5);
  transition: width 0.05s linear;
  pointer-events: none;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1100px;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.site-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-white);
  line-height: 1.2;
}

.site-title span {
  font-style: normal;
  font-weight: 300;
}

.site-logo-sep {
  display: inline-block;
  width: 1px;
  height: 1.1em;
  background-color: rgba(255, 255, 255, 0.3);
  margin: 0 0.85rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
}

.site-nav a:hover {
  color: var(--color-white);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--color-white);
}

.nav-toggle svg {
  display: block;
}

/* ------------------------------------------------------------
   6. SITE TAGLINE (homepage only)
   ------------------------------------------------------------ */
.site-tagline {
  text-align: center;
  padding: 0.65rem 0;
  border-bottom: none;
  background-color: #e0ddd7;
}

.site-tagline p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-weight: 400;
}

/* ------------------------------------------------------------
   7. POST LIST (homepage / archive)
   ------------------------------------------------------------ */
.post-list {
  padding: var(--section-gap) 0;
}

.post-list article {
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--color-rule);
}

.post-list article:last-child {
  border-bottom: none;
}

/* Featured image on list */
.post-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-thumbnail:hover img {
  transform: scale(1.02);
}

/* Post meta */
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.post-date {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.post-tag {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-navy-light);
  background-color: var(--color-tag-bg);
  padding: 0.2em 0.55em;
  border-radius: 2px;
  transition: background-color 0.15s ease;
}

.post-tag:hover {
  background-color: var(--color-navy);
  color: var(--color-white);
}

/* Post title */
.post-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-navy);
  margin-bottom: 0.85rem;
}

.post-title a {
  transition: color 0.2s ease;
}

.post-title a:hover {
  color: var(--color-navy-light);
}

/* Excerpt */
.post-excerpt {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.7;
}

.read-more {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-navy);
  border-bottom: 1px solid var(--color-navy);
  padding-bottom: 1px;
  transition: opacity 0.2s ease;
}

.read-more:hover {
  opacity: 0.6;
}

/* ------------------------------------------------------------
   7B. MAGAZINE GRID (homepage)
   ------------------------------------------------------------ */
.magazine {
  padding: var(--section-gap) 0;
}

.magazine .container {
  max-width: 1100px;
}

/* An "issue" = 6 posts in a hero + 3-row + 2/1-row layout.
   Issues flow into each other without a divider — just breathing room. */
.issue {
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.issue:last-of-type {
  margin-bottom: 0;
}

/* HERO (issue position 0) ───────────────────────────── */
.mag-hero {
  margin-bottom: 2.25rem;
}

.mag-hero-img {
  display: block;
  width: 100%;
  height: 420px;
  background-size: cover;
  background-position: center;
  background-color: var(--color-tag-bg);
  margin-bottom: 1.1rem;
  overflow: hidden;
  transition: opacity 0.25s ease;
}

.mag-hero-img:hover {
  opacity: 0.92;
}

.mag-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.mag-date {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-navy);
}

.mag-loc {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted);
  position: relative;
  padding-left: 0.85rem;
}

.mag-loc::before {
  content: "·";
  position: absolute;
  left: 0;
  color: #c0bbb0;
}

.mag-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--color-navy);
  margin-bottom: 0.6rem;
}

.mag-hero-title a {
  transition: color 0.2s ease;
}

.mag-hero-title a:hover {
  color: var(--color-navy-light);
}

.mag-hero-excerpt {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-muted);
  max-width: 80%;
}

/* TILE ROWS ──────────────────────────────────────────── */
.issue-row {
  display: grid;
  gap: 1rem;
}

.issue-row-3 {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 1rem;
}

.issue-row-2 {
  grid-template-columns: 2fr 1fr;
}

/* Each tile = anchor with an inner image div + info overlay */
.mag-tile {
  position: relative;
  display: block;
  overflow: hidden;
  text-decoration: none;
}

.mag-tile-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--color-tag-bg);
  transition: transform 0.4s ease;
}

.mag-tile:hover .mag-tile-bg {
  transform: scale(1.03);
}

.mag-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 35%,
    rgba(26, 39, 68, 0.55) 70%,
    rgba(26, 39, 68, 0.92) 100%
  );
  transition: opacity 0.25s ease;
  z-index: 1;
  pointer-events: none;
}

.mag-tile:hover::after {
  opacity: 0.85;
}

.issue-row-3 .mag-tile {
  height: 320px;
}

.issue-row-2 .mag-tile {
  height: 380px;
}

.mag-tile-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.25rem 1.35rem 1.15rem;
  z-index: 2;
  color: var(--color-white);
}

.mag-tile-meta {
  font-family: var(--font-title);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.4rem;
}

.mag-tile-meta .dot {
  margin: 0 0.4rem;
  opacity: 0.5;
}

.mag-tile-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.22;
  color: var(--color-white);
}

.issue-row-2 .mag-tile-narrow .mag-tile-title {
  font-size: 1.05rem;
}

/* ------------------------------------------------------------
   8. PAGINATION
   ------------------------------------------------------------ */
.pagination {
  padding: 2rem 0 var(--section-gap);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.pagination a,
.pagination span {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  padding: 0.4em 0.8em;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: all 0.15s ease;
}

.pagination a:hover {
  color: var(--color-navy);
  border-color: var(--color-rule);
}

.pagination .current {
  color: var(--color-navy);
  border-color: var(--color-navy);
}

/* ------------------------------------------------------------
   9. SINGLE POST
   ------------------------------------------------------------ */
.post-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.post-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-header {
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.post-header .post-meta {
  margin-bottom: 1rem;
}

.post-header .post-title {
  font-size: clamp(1.8rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin-bottom: 0;
}

/* Post body content */
.post-content {
  font-size: clamp(1rem, 2.5vw, 1.08rem);
  line-height: 1.85;
}

.post-content p {
  margin-bottom: 1.5em;
}

.post-content p:last-child {
  margin-bottom: 0;
}

.post-content h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 500;
  color: var(--color-navy);
  margin: 2.5em 0 0.75em;
  line-height: 1.25;
}

.post-content h3 {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 2em 0 0.75em;
}

.post-content a {
  color: var(--color-navy);
  border-bottom: 1px solid var(--color-rule);
  transition: border-color 0.2s ease;
}

.post-content a:hover {
  border-color: var(--color-navy);
}

.post-content blockquote {
  border-left: 2px solid var(--color-navy);
  padding-left: 1.5rem;
  margin: 2em 0;
  font-style: italic;
  color: var(--color-muted);
}

.post-content ul,
.post-content ol {
  list-style: initial;
  padding-left: 1.5em;
  margin-bottom: 1.5em;
}

.post-content ol {
  list-style: decimal;
}

.post-content li {
  margin-bottom: 0.4em;
}

/* In-post images */
.post-content img,
.post-content figure {
  width: 100%;
  margin: 2.5em 0;
}

.post-content figure figcaption {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  margin-top: 0.6rem;
  text-align: center;
}

/* Section divider — WordPress HR */
.post-content hr {
  border: none;
  text-align: center;
  margin: 3em 0;
  color: var(--color-muted);
  font-size: 1rem;
  letter-spacing: 0.5em;
}

.post-content hr::after {
  content: '· · ·';
}

/* ------------------------------------------------------------
   10. POST NAVIGATION
   ------------------------------------------------------------ */
.post-navigation {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--color-rule);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.post-nav-link {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 45%;
}

.post-nav-link span {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-navy);
  line-height: 1.3;
}

.post-nav-link:hover span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-nav-prev { align-items: flex-start; }
.post-nav-next { align-items: flex-end; text-align: right; }

/* ------------------------------------------------------------
   11. COMMENTS (minimal, only shown if comments exist)
   ------------------------------------------------------------ */
.comments-area {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--color-rule);
}

.comments-title {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 2rem;
}

.comment-body {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-rule);
}

.comment-author {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-navy);
  margin-bottom: 0.5rem;
}

.comment-content {
  font-size: 0.95rem;
  line-height: 1.7;
}

/* Comment form — hidden by default (personal journal) */
.comment-respond {
  display: none;
}

/* ------------------------------------------------------------
   12. SITE FOOTER
   ------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--color-rule);
  padding: 2.5rem 0;
  margin-top: var(--section-gap);
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.footer-logo {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.footer-name {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-muted);
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

/* ------------------------------------------------------------
   13. ABOUT PAGE
   ------------------------------------------------------------ */
.page-content {
  padding: var(--section-gap) 0;
}

.page-content article {
  padding-left: var(--col-padding);
  padding-right: var(--col-padding);
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 500;
  color: var(--color-navy);
  margin-bottom: 2rem;
  line-height: 1.15;
}

/* ------------------------------------------------------------
   14. RESPONSIVE — TABLET
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  html {
    font-size: 17px;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-navy);
    border-bottom: 1px solid var(--color-navy-mid);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 0;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.75rem var(--col-padding);
    width: 100%;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .post-navigation {
    flex-direction: column;
    gap: 1.5rem;
  }

  .post-nav-link {
    max-width: 100%;
  }

  .post-nav-next {
    align-items: flex-start;
    text-align: left;
  }

  /* Magazine grid — tablet: shorten heroes and tiles slightly */
  .mag-hero-img {
    height: 340px;
  }

  .mag-hero-excerpt {
    max-width: 100%;
  }

  .issue-row-3 .mag-tile,
  .issue-row-2 .mag-tile {
    height: 240px;
  }
}

/* ------------------------------------------------------------
   15. RESPONSIVE — MOBILE
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .site-header {
    padding: 1.25rem 0;
  }

  .site-title {
    font-size: 1.15rem;
  }

  .post-thumbnail {
    aspect-ratio: 4 / 3;
  }

  .post-hero {
    aspect-ratio: 4 / 3;
  }

  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Magazine grid — mobile: full collapse to single column.
     Tiles flatten: image (fixed height) → navy meta + title below on cream. */
  .issue-row-3,
  .issue-row-2 {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    margin-bottom: 0;
  }

  .issue-row {
    margin-bottom: 1.75rem;
  }

  .mag-hero-img {
    height: 240px;
  }

  .mag-hero-title {
    font-size: 1.5rem;
  }

  .mag-hero-excerpt {
    font-size: 0.92rem;
  }

  /* Tile flattens into a card */
  .issue-row .mag-tile {
    height: auto;
    display: block;
  }

  .issue-row .mag-tile-bg {
    position: relative;
    inset: auto;
    width: 100%;
    height: 220px;
    display: block;
    margin-bottom: 0.85rem;
  }

  /* Hide the dark gradient overlay on mobile */
  .issue-row .mag-tile::after {
    display: none;
  }

  /* Reset info from absolute → static, and flip text color to navy */
  .issue-row .mag-tile-info {
    position: static;
    padding: 0;
    color: var(--color-navy);
  }

  .issue-row .mag-tile-meta {
    color: var(--color-navy);
  }

  .issue-row .mag-tile-meta .dot {
    color: #c0bbb0;
    opacity: 1;
  }

  .issue-row .mag-tile-title {
    color: var(--color-navy);
    font-size: 1.1rem;
  }

  /* Disable hover scale on touch */
  .mag-tile:hover .mag-tile-bg {
    transform: none;
  }
}
