/* Life Compass - global styles. No Chinese in this file. */

:root{
  --law: #2C3E6B;
  --health: #2E8B57;
  --travel: #E67E22;
  --humanities: #8B5A2B;
  --home: #3E7CB1;
  --about: #7A5C9E;
  --bg: #F8F6F3;
  --surface: #FFFFFF;
  --ink: #23252B;
  --muted: #6B6B73;
  --line: #E7E2DA;
  --shadow: 0 8px 28px rgba(40,38,34,0.08);
  --radius: 16px;
  --maxw: 1120px;
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: "Outfit","Manrope",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* the fixed header is out of flow: reserve its height so content is not hidden */
  padding-top: 69px;
}
a{ color: inherit; text-decoration: none; }
img{ max-width:100%; display:block; }
.container{ max-width: var(--maxw); margin:0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header{
  position: fixed; top:0; left:0; right:0; z-index: 50;
  background: rgba(248,246,243,0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner{
  display:flex; align-items:center; justify-content:space-between;
  height: 68px; gap: 16px;
}
.brand{ display:flex; align-items:center; gap:10px; font-weight:700; font-size:20px; letter-spacing:.2px; }
.brand .logo{ width:38px; height:38px; flex:0 0 auto; }
.brand .brand-text{ display:flex; flex-direction:column; line-height:1.05; }
.brand .brand-text small{ font-size:11px; font-weight:500; color:var(--muted); letter-spacing:2px; text-transform:uppercase; }

.nav{ display:flex; align-items:center; gap: 6px; }
.nav a{
  padding: 8px 12px; border-radius: 10px; font-weight:600; font-size:14px; color:var(--muted);
  transition: background .15s, color .15s;
}
.nav a:hover{ background: #fff; color: var(--ink); }
.nav a.cat-law:hover{ color: var(--law); }
.nav a.cat-health:hover{ color: var(--health); }
.nav a.cat-travel:hover{ color: var(--travel); }
.nav a.cat-humanities:hover{ color: var(--humanities); }
.nav a.cat-home:hover{ color: var(--home); }
.nav a.cat-about:hover{ color: var(--about); }

.hamburger{ display:none; background:none; border:1px solid var(--line); border-radius:10px; width:44px; height:40px; cursor:pointer; font-size:18px; color:var(--ink); }

/* ---------- Hero / first title ---------- */
.page-head{ padding: 40px 0 8px; }
.eyebrow{ font-size:12px; letter-spacing:3px; text-transform:uppercase; color:var(--muted); font-weight:600; }
.page-title{ font-size: clamp(28px, 5vw, 44px); margin: 6px 0 10px; line-height:1.1; }
.page-sub{ color:var(--muted); max-width: 640px; margin:0; }

/* ---------- Article grid ---------- */
.feed{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 28px 0 8px; }
.card{
  background: var(--surface); border:1px solid var(--line); border-radius: var(--radius);
  overflow:hidden; box-shadow: var(--shadow); display:flex; flex-direction:column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover{ transform: translateY(-4px); box-shadow: 0 14px 34px rgba(40,38,34,0.12); }
.card .thumb{ aspect-ratio: 3/2; width:100%; object-fit:cover; }
.card .body{ padding: 16px 18px 20px; display:flex; flex-direction:column; gap:8px; flex:1; }
.cat-tag{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; letter-spacing:.4px; width:fit-content; padding:4px 10px; border-radius:999px; }
.cat-law{ background: rgba(44,62,107,0.10); color: var(--law); }
.cat-health{ background: rgba(46,139,87,0.12); color: var(--health); }
.cat-travel{ background: rgba(230,126,34,0.14); color: var(--travel); }
.cat-humanities{ background: rgba(139,90,43,0.12); color: var(--humanities); }
.cat-home{ background: rgba(62,124,177,0.12); color: var(--home); }
.cat-about{ background: rgba(122,92,158,0.12); color: var(--about); }
.card h3{ font-size:18px; margin:0; line-height:1.3; }
.card .excerpt{ color:var(--muted); font-size:14px; margin:0; flex:1; }
.card .more{ font-weight:700; color:var(--ink); font-size:14px; }
.card .more span{ transition: transform .15s; display:inline-block; }
.card:hover .more span{ transform: translateX(4px); }

/* ---------- Detail ---------- */
/* NOTE: keep horizontal padding here - `.detail` also sits on `.container`,
   so an explicit 0 side padding would flush the copy against the wall on mobile. */
.detail{max-width: 800px; margin:0 auto; padding: 28px 20px 40px; }
.back-link{ color:var(--muted); font-size:14px; font-weight:600; }
.detail h1{ font-size: clamp(26px,4.5vw,38px); line-height:1.15; margin: 14px 0 8px; }
.detail .meta{ color:var(--muted); font-size:14px; margin-bottom: 18px; display:flex; gap:10px; align-items:center; }
.detail .lead-img{ width:100%; aspect-ratio:3/2; object-fit:cover; border-radius: var(--radius); margin: 6px 0 22px; box-shadow: var(--shadow); }
.detail h2{ font-size:22px; margin: 26px 0 10px; }
.detail p{ font-size:17px; margin: 0 0 18px; }
.detail .inline-img{ width:100%; aspect-ratio:3/2; object-fit:cover; border-radius:12px; margin: 10px 0 22px; }

.related{ margin-top: 40px; }
.related h3{ font-size:20px; margin:0 0 16px; }
.related-grid{ display:grid; grid-template-columns: repeat(3,1fr); gap:16px; }

/* ---------- Continue button (interstitial trigger) ---------- */
.continue-btn{
  display:inline-flex; align-items:center; gap:8px; margin-top: 18px;
  background: var(--ink); color:#fff; border:none; border-radius:12px;
  padding: 12px 20px; font-weight:700; font-size:15px; cursor:pointer; font-family:inherit;
}
.continue-btn:hover{ opacity:.9; }

/* ---------- Ad slots / placeholders ---------- */
.adbox{ margin: 22px 0; display:flex; justify-content:center; }
/* a homepage ad placed inside the grid must span the full width (mobile-first) */
.feed > .adbox{ grid-column: 1 / -1; }
.ad-slot{
  width:100%; height:auto; min-height: 250px;
  display:flex; align-items:center; justify-content:center;
  border: 1px dashed #D8D2C8; border-radius: 12px;
  background: repeating-linear-gradient(45deg, #fbfaf8, #fbfaf8 10px, #f4f1ec 10px, #f4f1ec 20px);
  color:#a59e92; font-size:12px; letter-spacing:2px; text-transform:uppercase; font-weight:600;
}
.ad-slot::after{ content:"advertisement"; }
/* when real ad is injected (iframe or ins), hide placeholder chrome */
.ad-slot:has(iframe), .ad-slot:has(ins){ min-height:auto; border-color:transparent; background:transparent; }
.ad-slot:has(iframe)::after, .ad-slot:has(ins)::after{ content:none; }

/* anchor bottom bar - fixed 50px, never covers content */
#adAnchor{
  position: fixed; left:0; right:0; bottom:0; z-index: 60;
  height: 50px; padding: 0; box-sizing: border-box; overflow: hidden;
  display:flex; justify-content:center; align-items:center;
  background: rgba(255,255,255,0.96); border-top:1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(40,38,34,0.10);
}
#adAnchor:empty{ display:none; }
/* the slot must stay inside the 50px bar: kill the base 250px min-height */
#adAnchor .ad-slot{ width:100%; height:100%; min-height:0; max-height:100%; max-width:none; }
/* reserve a 50px bottom gutter while the bar is shown so it never hides content/footer */
body.anchor-visible{ padding-bottom: 50px; }

/* interstitial overlay - inset with a gutter so the panel never touches the walls */
#adInterstitial{
  position: fixed; inset:0; z-index: 100; display:none;
  align-items:center; justify-content:center; padding: 16px;
  background: rgba(20,20,24,0.72); backdrop-filter: blur(2px);
}
#adInterstitial.show{ display:flex; }
#adInterstitialBody{
  position: relative; width: 100%; max-width: 520px;
  background:#fff; border-radius: 12px; padding: 0; overflow: hidden;
  display:flex; align-items:center; justify-content:center;
}
/* the moved adbox is a flex child: force it to span the full modal width */
#adInterstitialBody .adbox{ width:100%; margin:0; }
#adInterstitialBody .ad-slot{ width:100%; min-height: 300px; }
.inter-close{
  position:absolute; z-index:2; top:10px; right:10px; width:36px; height:36px; border-radius:50%;
  background:#fff; border:1px solid var(--line); cursor:pointer; font-size:18px; color:var(--ink);
  box-shadow: var(--shadow);
}

/* ---------- Footer ---------- */
.site-footer{ border-top:1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-inner{ padding: 32px 0; display:flex; flex-wrap:wrap; gap: 24px; justify-content:space-between; }
.footer-cols{ display:flex; gap: 40px; flex-wrap:wrap; }
.footer-col h4{ font-size:13px; letter-spacing:1px; text-transform:uppercase; color:var(--muted); margin:0 0 10px; }
.footer-col a{ display:block; color:var(--ink); font-size:14px; padding:3px 0; }
.footer-col a:hover{ color: var(--travel); }
.cookie-note{ font-size:12px; color:var(--muted); max-width: 520px; line-height:1.5; }
.copyright{ font-size:12px; color:var(--muted); padding: 0 0 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px){ .feed{ grid-template-columns: repeat(2,1fr); } .related-grid{ grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px){
  /* keep a clear gutter on small screens: nothing may sit flush against the wall */
  .container, .container.detail{ padding-left: 20px; padding-right: 20px; }
  .feed{ grid-template-columns: 1fr; }
  .related-grid{ grid-template-columns: 1fr; }
  .nav{
    position:absolute; top:68px; left:0; right:0; background: var(--surface);
    border-bottom:1px solid var(--line); flex-direction:column; align-items:stretch;
    padding: 8px 20px 16px; gap:4px; display:none;
  }
  .nav.open{ display:flex; }
  .nav a{ padding: 12px 8px; }
  .hamburger{ display:inline-flex; align-items:center; justify-content:center; }
  .detail p{ font-size:16px; }
}
