/* ============================================================
   SelectPdf samples — samples.css
   1. Content shell + sample directory (home) + compact inner nav.
   2. Compatibility layer: re-skins the legacy demo markup
      (.entry-content / .col2 / .mybutton / bare inputs) using the
      design-system tokens, so every sample page adopts the new look
      without per-page edits.
   ============================================================ */

/* ─── Content shell ────────────────────────────────────────── */
.spdf-samples-main { padding-top: 40px; padding-bottom: 24px; }
.spdf-samples-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.spdf-samples-layout.is-home { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 900px) {
  .spdf-samples-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

/* ─── Compact "all samples" inner nav (left rail) ──────────── */
.spdf-samples-nav {
  position: sticky;
  top: 84px;
  border: 1px solid var(--spdf-line);
  border-radius: 14px;
  background: var(--spdf-panel);
  padding: 14px 12px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}
.spdf-samples-nav-group {
  font-family: var(--spdf-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--spdf-text-mute);
  padding: 12px 8px 5px;
}
.spdf-samples-nav a {
  display: block;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--spdf-text-dim);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  transition: background .12s, color .12s;
}
.spdf-samples-nav a:hover { background: var(--spdf-chip); color: var(--spdf-text); }

/* Home / directory link pinned at the top of the rail */
.spdf-samples-nav a.spdf-samples-nav-home {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--spdf-text);
  margin-bottom: 8px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--spdf-line);
  border-radius: 7px 7px 0 0;
}
.spdf-samples-nav a.spdf-samples-nav-home .spdf-samples-nav-home-icon {
  display: inline-flex;
  color: var(--spdf-text-mute);
}
.spdf-samples-nav a.spdf-samples-nav-home:hover { color: var(--spdf-accent); }
.spdf-samples-nav a.spdf-samples-nav-home:hover .spdf-samples-nav-home-icon { color: var(--spdf-accent); }
.spdf-samples-nav a[aria-current="page"] {
  background: var(--spdf-chip);
  color: var(--spdf-accent);
  font-weight: 600;
}

/* Collapse toggle — hidden on desktop (rail always open) */
.spdf-samples-nav-toggle { display: none; }

@media (max-width: 900px) {
  .spdf-samples-nav { position: static; max-height: none; padding: 0; }
  .spdf-samples-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 14px;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: var(--spdf-font-body);
    font-weight: 600;
    font-size: 14px;
    color: var(--spdf-text);
  }
  .spdf-samples-nav-toggle .spdf-nav-caret { transition: transform .15s; }
  .spdf-samples-nav[data-rail-open="true"] .spdf-samples-nav-toggle .spdf-nav-caret {
    transform: rotate(180deg);
  }
  /* Collapsed by default on mobile; expand when toggled open */
  .spdf-samples-nav-list { display: none; padding: 0 12px 12px; }
  .spdf-samples-nav[data-rail-open="true"] .spdf-samples-nav-list { display: block; }
}

/* ─── Home: hero + grouped card directory ──────────────────── */
.spdf-samples-hero { padding: 24px 0 8px; max-width: 760px; }
.spdf-samples-hero h1 {
  font-family: var(--spdf-font-display);
  font-weight: var(--spdf-display-weight);
  letter-spacing: var(--spdf-display-letter);
  font-size: var(--spdf-h1-editorial);
  line-height: var(--spdf-h1-editorial-lh);
  color: var(--spdf-text);
}
.spdf-samples-hero p { margin-top: 18px; }

.spdf-samples-group { margin-top: 56px; }
.spdf-samples-group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--spdf-line);
}
.spdf-samples-group-head h2 {
  font-family: var(--spdf-font-display);
  font-weight: var(--spdf-display-weight);
  letter-spacing: var(--spdf-display-letter);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  color: var(--spdf-text);
}
.spdf-samples-group-head .count {
  font-family: var(--spdf-font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--spdf-text-mute);
}

.spdf-samples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 1024px) { .spdf-samples-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .spdf-samples-grid { grid-template-columns: 1fr; } }

.spdf-sample-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--spdf-line);
  border-radius: 12px;
  background: var(--spdf-panel);
  text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.spdf-sample-card:hover {
  border-color: var(--spdf-accent);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -18px rgba(0,0,0,.3);
}
.spdf-sample-card .name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--spdf-font-body);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--spdf-text);
}
.spdf-sample-card .name::after {
  content: "→";
  margin-left: auto;
  color: var(--spdf-text-mute);
  transition: color .15s, transform .15s;
}
.spdf-sample-card:hover .name::after { color: var(--spdf-accent); transform: translateX(2px); }
.spdf-sample-card .desc {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--spdf-text-dim);
}

/* ─── Code-listing panel (rendered by MainLayout) ──────────── */
.spdf-code-block { margin-top: 40px; }
.spdf-code-block .spdf-code-pre {
  /* ColorCode emits its own inline-styled spans; keep the container
     on-token but let token colors come through. */
  white-space: pre;
}
.spdf-code-block .spdf-code-pre div,
.spdf-code-block .spdf-code-pre pre { margin: 0; background: transparent !important; }

