/* ============================================================
   pempi — pkgdown custom theme (clean light)
   Adapted from the rollup template.
   ============================================================ */

:root {
  --indigo-50:  #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-400: #818cf8;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --slate-50:   #f8fafc;
  --slate-100:  #f1f5f9;
  --slate-200:  #e2e8f0;
  --slate-300:  #cbd5e1;
  --slate-400:  #94a3b8;
  --slate-500:  #64748b;
  --slate-600:  #475569;
  --slate-700:  #334155;
  --slate-800:  #1e293b;
  --slate-900:  #0f172a;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6rem;

  --shadow-card-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -10px rgba(15, 23, 42, 0.08);
  --shadow-card-lift: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 28px -10px rgba(79, 70, 229, 0.16);
}

html, body { background: #ffffff !important; color: var(--slate-800) !important; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  color: var(--slate-700);
}

h1, h2, h3, h4 {
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--slate-900);
}

main h1:first-child {
  font-size: clamp(2rem, 4.2vw + 0.6rem, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
  margin-top: 0.5rem;
  margin-bottom: 0.65rem;
  color: var(--slate-900);
  hyphens: auto;
  -webkit-hyphens: auto;
}

main h1:first-child + blockquote {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--slate-600);
  border: none;
  padding: 0;
  margin: 0 0 2rem 0;
  max-width: 760px;
  font-weight: 400;
  background: none;
  border-radius: 0;
}

main h1:first-child + blockquote::before { content: none; }
main h1:first-child + blockquote p { margin: 0; }
main h1:first-child + blockquote strong {
  color: var(--slate-900);
  font-weight: 700;
  display: block;
  margin-bottom: 0.4rem;
  font-size: 1.05em;
}

h2 {
  font-size: 1.85rem;
  margin-top: 3.5rem;
  margin-bottom: 0.6rem;
  color: var(--slate-900);
  font-weight: 700;
}

h3 {
  font-size: 1.3rem;
  margin-top: 2.25rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: var(--slate-800);
}

p { color: var(--slate-700); }

/* ---- Hero figure (kept for future static SVG/PNG) ---- */
.hero-figure {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem auto 3rem;
  border-radius: 0.75rem;
  border: 1px solid var(--slate-100);
  background: #ffffff;
  padding: 0;
  box-shadow: var(--shadow-card-soft);
}

/* ---- Award pill (a tiny custom element used in README + sidebar) ---- */
.award-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.award-pill:hover {
  color: #78350f;
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fde68a, #fcd34d);
}

/* ---- Code styling ---- */
code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9em;
  background: var(--slate-100);
  padding: 0.18em 0.4em;
  border-radius: 0.32em;
  color: var(--indigo-700);
  font-weight: 500;
  border: none;
}

.table td code, .table th code { white-space: nowrap; }

blockquote code {
  background: rgba(255, 255, 255, 0.7);
  color: var(--indigo-700);
}

pre {
  background: #fafbff !important;
  border: 1px solid var(--slate-100) !important;
  border-radius: 0.6rem;
  padding: 1.1rem 1.3rem;
  font-size: 0.9em;
  line-height: 1.65;
  overflow-x: auto;
  color: var(--slate-800);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  background-image:
    linear-gradient(to right, transparent calc(100% - 24px), rgba(15, 23, 42, 0.06));
  background-attachment: local;
  background-repeat: no-repeat;
}

pre code {
  background: transparent !important;
  color: var(--slate-800) !important;
  border: none;
  padding: 0;
  font-size: inherit;
  font-weight: 400;
}

