/*
Theme Name: Madagate
Theme URI: https://madagate.com
Author: Madagate
Description: Theme presse pour MADAGATE.com — actualites et archives de Madagascar depuis 2007
Version: 1.0
Text Domain: madagate
*/

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
  --brand: #4caf50;
  --brand-dark: #2e7d32;
  --breaking: #c62828;
  --breaking-fg: #ffffff;
  --ink: #1e272e;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6c757d;
  --border: #e2e8f0;
  --surface: #f7f8fa;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  --max-w: 1200px;
  --gutter: 1rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ─── TOP BAR ─── */
.topbar {
  background: var(--ink);
  color: rgba(255,255,255,.85);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.topbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.topbar .since { display: none; }
@media(min-width:640px) { .topbar .since { display: inline; } }

/* ─── HEADER ─── */
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.site-logo img {
  height: 40px;
  width: auto;
}
@media(min-width:768px) {
  .site-logo img { height: 50px; }
}
.site-search {
  display: none;
}
@media(min-width:768px) {
  .site-search {
    display: block;
  }
  .site-search input {
    width: 280px;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--sans);
    outline: none;
    transition: border-color .2s;
  }
  .site-search input:focus {
    border-color: var(--brand);
  }
}

/* ─── NAVIGATION ─── */
.main-nav {
  border-top: 4px solid var(--brand);
  background: var(--bg);
}
.main-nav .wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.main-nav ul {
  display: flex;
  gap: 0;
}
.main-nav li a,
.main-nav li span {
  display: block;
  padding: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: color .2s;
}
.main-nav li a:hover,
.main-nav li .current-cat {
  color: var(--brand);
}

/* ─── BREAKING NEWS ─── */
.breaking-bar {
  background: var(--breaking);
  color: var(--breaking-fg);
  font-size: 0.875rem;
  overflow: hidden;
}
.breaking-bar .wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.breaking-label {
  flex-shrink: 0;
  font-weight: 700;
  text-transform: uppercase;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}
.breaking-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── HERO ─── */
.hero-section {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 3rem;
}
@media(min-width:1024px) {
  .hero-section {
    grid-template-columns: 2fr 1fr;
  }
}
.hero-main {
  position: relative;
  overflow: hidden;
  border-radius: 0.375rem;
  cursor: pointer;
}
.hero-main img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  transition: transform .7s;
}
.hero-main:hover img { transform: scale(1.05); }
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.3) 40%, transparent 70%);
}
.hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  color: #fff;
}
@media(min-width:640px) { .hero-content { padding: 2rem; } }
.hero-content .badge { margin-bottom: 0.75rem; }
.hero-content h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
}
@media(min-width:640px) {
  .hero-content h1 { font-size: 2.25rem; }
}
.hero-content .excerpt {
  display: none;
  margin-top: 0.5rem;
  opacity: .9;
  max-width: 40rem;
}
@media(min-width:640px) { .hero-content .excerpt { display: block; } }
.hero-content .meta {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  opacity: .8;
}
.hero-sidebar {
  display: grid;
  gap: 1.5rem;
}
@media(min-width:640px) and (max-width:1023px) {
  .hero-sidebar { grid-template-columns: repeat(3, 1fr); }
}
.hero-sidebar-item {
  display: flex;
  gap: 0.75rem;
  cursor: pointer;
}
@media(min-width:640px) and (max-width:1023px) {
  .hero-sidebar-item { flex-direction: column; }
}
.hero-sidebar-item img {
  width: 8rem;
  height: 6rem;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 0.25rem;
}
@media(min-width:640px) and (max-width:1023px) {
  .hero-sidebar-item img { width: 100%; height: 8rem; }
}
.hero-sidebar-item h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.3;
  margin-top: 0.25rem;
  transition: color .2s;
}
.hero-sidebar-item:hover h3 { color: var(--brand-dark); }
.hero-sidebar-item .meta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--brand);
  color: #fff;
}
.badge.urgent {
  background: var(--breaking);
}

/* ─── CONTENT GRID ─── */
.content-grid {
  display: grid;
  gap: 2.5rem;
}
@media(min-width:1024px) {
  .content-grid {
    grid-template-columns: 1fr 320px;
  }
}

/* ─── CATEGORY SECTION ─── */
.cat-section { margin-bottom: 3rem; }
.cat-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--fg);
  margin-bottom: 1.25rem;
}
.cat-header h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cat-header h2::before {
  content: '';
  display: inline-block;
  width: 0.375rem;
  height: 1.25rem;
  background: var(--brand);
  border-radius: 1px;
}
.cat-header a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-dark);
  transition: text-decoration .2s;
}
.cat-header a:hover { text-decoration: underline; }