/* Dark mode: the sample code is highlighted by ColorCode, which bakes fixed
   LIGHT-theme colors into inline span styles that CSS can't override. To show a
   proper DARK code block in dark mode, render that light-highlighted code on a
   light surface and INVERT just the code area: invert(1) flips the light bg —>
   dark and the dark text —> light, and hue-rotate(180deg) keeps the syntax hues
   (blue keywords stay blue, etc.). The header + window dots sit OUTSIDE
   .spdf-code-pre, so they keep the normal dark-token chrome and are not inverted.
   Light mode is untouched. */
html[data-theme="dark"] .spdf-code-block .spdf-code-pre {
  background: #FAF3E2;
  filter: invert(1) hue-rotate(180deg);
}

/* ─── Sample output / result banners ───────────────────────── */
.spdf-sample-note {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid var(--spdf-line);
  border-left: 3px solid var(--spdf-accent);
  border-radius: 8px;
  background: var(--spdf-surface);
  font-size: 13.5px;
  color: var(--spdf-text-dim);
}

/* ============================================================
   COMPATIBILITY LAYER — legacy demo markup → new design tokens
   ============================================================ */

.entry-header { margin-bottom: 18px; }
.entry-title {
  font-family: var(--spdf-font-display);
  font-weight: var(--spdf-display-weight);
  letter-spacing: var(--spdf-display-letter);
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.08;
  color: var(--spdf-text);
}

.entry-content { font-family: var(--spdf-font-body); color: var(--spdf-text-dim); }
.entry-content p { margin: 0 0 16px; font-size: 15px; line-height: 1.6; }
.entry-content a { color: var(--spdf-accent); text-decoration: none; }
.entry-content a:hover { text-decoration: underline; }
.entry-content h2 { font-size: 24px; margin: 28px 0 12px; color: var(--spdf-text); }
.entry-content h3 {
  font-family: var(--spdf-font-display);
  font-weight: var(--spdf-display-weight);
  letter-spacing: var(--spdf-display-letter);
  font-size: 20px;
  margin: 26px 0 12px;
  color: var(--spdf-text);
}
.entry-content ul, .entry-content ol { margin: 0 0 16px; padding-left: 22px; }
.entry-content li { margin: 4px 0; font-size: 15px; line-height: 1.55; }

/* Legacy form fields → design-system inputs */
.entry-content input[type="text"],
.entry-content input[type="number"],
.entry-content input[type="password"],
.entry-content input[type="email"],
.entry-content textarea,
.entry-content select {
  font-family: var(--spdf-font-body);
  font-size: 14px;
  color: var(--spdf-text);
  background: var(--spdf-panel);
  border: 1.5px solid var(--spdf-line-strong);
  border-radius: 9px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
  max-width: 100%;
}
.entry-content textarea { width: 100%; min-height: 180px; line-height: 1.5; }
.entry-content input:focus,
.entry-content textarea:focus,
.entry-content select:focus { border-color: var(--spdf-accent); }

/* Legacy narrow inputs carry an inline width:50px sized for the old
   slim fields; the new 12px padding + border eats the box (≈24px of
   content), hiding 4-digit values. min-width wins over inline width
   without !important and restores room for ~4 digits. */
.entry-content input[type="text"],
.entry-content input[type="number"] { min-width: 76px; }

/* "Name: __ Value: __" inline pairs (HttpPostRequest / HttpCookies /
   HttpHeaders use width:40% inputs) wrap raggedly on a phone — the 2nd
   input drops under the 1st. On mobile, stack each input on its own line
   under its label. Scoped to width:40% so unit-label inputs (px / %) and
   the col-grid fields are untouched. */
@media (max-width: 640px) {
  .entry-content input[style*="width: 40%"],
  .entry-content input[style*="width:40%"] {
    display: block;
    /* inline width:40% wins without !important; override it so the
       stacked inputs match the full-width Url field above */
    width: 100% !important;
    max-width: 340px;
    margin: 4px 0 12px;
  }
}

/* Legacy primary button → spdf primary */
.mybutton, .entry-content button[type="submit"], .entry-content .button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--spdf-accent);
  color: var(--spdf-accent-ink);
  border: 0;
  border-radius: 10px;
  padding: 12px 20px;
  font-family: var(--spdf-font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
}
.mybutton:hover, .entry-content button[type="submit"]:hover { filter: brightness(0.96); }

/* Legacy multi-column blocks → side-by-side floats (markup pairs them
   with a .col-clear clearfix, so float is the layout they expect;
   inline-block wraps blocks on sub-pixel/whitespace rounding). col2/3/4
   = 2/3/4 settings per row. */
.col2, .col3, .col4 { float: left; margin-right: 2%; }
.col2 { width: 48%;    min-width: 260px; }
.col3 { width: 31.33%; min-width: 190px; }
.col4 { width: 23%;    min-width: 150px; }
.col-clear { clear: both; }

/* Tablet: drop the denser 3/4-up grids to 2-up before they get cramped */
@media (max-width: 900px) {
  .col3, .col4 { width: 48%; min-width: 220px; }
}
/* Mobile: stack everything one per row */
@media (max-width: 640px) {
  .col2, .col3, .col4 { float: none; width: 100%; margin-right: 0; }
}

/* Legacy inline link lists used on some pages */
.nav-single a { color: var(--spdf-accent); text-decoration: none; line-height: 1.9; }
.nav-single a:hover { text-decoration: underline; }
