/* ═══════════════════════════════════════════════════════════════
   云栖 · Stylesheet
   Sections:
     1. Tokens (light / dark)
     2. Reset & base
     3. Layout primitives
     4. Nav
     5. Hero
     6. Sections & section header
     7. Cards (tutorial / download / feature)
     8. FAQ
     9. Contact strip & copy
    10. Footer
    11. Back-to-top
    12. Article (tutorial pages)
    13. Image lightbox
    14. Animations
    15. Responsive
   ═══════════════════════════════════════════════════════════════ */


/* ─── 1. TOKENS ──────────────────────────────────────────────── */
:root {
  /* Brand */
  --accent:        #c8501a;
  --accent-soft:   rgba(200, 80, 26, 0.10);
  --accent-glow:   rgba(200, 80, 26, 0.18);

  /* Neutrals (light) */
  --bg:            #fafaf7;
  --bg-elev:       #ffffff;
  --bg-subtle:     #f3f1ec;
  --bg-overlay:    rgba(255, 255, 255, 0.72);

  --ink:           #0a0a0a;
  --ink-soft:      #404040;
  --ink-muted:     #8a8a8a;
  --ink-faint:     #b8b8b8;

  --border:        rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);

  /* Platform tints (icon backgrounds) */
  --p-android-bg: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  --p-android-fg: #2e7d32;
  --p-apple-bg:   linear-gradient(135deg, #f5f5f5, #e0e0e0);
  --p-apple-fg:   #1a1a1a;
  --p-win-bg:     linear-gradient(135deg, #e3f2fd, #bbdefb);
  --p-win-fg:     #0062ac;
  --p-ios-bg:     linear-gradient(135deg, #fce4ec, #f8bbd0);
  --p-ios-fg:     #ad1457;

  /* Geometry */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 1px 4px rgba(0,0,0,0.04), 0 6px 24px rgba(0,0,0,0.07);
  --shadow-lg: 0 2px 8px rgba(0,0,0,0.05), 0 18px 48px rgba(0,0,0,0.10);

  /* Motion */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-w: 1200px;
  --gutter: 1.5rem;

  /* Callouts */
  --co-info-bg:      rgba(30, 111, 217, 0.08);
  --co-info-border:  rgba(30, 111, 217, 0.30);
  --co-info-ink:     #0f5ec7;

  --co-warn-bg:      rgba(217, 138, 30, 0.10);
  --co-warn-border:  rgba(217, 138, 30, 0.32);
  --co-warn-ink:     #b56700;

  --co-tip-bg:       rgba(34, 158, 94, 0.10);
  --co-tip-border:   rgba(34, 158, 94, 0.30);
  --co-tip-ink:      #1e7c47;

  --co-danger-bg:    rgba(200, 50, 50, 0.10);
  --co-danger-border:rgba(200, 50, 50, 0.32);
  --co-danger-ink:   #b62a2a;

  --co-important-bg:     rgba(124, 58, 237, 0.10);
  --co-important-border: rgba(124, 58, 237, 0.30);
  --co-important-ink:    #6d28d9;
}

[data-theme="dark"] {
  --bg:            #0e0e10;
  --bg-elev:       #18181b;
  --bg-subtle:     #1c1c20;
  --bg-overlay:    rgba(24, 24, 27, 0.72);

  --ink:           #f5f5f5;
  --ink-soft:      #c2c2c2;
  --ink-muted:     #888888;
  --ink-faint:     #5a5a5a;

  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --accent:        #ff7a3d;
  --accent-soft:   rgba(255, 122, 61, 0.14);
  --accent-glow:   rgba(255, 122, 61, 0.25);

  --p-android-bg: linear-gradient(135deg, rgba(46, 125, 50, 0.22), rgba(46, 125, 50, 0.06));
  --p-android-fg: #66bb6a;
  --p-apple-bg:   linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
  --p-apple-fg:   #e5e5e5;
  --p-win-bg:     linear-gradient(135deg, rgba(30, 111, 217, 0.22), rgba(30, 111, 217, 0.06));
  --p-win-fg:     #64b5f6;
  --p-ios-bg:     linear-gradient(135deg, rgba(173, 20, 87, 0.20), rgba(173, 20, 87, 0.04));
  --p-ios-fg:     #f06292;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.40);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.55);
}


/* ─── 2. RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  /* Anchor offset: account for sticky nav so #headings aren't hidden */
  scroll-padding-top: 80px;
  /* Prevent iOS from inflating text in landscape */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'palt' 1;
  /* Smooth color transition when toggling theme */
  transition: background 0.25s var(--ease-smooth), color 0.25s var(--ease-smooth);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style-position: outside; }

::selection {
  background: var(--accent);
  color: #fff;
}

/* Dot grid (subtle, only in light mode for warmth) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
  transform: translateZ(0);
}
[data-theme="dark"] body::before {
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
}


/* ─── 3. LAYOUT PRIMITIVES ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  /* Honor notch / rounded-corner safe areas in landscape */
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  position: relative;
  z-index: 1;
}

