/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* ── Tokens ── */
:root {
  --bg:        #F3F6FB;
  --paper:     #FFFFFF;
  --surface:   #EDF1F8;

  --ink:       #0F1E2D;
  --ink-mid:   #4A6275;
  --ink-lt:    #8BA3B6;
  --ink-xs:    #C2D2DE;

  --blue:      #3B7DD8;
  --blue-dk:   #2A5FAF;
  --blue-pale: #DEEAF9;

  --amber:     #E2943E;
  --amber-pale:#FDF3E7;

  --teal:      #3A9E8F;
  --teal-pale: #E2F4F2;
  --purple:    #7B62C8;
  --purple-pale:#EDE9F8;

  --border:    rgba(15,30,45,.07);
  --border-md: rgba(15,30,45,.13);

  --serif: 'Noto Serif TC', Georgia, serif;
  --sans:  'DM Sans', 'Noto Sans TC', sans-serif;
  --zh:    'Noto Sans TC', sans-serif;
  --mono:  'DM Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ══ TOP ACCENT LINE ══ */
.top-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--blue-dk), var(--blue) 60%, var(--amber));
}

/* ══ TOP NAV ══ */
.top-nav {
  position: sticky; top: 0; z-index: 300;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-md);
  height: 50px;
}
.top-nav-inner {
  max-width: 1160px; margin: 0 auto;
  padding: 0 48px;
  height: 100%;
  display: flex; align-items: stretch;
}
.nav-logo {
  display: flex; align-items: center;
  padding-right: 20px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-grid {
  width: 24px; height: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}
.logo-grid span {
  background: var(--blue);
  border-radius: 2px;
}
.logo-grid span:last-child { background: var(--amber); }

.tab-list {
  flex: 1;
  display: flex; align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }

.tab-item {
  display: flex; align-items: center;
  padding: 0 16px;
  height: 100%;
  font-family: var(--zh); font-size: .84rem; font-weight: 500;
  color: var(--ink-mid);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-item:hover { color: var(--ink); }
.tab-item.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 700;
}

.nav-right {
  display: flex; align-items: center;
  flex-shrink: 0;
}
.nav-brand-inline {
  display: flex; flex-direction: column; gap: 1px;
  padding: 0 20px;
}
.nav-brand-name {
  font-family: var(--zh); font-size: .84rem; font-weight: 700;
  color: var(--ink); letter-spacing: .06em; line-height: 1.2;
}
.nav-brand-sub {
  font-family: var(--mono); font-size: .58rem;
  color: var(--ink-lt); letter-spacing: .12em;
}
.nav-about {
  display: flex; align-items: center;
  padding: 0 20px;
  font-family: var(--zh); font-size: .8rem; font-weight: 400;
  color: var(--ink-lt); text-decoration: none;
  border-left: 1px solid var(--border);
  height: 28px;
}
.nav-about:hover { color: var(--blue); }

/* ══ MAIN LAYOUT ══ */
.layout {
  max-width: 1160px; margin: 0 auto;
  padding: 36px 48px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: start;
}

/* ══ FEATURED ARTICLE ══ */
.featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  display: block;
}
.featured-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.featured:hover .featured-title { color: var(--blue); }

.featured-img {
  aspect-ratio: 4/3;
  background: var(--surface);
  overflow: hidden;
}
.featured-img img { width: 100%; height: 100%; object-fit: cover; }
.featured-img-placeholder {
  width: 100%; height: 100%;
  min-height: 220px;
  background: linear-gradient(135deg, var(--blue-pale) 0%, var(--surface) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .7rem; color: var(--ink-lt);
}

.featured-body {
  padding: 28px 32px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.featured-tag {
  display: inline-flex; align-items: center;
  font-family: var(--zh); font-size: .75rem; font-weight: 500;
  padding: 3px 10px; border-radius: 4px;
  width: fit-content;
  margin-bottom: 14px;
}
.featured-title {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600;
  line-height: 1.5; color: var(--ink);
  margin-bottom: 12px;
  transition: color .15s;
}
.featured-excerpt {
  font-family: var(--zh); font-size: .95rem; font-weight: 300;
  color: var(--ink-mid); line-height: 1.8;
  flex: 1;
  margin-bottom: 20px;
}
.featured-meta {
  font-family: var(--serif); font-size: .72rem; font-weight: 300; color: var(--ink-lt);
}

/* ══ SECTION DIVIDER ══ */
.section-label {
  display: flex; align-items: center; gap: 12px;
  margin: 28px 0 16px;
}
.section-label span {
  font-family: var(--zh); font-size: .76rem; font-weight: 700;
  letter-spacing: .1em; color: var(--ink-lt);
  white-space: nowrap;
}
.section-label::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border-md);
}

