/* =========================================================
   CULTRAFAN - Main stylesheet
   ========================================================= */

/* ---------- 1. Color variables ---------- */
:root {
  --navy: #0d1b2a;
  --orange: #ff5722;
  --orange-dark: #e64a19;
  --slate: #415a77;
  --bg: #faf8f5;
  --card: #ffffff;
  --border: #e0e1dd;
  --text: #1b263b;
  --overlay: rgba(13, 27, 42, 0.85); /* navy, 85% opaque: gradient on hero photos */
  /* Shadows of the magazine covers (navy-tinted, like a printed magazine) */
  --shadow-cover: 0 2px 4px rgba(13, 27, 42, 0.12), 0 14px 30px rgba(13, 27, 42, 0.22);
  --shadow-cover-hover: 0 4px 8px rgba(13, 27, 42, 0.14), 0 26px 50px rgba(13, 27, 42, 0.3);

  /* Arabic text: Tajawal. The logo keeps Inter (Latin letters). */
  --font: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-logo: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --backdrop: rgba(13, 27, 42, 0.5); /* navy, 50%: dark layer behind the phone menu */
  --radius: 8px;
  --shadow: 0 2px 10px rgba(13, 27, 42, 0.06);
  --shadow-hover: 0 10px 28px rgba(13, 27, 42, 0.12);
  --max-width: 1200px;
}

/* ---------- 2. Base / reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.9; /* a little more room for Arabic letters */
  color: var(--text);
  background-color: var(--bg);
}

/* Buttons and form fields use the site font too */
button,
input,
select,
textarea {
  font-family: inherit;
}

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

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

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Elements with the "hidden" attribute are never shown (used by the search) */
[hidden] {
  display: none !important;
}

/* Hidden on screen but still read by Google and screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Leave room for the sticky header when jumping to a section */
section[id] {
  scroll-margin-top: 90px;
}

/* ---------- 3. Shared components ---------- */

/* Orange category label */
.tag {
  display: inline-block;
  background-color: var(--orange);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
}

.meta {
  font-size: 0.85rem;
  color: var(--slate);
}

.btn {
  display: inline-block;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background-color: var(--orange);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--orange-dark);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--navy);
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy);
}

.section-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
}

.section-link:hover {
  color: var(--orange-dark);
}

/* ---------- 4. Logo ---------- */
/* The logo stays in Latin letters with Inter, left-to-right (dir="ltr" in the HTML) */
.logo {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  font-family: var(--font-logo);
}

.logo-text {
  font-size: 2rem;
  letter-spacing: -0.03em;
  color: var(--navy);
}

.logo-light {
  font-weight: 400;
}

.logo-accent {
  font-weight: 800;
  color: var(--orange);
}

.logo-bold {
  font-weight: 800;
}

.logo-tagline {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--slate);
  margin-top: 6px;
}

/* ---------- 5. Header & navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
}

/* The menu takes the free space between the logo and the buttons.
   js/main.js moves the categories that don't fit into the "Plus ▾" dropdown. */
.main-nav {
  display: flex;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  margin-inline-start: 24px;
}

.main-nav ul {
  display: flex;
  gap: 32px;
}

.main-nav > ul {
  flex: none;
  align-items: center;
}

.main-nav li {
  white-space: nowrap;
}

/* Items that only exist on one screen size */
.nav-mobile-only {
  display: none;
}

.main-nav a {
  position: relative;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  padding: 6px 0;
  transition: color 0.2s;
}

/* Orange underline that slides in on hover */
.main-nav a::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--orange);
  transition: width 0.25s;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--orange);
}

.main-nav a:hover::after,
.main-nav a.active::after {
  width: 100%;
}

/* "Plus ▾" dropdown (desktop) */
.nav-more {
  position: relative;
}

.nav-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-more-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.2s;
}

.nav-more-btn:hover,
.nav-more-btn.has-active,
.nav-more-btn[aria-expanded="true"] {
  color: var(--orange);
}

.nav-more-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.main-nav .nav-more-list {
  position: absolute;
  top: calc(100% + 14px);
  inset-inline-end: 0;
  z-index: 10;
  display: block;
  min-width: 220px;
  padding: 8px 0;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}

