:root {
  --primary: #2f6fed;
  --primary-dark: #1e54c4;
  --accent: #ff6b4a;
  --ink: #14213d;
  --muted: #5c6b8a;
  --line: #d5e3f7;
  --bg: #f0f6ff;
  --bg-elevated: #ffffff;
  --bg-soft: #e3eeff;
  --success: #2f9e6b;
  --sidebar-w: 280px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(20, 33, 61, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Avenir Next", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(47, 111, 237, 0.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(255, 107, 74, 0.08), transparent 55%),
    linear-gradient(180deg, var(--bg), #ffffff 48%);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ——— Sidebar ——— */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 1.5rem 1.15rem 2rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.35rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.35rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: 0 6px 16px rgba(47, 111, 237, 0.35);
  flex-shrink: 0;
  display: block;
  object-fit: cover;
}

.brand-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-tag {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.toc-label {
  margin: 0.5rem 0 0.15rem;
  padding: 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.toc a {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.toc a:hover,
.toc a.active {
  background: var(--bg-soft);
  color: var(--primary-dark);
}

.langs {
  display: flex;
  gap: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.langs button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.langs button:hover,
.langs button.active {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--bg-soft);
}

/* ——— Main ——— */
.main-wrap {
  min-width: 0;
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  max-width: 1100px;
}

.hero {
  margin-bottom: 2.5rem;
  padding: 1.75rem 0 2rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 3.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.lede {
  margin: 0;
  max-width: 42rem;
  font-size: 1.05rem;
  color: var(--muted);
}

.lede-inline {
  margin: 0 0 1.5rem;
  max-width: 46rem;
  font-size: 1.02rem;
  color: var(--muted);
}

.doc-section {
  margin: 0 0 3.25rem;
  scroll-margin-top: 1.5rem;
}

.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-free {
  background: #e8f0ff;
  color: var(--primary-dark);
}

.plan-plus {
  background: #fff0eb;
  color: #c4472c;
}

.plan-premium {
  background: #eaf8f1;
  color: #1f7a52;
}

.prose {
  max-width: 46rem;
  margin-bottom: 1.35rem;
}

.prose p {
  margin: 0 0 0.85rem;
  color: var(--ink);
  font-size: 0.98rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.callout {
  margin: 1.5rem 0 0;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  max-width: 46rem;
}

.callout h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.callout .prose {
  margin-bottom: 0;
}

.callout .prose p {
  color: var(--muted);
  font-size: 0.92rem;
}

.subblock {
  max-width: 46rem;
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.subblock h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.subblock .prose {
  margin-bottom: 0;
}

.howto {
  max-width: 46rem;
  margin: 0 0 1.5rem;
  padding: 1.15rem 1.25rem 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.howto-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.howto-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.howto-step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.howto-num {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  background: var(--primary);
  color: #fff;
}

.howto-body h4 {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.98rem;
  font-weight: 700;
}

.howto-body .prose {
  margin-bottom: 0;
}

.howto-body .prose p {
  font-size: 0.92rem;
  color: var(--muted);
}

.related {
  max-width: 46rem;
  margin: 0 0 1.5rem;
}

.related h3 {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.related-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.related-link:hover {
  border-color: var(--primary);
  background: #e8f0ff;
}

/* ——— Security ——— */
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.security-card {
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.security-card h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.security-card .prose {
  margin-bottom: 0;
}

.security-card .prose p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

/* ——— Gallery ——— */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem 1.1rem;
  align-items: start;
}

.shot-tablet {
  grid-column: span 2;
}

.shot {
  margin: 0;
}

.shot-frame {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 0.65rem;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: var(--bg-soft);
}

/* Reserve space before lazy images decode — avoids TOC scroll missing the target. */
.shot-phone img {
  aspect-ratio: 390 / 844;
}

.shot-tablet img {
  aspect-ratio: 1024 / 768;
}

figcaption {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}

.doc-footer {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.doc-footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.doc-footer .legal-label {
  margin-top: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-footer .legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin-top: 0.55rem;
}

.doc-footer .legal-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.doc-footer .legal-links a:hover {
  border-bottom-color: var(--ink);
}

/* ——— Responsive ——— */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .toc {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.2rem;
  }

  .shot-tablet {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .toc {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar {
    display: none;
  }

  .shell {
    display: block;
  }

  .main-wrap {
    max-width: none;
    padding: 0;
  }

  /* Chromium PDF paints soft box-shadows as gray bands across grids — disable. */
  .security-card,
  .howto,
  .callout,
  .shot-frame,
  .related-link,
  .brand-mark {
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
  }

  /* Stack security cards cleanly; avoid multi-column shadow / gap artifacts. */
  .security-grid {
    display: block;
  }

  .security-card {
    display: block;
    width: auto;
    margin: 0 0 0.75rem;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    background: #fff !important;
    border: 1px solid #c5d4ea;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .security-section {
    break-inside: auto;
  }

  /* Avoid blank light-blue boxes when an image failed to decode for print. */
  .shot img {
    background: transparent;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .shot,
  .shot-frame {
    break-inside: avoid;
  }

  body {
    background: #fff !important;
  }
}
