/* ============================================================
   小梦实验室 · 门户样式
   视觉语言与「深色学科海报」封面保持一致：
   深空底 + 学科双色渐变 + 细发丝线 + 微光颗粒
   ============================================================ */

:root {
  --bg: #05070f;
  --ink: #eaeefa;
  --ink-2: #c3cce0;
  --muted: #8b96ae;
  --muted-2: #646e88;

  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);

  --brand: #818cf8;
  --brand-2: #22d3ee;

  --font-sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Hiragino Sans GB", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-en: "Bahnschrift", "Segoe UI Variable", "Segoe UI", -apple-system,
    "Helvetica Neue", Arial, sans-serif;

  --shell: 1320px;
  --pad: 32px;
  --r: 18px;
  --ease: cubic-bezier(0.22, 0.68, 0.16, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background-color: #05070f;
}

/* 视觉隐藏但保留给读屏 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    radial-gradient(1100px 620px at 10% -10%, rgba(129, 140, 248, 0.14), transparent 62%),
    radial-gradient(900px 540px at 92% 4%, rgba(34, 211, 238, 0.09), transparent 60%),
    linear-gradient(180deg, #05070f 0%, #070b17 46%, #05070f 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 链接基线：干掉默认蓝与下划线 */
a {
  color: inherit;
  text-decoration: none;
}
a:focus-visible {
  outline: 2px solid rgba(129, 140, 248, 0.85);
  outline-offset: 3px;
}

/* ===== 背景光场 ===== */
.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.aura span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.aura .a1 {
  width: 620px; height: 620px; top: -260px; left: -140px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 66%);
  animation: drift-a 26s var(--ease) infinite alternate;
}
.aura .a2 {
  width: 560px; height: 560px; top: -180px; right: -160px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.32), transparent 66%);
  animation: drift-b 32s var(--ease) infinite alternate;
}
.aura .a3 {
  width: 700px; height: 700px; bottom: -420px; left: 40%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.26), transparent 68%);
  animation: drift-a 38s var(--ease) infinite alternate-reverse;
}
@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(60px, 40px, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to   { transform: translate3d(-70px, 50px, 0) scale(1); }
}

/* 极细颗粒，压住渐变的塑料感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.028;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ===== 顶部导航 ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.88), rgba(5, 7, 15, 0.5));
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transition: border-color 0.3s ease, background 0.3s ease;
}
.nav.scrolled {
  border-bottom-color: var(--line);
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.96), rgba(5, 7, 15, 0.74));
}
.nav-in {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 15px var(--pad);
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none;
}
.logo-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  box-shadow:
    0 6px 18px -6px rgba(99, 102, 241, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-txt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1;
}
.brand-txt b {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.brand-txt em {
  font-family: var(--font-en);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted-2);
}

/* 学科胶囊导航 */
.chips {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: color 0.22s ease, background 0.22s ease, border-color 0.22s ease;
  white-space: nowrap;
}
.chip i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, var(--brand));
  box-shadow: 0 0 8px var(--accent, var(--brand));
}
.chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--line);
}
.chip.on {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-2);
}

.nav-meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.nav-meta b {
  color: #dfe6f7;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
}
.back svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.back:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--line-2);
  transform: translateX(-2px);
}

/* ===== 广告横幅 ===== */
.ad-wrap {
  position: relative;
  z-index: 2;
  max-width: var(--shell);
  margin: 26px auto 0;
  padding: 0 var(--pad);
}
.ad-banner {
  position: relative;
  display: block;
  border-radius: 20px;
  overflow: hidden;
  line-height: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 18px 44px -18px rgba(3, 6, 16, 0.9);
  transition: box-shadow 0.3s ease;
}
.ad-banner picture {
  display: block;
  line-height: 0;
}
.ad-banner img {
  width: 100%;
  height: auto;
  display: block;
}
.ad-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 44%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ad-banner:hover {
  box-shadow:
    0 0 0 1px rgba(129, 140, 248, 0.42) inset,
    0 22px 52px -18px rgba(3, 6, 16, 1);
}
.ad-banner:hover::after { opacity: 1; }

/* ===== 学科区块 ===== */
.container {
  position: relative;
  z-index: 2;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 46px var(--pad) 76px;
}
.container.is-list { padding-top: 30px; }

.subject {
  margin-bottom: 54px;
}
/* 只有 JS 可用时才做入场隐藏，避免脚本失效导致内容不可见 */
.js .subject {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js .subject.in {
  opacity: 1;
  transform: none;
}
.subject:last-child { margin-bottom: 0; }

.s-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.s-title {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: none;
}
.s-en {
  font-family: var(--font-en);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent, var(--brand));
  opacity: 0.92;
}
.s-title h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  color: #f4f7ff;
}
.s-line {
  flex: 1;
  height: 1px;
  margin-bottom: 9px;
  background: linear-gradient(90deg, var(--line-2), rgba(255, 255, 255, 0.02));
}
.s-cnt {
  flex: none;
  margin-bottom: 5px;
  font-size: 12.5px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.s-cnt b {
  color: var(--ink-2);
  font-weight: 700;
  font-size: 14px;
}

/* 「全部课件」胶囊按钮 */
.more {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 16px;
  margin-bottom: 2px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  transition: color 0.24s ease, background 0.24s ease, border-color 0.24s ease;
}
.more .arr {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  transition: background 0.24s ease, color 0.24s ease, transform 0.24s ease;
}
.more .arr svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.more:hover {
  color: #080b16;
  background: var(--accent, var(--brand));
  border-color: transparent;
}
.more:hover .arr {
  background: rgba(8, 11, 22, 0.16);
  color: #080b16;
  transform: translateX(2px);
}

/* ===== 网格：固定 4 列，无滚动条 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.grid.all { gap: 18px; }

/* ===== 海报卡片 ===== */
.tile {
  position: relative;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #080c16;
  isolation: isolate;
  transform: translateZ(0);
  transition:
    transform 0.4s var(--ease),
    border-color 0.3s ease,
    box-shadow 0.4s var(--ease);
}
.tile-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.005);
  transition: transform 0.7s var(--ease), filter 0.4s ease;
}

