/* ============================================================
   AI·NEWS — design system (dark editorial, signature gradient)
   ============================================================ */
:root {
  --bg: #0a0c11;
  --bg-2: #0e1119;
  --surface: #141926;
  --surface-2: #1a2131;
  --surface-3: #212a3d;
  --ink: #eef2f9;
  --ink-2: #c3cad8;
  --muted: #8a93a8;
  --muted-2: #5f6980;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --brand: #7c5cff;
  --brand-2: #22d3ee;
  --heat: #ff5d7a;
  --ok: #34d399;
  --grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .75);
  --shadow-sm: 0 6px 18px -10px rgba(0, 0, 0, .7);
  --maxw: 1240px;
  --header-h: 68px;
  --font-body: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-disp: "Sora", "Noto Sans SC", "Inter", -apple-system, "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, video { display: block; max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; color: var(--ink-2); }
::selection { background: rgba(124, 92, 255, .35); color: #fff; }

/* ambient background glow */
.bg-fx {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 85% -10%, rgba(124, 92, 255, .18), transparent 60%),
    radial-gradient(50vw 50vw at -5% 8%, rgba(34, 211, 238, .14), transparent 60%),
    radial-gradient(70vw 70vw at 50% 120%, rgba(124, 92, 255, .10), transparent 60%);
}
body > *:not(.bg-fx) { position: relative; z-index: 1; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  background: rgba(10, 12, 17, .72);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); background: rgba(10, 12, 17, .86); }
.header-inner { height: 100%; display: flex; align-items: center; gap: 26px; }

.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-disp); font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand-orb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 0 rgba(124, 92, 255, .5);
  animation: orb 3.2s ease-in-out infinite;
}
@keyframes orb {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, .45), inset 0 0 6px rgba(255, 255, 255, .5); transform: scale(1); }
  50% { box-shadow: 0 0 18px 3px rgba(34, 211, 238, .55); transform: scale(1.06); }
}
.brand-word { white-space: nowrap; }

.main-nav { display: flex; gap: 4px; margin-left: 6px; }
.main-nav a {
  position: relative; padding: 8px 14px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 15px; transition: color .2s, background .2s;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a.active { color: var(--ink); }
.main-nav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  border-radius: 2px; background: var(--grad);
}

.search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; width: 260px; transition: border-color .2s, width .25s, background .2s;
  color: var(--muted);
}
.search:focus-within { border-color: var(--line-2); background: var(--surface-2); width: 320px; }
.search svg { flex: 0 0 auto; }
.search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink);
  font-size: 14px; font-family: inherit;
}
.search input::placeholder { color: var(--muted-2); }
.search-clear { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; }
.search-clear:hover { color: var(--ink); }