.main-nav .nav-more-list a {
  display: block;
  padding: 10px 20px;
}

.main-nav .nav-more-list a::after {
  display: none;
}

/* Search + hamburger buttons on the right */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 24px;
}

/* Desktop: | separator, magazine button, social icons (hidden on phones) */
.header-extras {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-inline-end: 8px;
}

.header-sep {
  width: 1px;
  height: 24px;
  background-color: var(--border);
}

.header-social {
  display: flex;
  gap: 8px;
}

.header-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--bg);
  transition: background-color 0.2s;
}

.header-social svg {
  width: 16px;
  height: 16px;
  fill: var(--navy);
  transition: fill 0.2s;
}

.header-social a:hover {
  background-color: var(--orange);
}

.header-social a:hover svg {
  fill: #fff;
}

/* "Télécharger le magazine" button */
.header-magazine {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background-color: var(--orange);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.header-magazine:hover {
  background-color: var(--orange-dark);
}

.header-magazine svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-toggle svg {
  width: 22px;
  height: 22px;
  fill: var(--navy);
  transition: fill 0.2s;
}

.search-toggle:hover,
.search-toggle[aria-expanded="true"] {
  background-color: var(--bg);
}

.search-toggle:hover svg,
.search-toggle[aria-expanded="true"] svg {
  fill: var(--orange);
}

/* Search bar that drops down under the header */
.search-panel {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px 0;
}

.search-form {
  display: flex;
  gap: 12px;
}

.search-form input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  padding: 12px 16px;
  background-color: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

.search-form input:focus {
  border-color: var(--orange);
}

.search-form .btn {
  flex-shrink: 0;
}

.search-status {
  font-size: 0.88rem;
  color: var(--slate);
}

.search-status:not(:empty) {
  margin-top: 10px;
}

/* Hamburger button: hidden on desktop */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--navy);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* Hamburger menu content (À propos, Contact...): only used on phones */
.mobile-menu {
  display: none;
}

/* Turn the 3 lines into an "X" when the menu is open */
.menu-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- 6. "À la une": Tendances bar + hero grid ---------- */
.hero {
  padding-top: 32px;
  padding-bottom: 56px;
}

/* Tendances bar */
.trending {
  display: flex;
  align-items: center;
  height: 44px;
  margin-bottom: 16px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.trending-label {
  display: flex;
  align-items: center;
  align-self: stretch;
  flex-shrink: 0;
  padding: 0 16px;
  background-color: var(--navy);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.trending-items {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0 16px;
}

/* All titles are stacked on top of each other; only the active one is visible */
.trending-item {
  position: absolute;
  inset: 0;
  line-height: 42px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s, color 0.2s;
}

.trending-item.is-active {
  opacity: 1;
  visibility: visible;
}

.trending-item:hover {
  color: var(--orange);
}

.trending-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  padding-inline-end: 8px;
}

.trending-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--navy);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.trending-btn:hover {
  color: var(--orange);
  border-color: var(--orange);
}

.trending-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transform: scaleX(-1); /* arrows mirrored for right-to-left: "previous" points right */
}

/* Hero grid: big article on the left half, the 3 others (.hero-side) on the right half */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  height: 480px;
  /* Rounds only the outer corners of the whole grid */
  border-radius: var(--radius);
  overflow: hidden;
}

/* Right half: wide article on top, 2 small ones below */
.hero-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  min-height: 0;
}

.hero-item--wide {
  grid-column: 1 / -1;
}

.hero-item {
  position: relative;
  display: block;
  overflow: hidden;
  background-color: var(--navy);
  color: #fff;
}

.hero-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.hero-item:hover img {
  transform: scale(1.05);
}

.hero-item:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: -3px;
}

/* Dark gradient at the bottom so the white text is readable */
.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 20px;
  background: linear-gradient(to bottom, transparent 35%, var(--overlay) 100%);
}

.hero-title {
  margin-top: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.5;
  color: #fff;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s;
}