.section { padding-block: 80px; position: relative; z-index: 1; }
.section--tight { padding-block: 48px; }


/* ─── 4. NAV ─────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border);
  transform: translateZ(0);
}
@supports (backdrop-filter: blur(1px)) {
  .nav {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
  }
}

.nav-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
}
.nav-brand-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  display: inline-block;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-subtle); }
.nav-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  color: var(--ink);
}

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--ink-soft);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg {
  width: 18px; height: 18px; stroke-width: 2;
  transition: transform 0.25s var(--ease-spring);
}
.icon-btn:hover svg  { transform: scale(1.12); }
.icon-btn:active svg { transform: scale(0.9); }
.theme-toggle:hover .sun { transform: rotate(35deg) scale(1.12); }

/* Theme toggle: show sun in dark, moon in light */
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun  { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* Mobile hamburger — hidden on desktop, shown via responsive rules below */
.mobile-menu-toggle { display: none; }
.mobile-menu-toggle .icon-close { display: none; }
.nav.is-mobile-open .mobile-menu-toggle .icon-menu  { display: none; }
.nav.is-mobile-open .mobile-menu-toggle .icon-close { display: block; }


/* ─── 5. HERO ────────────────────────────────────────────────── */
.hero {
  padding: 88px 0 64px;
  position: relative;
  z-index: 1;
}
.hero-inner { max-width: 920px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 6px 14px 6px 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}
.hero-badge-dot {
  width: 18px; height: 18px;
  background: var(--accent-soft);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hero-badge-dot::after {
  content: '';
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

.hero-title {
  font-size: clamp(38px, 7vw, 84px);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 22px;
  word-break: keep-all;
}
.title-accent { color: var(--accent); font-weight: 400; }

.hero-sub {
  font-size: clamp(15px, 1.6vw, 17px);
  color: var(--ink-soft);
  font-weight: 300;
  line-height: 1.7;
  max-width: 620px;
  margin-bottom: 36px;
}

.hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}
.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 100px;
}
.feature-chip svg {
  width: 13px; height: 13px;
  color: var(--accent);
  stroke-width: 2.2;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}


/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke-width: 2; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { opacity: 0.88; }

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 18px var(--accent-glow);
}
.btn-accent:hover { opacity: 0.92; }

.btn-ghost {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-subtle); }


/* ─── 6. SECTION HEADER ─────────────────────────────────────── */
.section-head { margin-bottom: 36px; }
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.section-eyebrow::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.section-title {
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.2;
}
.section-desc {
  font-size: 15px;
  color: var(--ink-muted);
  font-weight: 300;
  line-height: 1.7;
  max-width: 620px;
}


/* ─── 7. CARDS ──────────────────────────────────────────────── */

