/* ------------------------------------------------------------------
   Garrotxa al dia — estil minimalista
   ------------------------------------------------------------------ */

:root {
  --bg: #f6faf5;
  --surface: #ffffff;
  --surface-soft: #eef5ee;
  --text: #1d2a21;
  --muted: #5b6c60;
  --border: #dde6dc;
  --accent: #2f7d55;
  --accent-strong: #246243;
  --accent-soft: #e4f1e8;
  --shadow: 0 1px 2px rgba(24, 46, 33, 0.06), 0 6px 20px rgba(24, 46, 33, 0.05);
  --radius: 14px;
  --max-width: 680px;
  --pattern-angle: 45deg;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1512;
    --surface: #151e19;
    --surface-soft: #1a251e;
    --text: #dbe7dd;
    --muted: #90a596;
    --border: #26332b;
    --accent: #7cc79b;
    --accent-strong: #9bd8b4;
    --accent-soft: #17251d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1512;
  --surface: #151e19;
  --surface-soft: #1a251e;
  --text: #dbe7dd;
  --muted: #90a596;
  --border: #26332b;
  --accent: #7cc79b;
  --accent-strong: #9bd8b4;
  --accent-soft: #17251d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Seamless newspaper-section pattern (adapts to light/dark via --muted) -- */

body::before {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%) rotate(var(--pattern-angle));
  z-index: -1;
  pointer-events: none;
  background-color: color-mix(in srgb, var(--muted) 14%, transparent);
  -webkit-mask-image: url("../img/newspaper-pattern.svg");
  mask-image: url("../img/newspaper-pattern.svg");
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: 600px 400px;
  mask-size: 600px 400px;
  -webkit-mask-position: left top;
  mask-position: left top;
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 var(--radius) 0;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

/* Header ---------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 60% 10% 60% 10%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  transform: rotate(45deg);
  flex: none;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.theme-toggle .icon {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

/* Intro ----------------------------------------------------------- */

.intro {
  padding: 48px 0 24px;
}

.intro-compact {
  padding: 32px 0 16px;
}

.site-title {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Editions navigation -------------------------------------------- */

.editions {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.editions-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.editions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.editions-list a,
.edition-current {
  display: inline-block;
  font-size: 0.85rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.editions-list a {
  color: var(--muted);
  border-color: var(--border);
}

.editions-list a:hover {
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
}

.edition-current {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  font-weight: 600;
}

/* Edition --------------------------------------------------------- */

.edition-header {
  margin-bottom: 18px;
}

.edition-title {
  margin: 0 0 4px;
  font-size: 1.3rem;
}

.edition-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* News items ------------------------------------------------------ */

.news-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.news[open] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.news > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  font-weight: 550;
  line-height: 1.35;
  transition: background 0.15s ease;
}

.news > summary::-webkit-details-marker {
  display: none;
}

.news > summary:hover {
  background: var(--surface-soft);
}

.news-title {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.06rem;
}

.chevron {
  flex: none;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -3px;
}

.news[open] .chevron {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.news-body {
  padding: 0 18px 18px;
  color: var(--text);
}

.news-body p {
  margin: 0 0 14px;
}

.news-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.source {
  font-size: 0.85rem;
  color: var(--muted);
}

.source:hover {
  color: var(--accent-strong);
}

.share {
  font: inherit;
  font-size: 0.85rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.share:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

/* Pages ----------------------------------------------------------- */

.page {
  padding: 48px 0 24px;
}

.page-header h1 {
  margin: 0 0 16px;
  font-size: clamp(1.7rem, 4.5vw, 2.2rem);
}

.page-content p {
  margin: 0 0 1.1em;
}

.page-content ul {
  padding-left: 1.2em;
}

/* Footer ---------------------------------------------------------- */

.site-footer {
  margin-top: 56px;
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0 0 6px;
}

.footer-note {
  font-size: 0.8rem;
  opacity: 0.85;
}

.empty {
  color: var(--muted);
}