.hero-item:hover .hero-title,
.hero-item:focus-visible .hero-title {
  text-decoration-color: #fff;
}

.hero-item--big .hero-overlay {
  padding: 32px;
}

.hero-item--big .hero-title {
  max-width: 90%;
  font-size: 2rem;
  line-height: 1.4;
}

.hero-item--wide .hero-title {
  font-size: 1.4rem;
}

.hero-meta {
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
}

/* While searching, the grid becomes a simple list of the matching blocks */
.hero-grid.is-filtered {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-template-rows: none;
  grid-auto-rows: 260px;
  height: auto;
}

/* "contents" removes the .hero-side box so its articles join the main list */
.hero-grid.is-filtered .hero-side {
  display: contents;
}

.hero-grid.is-filtered .hero-item {
  grid-column: auto;
  flex: none;
  height: auto;
}

/* Used on phones: the search bar and the hamburger menu slide down */
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Used on phones: the hamburger menu slides in from the right edge */
@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: none;
  }
}

/* Less movement for people who turned off animations in their system */
@media (prefers-reduced-motion: reduce) {
  .trending-item,
  .hero-item img {
    transition: none;
  }

  .search-panel,
  .mobile-menu {
    animation: none !important;
  }
}

/* ---------- 7. Homepage sections & article cards ---------- */
.home-section {
  padding: 64px 0;
}

/* "Dernières publications" sits right under "À la une" */
.home-section.latest {
  padding-top: 0;
}

/* Every other section gets a white band, to separate categories */
.home-section.section-alt {
  background-color: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-image {
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

.card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 22px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--navy);
}

.card-title a:hover {
  color: var(--orange);
}

.card-date {
  font-size: 0.8rem;
  color: var(--slate);
}

.card-summary {
  font-size: 0.93rem;
  color: var(--text);
  opacity: 0.85;
}

/* ---------- 8. Footer ---------- */
.site-footer {
  background-color: var(--navy);
  color: rgba(255, 255, 255, 0.75);
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  padding-top: 56px;
  padding-bottom: 48px;
}

/* On the navy background, the navy logo parts become white */
.logo-footer .logo-text {
  color: #fff;
}

.logo-footer .logo-tagline {
  color: rgba(255, 255, 255, 0.6);
}

.footer-about {
  margin-top: 18px;
  max-width: 320px;
  font-size: 0.92rem;
}

.site-footer h4 {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.footer-links li + li {
  margin-top: 10px;
}

.footer-links a {
  font-size: 0.92rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--orange);
}

.social-icons {
  display: flex;
  gap: 12px;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.08);
  transition: background-color 0.2s;
}

.social-icons a:hover {
  background-color: var(--orange);
}

.social-icons svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
}

/* =========================================================
   INNER PAGES (categorie, article, à propos, contact...)
   ========================================================= */

/* ---------- 9. Page header (title area of inner pages) ---------- */
.page-hero {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 36px 0 44px;
}

.page-title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--navy);
  margin-top: 14px;
}

.page-intro {
  max-width: 680px;
  margin-top: 14px;
  font-size: 1.1rem;
  color: var(--slate);
}

.page-count {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
}

.page-body {
  padding: 56px 0 72px;
}

/* Narrow column for comfortable reading (720px of text) */
.container-narrow {
  max-width: 760px;
}

/* "Accueil / Cinéma" path */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  font-size: 0.85rem;
  color: var(--slate);
}

.breadcrumb li + li::before {
  content: "/";
  margin: 0 8px;
  color: var(--border);
}

.breadcrumb a:hover {
  color: var(--orange);
}

/* ---------- 10. Category page: pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 24px;
  margin-top: 48px;
}

.pagination-link {
  display: inline-block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  padding: 10px 20px;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  transition: background-color 0.2s, color 0.2s;
}

.pagination-link:hover {
  background-color: var(--navy);
  color: #fff;
}

.pagination-link.is-disabled {
  border-color: var(--border);
  color: var(--slate);
  opacity: 0.5;
  pointer-events: none;
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--slate);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--slate);
}

.empty-state p {
  margin-bottom: 20px;
}

/* ---------- 11. Article page ---------- */
.article-header {
  padding-top: 36px;
}

