/* Madrilink — local newspaper editorial style */
:root {
  --color-primary: #2F5233;
  --color-bg: #F5F0E1;
  --color-dark: #1A2E1C;
  --color-accent: #4A7A50;
  --color-muted: #6B7A6D;
  --color-card: #FFFCF5;
  --color-border: #D4C9B0;
  --color-shadow: rgba(26, 46, 28, 0.12);
  --color-shadow-deep: rgba(26, 46, 28, 0.22);
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --max-width: 1180px;
  --sidebar-width: 320px;
  --radius: 6px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --color-bg: #1A2E1C;
  --color-dark: #F5F0E1;
  --color-card: #243828;
  --color-border: #3D5A40;
  --color-muted: #A8B5A9;
  --color-shadow: rgba(0, 0, 0, 0.3);
  --color-shadow-deep: rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-dark);
  line-height: 1.65;
  font-size: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

ul, ol {
  margin: 0 0 1rem 1.25rem;
}

/* Header — centered logo */
.site-header {
  background: var(--color-card);
  border-bottom: 3px double var(--color-primary);
  box-shadow: 0 2px 12px var(--color-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  text-align: center;
}

.logo {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  display: inline-block;
}

.logo-tagline {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-style: italic;
  margin-top: 0.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.nav-bar a {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-dark);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.nav-bar a:hover,
.nav-bar a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.header-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-icon {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  color: var(--color-dark);
  font-size: 0.85rem;
  transition: background var(--transition);
}

.btn-icon:hover {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

.menu-toggle {
  display: none;
}

/* Main layout */
main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  width: 100%;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--color-shadow);
}

.hero-text h1 {
  margin-bottom: 1rem;
}

.hero-text .lead {
  font-size: 1.1rem;
  color: var(--color-muted);
  font-family: var(--font-serif);
  font-style: italic;
}

.hero-visual img,
.hero-visual svg {
  border-radius: var(--radius);
  box-shadow: 0 6px 24px var(--color-shadow-deep);
}

/* Section titles */
.section-title {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-primary);
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: var(--color-accent);
}

/* Magazine grid — mixed layout */
.magazine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  margin-bottom: 3rem;
}

.card {
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px var(--color-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px var(--color-shadow-deep);
}

.card-featured {
  grid-column: span 2;
  grid-row: span 1;
  flex-direction: row;
}

.card-featured .card-image {
  width: 55%;
  flex-shrink: 0;
}

.card-featured .card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-image {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--color-border);
}

.card-image img,
.card-image svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 1.25rem;
  flex: 1;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.card-body h3 a {
  color: var(--color-dark);
}

.card-body h3 a:hover {
  color: var(--color-primary);
}

.card-excerpt {
  font-size: 0.92rem;
  color: var(--color-muted);
  margin-top: 0.5rem;
}

/* Editorial picks — spacious */
.picks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

.pick-card {
  background: var(--color-card);
  padding: 1.75rem;
  border-left: 4px solid var(--color-primary);
  box-shadow: 0 4px 16px var(--color-shadow);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.pick-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Article page — sidebar layout */
.article-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 2.5rem;
  align-items: start;
}

.article-main {
  background: var(--color-card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--color-shadow);
}

.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.article-category {
  display: inline-block;
  background: var(--color-primary);
  color: var(--color-bg);
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
}

.article-meta span {
  margin-right: 1rem;
}

.article-hero-img {
  margin: 1.5rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px var(--color-shadow);
}

.article-content p {
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.article-content h2 {
  margin-top: 2rem;
  font-size: 1.4rem;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 120px;
}

.sidebar-block {
  background: var(--color-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px var(--color-shadow);
  margin-bottom: 1.5rem;
}

.sidebar-block h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.related-item {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.related-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.related-thumb {
  width: 70px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--color-border);
}

.related-thumb img,
.related-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-item a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-dark);
  line-height: 1.35;
}

.author-box {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--color-primary);
}

.author-avatar img,
.author-avatar svg {
  width: 100%;
  height: 100%;
}

.author-info {
  font-size: 0.9rem;
}

.author-info strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1rem;
}

/* Page content (legal, about) */
.page-content {
  max-width: 780px;
  margin: 0 auto;
  background: var(--color-card);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--color-shadow);
}

.page-content h1 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.page-content h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
}

/* Articles listing */
.articles-intro {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 2.5rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--color-muted);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

/* Contact */
.contact-box {
  background: var(--color-card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px var(--color-shadow);
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-box a {
  font-size: 1.15rem;
  font-weight: 600;
}

/* Footer */
.site-footer {
  background: var(--color-dark);
  color: var(--color-bg);
  padding: 2.5rem 1.25rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}

.footer-brand .logo {
  color: var(--color-bg);
  font-size: 1.5rem;
}

.footer-brand p {
  font-size: 0.88rem;
  opacity: 0.8;
  margin-top: 0.5rem;
}

.footer-nav h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  color: var(--color-accent);
}

.footer-nav ul {
  list-style: none;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 0.4rem;
}

.footer-nav a {
  color: var(--color-bg);
  opacity: 0.85;
  font-size: 0.88rem;
}

.footer-nav a:hover {
  opacity: 1;
  color: #fff;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(245, 240, 225, 0.2);
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.7;
}

/* Cookie notice */
.cookie-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-dark);
  color: var(--color-bg);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  z-index: 200;
  box-shadow: 0 -4px 20px var(--color-shadow-deep);
  transform: translateY(100%);
  transition: transform 0.4s ease;
}

.cookie-notice.visible {
  transform: translateY(0);
}

.cookie-notice p {
  margin: 0;
  font-size: 0.88rem;
  max-width: 600px;
}

.cookie-notice button {
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.cookie-notice button:hover {
  background: var(--color-accent);
}

.cookie-notice.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 960px) {
  .magazine-grid,
  .articles-grid {
    grid-template-columns: 1fr 1fr;
  }

  .card-featured {
    grid-column: span 2;
    flex-direction: column;
  }

  .card-featured .card-image {
    width: 100%;
  }

  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .menu-toggle {
    display: inline-block;
  }

  .nav-bar {
    display: none;
    flex-direction: column;
    width: 100%;
  }

  .nav-bar.open {
    display: flex;
  }

  .magazine-grid,
  .articles-grid,
  .picks-grid {
    grid-template-columns: 1fr;
  }

  .card-featured {
    grid-column: span 1;
  }

  .page-content,
  .article-main {
    padding: 1.5rem;
  }
}
