/*
 * "magazine" template. Served to every site that uses it as /assets/style.css
 * (nginx → templates/magazine/style.css). No external fonts or images.
 */

:root {
  --mg-ink: #1d2433;
  --mg-ink-soft: #4a5468;
  --mg-muted: #8a93a6;
  --mg-paper: #f5f2ec;
  --mg-card: #ffffff;
  --mg-line: #e4dfd5;
  --mg-accent: #d9480f;
  --mg-accent-soft: #fff0e6;
  --mg-dark: #1d2433;
  --mg-radius: 10px;
  --mg-shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 6px 18px rgba(29, 36, 51, .06);
  --mg-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mg-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body.mg {
  margin: 0;
  background: var(--mg-paper);
  color: var(--mg-ink);
  font: 16px/1.65 var(--mg-sans);
  -webkit-font-smoothing: antialiased;
}
.mg a { color: var(--mg-accent); text-decoration: none; }
.mg a:hover { text-decoration: underline; }

.mg-wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.mg-main { padding-top: 32px; padding-bottom: 48px; }

/* ---------- Top bar ---------------------------------------------------- */

.mg-topbar { background: var(--mg-dark); color: #fff; }
.mg-topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.mg-brand { display: flex; align-items: center; gap: 10px; color: #fff !important; text-decoration: none !important; min-width: 0; }
.mg-brand__logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: #fff; }
.mg-brand__name { font: 700 1.3rem/1.2 var(--mg-serif); letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-topbar__tag { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: #c3c9d6; white-space: nowrap; }
.mg-topbar__cat {
  color: #fff !important; font-size: .85rem; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%;
}
.mg-topbar__cat:hover { background: rgba(255, 255, 255, .08); text-decoration: none !important; }

/* ---------- Hero (home) / band (category) ------------------------------ */

.mg-hero, .mg-band { background: var(--mg-card); border-bottom: 1px solid var(--mg-line); }
.mg-hero { padding: 48px 0 40px; }
.mg-hero__title { margin: 0 0 12px; font: 700 clamp(1.8rem, 4vw, 2.8rem)/1.15 var(--mg-serif); max-width: 820px; }
.mg-hero__lead { margin: 0; color: var(--mg-ink-soft); font-size: 1.08rem; max-width: 720px; }
.mg-band { padding: 28px 0 24px; }
.mg-band__title { margin: 6px 0 0; font: 700 clamp(1.6rem, 3.4vw, 2.3rem)/1.2 var(--mg-serif); }
.mg-band__count { margin: 6px 0 0; color: var(--mg-muted); font-size: .9rem; }

.mg-section-title {
  display: flex; align-items: center; gap: 14px; margin: 8px 0 22px;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--mg-ink-soft);
}
.mg-section-title::after { content: ""; flex: 1; height: 2px; background: var(--mg-line); }
.mg-section-title span { border-left: 4px solid var(--mg-accent); padding-left: 10px; }

.mg-meta { margin: 0; font-size: .82rem; color: var(--mg-muted); }
.mg-empty { padding: 48px 0; text-align: center; color: var(--mg-muted); }

/* ---------- Breadcrumbs ------------------------------------------------ */

.mg-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .84rem; color: var(--mg-muted); }
.mg-crumbs a { color: var(--mg-ink-soft); }
.mg-crumbs__sep { color: #c2bcb0; }

/* ---------- Home: card grid -------------------------------------------- */

.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.mg-card {
  display: flex; gap: 16px; padding: 22px; background: var(--mg-card);
  border-radius: var(--mg-radius); box-shadow: var(--mg-shadow); border-top: 3px solid transparent;
  transition: transform .15s ease, border-color .15s ease;
}
.mg-card:hover { transform: translateY(-2px); border-top-color: var(--mg-accent); }
.mg-card__date {
  flex: 0 0 52px; height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--mg-accent-soft); color: var(--mg-accent); line-height: 1;
}
.mg-card__day { font: 700 1.35rem/1 var(--mg-serif); }
.mg-card__month { margin-top: 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.mg-card__body { min-width: 0; display: flex; flex-direction: column; }
.mg-card__title { margin: 0 0 6px; font: 700 1.15rem/1.3 var(--mg-serif); }
.mg-card__title a { color: var(--mg-ink); }
.mg-card__excerpt { margin: 10px 0 12px; color: var(--mg-ink-soft); font-size: .93rem; }
.mg-card__more { margin-top: auto; font-size: .85rem; font-weight: 600; }

.mg-card--lead { grid-column: 1 / -1; padding: 30px; background: var(--mg-dark); color: #fff; }
.mg-card--lead .mg-card__date { background: var(--mg-accent); color: #fff; flex-basis: 64px; height: 70px; }
.mg-card--lead .mg-card__title { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.mg-card--lead .mg-card__title a { color: #fff; }
.mg-card--lead .mg-meta { color: #aab2c3; }
.mg-card--lead .mg-card__excerpt { color: #d5dae4; font-size: 1rem; max-width: 760px; }
.mg-card--lead .mg-card__more { color: #ffb38a; }

/* ---------- Category: chips + list ------------------------------------- */

.mg-chips { list-style: none; margin: 0 0 34px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.mg-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--mg-card); border: 1px solid var(--mg-line); color: var(--mg-ink) !important; font-weight: 600; font-size: .92rem;
}
.mg-chip:hover { border-color: var(--mg-accent); text-decoration: none !important; }
.mg-chip__count { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--mg-accent-soft); color: var(--mg-accent); font-size: .75rem; text-align: center; }

.mg-list { list-style: none; margin: 0; padding: 0; background: var(--mg-card); border-radius: var(--mg-radius); box-shadow: var(--mg-shadow); }
.mg-list__item { display: flex; gap: 22px; padding: 22px 24px; border-bottom: 1px solid var(--mg-line); }
.mg-list__item:last-child { border-bottom: 0; }
.mg-list__date { flex: 0 0 74px; display: flex; flex-direction: column; color: var(--mg-muted); line-height: 1.1; }
.mg-list__day { font: 700 1.8rem/1 var(--mg-serif); color: var(--mg-accent); }
.mg-list__month { margin-top: 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.mg-list__body { min-width: 0; }
.mg-list__title { margin: 0 0 6px; font: 700 1.15rem/1.3 var(--mg-serif); }
.mg-list__title a { color: var(--mg-ink); }
.mg-list__excerpt { margin: 0 0 6px; color: var(--mg-ink-soft); font-size: .93rem; }

/* ---------- Pagination ------------------------------------------------- */

.mg-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 34px; }
.mg-pager__num, .mg-pager__step, .mg-pager__gap {
  min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font-size: .9rem; font-weight: 600;
}
.mg-pager__num, .mg-pager__step { background: var(--mg-card); border: 1px solid var(--mg-line); color: var(--mg-ink) !important; }
.mg-pager__num:hover, .mg-pager__step:hover { border-color: var(--mg-accent); text-decoration: none !important; }
.mg-pager__num.is-current { background: var(--mg-accent); border-color: var(--mg-accent); color: #fff !important; }
.mg-pager__gap { color: var(--mg-muted); }

/* ---------- Single: article + sidebar ---------------------------------- */

.mg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; padding-top: 28px; padding-bottom: 56px; align-items: start; }
.mg-article { background: var(--mg-card); border-radius: var(--mg-radius); box-shadow: var(--mg-shadow); padding: 28px 40px 40px; min-width: 0; }

.mg-byline { display: flex; align-items: center; gap: 12px; margin: 18px 0 8px; padding-bottom: 18px; border-bottom: 1px solid var(--mg-line); }
.mg-byline__avatar {
  flex: 0 0 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--mg-dark); color: #fff; font: 700 1.1rem/1 var(--mg-serif);
}
.mg-byline__author { font-weight: 700; font-size: .95rem; }

.mg-prose { font: 1.08rem/1.8 var(--mg-serif); color: #262d3b; overflow-wrap: anywhere; }
.mg-prose h1 { margin: 24px 0 16px; font: 700 clamp(1.7rem, 3.6vw, 2.4rem)/1.2 var(--mg-serif); color: var(--mg-ink); }
.mg-prose h2 { margin: 36px 0 12px; font: 700 1.45rem/1.3 var(--mg-serif); color: var(--mg-ink); }
.mg-prose h3 { margin: 28px 0 10px; font: 700 1.2rem/1.35 var(--mg-serif); color: var(--mg-ink); }
.mg-prose p { margin: 0 0 18px; }
.mg-prose a { text-decoration: underline; text-decoration-color: rgba(217, 72, 15, .35); text-underline-offset: 3px; }
.mg-prose img { display: block; max-width: 100%; height: auto; margin: 22px auto; border-radius: 8px; }
.mg-prose ul, .mg-prose ol { margin: 0 0 18px; padding-left: 24px; }
.mg-prose li { margin-bottom: 6px; }
.mg-prose li::marker { color: var(--mg-accent); }
.mg-prose blockquote { margin: 22px 0; padding: 14px 20px; border-left: 4px solid var(--mg-accent); background: var(--mg-accent-soft); border-radius: 0 8px 8px 0; }
.mg-prose table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font: .95rem/1.5 var(--mg-sans); display: block; overflow-x: auto; }
.mg-prose th, .mg-prose td { padding: 8px 10px; border: 1px solid var(--mg-line); text-align: left; }
.mg-prose th { background: var(--mg-paper); }
.mg-prose hr { border: 0; border-top: 1px solid var(--mg-line); margin: 28px 0; }

.mg-sidebar { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 20px; }
.mg-box { background: var(--mg-card); border-radius: var(--mg-radius); box-shadow: var(--mg-shadow); padding: 20px 22px; }
.mg-box--accent { border-top: 3px solid var(--mg-accent); }
.mg-box__title { margin: 0 0 12px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--mg-ink-soft); }
.mg-box__list { list-style: none; margin: 0; padding: 0; }
.mg-box__list li { padding: 9px 0; border-bottom: 1px dashed var(--mg-line); font-size: .93rem; line-height: 1.4; }
.mg-box__list li:last-child { border-bottom: 0; padding-bottom: 0; }
.mg-box__list a { color: var(--mg-ink); }
.mg-box__list a:hover { color: var(--mg-accent); }

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

.mg-footer { background: var(--mg-dark); color: #aab2c3; font-size: .85rem; }
.mg-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 22px; padding-bottom: 22px; }
.mg-footer a { color: #fff; }

/* ---------- Small screens ---------------------------------------------- */

@media (max-width: 900px) {
  .mg-layout { grid-template-columns: minmax(0, 1fr); }
  .mg-sidebar { position: static; }
}
@media (max-width: 600px) {
  .mg-wrap { padding: 0 14px; }
  .mg-topbar__tag { display: none; }
  .mg-hero { padding: 32px 0 28px; }
  .mg-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .mg-card, .mg-card--lead { padding: 18px; }
  .mg-list__item { flex-direction: column; gap: 6px; padding: 18px; }
  .mg-list__date { flex-direction: row; align-items: baseline; gap: 8px; flex-basis: auto; }
  .mg-list__day { font-size: 1.2rem; }
  .mg-article { padding: 20px 18px 28px; }
}
