/* =============================================================================
   族 mag —— 杂志型
   骨架：1120 宽 / 首屏大图压标题 / 栏目内两列图文卡 / 文章页右栏常驻
   与 dir 的区别：有图、有栅格、有侧栏，标题与正文同族无衬线。
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.mag-page {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Segoe UI", sans-serif;
  font-size: 15.5px; line-height: 1.8;
  display: flex; flex-direction: column; min-height: 100vh;
}
body.mag-page > .mag-main { flex: 1 0 auto; }
.mag-page a { color: inherit; text-decoration: none; }
.mag-page img { max-width: 100%; }

/* ------------------------------------------------------------------ header */
.mag-head {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.mag-head-in {
  display: grid; align-items: center; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  grid-template-columns: 1fr auto 1fr;
}
/* is-center：报头式两行——刊头居中占一行，导航居中另起一行。
   单行排法怎么摆都不成立：导航右对齐会一路顶到刊头跟前（只剩 16px），整行读成
   「首页 必吃 … 关于本站 金华美食指南」，站名像菜单最后一项；改左对齐后右半栏
   仍空着 460px，像没写完。两行居中让页头左右对称，导航也拿到整行宽度
   （频道再多也不会挤成两行）。≤760 仍是刊头 + 抽屉，不走这套。 */
@media (min-width: 761px) {
  .mag-head.is-center .mag-head-in {
    grid-template-columns: 1fr; justify-items: center;
    gap: 6px; padding: 12px 20px 10px;
  }
  .mag-head.is-center .mag-brand { grid-row: 1; line-height: 1.35; }
  .mag-head.is-center .mag-nav { grid-row: 2; justify-content: center; }
}
.mag-head.is-left .mag-head-in { grid-template-columns: auto 1fr auto; }
.mag-head.is-left .mag-nav { justify-content: flex-end; }
/* stack：标题与导航同排（nav-row 在 head-in 外，用 header flex 拉平；is-left 为两端对齐） */
.mag-head.is-stack { position: relative; display: flex; align-items: center; }
.mag-head.is-stack .mag-head-in {
  flex: 0 0 auto; grid-template-columns: auto auto; border-bottom: 0; padding: 14px 20px;
}
.mag-head.is-stack .mag-nav-row {
  flex: 1 1 auto; margin: 0; padding: 0 20px 0 6px; justify-content: flex-start;
}
.mag-head.is-stack .mag-nav a { transition: color .16s ease; font-size: 13.5px; letter-spacing: .02em; }
.mag-brand {
  display: inline-flex; align-items: center; gap: 9px; justify-self: center;
  font-size: 20px; font-weight: 500; letter-spacing: .04em; color: var(--text);
  white-space: nowrap;
}
.mag-head.is-left .mag-brand { justify-self: start; }
.mag-head.is-stack .mag-brand { justify-self: start; }
.mag-mark { border-radius: 6px; flex: 0 0 auto; }
/* 页头导航恒为一行：放不下就横向滑，不折行。
   折行会把刊头挤成高低不齐的两行（移动端最明显），而这里是全站唯一的主入口，
   一旦折掉就是「菜单看着断了一截」。滚动条隐掉，横滑不带动整页。 */
.mag-nav {
  display: flex; flex-wrap: nowrap; gap: 2px 20px;
  min-width: 0; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior-x: contain;
}
.mag-nav::-webkit-scrollbar { display: none; }
.mag-nav a { flex: 0 0 auto; white-space: nowrap; }
.mag-nav a { font-size: 14px; color: var(--text-3); }
.mag-nav a:hover { color: var(--accent); }
.mag-nav-row {
  max-width: 1120px; margin: 0 auto; padding: 9px 20px 11px;
  justify-content: flex-start;
}
.mag-drawer { display: none; justify-self: end; position: relative; }
.mag-drawer-btn {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  /* 34px 触摸目标是给手指的，不是给图标的：默认靠左会让 22px 图标右侧空出
     12px，窄屏下图标右缘距屏幕 ~32px，而站名左缘只有 20px，页头两边不对称。
     图标贴按钮右缘后与容器内边距对齐，左右边距一致 */
  justify-content: flex-end;
  width: 34px; height: 34px; color: var(--text-3);
}
.mag-drawer-btn::-webkit-details-marker { display: none; }
.mag-drawer-btn::marker { content: ""; }
.mag-drawer-panel {
  display: none; position: absolute; right: 0; top: 42px; z-index: 30;
  min-width: 200px; padding: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
.mag-drawer[open] .mag-drawer-panel { display: block; }
.mag-drawer-panel a {
  display: block; padding: 10px 12px; border-radius: 8px;
  font-size: 15px; color: var(--text-2);
}
.mag-drawer-panel a:hover { background: var(--accent-soft); color: var(--accent-deep); }

/* -------------------------------------------------------------------- hero */
/* 首屏导语带：原先是整幅插画上压一张白卡（卡里是站名 h1），站名与页头品牌
   逐字重复；插画又都是同一套模板生成的（碗/天际线 + 地平线 + 圆），
   是全站视觉重复度最高的元素。现在只留那句描述，做成报头下的导语。 */
.mag-hero { width: 100%; max-width: 1120px; margin: 26px auto 0; padding: 0 20px; }
.mag-hero-tag {
  margin: 0; text-align: center;
  font-size: 17px; line-height: 1.9; letter-spacing: .02em; color: var(--text-2);
}

/* -------------------------------------------------------------------- main */
.mag-main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px 56px; }
.mag-sec { margin-top: 34px; }
.mag-sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 8px; border-bottom: 2px solid var(--text);
}
.mag-sec-h { margin: 0; font-size: 19px; font-weight: 500; }
.mag-sec-h a { color: var(--text); }
.mag-sec-more { font-size: 12.5px; color: var(--muted); }
.mag-items {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 28px; margin-top: 18px;
}
.mag-items.is-flat { margin-top: 14px; }
.mag-item { display: flex; flex-direction: column; gap: 10px; }
.mag-figure { display: block; border-radius: 12px; overflow: hidden; background: var(--surface-soft); }
.mag-figure img {
  display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  transition: transform .3s ease;
}
.mag-item:hover .mag-figure img { transform: scale(1.02); }
.mag-item-body { display: flex; flex-direction: column; gap: 4px; }
.mag-item-h { margin: 0; font-size: 16.5px; font-weight: 500; line-height: 1.55; }
.mag-item-h a { color: var(--text); }
.mag-item-h a:hover { color: var(--accent); }
.mag-item-date { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.mag-item.is-text {
  padding: 12px 0 10px; border-bottom: 1px solid var(--border-soft);
}
.mag-item.is-text .mag-item-h { font-size: 15.5px; }

/* ------------------------------------------------------------------ crumbs */
.mag-crumb { margin: 22px 0 10px; font-size: 12.5px; color: var(--muted); }
.mag-crumb a { color: var(--text-3); }
.mag-slash { margin: 0 8px; color: var(--border); }
.mag-cat-head { padding: 4px 0 20px; border-bottom: 1px solid var(--border); }
.mag-cat-h { margin: 0 0 6px; font-size: 28px; font-weight: 500; }
.mag-cat-n { margin: 0; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ article + aside */
.mag-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: 44px; align-items: start; margin-top: 12px;
}
.mag-layout.is-single { grid-template-columns: minmax(0, 760px); }
.mag-post { min-width: 0; }
.mag-post-h { margin: 0 0 10px; font-size: 31px; font-weight: 500; line-height: 1.35; }
.mag-meta {
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.mag-meta-tag {
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep); font-size: 12px;
}
.mag-body { font-size: 16px; line-height: 1.85; }
.mag-body p { margin: 0 0 15px; }
.mag-body h2 { margin: 30px 0 12px; font-size: 20px; font-weight: 500; }
.mag-body h3 { margin: 22px 0 8px; font-size: 17px; font-weight: 500; }
.mag-body .lead { font-size: 17px; color: var(--text-2); }
.mag-body ul.plain { margin: 0 0 18px; padding-left: 20px; }
.mag-body ul.plain li { margin: 7px 0; }
.mag-body figure, .mag-body .post-figure { margin: 20px 0; }
.mag-body .post-figure img { border-radius: 12px; }
.mag-body .post-figure figcaption { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }
.mag-body .post-tips {
  list-style: none; margin: 18px 0; padding: 14px 18px;
  background: var(--accent-soft); border-radius: 10px; font-size: 14.5px;
}
.mag-body .post-tips li { margin: 5px 0; }
.mag-body .post-mistake {
  margin: 18px 0; padding: 14px 16px; border-radius: 10px;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
}
.mag-body .post-mistake .wrong { color: var(--warn); }
.mag-body .post-mistake .right { color: var(--accent-deep); margin-top: 6px; }
.mag-body .post-mistake .note { margin-top: 8px; font-size: 13.5px; color: var(--text-4); }
.mag-body .post-qa { margin: 20px 0; }
.mag-body .post-qa dt { margin-top: 14px; font-weight: 600; }
.mag-body .post-qa dd { margin: 5px 0 0; color: var(--text-2); }
.mag-body table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.mag-body th, .mag-body td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; }