.article-header .tag {
  margin-top: 24px;
}

.article-title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--navy);
  margin-top: 16px;
}

.article-subtitle {
  margin-top: 16px;
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--slate);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--slate);
}

.article-meta strong {
  color: var(--navy);
}

.article-hero {
  max-width: 1100px;
  margin: 36px auto 44px;
}

.article-hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Readable text: used by articles, "À propos" and "Collaborations" */
.prose {
  font-size: 1.125rem;
  line-height: 1.95;
}

.prose p {
  margin-bottom: 1.4em;
}

.prose .lead {
  font-size: 1.3rem;
  line-height: 1.85;
  color: var(--navy);
}

.prose h2 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--navy);
  margin: 2em 0 0.7em;
}

.prose > h2:first-child {
  margin-top: 0;
}

.prose a {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--orange-dark);
}

.prose ul {
  list-style: disc;
  padding-inline-start: 1.4em;
  margin-bottom: 1.4em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose blockquote {
  margin: 2em 0;
  padding-block: 4px;
  padding-inline: 24px 0;
  border-inline-start: 4px solid var(--orange);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--navy);
}

.prose blockquote cite {
  display: block;
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 400;
  font-style: normal;
  color: var(--slate);
}

.prose figure,
.article-hero {
  margin-inline-start: auto;
  margin-inline-end: auto;
}

.prose figure {
  margin-top: 2.2em;
  margin-bottom: 2.2em;
}

.prose figure img {
  width: 100%;
  border-radius: var(--radius);
}

figcaption {
  margin-top: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--slate);
}

/* Responsive YouTube video (always 16:9) */
.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: var(--navy);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Keywords + share buttons */
.article-footer {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.article-tags,
.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.share {
  margin-top: 24px;
}

.footer-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  margin-inline-end: 4px;
}

.tag-link {
  font-size: 0.82rem;
  color: var(--slate);
  padding: 5px 12px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s;
}

.tag-link:hover {
  color: var(--orange);
  border-color: var(--orange);
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--navy);
  transition: background-color 0.2s;
}

.share-btn:hover {
  background-color: var(--orange);
}

.share-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

.copy-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.copy-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.copy-link:hover,
.copy-link.copied {
  color: var(--orange);
  border-color: var(--orange);
}

/* ---------- 12. Feature cards (À propos, Collaborations) ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 1.6em 0 2.2em;
}

.feature-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius);
  padding: 24px;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--navy);
  margin-bottom: 8px;
}

.prose .feature-card p,
.feature-card p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--slate);
}

.page-image {
  margin-bottom: 2.4em;
}

.page-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}

/* List of categories on the "À propos" page */
.prose .category-list {
  list-style: none;
  padding-inline-start: 0;
}

.category-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.prose .category-list li + li {
  margin-top: 0;
}

.prose .category-list a {
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
}

.prose .category-list a:hover {
  color: var(--orange);
}

.category-list span {
  display: block;
  font-size: 0.98rem;
  color: var(--slate);
}

/* Navy call-to-action box */
.cta-box {
  margin-top: 48px;
  padding: 40px 32px;
  text-align: center;
  background-color: var(--navy);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.75);
}

.prose .cta-box h2 {
  margin: 0 0 10px;
  color: #fff;
}

.prose .cta-box p {
  margin-bottom: 24px;
}

.prose .cta-box .btn {
  color: #fff;
  text-decoration: none;
}

.prose .cta-box .cta-note {
  margin: 18px 0 0;
  font-size: 0.9rem;
}

.prose .cta-box .cta-note a {
  color: #fff;
}

/* ---------- 13. Contact page ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 40px;
  align-items: start;
}

.form-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}

.form-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
}

.form-note {
  margin: 6px 0 24px;
  font-size: 0.88rem;
  color: var(--slate);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-field label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  padding: 12px 16px;
  background-color: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

/* The email field is written left-to-right but stays aligned with the other fields */
.form-field input[dir="ltr"] {
  text-align: right;
}