/* Grid containers */
.grid {
  display: grid;
  gap: 18px;
}
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-features { grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* Tutorial card (links to /tutorials/<slug>) */
.t-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 22px 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-spring),
              border-color 0.2s,
              box-shadow 0.25s;
}
@media (hover: hover) and (pointer: fine) {
  .t-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
  }
  .t-card:hover .t-card-cta { color: var(--accent); }
  .t-card:hover .t-card-cta svg { transform: translateX(3px); }
  .t-card:hover .platform-icon { transform: scale(1.08) rotate(-3deg); }
}
.t-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.platform-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  transition: transform 0.3s var(--ease-spring);
}
.platform-icon svg { width: 24px; height: 24px; }
.pi-android { background: var(--p-android-bg); }
.pi-android svg { fill: var(--p-android-fg); }
.pi-apple   { background: var(--p-apple-bg); }
.pi-apple svg { fill: var(--p-apple-fg); }
.pi-win     { background: var(--p-win-bg); }
.pi-win svg { fill: var(--p-win-fg); }
.pi-ios     { background: var(--p-ios-bg); }
.pi-ios svg { fill: var(--p-ios-fg); }

.t-card-platform {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.t-card-app {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.t-card-desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.65;
  font-weight: 300;
  margin-bottom: 24px;
  flex: 1;
}
.t-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.t-card-cta svg {
  width: 14px; height: 14px;
  stroke-width: 2;
  transition: transform 0.2s;
}

/* Feature card */
.f-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.f-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.f-card-icon svg { width: 18px; height: 18px; stroke-width: 2.2; }
.f-card-title { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.f-card-desc { font-size: 13px; color: var(--ink-muted); line-height: 1.65; font-weight: 300; }


/* ─── 8. FAQ ─────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s;
}
.faq-item[open] { border-color: var(--border-strong); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--bg-subtle); }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.faq-chevron {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--ink-muted);
  transition: transform 0.25s var(--ease-smooth);
  stroke-width: 2.2;
}
.faq-item[open] .faq-chevron { transform: rotate(180deg); color: var(--accent); }
.faq-body {
  padding: 0 22px 20px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.75;
  font-weight: 300;
}
.faq-body p + p { margin-top: 8px; }
.faq-body a { color: var(--accent); text-decoration: none; font-weight: 500; }
.faq-body a:hover { text-decoration: underline; }


/* ─── 9. CONTACT / SUBSCRIPTION COPY ─────────────────────────── */
.contact-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
}
.contact-text h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.contact-text p {
  font-size: 13.5px;
  color: var(--ink-muted);
  font-weight: 300;
  line-height: 1.6;
}
.contact-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Subscription copy field */
.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 8px 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.copy-field input {
  flex: 1;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  min-width: 0;
  outline: none;
}
.copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 12px;
  min-height: 34px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.copy-btn:hover { background: var(--bg); }
.copy-btn svg { width: 13px; height: 13px; stroke-width: 2.2; }
.copy-btn.is-copied {
  background: var(--co-tip-bg);
  border-color: var(--co-tip-border);
  color: var(--co-tip-ink);
}
.copy-btn .icon-check { display: none; }
.copy-btn.is-copied .icon-check { display: block; }
.copy-btn.is-copied .icon-copy  { display: none; }


/* ─── 10. FOOTER ─────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  background: var(--bg-overlay);
  position: relative; z-index: 1;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 7px;
  transition: color 0.15s, background 0.15s;
}
.footer-links a:hover { color: var(--ink); background: var(--bg-subtle); }
.footer-copy {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--ink-faint);
}


/* ─── 11. BACK TO TOP ────────────────────────────────────────── */
.to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s var(--ease-smooth);
  z-index: 50;
}
.to-top svg { width: 16px; height: 16px; stroke-width: 2.4; }
.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}


/* ─── 12. ARTICLE (tutorial pages) ──────────────────────────── */
.article-wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding-block: 56px;
  position: relative;
  z-index: 1;
}