/* ══ ARTICLE LIST ROWS ══ */
.article-list { display: flex; flex-direction: column; }

.article-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.article-row:first-child { border-top: 1px solid var(--border); }
.article-row:hover .row-title { color: var(--blue); }

.row-thumb {
  aspect-ratio: 16/10;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder {
  width: 100%; height: 100%;
  min-height: 80px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .6rem; color: var(--ink-xs);
}

/* Category colour bars */
.cat-earn       { box-shadow: inset 3px 0 0 var(--blue); }
.cat-finance    { box-shadow: inset 3px 0 0 var(--teal); }
.cat-productivity { box-shadow: inset 3px 0 0 var(--amber); }
.cat-privacy    { box-shadow: inset 3px 0 0 var(--purple); }

.row-body { display: flex; flex-direction: column; gap: 6px; }

.row-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--zh); font-size: .72rem; font-weight: 500;
  color: var(--ink-lt);
  width: fit-content;
}
.row-tag-dot {
  width: 4px; height: 4px; border-radius: 50%;
  flex-shrink: 0;
}
.row-title {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 400;
  line-height: 1.55; color: var(--ink);
  transition: color .15s;
}
.row-excerpt {
  font-family: var(--zh); font-size: .88rem; font-weight: 300;
  color: var(--ink-mid); line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-meta {
  font-family: var(--serif); font-size: .7rem; font-weight: 300; color: var(--ink-xs);
  margin-top: 2px;
}

/* ══ LOAD MORE ══ */
.load-more {
  display: flex; justify-content: center;
  padding: 24px 0 8px;
}
.load-more a {
  font-family: var(--zh); font-size: .85rem; font-weight: 500;
  color: var(--blue); text-decoration: none;
  padding: 9px 24px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  letter-spacing: .04em;
}
.load-more a:hover { background: var(--blue-pale); }

/* ══ SIDEBAR ══ */
.sidebar { display: flex; flex-direction: column; gap: 24px; }

.sidebar-block {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sidebar-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-head-text {
  font-family: var(--zh); font-size: .76rem; font-weight: 700;
  letter-spacing: .1em; color: var(--ink-lt);
}

.popular-list { padding: 8px 0; }
.popular-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.popular-item:last-child { border-bottom: none; }
.popular-item:hover .popular-title { color: var(--blue); }
.popular-num {
  font-family: var(--serif); font-size: .78rem; font-weight: 300;
  color: var(--ink-xs);
}
.popular-item:nth-child(1) .popular-num,
.popular-item:nth-child(2) .popular-num,
.popular-item:nth-child(3) .popular-num { color: var(--blue); }
.popular-title {
  font-family: var(--serif); font-size: .88rem; font-weight: 400;
  line-height: 1.5; color: var(--ink-mid);
}

.about-block { padding: 20px; }
.about-text {
  font-family: var(--zh); font-size: .85rem; font-weight: 300;
  color: var(--ink-mid); line-height: 1.85;
}
.about-cta {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--zh); font-size: .8rem; font-weight: 500;
  color: var(--blue); text-decoration: none;
  padding: 7px 16px;
  border: 1px solid var(--blue);
  border-radius: 5px;
}
.about-cta:hover { background: var(--blue-pale); }

/* ══ FOOTER ══ */
footer {
  border-top: 1px solid var(--border-md);
  background: var(--paper);
  padding: 28px 48px;
  margin-top: 48px;
}
.footer-inner {
  max-width: 1160px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px;
}
.footer-copy {
  font-family: var(--serif); font-size: .68rem; font-weight: 300; color: var(--ink-xs);
  letter-spacing: .06em;
}
.footer-links { display: flex; gap: 20px; list-style: none; }
.footer-links a {
  font-family: var(--zh); font-size: .76rem; color: var(--ink-lt);
  text-decoration: none;
}
.footer-links a:hover { color: var(--blue); }

/* ══ CATEGORY TAG COLOURS ══ */
.tag-earn        { color: var(--blue);   background: var(--blue-pale); }
.tag-finance     { color: var(--teal);   background: var(--teal-pale); }
.tag-productivity{ color: var(--amber);  background: var(--amber-pale); }
.tag-privacy     { color: var(--purple); background: var(--purple-pale); }

/* ══ SINGLE ARTICLE PAGE ══ */
.article-layout {
  max-width: 1160px; margin: 0 auto;
  padding: 40px 48px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}

.article-header { margin-bottom: 32px; }
.article-cat-tag {
  display: inline-flex; align-items: center;
  font-family: var(--zh); font-size: .75rem; font-weight: 500;
  padding: 3px 10px; border-radius: 4px;
  margin-bottom: 16px;
}
.article-title {
  font-family: var(--serif); font-size: 2rem; font-weight: 600;
  line-height: 1.45; color: var(--ink);
  margin-bottom: 14px;
}
.article-meta {
  font-family: var(--serif); font-size: .76rem; font-weight: 300;
  color: var(--ink-lt);
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-md);
}