.form-field textarea {
  min-height: 160px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--orange);
}

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
  border-color: var(--orange-dark);
}

.field-error {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--orange-dark);
}

.field-error:empty {
  display: none;
}

.form-success {
  margin-bottom: 24px;
  padding: 16px 20px;
  background-color: var(--bg);
  border-inline-start: 4px solid var(--orange);
  border-radius: var(--radius);
  color: var(--navy);
  outline: none;
}

.contact-card {
  background-color: var(--navy);
  border-radius: var(--radius);
  padding: 32px;
  color: rgba(255, 255, 255, 0.75);
}

.contact-card h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 24px;
}

.contact-card dt {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--orange);
}

.contact-card dd {
  margin: 4px 0 20px;
  color: #fff;
}

.contact-card a:hover {
  color: var(--orange);
}

.contact-card .contact-social {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.92rem;
}

.contact-card .contact-social a {
  font-weight: 700;
  color: #fff;
}

.contact-card .contact-social a:hover {
  color: var(--orange);
}

/* ---------- 14. Social networks page ---------- */
.social-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.social-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  transition: transform 0.25s, box-shadow 0.25s;
}

.social-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.social-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  border-radius: 50%;
  background-color: var(--navy);
  transition: background-color 0.25s;
}

.social-card:hover .social-card-icon {
  background-color: var(--orange);
}

.social-card-icon svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.social-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--navy);
}

.social-handle {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate);
}

.social-card p {
  flex-grow: 1;
  margin-bottom: 8px;
}

/* ---------- 15. Responsive ---------- */

/* Medium desktop: tighter menu so the header stays on one line */
@media (max-width: 1240px) {
  .main-nav ul {
    gap: 22px;
  }

  .main-nav a {
    font-size: 0.9rem;
  }

  .header-extras {
    gap: 12px;
  }
}

/* Medium screens: a bit less space between categories */
@media (max-width: 1100px) {
  .main-nav ul {
    gap: 18px;
  }
}

/* Small tablets: the header icons are hidden (they stay in the footer)
   and the magazine button shows only its download icon */
@media (max-width: 1024px) {
  .header-sep,
  .header-social {
    display: none;
  }

  .header-magazine {
    width: 34px;
    padding: 0;
  }

  .header-magazine-text {
    display: none;
  }
}