.article-toc {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 8px;
}
.article-toc h4 {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.article-toc ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.article-toc a {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  line-height: 1.5;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.article-toc a:hover { color: var(--ink); background: var(--bg-subtle); }
.article-toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.article-toc .toc-l3 { padding-left: 24px; font-size: 12px; }

.article {
  min-width: 0;
  max-width: 760px;
}

.article-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.article-eyebrow .platform-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  margin: 0;
}
.article-eyebrow .platform-icon svg { width: 13px; height: 13px; }

.article h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.18;
  margin-bottom: 16px;
  color: var(--ink);
}
.article-lede {
  font-size: 16px;
  color: var(--ink-soft);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.article h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 56px 0 18px;
  scroll-margin-top: 84px;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.article h2 .h-step {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.article h3 {
  font-size: 17px;
  font-weight: 500;
  margin: 32px 0 14px;
  scroll-margin-top: 84px;
  color: var(--ink);
}

.article p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0 0 14px;
  font-weight: 300;
}
.article a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.15s;
}
.article a:hover { border-bottom-color: var(--accent); }
.article a[target="_blank"]::after {
  content: '↗';
  margin-left: 2px;
  font-size: 0.85em;
  opacity: 0.7;
}

.article strong { font-weight: 600; color: var(--ink); }
.article em { font-style: normal; color: var(--accent); font-weight: 500; }
.article code {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--ink);
}
.article kbd {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 2px 8px;
  box-shadow: 0 1px 0 var(--border-strong);
  color: var(--ink);
}

.article ul, .article ol {
  margin: 0 0 18px;
  padding-left: 22px;
}
.article li {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 300;
}
.article li::marker { color: var(--ink-muted); }
.article ol > li::marker { color: var(--accent); font-weight: 500; }

.article ul ul, .article ol ol, .article ul ol, .article ol ul {
  margin: 6px 0;
}

.article hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

.article img {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 22px auto;
  cursor: zoom-in;
  background: var(--bg-subtle);
  transition: opacity 0.3s, transform 0.2s;
}
.article img.is-loaded { opacity: 1; }

.article-figure {
  margin: 22px 0;
  text-align: center;
}
.article-figure figcaption {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 8px;
  font-weight: 300;
}

/* Tables */
.article .table-scroll {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}
.article table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}
.article th, .article td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  font-weight: 300;
  vertical-align: top;
  line-height: 1.6;
}
.article th {
  background: var(--bg-subtle);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.article tr:last-child td { border-bottom: 0; }

/* Pre / code blocks */
.article pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 18px 0;
  font-size: 13px;
  line-height: 1.65;
}
.article pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--ink);
}

/* Callouts (Obsidian-style) */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  margin: 22px 0;
  background: var(--bg-subtle);
  font-weight: 300;
}
.callout-body { flex: 1; min-width: 0; }
.callout-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 2px;
  stroke-width: 2.2;
  fill: none;
  stroke: currentColor;
}
.callout-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: inherit;
}
.callout-body p {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  line-height: 1.7;
}
.callout-body p:last-child { margin-bottom: 0; }
.callout-body ul, .callout-body ol { margin-bottom: 0; }

.callout--info     { background: var(--co-info-bg);      border-color: var(--co-info-border);      color: var(--co-info-ink); }
.callout--warning  { background: var(--co-warn-bg);      border-color: var(--co-warn-border);      color: var(--co-warn-ink); }
.callout--tip      { background: var(--co-tip-bg);       border-color: var(--co-tip-border);       color: var(--co-tip-ink); }
.callout--danger,
.callout--caution  { background: var(--co-danger-bg);    border-color: var(--co-danger-border);    color: var(--co-danger-ink); }
.callout--important{ background: var(--co-important-bg); border-color: var(--co-important-border); color: var(--co-important-ink); }

/* Mobile TOC toggle */
.toc-mobile-toggle {
  display: none;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 24px;
  align-items: center;
  justify-content: space-between;
}
.toc-mobile-toggle svg { width: 14px; height: 14px; stroke-width: 2.2; transition: transform 0.2s; }
.toc-mobile-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }


/* ─── 13. IMAGE LIGHTBOX ─────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  cursor: zoom-out;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close svg { width: 18px; height: 18px; stroke-width: 2; }


/* ─── 14. ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes navSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-badge    { animation: fadeUp 0.5s var(--ease-spring) both 0.05s; }
.hero-title    { animation: fadeUp 0.5s var(--ease-spring) both 0.12s; }
.hero-sub      { animation: fadeUp 0.5s var(--ease-spring) both 0.20s; }
.hero-features { animation: fadeUp 0.5s var(--ease-spring) both 0.28s; }
.hero-ctas     { animation: fadeUp 0.5s var(--ease-spring) both 0.36s; }

/* Scroll reveal — JS adds .reveal to below-fold elements, .is-revealed on enter */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--ease-smooth), transform 0.55s var(--ease-spring);
}
.reveal.is-revealed { opacity: 1; transform: none; }

/* Subtle stagger for items revealing together inside a grid row */
.grid .reveal:nth-child(2) { transition-delay: 0.06s; }
.grid .reveal:nth-child(3) { transition-delay: 0.12s; }
.grid .reveal:nth-child(4) { transition-delay: 0.18s; }


/* ─── 15. RESPONSIVE ─────────────────────────────────────────── */

/* Tablet ≤ 980px */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-features { grid-template-columns: repeat(2, 1fr); }

  .article-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-block: 40px;
  }
  .article-toc {
    position: static;
    max-height: none;
    margin-bottom: 24px;
    padding-right: 0;
  }
  .toc-mobile-toggle { display: flex; }
  .article-toc-body { display: none; }
  .article-toc.is-open .article-toc-body { display: block; padding-top: 16px; }
}

/* Mobile ≤ 640px */
@media (max-width: 640px) {
  :root { --gutter: 1.15rem; }
  .section { padding-block: 56px; }

  .nav-inner { height: 56px; }
  .nav-links { display: none; }
  .mobile-menu-toggle { display: inline-flex; }

  /* Mobile menu: slides down from nav bottom edge */
  .nav.is-mobile-open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 8px var(--gutter) 16px;
    gap: 2px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: navSlideDown 0.18s var(--ease-smooth) both;
  }
  @supports (backdrop-filter: blur(1px)) {
    .nav.is-mobile-open .nav-links {
      background: color-mix(in srgb, var(--bg) 94%, transparent);
      backdrop-filter: blur(18px) saturate(180%);
      -webkit-backdrop-filter: blur(18px) saturate(180%);
    }
  }
  .nav.is-mobile-open .nav-links a {
    padding: 12px 14px;
    font-size: 15px;
    border-radius: 10px;
  }

  .hero { padding: 56px 0 40px; }

  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .grid-features { grid-template-columns: 1fr; gap: 10px; }

  .contact-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 22px;
  }
  .contact-actions { width: 100%; }
  .contact-actions .btn { flex: 1; }

  .btn { min-height: 46px; padding: 0 18px; }
  .hero-ctas .btn { flex: 1; }

  /* ≥16px input font prevents iOS auto-zoom on focus */
  .copy-field input { font-size: 16px; }

  .article { font-size: 15px; }
  .article h2 { font-size: 19px; margin-top: 40px; }
  .article h3 { font-size: 16px; margin-top: 26px; }
  .article-lede { font-size: 14.5px; }

  .footer-inner { justify-content: center; text-align: center; }
}

/* Small phones ≤ 380px */
@media (max-width: 380px) {
  .hero-title { font-size: 32px; }
  .hero-features { gap: 6px; }
  .feature-chip { font-size: 11.5px; padding: 5px 10px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding-top: 40px; padding-bottom: 28px; }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Never leave reveal elements stuck hidden */
  .reveal { opacity: 1 !important; transform: none !important; }
}


/* ─── PRINT (tutorial pages should be printable) ─────────────── */
@media print {
  .nav, .footer, .to-top, .article-toc, .toc-mobile-toggle { display: none !important; }
  body::before { display: none; }
  .article { max-width: none; }
  .article img { break-inside: avoid; }
  a { color: inherit !important; border: 0 !important; }
}