/* ---------- layout / sections ---------- */
#app { padding-top: 30px; padding-bottom: 60px; min-height: calc(100vh - var(--header-h)); }
.section { margin-top: 40px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.section-title { font-family: var(--font-disp); font-weight: 800; font-size: 24px; letter-spacing: .3px; margin: 0; display: flex; align-items: center; gap: 12px; }
.section-title .bar { width: 4px; height: 22px; border-radius: 3px; background: var(--grad); }
.section-sub { color: var(--muted); font-size: 14px; margin-left: auto; }

/* ---------- controls: segmented, pills, buttons ---------- */
.seg {
  display: inline-flex; padding: 4px; gap: 4px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
.seg button {
  border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 7px 16px; border-radius: 9px; transition: color .2s, background .2s, box-shadow .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button.active { color: #fff; background: var(--grad); box-shadow: 0 6px 16px -8px rgba(124, 92, 255, .8); }
.seg .ic { font-size: 13px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 7px 15px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: all .18s; display: inline-flex; align-items: center; gap: 7px;
}
.pill:hover { color: var(--ink); border-color: var(--line-2); }
.pill.active { color: #fff; background: var(--surface-3); border-color: var(--brand); box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .5); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 18px; border-radius: 11px; font-size: 14px; font-weight: 600;
  transition: all .18s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-1px); }
.btn-primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 22px -10px rgba(124, 92, 255, .9); }
.btn-primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.daterange { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.daterange input[type="date"] {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: 9px; padding: 7px 10px; font-family: inherit; font-size: 13px; color-scheme: dark;
}
.chip { border: 1px solid var(--line); background: none; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.chip.active { color: #fff; background: var(--surface-3); border-color: var(--brand); }

/* ---------- category tag / meta ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 999px; letter-spacing: .2px;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grad); }
.meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta .m { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { opacity: .8; }
.heat { color: var(--heat); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.heat .flame { font-size: 14px; filter: drop-shadow(0 0 6px rgba(255, 93, 122, .6)); }
.feat-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  color: #fff; background: var(--grad); padding: 3px 9px; border-radius: 999px; letter-spacing: .4px;
}

/* ---------- HERO (top focus) ---------- */
.hero {
  position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line);
  background: var(--surface); min-height: 340px; display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: var(--shadow); isolation: isolate;
}
.hero-bg { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; transition: transform .8s ease; }
.hero:hover .hero-bg { transform: scale(1.04); }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10,12,17,.15) 0%, rgba(10,12,17,.55) 45%, rgba(10,12,17,.94) 100%);
}
.hero-body { padding: 30px 32px; }
.hero .tag { backdrop-filter: blur(6px); background: rgba(20,25,38,.6); }
.hero h1 { font-family: var(--font-disp); font-weight: 800; font-size: clamp(26px, 3.6vw, 42px); line-height: 1.12; margin: 14px 0 10px; letter-spacing: -.3px; }
.hero p { color: var(--ink-2); font-size: 16px; max-width: 62ch; margin: 0 0 16px; }
.hero .meta { color: var(--ink-2); }
.hero .feat-badge { margin-bottom: 14px; }

/* ---------- news card ---------- */
.grid-news { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.card {
  display: flex; flex-direction: column; gap: 12px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .2s, border-color .2s, box-shadow .2s, background .2s;
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 3px;
  background: var(--grad); opacity: 0; transition: opacity .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-2); box-shadow: var(--shadow-sm); }
.card:hover::before { opacity: 1; }
.card-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.card h3 { font-size: 18px; line-height: 1.35; margin: 0; font-weight: 700; letter-spacing: -.1px; }
.card p { color: var(--muted); font-size: 14.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* featured list row (home) */
.feat-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.feat-side { display: flex; flex-direction: column; gap: 18px; }
.mini-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: all .2s; }
.mini-card:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-2px); }
.mini-thumb { width: 92px; height: 68px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; background: var(--surface-3); }
.mini-thumb.placeholder { display: grid; place-items: center; font-size: 22px; }
.mini-card h4 { margin: 0 0 4px; font-size: 15.5px; line-height: 1.3; font-weight: 600; }
.mini-card .meta { margin-top: 6px; font-size: 12px; }

/* empty / states */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 12px; }
.empty h3 { color: var(--ink); font-family: var(--font-disp); font-weight: 700; margin: 0 0 6px; }

/* ---------- news browse ---------- */
.toolbar { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.toolbar-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.result-count { color: var(--muted); font-size: 13px; }

.news-list { display: flex; flex-direction: column; gap: 14px; }
.news-row { display: grid; grid-template-columns: 1fr 220px; gap: 18px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); transition: all .2s; }
.news-row:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateX(2px); }
.news-row .body h3 { font-size: 18px; margin: 0 0 6px; font-weight: 700; line-height: 1.35; }
.news-row .body p { color: var(--muted); margin: 0; font-size: 14px; }
.news-row .thumb { width: 100%; height: 100%; min-height: 130px; border-radius: 10px; object-fit: cover; background: var(--surface-3); align-self: stretch; }
.news-row .thumb.placeholder { display: grid; place-items: center; font-size: 30px; }

/* pagination / load more */
.loadmore { display: flex; justify-content: center; margin-top: 26px; }