/* Tablets */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tighter menu so the 5 categories still fit on one line */
  .main-nav ul {
    gap: 20px;
  }

  .main-nav a {
    font-size: 0.9rem;
  }

  .header-actions {
    margin-inline-start: 12px;
  }

  /* Hero grid: big article on top, the 3 others in one row below */
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 380px 220px;
    height: auto;
  }

  .hero-side {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
  }

  .hero-item--wide {
    grid-column: auto;
  }

  .hero-item--wide .hero-title {
    font-size: 1.1rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* Small tablets: a bit less space between categories, so the logo never touches the menu
   (min-width: 769px = this rule never touches the phone header) */
@media (min-width: 769px) and (max-width: 900px) {
  .main-nav ul {
    gap: 12px;
  }

  .main-nav a {
    font-size: 0.85rem;
  }
}

/* Phones */
@media (max-width: 768px) {
  /* Safety net: nothing can make the page scroll sideways */
  body {
    overflow-x: clip;
  }

  /* ----- Header: sticky, white, light shadow ----- */
  .site-header {
    box-shadow: var(--shadow);
  }

  /* Row 1: logo + buttons. Row 2: the category bar (wraps onto its own line) */
  .header-inner {
    flex-wrap: wrap;
    min-height: 0;
    padding-top: 10px;
  }

  .logo-text {
    font-size: 1.8rem;
  }

  .logo-tagline {
    font-size: 0.5rem;
    letter-spacing: 0.25em;
    margin-top: 4px;
  }

  .header-actions {
    margin-inline-start: auto;
    gap: 0;
  }

  .menu-toggle {
    display: flex;
  }

  /* Social icons are in the hamburger menu, the magazine link is in the category bar */
  .header-extras {
    display: none;
  }

  /* ----- Category bar: one line you can swipe with the finger ----- */
  .main-nav {
    display: block;
    position: relative;
    order: 3;                       /* goes below the logo and buttons */
    flex: 0 0 calc(100% + 40px);    /* full screen width... */
    min-width: 0;                   /* don't stretch to fit all the categories */
    margin: 8px -20px 0;            /* ...edge to edge */
    border-top: 1px solid var(--border);
  }

  .main-nav ul {
    gap: 24px;
    padding-block: 0;
    padding-inline: 20px 48px;      /* bigger at the end: last item can scroll out of the fade */
    overflow-x: auto;
    scrollbar-width: none;          /* hide the scrollbar (Firefox) */
  }

  .main-nav ul::-webkit-scrollbar {
    display: none;                  /* hide the scrollbar (Chrome, Safari) */
  }

  .main-nav li {
    flex-shrink: 0;
  }

  .main-nav a {
    display: block;
    padding: 12px 0;
    white-space: nowrap;
  }

  /* "Qui sommes-nous ?" is in the hamburger menu; no "Plus" dropdown on phones */
  .main-nav .nav-desktop-only,
  .main-nav .nav-more {
    display: none;
  }

  .main-nav .nav-mobile-only {
    display: block;
  }

  .main-nav a.nav-magazine {
    color: var(--orange);
  }

  /* Soft white fade on the end edge (the left, in Arabic): shows there is more to swipe */
  .main-nav::after {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    bottom: 0;
    width: 48px;
    background: linear-gradient(to left, transparent, var(--card));
    pointer-events: none;
  }

  /* ----- Search bar slides down under the header ----- */
  .search-panel {
    padding: 16px 0;
  }

  .search-panel:not([hidden]) {
    animation: slide-down 0.25s ease;
  }

  /* ----- Hamburger menu: a panel that slides in from the right ----- */
  .mobile-menu.open {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;          /* the right edge, in Arabic */
    z-index: 300;
    width: min(320px, 85vw);
    padding: 16px 24px 32px;
    overflow-y: auto;
    background-color: var(--card);
    box-shadow: var(--shadow-hover);
    animation: drawer-in 0.25s ease;
  }

  /* Dark layer behind the menu: tapping it closes the menu */
  .menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 250;
    background-color: var(--backdrop);
  }

  /* The page behind doesn't scroll while the menu is open */
  body.menu-open {
    overflow: hidden;
  }

  .mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--navy);
  }

  .mobile-menu-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--navy);
  }

  .mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-inline-end: -10px;
    background: none;
    border: none;
    cursor: pointer;
  }

  .mobile-menu-close svg {
    width: 24px;
    height: 24px;
    fill: var(--navy);
  }

  .mobile-menu-links li + li {
    border-top: 1px solid var(--border);
  }

  .mobile-menu-links a {
    display: flex;
    align-items: center;
    min-height: 48px;
    font-weight: 700;
    color: var(--navy);
  }

  .mobile-menu-links a:hover {
    color: var(--orange);
  }

  .mobile-menu .social-icons {
    margin-top: 16px;
  }

  .mobile-menu .social-icons a {
    background-color: var(--navy);
  }

  .mobile-menu .social-icons a:hover {
    background-color: var(--orange);
  }

  /* ----- Tendances bar: smaller text, no arrows ----- */
  .trending-label {
    padding: 0 12px;
    font-size: 0.75rem;
  }

  .trending-items {
    margin: 0 12px;
  }

  .trending-item {
    font-size: 0.82rem;
  }

  .trending-controls {
    display: none;
  }

  /* ----- Hero: big article on top, the 3 others in a swipe row ----- */
  .hero {
    padding-top: 20px;
    padding-bottom: 40px;
  }

  .hero-grid {
    grid-template-rows: 300px auto;
    gap: 12px;
    border-radius: 0;
    overflow: visible;
  }

  .hero-item--big {
    border-radius: var(--radius);
  }

  .hero-item--big .hero-overlay {
    padding: 20px;
  }

  .hero-item--big .hero-title {
    max-width: none;
    font-size: 1.5rem;
  }

  .hero-side {
    display: flex;
    gap: 12px;
    margin: 0 -20px;                /* row goes to the screen edges */
    padding: 0 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;  /* cards "stop" nicely when swiping */
    scroll-padding: 0 20px;
    scrollbar-width: none;
  }

  .hero-side::-webkit-scrollbar {
    display: none;
  }

  .hero-side .hero-item {
    flex: 0 0 75%;                  /* next card stays partly visible */
    height: 200px;
    border-radius: var(--radius);
    scroll-snap-align: start;
  }

  /* ----- Bigger tap targets (at least 44px) ----- */
  .social-icons a,
  .share-btn {
    width: 44px;
    height: 44px;
  }

  .copy-link {
    height: 44px;
  }

  .tag-link {
    padding: 11px 14px;
  }

  /* Cards stack in one column */
  .card-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 1.35rem;
  }

  .home-section {
    padding: 48px 0;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Inner pages */
  .page-hero {
    padding: 24px 0 32px;
  }

  .page-title,
  .article-title {
    font-size: 1.85rem;
  }

  .page-intro,
  .article-subtitle {
    font-size: 1.05rem;
  }

  .page-body {
    padding: 40px 0 56px;
  }

  .article-hero {
    margin: 24px auto 32px;
  }

  .prose {
    font-size: 1.05rem;
  }

  .prose .lead {
    font-size: 1.15rem;
  }

  .prose h2 {
    font-size: 1.35rem;
  }

  .prose blockquote {
    font-size: 1.15rem;
    padding-inline-start: 18px;
  }

  .form-card,
  .contact-card,
  .social-card {
    padding: 24px;
  }

  .form-row,
  .social-grid {
    grid-template-columns: 1fr;
  }

  .cta-box {
    padding: 32px 20px;
  }

  .pagination-info {
    order: -1;
    width: 100%;
    text-align: center;
  }
}