/* ─── ARTICLE CARDS ─── */
.articles-grid {
  display: grid;
  gap: 1.5rem;
}
@media(min-width:640px) { .articles-grid { grid-template-columns: repeat(2, 1fr); } }
@media(min-width:1024px) { .articles-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  cursor: pointer;
}
.card .thumb {
  overflow: hidden;
  border-radius: 0.25rem;
}
.card .thumb img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  transition: transform .5s;
}
.card:hover .thumb img { transform: scale(1.05); }
.card .card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.card h3 {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 0.5rem;
  transition: color .2s;
}
.card:hover h3 { color: var(--brand-dark); }
.card .card-excerpt {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar { display: flex; flex-direction: column; gap: 2.5rem; }
.side-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--brand);
  margin-bottom: 1rem;
}

/* Most read */
.most-read li {
  display: flex;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem 0;
}
.most-read li:hover h4 { color: var(--brand-dark); }
.most-read .rank {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--brand);
  line-height: 1;
  min-width: 1.5rem;
}
.most-read h4 {
  font-family: var(--serif);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
  transition: color .2s;
}
.most-read .meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.125rem;
}

/* Archives */
.archives-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.archives-list li a:hover { color: var(--brand); }
.archives-list .count { color: var(--muted); }

.archives-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--sans);
  background: var(--bg);
  margin-top: 1rem;
}

/* Social */
.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.social-grid a {
  padding: 0.75rem;
  background: var(--surface);
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all .2s;
}
.social-grid a:hover {
  background: var(--brand);
  color: #fff;
}
.social-grid .followers {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: .7;
  margin-top: 0.125rem;
}

/* Newsletter */
.newsletter {
  background: var(--brand);
  color: #fff;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-top: 1rem;
}
.newsletter h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
}
.newsletter input[type="email"] {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-family: var(--sans);
}
.newsletter button {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  transition: opacity .2s;
}
.newsletter button:hover { opacity: .9; }

/* ─── FOOTER ─── */
.site-footer {
  margin-top: 3rem;
  background: var(--ink);
  color: rgba(255,255,255,.85);
}
.footer-grid {
  display: grid;
  gap: 2rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
}
@media(min-width:640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media(min-width:1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }

.footer-brand p {
  margin-top: 0.75rem;
  max-width: 28rem;
  font-size: 0.875rem;
  opacity: .8;
  line-height: 1.6;
}
.footer-brand .site-logo img {
  filter: brightness(10);
}
.footer-links h3,
.footer-contact h3 {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}
.footer-links ul { display: flex; flex-direction: column; gap: 0.25rem; }
.footer-links a {
  font-size: 0.875rem;
  opacity: .8;
  transition: opacity .2s;
}
.footer-links a:hover { opacity: 1; text-decoration: underline; }
.footer-contact p {
  font-size: 0.875rem;
  opacity: .8;
  line-height: 1.7;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding: 1rem 0;
  text-align: center;
  font-size: 0.75rem;
  opacity: .7;
}

/* ─── SINGLE POST ─── */
.single-header { margin-bottom: 2rem; }
.single-header .badge { margin-bottom: 0.75rem; }
.single-header h1 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.2;
}
@media(min-width:640px) {
  .single-header h1 { font-size: 2.5rem; }
}
.single-header .post-meta {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.single-featured {
  margin-bottom: 2rem;
  border-radius: 0.375rem;
  overflow: hidden;
}
.single-featured img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.single-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  max-width: 44rem;
}
.single-content p { margin-bottom: 1.25rem; }
.single-content h2, .single-content h3 {
  font-family: var(--serif);
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
.single-content h2 { font-size: 1.5rem; }
.single-content h3 { font-size: 1.25rem; }
.single-content img {
  border-radius: 0.375rem;
  margin: 1.5rem 0;
}
.single-content blockquote {
  border-left: 4px solid var(--brand);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--muted);
}

/* ─── ARCHIVE PAGE ─── */
.archive-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--brand);
}
.archive-header h1 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
}
.archive-header p {
  margin-top: 0.5rem;
  color: var(--muted);
}

/* ─── PAGINATION ─── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  transition: all .2s;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* ─── SEARCH RESULTS ─── */
.search-header h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* ─── 404 ─── */
.page-404 {
  text-align: center;
  padding: 4rem 0;
}
.page-404 h1 {
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 900;
  color: var(--brand);
}
.page-404 p {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.125rem;
}
.page-404 a {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--brand);
  color: #fff;
  border-radius: 0.375rem;
  font-weight: 600;
}

/* ─── UTILITIES ─── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
