:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #3d3d3d;
  --text-muted: #8a8a8a;
  --text-soft: #6b6b6b;
  --border: #e6e6e6;
  --border-strong: #d4d4d4;
  --orange: #f29131;
  --orange-hover: #e07e1c;
  --orange-soft: rgba(242, 145, 49, 0.12);
  --orange-ring: rgba(242, 145, 49, 0.28);
  --warn-bg: #fff8f0;
  --warn-border: #f5d4b0;
  --info-bg: #fafafa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --radius-sm: 8px;
  --topbar-h: 64px;
  --sidebar-w: 260px;
  --content-max: 820px;
  --font: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(242, 145, 49, 0.06), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--orange);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--orange-hover);
  text-decoration: underline;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #f0f0f0;
  color: #4a4a4a;
  padding: 0.15em 0.45em;
  border-radius: 5px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--orange);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* —— Top bar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand__logo {
  height: 38px;
  width: auto;
  display: block;
}

.brand__tagline {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text-muted);
  border-left: 1px solid var(--border-strong);
  padding-left: 1rem;
  margin-left: 0.15rem;
  line-height: 1.3;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* —— Layout —— */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 1.75rem 1rem 1.75rem 1.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar__label {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 0.75rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__nav a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar__nav a:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.03);
  text-decoration: none;
}

.sidebar__nav a.is-active {
  color: var(--orange);
  background: var(--orange-soft);
  border-left-color: var(--orange);
  font-weight: 600;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 0.75rem;
}

.sidebar__footer a {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar__footer a:hover {
  color: var(--orange);
}

.main {
  padding: 2.5rem 2.5rem 4rem;
}

.doc {
  max-width: var(--content-max);
}

/* —— Hero —— */
.doc__hero {
  margin-bottom: 2.75rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
}

.doc__hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #2f2f2f;
}

.lede {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 36em;
  font-weight: 500;
}

/* —— Sections —— */
.section {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--topbar-h) + 24px);
}

.section h2 {
  margin: 0 0 0.85rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #2f2f2f;
}

.section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #333;
}

.section__intro {
  margin: 0 0 1.25rem;
  color: var(--text-soft);
}

.section p {
  margin: 0 0 1rem;
}

.section ul,
.section ol {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
}

.section li {
  margin-bottom: 0.45rem;
}

.section li::marker {
  color: var(--orange);
}

.muted {
  color: var(--text-muted);
  font-size: 0.925rem;
}

/* —— Flow steps —— */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.flow li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-weight: 500;
}

.flow__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

/* —— Steps —— */
.step {
  margin-bottom: 1.75rem;
  padding: 1.35rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step:last-child {
  margin-bottom: 0;
}

.step__badge {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-soft);
  border-radius: 999px;
  vertical-align: middle;
}

.pattern {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
}

.pattern__label {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pattern__value {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.pattern__example {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--text-soft);
}

.path-line {
  margin: 0 0 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
}

/* —— Screenshots —— */
.shot {
  margin: 1.25rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f0f2f5;
  box-shadow: var(--shadow);
}

.shot__trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
}

.shot__trigger:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -2px;
}

.shot__trigger::after {
  content: "Click to enlarge";
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  background: rgba(35, 35, 35, 0.72);
  color: #fff;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.shot__trigger:hover::after,
.shot__trigger:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.shot img {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  transition: transform 0.2s ease;
}

.shot__trigger:hover img {
  transform: scale(1.01);
}

.shot figcaption {
  margin: 0;
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
  border-top: 1px solid var(--border);
  line-height: 1.45;
}

.step .shot + .shot {
  margin-top: 1rem;
}

.step .callout {
  margin-top: 1rem;
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 4rem 2.5rem;
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__figure {
  margin: 0;
  max-width: min(1280px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  background: #fff;
}

.lightbox__caption {
  margin: 0;
  max-width: 48rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox__nav--prev {
  left: 1rem;
}

.lightbox__nav--next {
  right: 1rem;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  .lightbox {
    padding: 3.5rem 0.75rem 1.5rem;
  }

  .lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }

  .lightbox__nav--prev {
    left: 0.35rem;
  }

  .lightbox__nav--next {
    right: 0.35rem;
  }

  .shot__trigger::after {
    opacity: 1;
    transform: none;
  }
}

/* —— Tables —— */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

th,
td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #fafafa;
}

tr:last-child td {
  border-bottom: none;
}

td:first-child {
  font-weight: 600;
  white-space: nowrap;
  color: #444;
  width: 32%;
}

/* —— Callouts —— */
.callout {
  margin: 1.25rem 0 0;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--info-bg);
  font-size: 0.925rem;
  color: var(--text-soft);
}

.callout strong {
  color: var(--text);
}

.callout--info {
  border-color: var(--orange-ring);
  background: var(--orange-soft);
}

.callout--warn {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

/* —— Email template —— */
.email {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.email__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
}

.btn-copy {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-copy:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-copy.is-copied {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.email__body {
  margin: 0;
  padding: 1.25rem 1.35rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #4a4a4a;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* —— Split —— */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.split__col {
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.split__col h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.split__col ol {
  margin-bottom: 0;
}

.split__col--do {
  border-top: 3px solid #3d9b6a;
}

.split__col--dont {
  border-top: 3px solid #c75b4a;
}

.split__col--do h3 {
  color: #2f7a52;
}

.split__col--dont h3 {
  color: #a3483a;
}

.split__col .checklist--plain {
  margin: 0;
}

.split__col .checklist--plain li:last-child {
  border-bottom: none;
}

/* —— Checklist —— */
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checklist li {
  margin: 0;
}

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 500;
  transition: border-color 0.15s ease;
}

.checklist label:hover {
  border-color: var(--border-strong);
}

.checklist input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--orange);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist--plain {
  list-style: none;
  padding: 0;
}

.checklist--plain li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.4rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.checklist--plain li:last-child {
  border-bottom: none;
}

.checklist--plain li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}

/* —— Rules —— */
.rules {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rules li {
  margin: 0 0 0.75rem;
  padding: 1rem 1.15rem 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: var(--shadow);
}

.rules li:last-child {
  margin-bottom: 0;
}

/* —— Numbered process —— */
.numbered-process {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: process;
}

.numbered-process li {
  counter-increment: process;
  position: relative;
  margin: 0;
  padding: 0.9rem 0 0.9rem 3rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.numbered-process li:last-child {
  border-bottom: none;
}

.numbered-process li::before {
  content: counter(process);
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 0.8rem;
  font-weight: 700;
}

/* —— Footer —— */
.doc__footer {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.doc__footer p {
  margin: 0;
}

.doc__footer a {
  color: var(--text-muted);
}

.doc__footer a:hover {
  color: var(--orange);
}

.sidebar-backdrop {
  display: none;
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .brand__tagline {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: min(300px, 86vw);
    height: calc(100vh - var(--topbar-h));
    background: var(--surface);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.08);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(30, 30, 30, 0.35);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    padding: 1.75rem 1.25rem 3rem;
  }

  .split {
    grid-template-columns: 1fr;
  }

  td:first-child {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media print {
  .topbar,
  .sidebar,
  .nav-toggle,
  .btn-copy,
  .sidebar-backdrop,
  .lightbox,
  .shot__trigger::after {
    display: none !important;
  }

  .shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  body {
    background: #fff;
  }

  .step,
  .flow li,
  .table-wrap,
  .split__col,
  .email,
  .rules li,
  .checklist label,
  .shot,
  .path-line {
    box-shadow: none;
  }

  .shot {
    break-inside: avoid;
  }
}
