/* 港見洽聞 — direction A 晨報. Paper, ink, vermilion. Phone first; desktop gets a 3-column broadsheet. */
:root {
  --paper: #F4EFE6; --paper-2: #EAE3D6; --ink: #1A1814; --ink-2: #3A352E; --muted: #5C554B;
  --rule: #CFC6B8; --accent: #B3261E; --mark: #F2C6B4;
  --serif: 'Noto Serif TC', 'Songti TC', serif; --sans: 'Noto Sans TC', 'PingFang HK', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.kicker { font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: 1px; }

/* ---------- shell ---------- */
.masthead { padding: calc(env(safe-area-inset-top) + 16px) 16px 10px; border-bottom: 3px double var(--ink);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.brand { font-family: var(--serif); font-weight: 900; font-size: 32px; letter-spacing: 2px; line-height: 1; }
.dateline { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.5; }
.cats { display: flex; gap: 18px; padding: 10px 16px 0; border-bottom: 1px solid var(--rule); overflow-x: auto;
  scrollbar-width: none; font-size: 14px; white-space: nowrap; }
.cats::-webkit-scrollbar { display: none; }
.cats a { padding-bottom: 8px; color: var(--muted); }
.cats a.on { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--accent); }
.layout { padding: 0 16px 100px; }
.side, .rail { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--ink);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
  z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted);
  min-height: 44px; justify-content: center; position: relative; }
.tabbar a.on { color: var(--accent); font-weight: 700; }
.tabbar svg { width: 22px; height: 22px; }
.badge { position: absolute; top: 2px; right: calc(50% - 20px); background: var(--accent); color: var(--paper);
  font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 16px; }

/* ---------- brief strip ---------- */
.briefbar { margin: 12px 0 0; padding: 10px 12px; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; gap: 12px; min-height: 52px; }
.briefbar:hover { color: var(--paper); }
.briefbar .dot { width: 32px; height: 32px; border-radius: 16px; background: var(--accent); flex: none;
  display: flex; align-items: center; justify-content: center; }
.briefbar small { display: block; color: #CFC6B8; font-size: 12px; }

/* ---------- feed ---------- */
.lead { display: block; padding: 16px 0 14px; border-bottom: 1px solid var(--ink); }
.lead .img { aspect-ratio: 16/9; background: var(--paper-2); overflow: hidden; margin-bottom: 12px; }
.lead .img img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); }
.lead h2 { font-family: var(--serif); font-weight: 900; font-size: 25px; line-height: 1.3; margin: 6px 0 8px; }
.lead p { margin: 0 0 10px; font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.spec { display: flex; height: 6px; gap: 2px; }
.spec span { display: block; }
.spec.sm { height: 4px; width: 140px; }
.row { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--rule);
  align-items: start; }