/* 四角细 L 角标（呼应海报四角标记） */
.tile::after {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.34s ease;
  --c: var(--accent, var(--brand));
  background:
    linear-gradient(var(--c), var(--c)) left top / 15px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 1px 15px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 15px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 1px 15px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 15px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 1px 15px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 15px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 1px 15px no-repeat;
}

.tile-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.34s ease;
  background: linear-gradient(
    to top,
    rgba(4, 7, 14, 0.96) 0%,
    rgba(4, 7, 14, 0.8) 34%,
    rgba(4, 7, 14, 0.16) 66%,
    rgba(4, 7, 14, 0) 100%
  );
}

.tile-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 16px 18px 17px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.34s ease, transform 0.34s var(--ease);
}
.tile-q {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #a7b1c6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: #8b96ae;
  font-variant-numeric: tabular-nums;
}
.tile-meta i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent, var(--brand));
}

.go {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 4;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(8, 12, 22, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-4px) scale(0.9);
  transition: opacity 0.34s ease, transform 0.34s var(--ease), background 0.24s ease;
}
.go svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 26px 54px -22px rgba(0, 0, 0, 0.95),
    0 20px 46px -26px var(--accent, var(--brand));
}
.tile:hover .tile-media img,
.tile:focus-visible .tile-media img {
  transform: scale(1.055);
}
.tile:hover::after,
.tile:focus-visible::after { opacity: 0.85; }
.tile:hover .tile-veil,
.tile:focus-visible .tile-veil,
.tile:hover .tile-info,
.tile:focus-visible .tile-info,
.tile:hover .go,
.tile:focus-visible .go {
  opacity: 1;
  transform: none;
}
.tile:hover .go { background: rgba(255, 255, 255, 0.14); }

/* 触屏设备：信息常驻，不依赖 hover */
@media (hover: none) {
  .tile-veil,
  .tile-info,
  .go,
  .tile::after { opacity: 1; transform: none; }
  .tile-veil { opacity: 0.92; }
}

/* ===== 学科页头部 ===== */
.s-hero {
  position: relative;
  z-index: 2;
  max-width: var(--shell);
  margin: 26px auto 0;
  padding: 0 var(--pad);
}
.hero-in {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 46px 48px 44px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.075),
    0 24px 60px -34px rgba(0, 0, 0, 0.9);
}
.hero-in::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.17;
  background: radial-gradient(
    760px 320px at 4% 0%,
    var(--accent, var(--brand)),
    transparent 64%
  );
  filter: blur(6px);
}
.hero-in::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  background: radial-gradient(
    620px 300px at 96% 100%,
    var(--accent2, var(--brand-2)),
    transparent 66%
  );
}
.hero-txt { position: relative; z-index: 2; }
.eyebrow {
  margin: 0 0 16px;
  font-family: var(--font-en);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent, var(--brand));
  opacity: 0.92;
}
.hero-txt h1 {
  margin: 0;
  font-size: clamp(40px, 5.4vw, 62px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.04;
  background: linear-gradient(
    118deg,
    #ffffff 0%,
    #ffffff 38%,
    var(--accent, var(--brand)) 72%,
    var(--accent2, var(--brand-2)) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.hero-sub b {
  color: var(--accent, var(--brand));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hero-no {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  font-family: var(--font-en);
  font-size: clamp(120px, 15vw, 210px);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: -0.03em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.1);
  pointer-events: none;
  user-select: none;
}

/* ===== 页脚 ===== */
.foot {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line);
  padding: 26px var(--pad) 46px;
}
.foot-in {
  max-width: var(--shell);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 11px;
  font-size: 12.5px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}
.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-weight: 600;
}
.foot-brand i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.foot-sep {
  width: 1px;
  height: 12px;
  background: var(--line-2);
}

/* ===== 响应式 ===== */
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .chips { display: none; }
}
@media (max-width: 860px) {
  :root { --pad: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .s-head { flex-wrap: wrap; align-items: center; }
  .s-line { display: none; }
  .s-cnt { margin-bottom: 0; margin-left: auto; }
  .s-title h2 { font-size: 22px; }
  .hero-in { padding: 34px 26px 32px; border-radius: 20px; }
  .hero-no { font-size: 108px; right: 14px; opacity: 0.7; }
  .nav-meta { display: none; }
  .back { margin-left: auto; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .hero-sub { font-size: 13px; }
  .foot-in { font-size: 12px; }
}

/* ===== 无障碍：减少动效 ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aura span, .live { animation: none; }
  .js .subject { opacity: 1; transform: none; transition: none; }
  .tile, .tile-media img, .tile-info, .go, .tile-veil { transition: none; }
}