.mag-aside { position: sticky; top: 84px; }
.mag-aside-h {
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 400; letter-spacing: .14em; color: var(--muted);
}
.mag-aside-item {
  display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px dotted var(--border-soft);
}
.mag-aside-img {
  width: 84px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--surface-soft);
}
.mag-aside-t { font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.mag-aside-item:hover .mag-aside-t { color: var(--accent); }

/* ------------------------------------------------------------------- footer */
.mag-foot { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.mag-foot.is-min { padding: 22px 20px; text-align: center; }
.mag-friends.is-tight { margin: 8px auto 0; max-width: 760px; }
.mag-foot.is-row { padding: 22px 20px; }
.mag-foot-in {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; max-width: 1120px; margin: 0 auto;
}
.mag-foot-nav a { font-size: 12.5px; color: var(--text-3); margin-left: 14px; }
.mag-friends { max-width: 1120px; margin: 12px auto 0; font-size: 12px; line-height: 1.9; }
.mag-friends a { color: var(--muted); margin-right: 14px; white-space: nowrap; }
.mag-foot.is-cols { padding: 34px 20px 22px; }
.mag-foot-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px;
  max-width: 1120px; margin: 0 auto 20px;
}
.mag-foot-brand { display: flex; flex-direction: column; gap: 6px; }
.mag-foot-name { margin: 4px 0 0; font-size: 15px; color: var(--text-2); }
.mag-foot-tag { margin: 0; font-size: 12.5px; line-height: 1.7; }
.mag-foot-h { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .14em; color: var(--text-2); }
.mag-foot-col a { display: block; font-size: 12.5px; color: var(--muted); line-height: 2; }
.mag-copy { text-align: center; font-size: 12px; margin: 0; }

/* ------------------------------------------------------------------- mobile */
@media (max-width: 860px) {
  .mag-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .mag-aside { position: static; }
  .mag-foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .mag-head-in { grid-template-columns: 1fr auto; }
  .mag-nav { display: none; }
  .mag-nav-row { display: none; }
  .mag-drawer { display: block; }
  .mag-brand { justify-self: start; }
  .mag-head.is-stack .mag-head-in { flex: 1 1 auto; grid-template-columns: 1fr auto; }
  .mag-hero { margin: 18px auto 0; padding: 0 16px; }
  .mag-hero-tag { font-size: 15.5px; line-height: 1.8; }
  .mag-main { padding: 0 16px 40px; }
  .mag-items { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .mag-post-h { font-size: 24px; }
  .mag-body { font-size: 16px; }
  .mag-foot-grid { grid-template-columns: 1fr; }
}

/* 居中变体：导航撑满整行再居中。不撑满的话盒宽按 fit-content 走，
   导航一 nowrap 就把页头撑出屏幕；safe center 保证溢出时首项滚得到。 */
.mag-head.is-center .mag-nav { align-self: stretch; justify-self: stretch; justify-content: safe center; }

.mag-nav a[aria-current="page"] {
  color: var(--accent-deep);
  text-decoration: underline; text-decoration-thickness: 1.5px;
  text-underline-offset: 5px; text-decoration-color: var(--accent);
}
.mag-drawer-panel a[aria-current="page"] { color: var(--accent-deep); font-weight: 600; }