.row .num { font-family: var(--serif); font-size: 20px; color: var(--accent); font-weight: 700; line-height: 1.3; }
.row h3 { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.4; margin: 0 0 5px; }
.row .meta { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.row .thumb { width: 72px; height: 72px; background: var(--paper-2); overflow: hidden; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border: 1px solid var(--muted); color: var(--ink-2);
  margin-left: 4px; vertical-align: 1px; }
.tag.red { border-color: var(--accent); color: var(--accent); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.section-title { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 24px 0 4px;
  padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
.mini { display: grid; grid-template-columns: 1fr 56px; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.mini .t { font-size: 15px; line-height: 1.45; }
.mini .m { font-size: 11px; color: var(--muted); margin-top: 3px; }
.mini img { width: 56px; height: 56px; object-fit: cover; background: var(--paper-2); }

/* ---------- story ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 8px 4px;
  border-bottom: 1px solid var(--rule); }
.iconbtn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0;
  color: var(--ink); }
.btn { height: 38px; padding: 0 14px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 14px; }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.red { background: var(--accent); border-color: var(--accent); color: var(--paper); }
article.story { padding: 18px 0 40px; display: flex; flex-direction: column; gap: 22px; }
article.story h1 { font-family: var(--serif); font-weight: 900; font-size: 28px; line-height: 1.3; margin: 8px 0 10px; }
.dek { font-family: var(--serif); font-size: 17px; line-height: 1.7; color: var(--ink-2); margin: 0; }
.hero { aspect-ratio: 16/9; overflow: hidden; background: var(--paper-2); }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.credit { font-size: 11px; color: var(--muted); margin-top: 4px; }
.box { padding: 14px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; font-size: 12px; color: var(--ink-2);
  margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; }
h2.h { font-family: var(--serif); font-size: 18px; margin: 0 0 10px; }
.summary { font-family: var(--serif); font-size: 17px; line-height: 1.9; margin: 0; }
.point { padding-left: 12px; border-left: 2px solid var(--ink); margin-bottom: 12px; }
.point p { margin: 0 0 3px; font-size: 15px; line-height: 1.65; }
.point small { font-size: 12px; color: var(--muted); }
.compare { padding: 16px; background: var(--paper-2); border: 1px solid var(--ink); }
.compare .h-item { margin-bottom: 12px; font-family: var(--serif); font-size: 15px; line-height: 1.5; }
.compare .h-item small { font-family: var(--sans); display: block; font-size: 11px; margin-bottom: 2px; }
.compare mark { background: var(--mark); color: var(--ink); padding: 0 2px; }
.angle { display: grid; grid-template-columns: 6px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.angle .bar { align-self: stretch; }
.angle .who { font-size: 12px; color: var(--muted); }
.angle .t { font-size: 15px; line-height: 1.45; }
.srcs a { display: flex; justify-content: space-between; gap: 10px; min-height: 46px; align-items: center;
  border-bottom: 1px solid var(--rule); font-size: 14px; }
.srcs .src-t { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.flagbox { border: 1px solid var(--accent); padding: 12px; font-size: 13px; line-height: 1.6; }
.flagbox b { color: var(--accent); }
.footer-ai { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }

/* ---------- 深入閱讀 / 全部報道 ---------- */
.deep { border: 1px solid var(--ink); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.deep-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.deep-head .btn { height: 44px; padding: 0 18px; font-size: 15px; }
.deep-head .btn:disabled { opacity: .7; cursor: progress; }
.deep-body[hidden] { display: none; }
.deep-body { display: flex; flex-direction: column; gap: 18px; border-top: 1px solid var(--rule); padding-top: 14px; }
.deep-h { font-family: var(--serif); font-size: 17px; margin: 0 0 8px; }
.deep-tl { display: grid; grid-template-columns: 76px 1fr; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--rule);
  font-size: 15px; line-height: 1.55; }
.deep-tl .deep-src { grid-column: 2; }
.deep-when { font-size: 12px; color: var(--accent); font-weight: 700; padding-top: 3px; }
.deep-src { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.deep-q { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.7; }
.allrep { border-top: 1px solid var(--ink); padding-top: 12px; }
.allrep summary { cursor: pointer; font-family: var(--serif); font-weight: 700; font-size: 16px; min-height: 44px;
  display: flex; align-items: center; }
.allrep-outlet { margin: 14px 0 0; padding-bottom: 4px; border-bottom: 1px solid var(--ink); font-size: 14px; }

/* ---------- forms / settings ---------- */
.card { border: 1px solid var(--ink); padding: 16px; margin: 16px 0; background: var(--paper); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 14px; }
.field input { height: 44px; border: 1px solid var(--ink); background: #FBF8F2; padding: 0 12px; font-size: 16px; font-family: inherit; }
table.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.runs td, table.runs th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.switch { display: flex; gap: 8px; }

/* ---------- desktop broadsheet ---------- */
@media (min-width: 1024px) {
  .masthead { max-width: 1240px; margin: 0 auto; padding: 28px 24px 12px; }
  .brand { font-size: 44px; }
  .cats { max-width: 1240px; margin: 0 auto; padding: 12px 24px 0; }
  .tabbar { display: none; }
  .layout { max-width: 1240px; margin: 0 auto; padding: 0 24px 60px; display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 320px; gap: 36px; }
  .layout.wide { grid-template-columns: 180px minmax(0, 1fr); }
  .side { display: block; padding-top: 20px; position: sticky; top: 0; align-self: start; }
  .side a { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
  .side a.on { color: var(--accent); font-weight: 700; }
  .rail { display: block; padding-top: 12px; }
  .lead:has(.img) { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; }
  .lead .img { margin: 0; }
  .lead h2 { font-size: 32px; }
  .topbar { max-width: 1240px; margin: 0 auto; padding: 16px 24px 8px; }
  article.story h1 { font-size: 38px; }
  .hero { max-height: 380px; }
  .story-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; }
  .story-grid > aside { padding-top: 18px; display: flex; flex-direction: column; gap: 22px; }
}
@media (min-width: 1024px) and (max-width: 1180px) { .layout { grid-template-columns: 150px minmax(0, 1fr) 280px; gap: 24px; } }