/* =========================================================
   MAGAZINE (magazine.html, sidebar card, "Les plus lus")
   ========================================================= */

/* ---------- 16. Shared buttons ---------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-icon svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-small {
  padding: 10px 18px;
  font-size: 0.85rem;
}

.btn-outline-navy {
  color: var(--navy);
  background-color: transparent;
  border-color: var(--navy);
}

.btn-outline-navy:hover {
  color: #fff;
  background-color: var(--navy);
}

/* ---------- 17. Magazine cover (looks like a printed magazine) ---------- */
.mag-cover-link,
.magazine-card-cover {
  position: relative;
  display: block;
  transition: transform 0.3s ease;
}

.mag-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow-cover);
  transition: box-shadow 0.3s ease;
}

/* Thin light/dark line on the right edge: the "spine" of the magazine
   (Arabic magazines are bound on the right) */
.mag-cover-link::after,
.magazine-card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.14) 2%, transparent 6%);
  pointer-events: none;
}

/* On hover: the cover lifts slightly with a bigger shadow */
.mag-cover-link:hover,
.magazine-card-cover:hover {
  transform: translateY(-6px);
}

.mag-cover-link:hover .mag-cover,
.magazine-card-cover:hover .mag-cover {
  box-shadow: var(--shadow-cover-hover);
}

/* ---------- 18. magazine.html: all the issues ---------- */
/* 4 per row on desktop, 2 on tablet and phone, 1 on very small phones */
.mag-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 48px 32px;
}

.mag-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.mag-item .mag-cover-link {
  width: 100%;
  margin-bottom: 20px;
}

/* "العدد 1 – نوفمبر 2026" */
.mag-item-number {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--navy);
}

/* Short description: 3 lines at most, so the buttons stay aligned */
.mag-item-summary {
  flex-grow: 1;
  margin: 6px 0 16px;
  font-size: 0.92rem;
  color: var(--slate);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "تحميل" + "اقرأ أونلاين" */
.mag-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.mag-item-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
}

