/* ============================================================
   Xiaoqing Aparture — an Apple-inspired blog design system
   ============================================================ */

/* ---- Design tokens ---- */
:root {
  --font-sans: "SF Pro Display", "SF Pro Text", -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo,
    Consolas, monospace;

  --ink: #1d1d1f;          /* Apple near-black text */
  --ink-soft: #6e6e73;     /* secondary text */
  --ink-faint: #86868b;    /* captions */
  --paper: #ffffff;
  --paper-alt: #f5f5f7;    /* Apple light gray section bg */
  --line: #d2d2d7;         /* hairline dividers */
  --blue: #0071e3;         /* Apple action blue */
  --blue-link: #06c;
  --blue-hover: #0077ed;

  --maxw: 980px;
  --nav-h: 48px;
  --radius: 18px;
  --radius-lg: 28px;

  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f7;
    --ink-soft: #a1a1a6;
    --ink-faint: #86868b;
    --paper: #000000;
    --paper-alt: #101012;
    --line: #29292b;
    --blue-link: #2997ff;
  }
}

/* ---- Reset / base ---- */
* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.47059;
  letter-spacing: -0.01em;
  font-size: 17px;
}

img { max-width: 100%; display: block; }

a { color: var(--blue-link); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(0, 113, 227, 0.22); }

/* ---- Layout helpers ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 700px; }

/* ============================================================
   Nav — translucent frosted glass bar
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
@media (prefers-color-scheme: dark) {
  .nav {
    background: rgba(22, 22, 23, 0.72);
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.nav__brand:hover { text-decoration: none; opacity: 0.7; }
.nav__links { display: flex; gap: 28px; }
.nav__links a {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}
.nav__links a:hover { color: var(--ink); text-decoration: none; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  text-align: center;
  padding: 96px 22px 72px;
}
.hero__eyebrow {
  font-size: 19px;
  font-weight: 600;
  color: var(--blue-link);
  margin: 0 0 8px;
  letter-spacing: 0;
}
.hero__title {
  font-size: clamp(40px, 7vw, 80px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  background: linear-gradient(180deg, var(--ink), var(--ink-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  font-size: clamp(19px, 2.4vw, 26px);
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto;
  font-weight: 400;
  line-height: 1.38;
}

/* ============================================================
   Article cards (home feed)
   ============================================================ */
.feed { padding: 20px 0 100px; }
.feed__label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 600;
  margin: 0 0 22px;
  padding-left: 4px;
}

.card {
  display: block;
  background: var(--paper-alt);
  border-radius: var(--radius-lg);
  padding: 44px 44px 40px;
  margin-bottom: 22px;
  color: var(--ink);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
  overflow: hidden;
  position: relative;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}
.card__tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--blue-link);
  margin-bottom: 12px;
}
.card__title {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 14px;
  max-width: 90%;
}
.card__excerpt {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 22px;
  max-width: 620px;
  line-height: 1.44;
}
.card__meta {
  font-size: 14px;
  color: var(--ink-faint);
  display: flex;
  gap: 14px;
  align-items: center;
}
.card__cta {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--blue-link);
  font-size: 17px;
}
.card__cta svg { transition: transform 0.3s var(--ease); }
.card:hover .card__cta svg { transform: translateX(4px); }

/* Featured card variant */
.card--featured {
  background: linear-gradient(160deg, #f5f5f7 0%, #e8e8ed 100%);
}
@media (prefers-color-scheme: dark) {
  .card--featured {
    background: linear-gradient(160deg, #1c1c1e 0%, #0a0a0c 100%);
  }
}

/* ============================================================
   Article page
   ============================================================ */
.post-head {
  text-align: center;
  padding: 80px 22px 40px;
  border-bottom: 1px solid var(--line);
}
.post-head__tag {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue-link);
  letter-spacing: 0;
  margin-bottom: 14px;
}
.post-head__title {
  font-size: clamp(34px, 5.4vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.07;
  margin: 0 auto 20px;
  max-width: 760px;
}
.post-head__meta {
  font-size: 15px;
  color: var(--ink-faint);
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); display: inline-block; }

.article {
  padding: 56px 0 40px;
  font-size: 19px;
  line-height: 1.6;
}
.article > * { margin-left: auto; margin-right: auto; }

.article .lead {
  font-size: 23px;
  line-height: 1.5;
  color: var(--ink);
  font-weight: 400;
  margin-bottom: 36px;
}
.article h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 56px 0 18px;
}
.article h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 38px 0 12px;
}
.article p { margin: 0 0 22px; color: var(--ink); }
.article strong { font-weight: 600; }
.article ul, .article ol { margin: 0 0 22px; padding-left: 1.3em; }
.article li { margin-bottom: 10px; }

.article blockquote {
  margin: 32px 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--blue);
  color: var(--ink-soft);
  font-size: 21px;
  line-height: 1.5;
}

/* Inline + block code */
.article code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--paper-alt);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}
.article pre {
  background: #1d1d1f;
  color: #f5f5f7;
  border-radius: 14px;
  padding: 22px 24px;
  overflow-x: auto;
  margin: 0 0 26px;
  font-size: 15px;
  line-height: 1.6;
  max-width: 760px;
}
@media (prefers-color-scheme: dark) {
  .article pre { background: #161617; border: 1px solid var(--line); }
}
.article pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.tok-key { color: #ff7ab2; }
.tok-num { color: #d0bf69; }
.tok-com { color: #6c7986; }
.tok-str { color: #78c2b3; }

/* Callout / info box */
.callout {
  max-width: 700px;
  background: var(--paper-alt);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin: 0 auto 30px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.callout strong { color: var(--ink); }

/* Stat row (Apple product-page style figures) */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 760px;
  margin: 10px auto 40px;
  text-align: center;
}
.stat__num {
  font-size: clamp(38px, 6vw, 60px);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, var(--blue) 0%, #42a5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.stat__label { font-size: 15px; color: var(--ink-soft); margin-top: 8px; }
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; gap: 28px; }
}

.article figure { margin: 40px auto; max-width: 640px; }
.article figure img {
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  padding: 12px;
}
.article figcaption {
  font-size: 14px;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 10px;
}

/* Back / bottom nav */
.post-foot {
  max-width: 700px;
  margin: 20px auto;
  padding: 40px 0 90px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--paper-alt);
  border-top: 1px solid var(--line);
  padding: 34px 0;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.6;
}
.footer a { color: var(--ink-faint); }
.footer a:hover { color: var(--ink-soft); }
.footer__row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

/* ============================================================
   Scroll reveal
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