/* ---------- detail ---------- */
.detail { max-width: 820px; margin: 0 auto; }
.detail .back { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.detail .back:hover { color: var(--ink); }
.detail-head h1 { font-family: var(--font-disp); font-weight: 800; font-size: clamp(26px, 4vw, 40px); line-height: 1.15; letter-spacing: -.4px; margin: 14px 0 16px; }
.detail-cover { width: 100%; border-radius: 18px; margin: 22px 0; max-height: 460px; object-fit: cover; border: 1px solid var(--line); }

/* multi-image gallery (detail page): one image visible at a time, swipe/arrows to move */
.gallery { position: relative; margin: 22px 0; }
.gallery .gallery-img { display: block; margin: 0; cursor: default; }
.gal-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(10, 12, 17, .62); border: 1px solid var(--line-2); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.gal-nav:hover { background: rgba(124, 92, 255, .55); }
.gal-prev { left: 12px; }
.gal-next { right: 12px; }
.gal-counter {
  position: absolute; right: 12px; top: 12px; z-index: 2;
  background: rgba(10, 12, 17, .72); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.gal-dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; gap: 7px; justify-content: center; z-index: 2; pointer-events: none; }
.gal-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, .35); cursor: pointer; pointer-events: auto;
  transition: background .15s, transform .15s;
}
.gal-dot.active { background: var(--brand-2); transform: scale(1.25); }
.detail-content { font-size: 17px; line-height: 1.85; color: var(--ink-2); }
.detail-content p { margin: 0 0 18px; white-space: pre-wrap; }
.detail-actions { display: flex; gap: 12px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.src-links { margin-top: 26px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.src-links-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; letter-spacing: .04em; }
.src-links-row { display: flex; flex-wrap: wrap; gap: 10px; }
.src-link { display: inline-flex; align-items: baseline; gap: 6px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); transition: border-color .15s, transform .15s; }
.src-link:hover { border-color: var(--brand-2); transform: translateY(-1px); text-decoration: none; color: var(--ink); }
.src-link-sub { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.tags-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- media gallery ---------- */
.media-grid { columns: 3; column-gap: 16px; }
.media-item { break-inside: avoid; margin: 0 0 16px; position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.media-item img, .media-item video { width: 100%; height: auto; min-height: 140px; display: block; background: var(--surface-3); transition: transform .5s ease; }
.media-item:hover img, .media-item:hover video { transform: scale(1.05); }
.media-item .ov {
  position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(10,12,17,.9));
  opacity: 0; transition: opacity .25s; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px;
}
.media-item:hover .ov { opacity: 1; }
.media-item .ov .t { font-weight: 600; font-size: 15px; }
.media-item .ov .c { color: var(--muted); font-size: 13px; }
.media-badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px; background: rgba(10,12,17,.72); backdrop-filter: blur(6px); border: 1px solid var(--line); color: var(--ink-2); font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.play-ind { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; background: rgba(124,92,255,.85); display: grid; place-items: center; box-shadow: 0 8px 24px -8px rgba(124,92,255,.9); transition: transform .2s; }
.media-item:hover .play-ind { transform: translate(-50%, -50%) scale(1.1); }
.play-ind::after { content: ""; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 3px; }
.rot-idx { position: absolute; bottom: 10px; right: 10px; background: rgba(10,12,17,.78); backdrop-filter: blur(6px); border: 1px solid var(--line); color: var(--ink-2); font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px; }

/* ---------- lightbox ---------- */
/* #lightbox (id) so it beats the `body > *:not(.bg-fx){position:relative;z-index:1}`
   stacking rule — otherwise the overlay drops into document flow and looks inert. */
#lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(6, 8, 12, .94); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; padding: 40px; }
#lightbox[hidden] { display: none; }
.lb-stage { max-width: min(1100px, 90vw); max-height: 82vh; display: flex; align-items: center; justify-content: center; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 82vh; border-radius: 12px; box-shadow: var(--shadow); }
.lb-close { position: absolute; top: 22px; right: 26px; background: none; border: 0; color: var(--muted); font-size: 34px; line-height: 1; }
.lb-close:hover { color: #fff; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(20,25,38,.7); border: 1px solid var(--line); color: #fff; width: 48px; height: 48px; border-radius: 50%; font-size: 26px; display: grid; place-items: center; }
.lb-nav:hover { background: var(--surface-3); }
.lb-prev { left: 26px; } .lb-next { right: 26px; }
.lb-caption { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; color: var(--ink-2); font-size: 15px; pointer-events: none; }
.lb-caption .lb-counter { font-size: 12px; letter-spacing: 1.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.lb-caption .t { color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 10px; }
.lb-caption .lb-series { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #fff; background: rgba(124,92,255,.28); border: 1px solid rgba(124,92,255,.5); padding: 2px 9px; border-radius: 999px; }
.lb-caption .lb-sub { font-size: 13.5px; margin-top: 3px; }
.lb-caption .lb-src { margin-top: 6px; }
.lb-caption .lb-src a { pointer-events: auto; color: var(--ink-2); font-size: 13px; text-decoration: none; border-bottom: 1px solid var(--line); }
.lb-caption .lb-src a:hover { color: #fff; border-bottom-color: #fff; }

/* ---------- loading / footer ---------- */
.loading { display: grid; place-items: center; padding: 80px 0; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 34px 0 46px; background: rgba(10,12,17,.5); }
.footer-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-brand { font-family: var(--font-disp); font-weight: 800; font-size: 18px; }
.footer-note { color: var(--muted); font-size: 13.5px; margin: 0; flex: 1; min-width: 240px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); font-size: 14px; }
.footer-links a:hover { color: var(--ink); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid-news { grid-template-columns: 1fr; }
  .feat-row { grid-template-columns: 1fr; }
  .media-grid { columns: 2; }
  .news-row { grid-template-columns: 1fr; }
  .news-row .thumb { min-height: 180px; order: -1; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .header-inner { gap: 12px; }
  .main-nav a { padding: 8px 10px; font-size: 14px; }
  .search { width: 150px; }
  .search:focus-within { width: 170px; }
  .brand-word { font-size: 18px; }
  .media-grid { columns: 1; }
  .hero { min-height: 280px; }
  .hero-body { padding: 22px; }
  .section-title { font-size: 21px; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .site-header { height: auto; }
}
