:root {
  color-scheme: light;
  --bg: #f7faff;
  --surface: #ffffff;
  --surface-soft: #f0f5fd;
  --ink: #0b1830;
  --text: #42516b;
  --muted: #76859e;
  --line: #dfe7f3;
  --primary: #1769ec;
  --primary-dark: #0e54c5;
  --cyan: #26b8d3;
  --amber: #edae39;
  --shadow: 0 18px 55px rgba(41, 74, 125, 0.12);
  --content: 1180px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071327;
  --surface: #0d1d36;
  --surface-soft: #112542;
  --ink: #f4f7fc;
  --text: #bdc9d9;
  --muted: #8293ac;
  --line: #213754;
  --primary: #4d91ff;
  --primary-dark: #7eb0ff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-size: 1rem; line-height: 1.65; transition: color 180ms ease, background 180ms ease; }
body.menu-open { overflow: hidden; }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 100; padding: 0.6rem 0.9rem; background: var(--primary); color: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(18px); }
.header-inner { width: min(calc(100% - 2.5rem), var(--content)); min-height: 72px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(1.5rem, 4vw, 4rem); }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; font-size: 1.08rem; font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 0.7rem; background: var(--primary); color: #fff; font: 750 0.7rem/1 ui-monospace, Consolas, monospace; box-shadow: 0 8px 20px rgba(23, 105, 236, 0.25); }
.nav { justify-self: center; display: flex; align-self: stretch; gap: clamp(1.1rem, 2.5vw, 2.25rem); }
.nav a { position: relative; display: flex; align-items: center; color: var(--text); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.nav a::after { content: ""; position: absolute; right: 50%; bottom: -1px; left: 50%; height: 2px; border-radius: 2px; background: var(--primary); transition: inset 160ms ease; }
.nav a:hover, .nav a:focus-visible, .nav a.active { color: var(--primary); }
.nav a:hover::after, .nav a:focus-visible::after, .nav a.active::after { right: 0; left: 0; }
.header-actions { display: flex; align-items: center; gap: 0.65rem; }
.search-box { position: relative; display: block; }
.search-box input { width: clamp(10rem, 17vw, 14rem); height: 38px; padding: 0 0.9rem 0 2.35rem; border: 1px solid transparent; border-radius: 999px; outline: none; background: var(--surface-soft); color: var(--ink); font-size: 0.82rem; transition: border 160ms ease, box-shadow 160ms ease, width 160ms ease; }
.search-box input:focus { width: clamp(12rem, 20vw, 17rem); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 105, 236, 0.12); }
.search-box input::placeholder { color: var(--muted); }
.search-icon { position: absolute; top: 11px; left: 0.85rem; z-index: 1; width: 14px; height: 14px; border: 2px solid var(--muted); border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; width: 6px; height: 2px; right: -5px; bottom: -2px; background: var(--muted); transform: rotate(45deg); }
.theme-toggle { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #173f79; color: #fff; cursor: pointer; box-shadow: 0 6px 16px rgba(14, 62, 128, 0.2); }
.theme-toggle:hover { transform: translateY(-1px); }
.sun { display: none; }
[data-theme="dark"] .sun { display: inline; }
[data-theme="dark"] .moon { display: none; }
.menu-toggle { display: none; width: 42px; height: 42px; border: 0; background: transparent; cursor: pointer; }
.menu-toggle span { display: block; width: 22px; height: 2px; margin: 5px auto; background: var(--ink); transition: transform 160ms ease, opacity 160ms ease; }

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 82% 35%, rgba(61, 139, 255, 0.13), transparent 28%), linear-gradient(180deg, color-mix(in srgb, var(--bg) 65%, #fff) 0%, var(--bg) 100%); }
.hero-grid { position: absolute; inset: 0; opacity: 0.55; background-image: linear-gradient(rgba(65, 116, 189, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(65, 116, 189, 0.08) 1px, transparent 1px); background-size: 72px 72px; mask-image: linear-gradient(to bottom, #000, transparent 88%); }
.hero-inner { position: relative; width: min(calc(100% - 2.5rem), var(--content)); min-height: 560px; margin: 0 auto; padding: 4.5rem 0 4rem; display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(410px, 1.05fr); gap: clamp(2.5rem, 7vw, 7rem); align-items: center; }
.eyebrow, .overline { margin: 0 0 1rem; color: var(--primary); font: 700 0.75rem/1.4 ui-monospace, Consolas, monospace; letter-spacing: 0.16em; }
.hero h1 { margin: 0; max-width: 8.5em; font-size: clamp(3rem, 5.4vw, 5.25rem); line-height: 1.03; letter-spacing: -0.065em; }
.hero h1 span { color: var(--primary); }
.hero-intro { max-width: 35rem; margin: 1.5rem 0 1.8rem; color: var(--text); font-size: 1.04rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.button { min-height: 46px; padding: 0 1.35rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.65rem; border: 1px solid var(--primary); border-radius: 0.62rem; color: var(--primary); font-size: 0.92rem; font-weight: 700; text-decoration: none; transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(23, 105, 236, 0.16); }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: var(--surface); }
.stats { display: flex; margin: 2.2rem 0 0; }
.stats div { min-width: 7.3rem; padding-right: 1.5rem; }
.stats div + div { padding-left: 1.5rem; border-left: 1px solid var(--line); }
.stats dt { color: var(--primary); font-size: 1.35rem; font-weight: 800; }
.stats dd { margin: 0; color: var(--muted); font-size: 0.78rem; }

.hero-visual { position: relative; min-height: 410px; }
.visual-glow { position: absolute; width: 75%; height: 75%; top: 10%; right: 0; border-radius: 50%; background: rgba(53, 134, 255, 0.16); filter: blur(45px); }
.code-window { position: absolute; z-index: 3; top: 2rem; right: 2.6rem; width: min(100%, 470px); border: 1px solid #223650; border-radius: 0.95rem; overflow: hidden; background: #0b1729; color: #cfdaea; box-shadow: 0 28px 60px rgba(7, 23, 47, 0.3); transform: perspective(900px) rotateY(-4deg) rotateX(2deg); }
.code-titlebar { height: 54px; padding: 0 1rem; display: flex; align-items: center; gap: 0.48rem; border-bottom: 1px solid #223650; background: #12223a; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.red { background: #ff6b65; }.yellow { background: #f2ba55; }.green { background: #45c68d; }
.filename { margin-left: 1rem; padding: 0.45rem 1.5rem; border-radius: 0.45rem 0.45rem 0 0; background: #0b1729; color: #9fb0c5; font: 0.75rem ui-monospace, Consolas, monospace; }
.code-body { padding: 1.5rem 1.2rem 1.8rem; }
.code-body div { min-height: 1.9rem; display: grid; grid-template-columns: 2rem 1fr; align-items: center; font: 0.76rem/1.65 ui-monospace, Consolas, monospace; }
.code-body i { color: #586b84; font-style: normal; }
.code-body b { color: #6d8199; font-weight: 400; }.code-body em { color: #f08ca2; font-style: normal; }.code-body strong { color: #a8d48a; font-weight: 400; }
.idea-card { position: absolute; z-index: 5; right: 0; bottom: 2.7rem; padding: 0.85rem 1.2rem; display: flex; gap: 0.75rem; align-items: center; border: 1px solid rgba(23, 105, 236, 0.18); border-radius: 0.75rem; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); transform: rotate(-2deg); }
.idea-card span { color: var(--amber); font-size: 1.45rem; }
.idea-card p { margin: 0; color: var(--text); font-size: 0.78rem; line-height: 1.45; }
.visual-note { position: absolute; z-index: 4; left: -1.2rem; bottom: 1.5rem; margin: 0; color: #7590bd; font-size: 0.95rem; font-style: italic; transform: rotate(-8deg); }
.cube { position: absolute; z-index: 1; width: 92px; height: 92px; background: linear-gradient(135deg, #64a5ff, #1769ec 56%, #084cb1); transform: rotate(30deg) skew(-5deg); box-shadow: 18px 22px 40px rgba(23, 105, 236, 0.18); }
.cube-one { top: 0.5rem; right: -1rem; }.cube-two { width: 62px; height: 62px; left: 0.5rem; top: 12.5rem; opacity: 0.35; }

.section { padding: 5.5rem max(1.25rem, calc((100% - var(--content)) / 2)); }
.notes-section, .about-section { background: var(--surface); }
.section-head { margin-bottom: 2rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.section-head > div { display: flex; align-items: center; gap: 0.75rem; }
.section-head h2 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.2rem); letter-spacing: -0.04em; }
.section-head > p { max-width: 34rem; margin: 0; color: var(--muted); font-size: 0.9rem; }
.section-bar { width: 5px; height: 1.5rem; border-radius: 4px; background: var(--primary); }
.search-status { min-height: 1.5rem; margin: -0.8rem 0 1rem; color: var(--muted); font-size: 0.85rem; }
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.article-card { overflow: hidden; border: 1px solid var(--line); border-radius: 0.85rem; background: var(--surface); box-shadow: 0 10px 32px rgba(45, 75, 120, 0.07); transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; }
.article-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); box-shadow: var(--shadow); }
.article-cover { position: relative; height: 145px; overflow: hidden; display: grid; place-items: center; background: #dce9f8; }
.article-cover::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.15) 1px, transparent 1px); background-size: 24px 24px; }
.article-cover span { position: relative; z-index: 2; color: #fff; font: 800 2rem/1 ui-monospace, Consolas, monospace; text-shadow: 0 4px 14px rgba(0,0,0,.18); }
.article-cover i { position: absolute; width: 110px; height: 110px; border: 20px solid rgba(255,255,255,.18); border-radius: 24px; transform: rotate(35deg); }
.article-cover i:nth-of-type(1) { left: -20px; bottom: -55px; }.article-cover i:nth-of-type(2) { right: -15px; top: -55px; }.article-cover i:nth-of-type(3) { width: 55px; height: 55px; right: 22%; bottom: -30px; }
.cover-frontend { background: linear-gradient(135deg, #6ba4e9, #1857a7); }.cover-python { background: linear-gradient(135deg, #16283e, #1d5d75); }.cover-growth { background: linear-gradient(135deg, #f3c77c, #e47758 58%, #4e78b5); }
.article-body { padding: 1.25rem; }
.tag { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 0.3rem; font-size: 0.72rem; font-weight: 700; }
.tag-blue { color: #175aba; background: #ddebff; }.tag-cyan { color: #147189; background: #d9f6fa; }.tag-amber { color: #9a6112; background: #fff0cf; }
.article-card h3 { margin: 0.85rem 0 0.55rem; font-size: 1.06rem; line-height: 1.45; }
.article-card h3 a { text-decoration: none; }.article-card h3 a:hover { color: var(--primary); }
.article-card p { margin: 0; color: var(--text); font-size: 0.88rem; line-height: 1.7; }
.article-meta { margin-top: 1.15rem; padding-top: 0.9rem; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; }
.empty-state { padding: 4rem 1rem; text-align: center; border: 1px dashed var(--line); border-radius: 0.85rem; background: var(--surface-soft); }
.empty-state strong { font-size: 1.1rem; }.empty-state p { margin: 0.45rem 0 0; color: var(--muted); }

.topics-section { background: var(--bg); }
.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; }
.topic-card { min-height: 150px; padding: 1.25rem; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 0.9rem 0.8rem; align-items: start; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface); text-decoration: none; transition: transform 160ms ease, border-color 160ms ease; }
.topic-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.topic-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 0.65rem; font: 800 0.82rem/1 ui-monospace, monospace; }
.icon-code { background: #e0edff; color: #1769ec; }.icon-python { background: #e1f5ef; color: #168169; }.icon-project { background: #eee8ff; color: #704dc5; font-size: 1.5rem; }.icon-book { background: #fff1d8; color: #b57619; font-size: 1.2rem; }
.topic-card strong, .topic-card small { display: block; }.topic-card strong { margin-top: 0.1rem; font-size: 0.95rem; }.topic-card small { margin-top: 0.22rem; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.topic-card em { grid-column: 1 / -1; color: var(--primary); font-size: 0.76rem; font-style: normal; font-weight: 700; }

.about-section { padding-top: 0; }
.about-card { padding: clamp(1.5rem, 4vw, 2.8rem); display: grid; grid-template-columns: auto 1fr auto; gap: clamp(1.4rem, 3vw, 2.5rem); align-items: center; border: 1px solid var(--line); border-radius: 1rem; background: linear-gradient(105deg, var(--surface-soft), var(--surface)); }
.avatar { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(140deg, #cde4ff, #287ef3); box-shadow: inset 0 0 0 8px rgba(255,255,255,.42); }
.avatar span { color: #fff; font: 800 1rem ui-monospace, monospace; }
.about-card h2 { margin: 0 0 0.45rem; font-size: 1.35rem; }.about-card p:not(.overline) { max-width: 48rem; margin: 0; color: var(--text); font-size: 0.9rem; }.about-card .overline { margin-bottom: 0.45rem; }

.site-footer { border-top: 1px solid var(--line); background: var(--bg); }
.footer-inner { width: min(calc(100% - 2.5rem), var(--content)); min-height: 100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 2rem; color: var(--muted); font-size: 0.78rem; }
.footer-inner > div { display: flex; align-items: center; gap: 0.8rem; }
.footer-brand { color: var(--ink); font-weight: 800; text-decoration: none; }.footer-links { flex-wrap: wrap; justify-content: flex-end; }.footer-links a { text-underline-offset: 0.2em; }.footer-links a:hover { color: var(--primary); }

@media (max-width: 1050px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .nav { gap: 1rem; }
  .nav a { font-size: 0.82rem; }
  .search-box { display: none; }
  .hero-inner { grid-template-columns: 1fr 0.9fr; gap: 2rem; }
  .code-window { right: 0; }
  .visual-note { left: 0; }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .header-inner { min-height: 66px; grid-template-columns: auto 1fr auto; gap: 0.5rem; }
  .menu-toggle { display: block; justify-self: end; }
  .header-actions { grid-column: 3; grid-row: 1; }
  .nav { position: fixed; inset: 66px 0 auto; padding: 1rem 1.25rem 1.5rem; display: none; flex-direction: column; gap: 0; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { min-height: 48px; border-bottom: 1px solid var(--line); }
  .nav a::after { display: none; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .hero-inner { min-height: 0; padding: 3.8rem 0 4.5rem; grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2.8rem, 11vw, 4.5rem); }
  .hero-visual { min-height: 380px; }
  .article-grid { grid-template-columns: 1fr; }
  .article-card { display: grid; grid-template-columns: minmax(180px, 0.75fr) 1.25fr; }
  .article-cover { height: 100%; min-height: 230px; }
  .section-head { align-items: start; flex-direction: column; gap: 0.6rem; }
  .about-card { grid-template-columns: auto 1fr; }
  .about-card .button { grid-column: 2; justify-self: start; }
  .footer-inner { padding: 1.5rem 0; align-items: flex-start; flex-direction: column; gap: 0.7rem; }
}

@media (max-width: 560px) {
  .header-inner, .hero-inner, .footer-inner { width: min(calc(100% - 2rem), var(--content)); }
  .brand > span:last-child { font-size: 0.95rem; }
  .brand-mark { width: 2rem; height: 2rem; }
  .theme-toggle { width: 36px; height: 36px; }
  .hero h1 { font-size: clamp(2.55rem, 14vw, 3.75rem); }
  .stats { justify-content: space-between; }
  .stats div { min-width: 0; padding-right: 0.85rem; }
  .stats div + div { padding-left: 0.85rem; }
  .hero-visual { min-height: 340px; }
  .code-window { top: 1rem; width: calc(100% - 0.7rem); transform: none; }
  .code-body { padding: 1.1rem 0.85rem 1.4rem; }
  .code-body div { grid-template-columns: 1.5rem 1fr; font-size: 0.68rem; }
  .idea-card { bottom: 0; right: 0; }
  .visual-note, .cube-two { display: none; }
  .section { padding: 4.3rem 1rem; }
  .article-card { display: block; }
  .article-cover { min-height: 145px; height: 145px; }
  .topic-grid { grid-template-columns: 1fr; }
  .about-card { grid-template-columns: 1fr; text-align: left; }
  .avatar { width: 76px; height: 76px; }
  .about-card .button { grid-column: auto; justify-self: stretch; }
  .footer-inner > div { align-items: flex-start; flex-direction: column; }
  .footer-links { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