/* Article body typography */
.article-body { font-family: var(--zh); font-size: 1rem; line-height: 1.9; color: var(--ink-mid); }

.article-body h2 {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 600;
  color: var(--ink);
  margin: 2.4em 0 .8em;
  padding-bottom: .4em;
  border-bottom: 1px solid var(--border);
}
.article-body h3 {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 600;
  color: var(--ink);
  margin: 2em 0 .6em;
}
.article-body h4 {
  font-family: var(--zh); font-size: .95rem; font-weight: 700;
  color: var(--ink);
  margin: 1.6em 0 .4em;
}
.article-body p { margin-bottom: 1.4em; }
.article-body p:last-child { margin-bottom: 0; }

.article-body strong { font-weight: 700; color: var(--ink); }
.article-body em { font-style: italic; }
.article-body code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface); border: 1px solid var(--border-md);
  border-radius: 3px; padding: 1px 5px;
  color: var(--blue-dk);
}
.article-body pre {
  background: var(--ink); color: #e8f0f8;
  border-radius: 8px; padding: 20px 24px;
  overflow-x: auto; margin: 1.6em 0;
  font-family: var(--mono); font-size: .88rem; line-height: 1.7;
}
.article-body pre code {
  background: transparent; border: none; padding: 0; color: inherit;
}

.article-body ul, .article-body ol {
  padding-left: 1.6em; margin-bottom: 1.4em;
}
.article-body li { margin-bottom: .4em; }

.article-body blockquote {
  border-left: 3px solid var(--blue);
  padding: 12px 20px;
  margin: 1.6em 0;
  background: var(--blue-pale);
  border-radius: 0 6px 6px 0;
  font-size: .9rem; color: var(--ink-mid);
}
.article-body blockquote p { margin-bottom: .4em; }
.article-body blockquote p:last-child { margin-bottom: 0; }

/* Tables */
.article-body table {
  width: 100%; border-collapse: collapse;
  margin: 1.6em 0;
  font-family: var(--zh); font-size: .88rem;
}
.article-body th {
  background: var(--surface);
  font-weight: 700; color: var(--ink);
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border-md);
  font-size: .82rem; letter-spacing: .04em;
}
.article-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--ink-mid);
  vertical-align: top;
}
.article-body tr:nth-child(even) td { background: var(--surface); }

.article-body hr {
  border: none; border-top: 1px solid var(--border-md);
  margin: 2em 0;
}

.article-body a { color: var(--blue); text-decoration: underline; text-decoration-color: var(--blue-pale); }
.article-body a:hover { text-decoration-color: var(--blue); }

/* Affiliate disclosure note */
.article-body p:has(> strong:first-child:contains("📌")) {
  background: var(--amber-pale);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: .85rem;
  color: var(--ink-mid);
  margin-top: 2em;
}

/* ══ SECTION/CATEGORY LIST PAGE ══ */
.section-layout {
  max-width: 1160px; margin: 0 auto;
  padding: 36px 48px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: start;
}
.section-header { margin-bottom: 8px; }
.section-title {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 600;
  color: var(--ink); margin-bottom: 6px;
}
.section-desc {
  font-family: var(--zh); font-size: .88rem; font-weight: 300;
  color: var(--ink-mid);
}

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  .layout, .article-layout, .section-layout {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    gap: 24px;
  }
  .sidebar { display: none; }
  .featured-inner { grid-template-columns: 1fr; }
  .featured-img { aspect-ratio: 16/9; }
  .top-nav-inner { padding: 0 20px; }
  .nav-brand-inline { display: none; }
  .article-title { font-size: 1.5rem; }
  footer { padding: 20px; }
}
@media (max-width: 600px) {
  .article-row { grid-template-columns: 120px 1fr; gap: 14px; }
  .tab-item { padding: 0 10px; font-size: .78rem; }
}