/* ---------- 19. Sidebar: magazine card ---------- */
.magazine-card {
  padding: 24px;
  text-align: center;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.magazine-card-label {
  margin-bottom: 20px;
  padding-bottom: 10px;
  text-align: start;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
}

.magazine-card-cover {
  width: 170px;
  margin: 0 auto 20px;
}

.magazine-card-issue {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
}

.magazine-card-text {
  margin: 2px 0 16px;
  font-size: 0.88rem;
  color: var(--slate);
}

.magazine-card-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange);
}

.magazine-card-link:hover {
  color: var(--orange-dark);
}

/* ---------- 20. Sidebar: "Les plus lus" ---------- */
.popular-title {
  padding-bottom: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
  border-bottom: 2px solid var(--navy);
}

.popular-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.popular-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
}

.popular-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popular-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--navy);
  transition: color 0.2s;
}

.popular-item:hover .popular-name {
  color: var(--orange);
}

.popular-text time {
  font-size: 0.78rem;
  color: var(--slate);
}

/* ---------- 21. Layout with sidebar (desktop, 1101px and wider) ---------- */
@media (min-width: 1101px) {
  .page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 40px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px 64px;
  }

  /* Inside the main column, sections use the column width */
  .page-main .container {
    max-width: none;
    padding: 0;
  }

  .page-main .home-section {
    padding: 0;
    margin-bottom: 56px;
  }

  .page-main .home-section:last-child {
    margin-bottom: 0;
  }

  /* The white bands become white panels */
  .page-main .home-section.section-alt {
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  /* Cards a bit more compact next to the sidebar */
  .page-main .card-grid {
    gap: 20px;
  }

  .page-main .card-body {
    padding: 18px;
  }

  .page-main .card-title {
    font-size: 1.05rem;
  }

  .page-sidebar {
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  /* The magazine card stays visible while scrolling (under the 84px header) */
  .sidebar-magazine {
    position: sticky;
    top: 108px;
    z-index: 2;
  }

  /* Article page: text column (720px) + sidebar, aligned with the main photo */
  .page-layout--article {
    max-width: 1100px;
  }

  .article-header.container-narrow {
    max-width: 1100px;
  }

  .article-header > * {
    max-width: 720px;
  }
}

/* ---------- 22. Tablet and phone: no sidebar ---------- */
@media (max-width: 1100px) {
  .page-layout {
    display: flex;
    flex-direction: column;
  }

  /* The sidebar box disappears: its 2 blocks are placed separately */
  .page-sidebar {
    display: contents;
  }

  .sidebar-block {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
  }

  /* Magazine card: banner at the top (after the hero) */
  .sidebar-magazine {
    order: -1;
    margin-bottom: 48px;
  }

  .magazine-card {
    text-align: start;
  }

  .magazine-card-content {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 28px;
    align-items: center;
  }

  .magazine-card-cover {
    width: auto;
    margin: 0;
  }

  .magazine-card .btn-block {
    display: inline-flex;
    width: auto;
  }

  .magazine-card-link {
    margin-inline-start: 16px;
  }

  /* "Les plus lus": after the article sections */
  .sidebar-popular {
    margin-top: 48px;
    margin-bottom: 64px;
  }

  .popular-title {
    font-size: 1.35rem;
  }

  .popular-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 32px;
  }

  /* Tablet: 2 issues per row (not too wide, centered) */
  .mag-grid {
    grid-template-columns: repeat(2, minmax(0, 300px));
    justify-content: center;
    gap: 48px 40px;
  }
}

@media (max-width: 768px) {
  /* Phone: 2 issues per row, buttons one under the other */
  .mag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px 16px;
  }

  .mag-item-actions {
    flex-direction: column;
  }

  .magazine-card-content {
    grid-template-columns: 100px 1fr;
    gap: 18px;
  }

  .magazine-card .btn-block {
    display: flex;
    width: 100%;
  }

  .magazine-card-link {
    margin-inline-start: 0;
  }

  .popular-list {
    grid-template-columns: 1fr;
  }
}

/* Very small phones: 1 issue per row */
@media (max-width: 380px) {
  .mag-grid {
    grid-template-columns: minmax(0, 280px);
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mag-cover-link,
  .magazine-card-cover,
  .mag-cover {
    transition: none;
  }
}