pre .kw, pre .cf { color: #be185d; font-weight: 500; }
pre .st          { color: #047857; }
pre .co          { color: var(--slate-600); font-style: italic; }
pre .dv, pre .fl { color: #b45309; }
pre .fu          { color: var(--indigo-700); font-weight: 500; }
pre .at          { color: #be185d; }

/* ---- Navbar ---- */
.navbar {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--slate-200);
  padding: 0.75rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--slate-900) !important;
  letter-spacing: -0.02em;
}

.navbar .navbar-brand .version { color: var(--indigo-600); font-weight: 500; }

.navbar .nav-link {
  font-weight: 500;
  color: var(--slate-700) !important;
  font-size: 0.96rem;
}

.navbar .nav-link:hover { color: var(--indigo-700) !important; }

.navbar .navbar-nav .nav-item.active .nav-link { color: var(--indigo-700) !important; }

#search-input {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  font-size: 0.92rem;
  border-radius: 0.4rem;
  padding: 0.4rem 0.75rem;
}

/* ---- Tables ---- */
.table {
  font-size: 0.94rem;
  border: 1px solid var(--slate-200);
  border-radius: 0.5rem;
  overflow: hidden;
  font-feature-settings: 'tnum' 1;
}

.table th {
  font-weight: 600;
  background: var(--slate-50);
  color: var(--slate-900);
  border-bottom: 2px solid var(--slate-200);
  padding: 0.7rem 0.75rem;
}

.table td { vertical-align: middle; padding: 0.65rem 0.75rem; color: var(--slate-700); }

/* ---- "Where to next" tile-grid table ---- */
main h2 + table:not(:has(thead tr th:not(:empty))) {
  border: none !important;
  overflow: visible !important;   /* let hover-lift escape the .table clip */
  margin: 1rem 0 2rem !important;
  padding-top: 4px;               /* room for the -2px lift on the top row */
  background: transparent;
  font-size: 1rem;
}

main h2 + table:not(:has(thead tr th:not(:empty))) thead { display: none; }

main h2 + table:not(:has(thead tr th:not(:empty))) tbody {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  background: transparent;
}

main h2 + table:not(:has(thead tr th:not(:empty))) tr {
  display: block;
  border: 1px solid var(--slate-200);
  border-radius: 0.65rem;
  padding: 1.1rem 1.25rem;
  background: #ffffff;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

main h2 + table:not(:has(thead tr th:not(:empty))) tr:hover {
  transform: translateY(-2px);
  border-color: var(--indigo-400);
  box-shadow: 0 10px 24px -10px rgba(79, 70, 229, 0.18);
}

main h2 + table:not(:has(thead tr th:not(:empty))) td {
  display: block;
  padding: 0;
  border: none;
}

main h2 + table:not(:has(thead tr th:not(:empty))) td:nth-child(1) {
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}

main h2 + table:not(:has(thead tr th:not(:empty))) td:nth-child(2) {
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
  color: var(--slate-900);
}

main h2 + table:not(:has(thead tr th:not(:empty))) td:nth-child(2) a {
  color: var(--slate-900);
  text-decoration: none;
  border-bottom: none;
}

main h2 + table:not(:has(thead tr th:not(:empty))) td:nth-child(2) a:hover {
  color: var(--indigo-700);
}

main h2 + table:not(:has(thead tr th:not(:empty))) td:nth-child(3) {
  color: var(--slate-600);
  font-size: 0.93rem;
  line-height: 1.5;
}

/* ---- Lists ---- */
ul, ol { padding-left: 1.4rem; }
li { margin: 0.3rem 0; color: var(--slate-700); }
li strong { color: var(--slate-900); font-weight: 600; }

/* ---- Links ---- */
main a {
  color: var(--indigo-700);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

main a:hover {
  color: var(--indigo-600);
  border-bottom-color: var(--indigo-400);
}

main h2 + table a { border-bottom: none; }

/* ---- Sidebar ---- */
.sidebar, .row > [class*="col-md-"]:last-child {
  font-size: 0.92rem;
}

.sidebar h2, aside h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-600);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  padding-top: 0;
  border: none;
}

.sidebar a, aside a {
  color: var(--slate-700);
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 0.35rem;
  border-bottom: none;
  transition: color 0.12s ease, background 0.12s ease;
}

.sidebar a:hover, aside a:hover {
  color: var(--indigo-700);
  background: var(--slate-50);
  border-bottom: none;
}

.sidebar a[aria-current="true"], aside a[aria-current="true"],
.sidebar a.active, aside a.active {
  color: var(--indigo-700);
  background: var(--indigo-50);
  font-weight: 500;
}

/* ---- Blockquotes (when not in hero) ---- */
blockquote {
  border-left: 3px solid var(--indigo-500);
  background: var(--indigo-50);
  padding: 0.85rem 1.15rem;
  border-radius: 0 0.4rem 0.4rem 0;
  margin: 1.5rem 0;
  color: var(--slate-700);
  font-size: 0.96rem;
}

/* ---- Reference index density ---- */
.template-reference-index h2 {
  margin-top: 2.25rem;
  margin-bottom: 0.5rem;
}

.template-reference-index main dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 0.5rem 2rem;
  margin: 0.5rem 0 1.5rem;
}

.template-reference-index main dl dt,
.template-reference-index main dl dd {
  margin: 0;
}

.template-reference-index main dl dt {
  font-weight: 500;
  font-size: 0.95rem;
}

.template-reference-index main dl dd {
  color: var(--slate-600);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.template-reference h2 {
  margin-top: 2.5rem;
}

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--slate-200);
  margin-top: 5rem;
  padding-top: 2rem;
  color: var(--slate-500);
  font-size: 0.92rem;
}

/* ---- 404 ---- */
.template-page-not-found .page-header { color: var(--slate-900); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01s !important; transition-duration: 0.01s !important; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  main h1:first-child + blockquote { font-size: 1.05rem; }
  h2 { font-size: 1.5rem; margin-top: 2.5rem; }
  body { font-size: 15px; }
  pre { font-size: 0.92em; }
  ul, ol { padding-left: 1.1rem; }
}

@media (max-width: 480px) {
  main h1:first-child {
    letter-spacing: -0.025em;
    word-break: break-word;
  }
}

/* ---- Force light mode regardless of system preference ---- */
[data-bs-theme="dark"] {
  --bs-body-bg: #ffffff !important;
  --bs-body-color: var(--slate-800) !important;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] main,
[data-bs-theme="dark"] .navbar,
[data-bs-theme="dark"] pre,
[data-bs-theme="dark"] code {
  background-color: inherit !important;
  color: inherit !important;
}
