/* ----------------------------------------------------------------------
   phppdf documentation theme
   Light/dark theme (dark by default) shared with examples/public/index.html.
   ---------------------------------------------------------------------- */

:root {
  --bg:          #14161c;
  --bg-2:        #1a1d25;
  --surface:     #1f232c;
  --border:      rgba(255, 255, 255, 0.08);
  --border-h:    rgba(255, 255, 255, 0.16);
  --accent:      #e0594a;
  --accent-soft: rgba(224, 89, 74, 0.14);
  --text-1:      #eef0f5;
  --text-2:      #9aa1b1;
  --text-3:      #5b6270;
  --radius:      6px;

  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --sidebar-width: 240px;
  --topbar-height: 4rem;
  --content-max: 46rem;
}

[data-theme="light"] {
  --bg:          #ffffff;
  --bg-2:        #f7f8fa;
  --surface:     #f3f4f7;
  --border:      #e4e7ec;
  --border-h:    #d2d7e0;
  --accent:      #c0392b;
  --accent-soft: rgba(192, 57, 43, 0.08);
  --text-1:      #16181d;
  --text-2:      #5b6270;
  --text-3:      #9aa1b1;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-1);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ------------------------------------------------------------------- */
/* Top bar                                                                */
/* ------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-1);
  white-space: nowrap;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  box-shadow: 0 4px 12px -2px rgba(224, 89, 74, 0.35);
}

.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(224, 89, 74, 0.25);
  border-radius: var(--radius);
  padding: 3px 7px;
  position: relative;
  top: -1px;
}

[data-theme="light"] .brand-tag {
  border-color: rgba(192, 57, 43, 0.25);
}

.topbar-tagline {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
}

.topbar-source {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.95rem;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.topbar-source:hover {
  color: var(--text-1);
  border-color: var(--border-h);
  background: var(--surface);
}

.theme-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text-1);
  border-color: var(--border-h);
  background: var(--surface);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }

[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Mobile nav toggle ----------------------------------------------------- */

.nav-toggle {
  display: none;
}

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-burger span {
  display: block;
  height: 2px;
  background: var(--text-1);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ------------------------------------------------------------------- */
/* Shell layout                                                           */
/* ------------------------------------------------------------------- */

.shell {
  display: flex;
  align-items: flex-start;
  max-width: 1320px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------- */
/* Sidebar / table of contents                                           */
/* ------------------------------------------------------------------- */

.sidebar {
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 2rem 1.25rem;
  border-right: 1px solid var(--border);
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 0.75rem;
  margin: 0 0 0.8rem;
}

.toc,
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toc a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.toc a:hover {
  color: var(--text-1);
  background: var(--surface);
}

.toc a.active {
  position: relative;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.toc a.active::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.1rem;
  border-radius: 2px;
  background: var(--accent);
}

.toc li {
  position: relative;
}

.toc-page > a {
  font-weight: 600;
  color: var(--text-1);
}

.toc-section {
  margin-top: 0.4rem;
}

.toc-section details {
  border: none;
}

.toc-section summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  color: var(--text-1);
  border-radius: var(--radius);
  user-select: none;
}

.toc-section summary:hover {
  background: var(--surface);
}

.toc-section summary::-webkit-details-marker {
  display: none;
}

.toc-section summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid var(--text-3);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.toc-section details[open] > summary::before {
  transform: rotate(90deg);
}

.toc-section ul {
  margin: 0.15rem 0 0.5rem 0.9rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.toc-section ul a {
  font-size: 0.85rem;
  font-weight: 500;
}

/* ------------------------------------------------------------------- */
/* Content                                                                */
/* ------------------------------------------------------------------- */

.content {
  flex: 1;
  min-width: 0;
  padding: 3.5rem 3rem 6rem;
  display: flex;
  justify-content: center;
}

.doc {
  width: 100%;
  max-width: var(--content-max);
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.eyebrow::before {
  content: "// ";
  color: var(--text-3);
}

.doc > h1,
.home-hero > h1 {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 0 0 0 1rem;
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-1);
  overflow-wrap: break-word;
}

.doc > h1::before,
.home-hero > h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 35%, transparent));
}

.home .doc > h1,
.home-hero > h1 {
  font-size: 2.9rem;
}

/* ------------------------------------------------------------------- */
/* Home hero decoration                                                  */
/* ------------------------------------------------------------------- */

.home-hero {
  position: relative;
  padding: 1.5rem 0 0.5rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.home-hero-curve {
  position: absolute;
  inset: -2rem -1.5rem auto -1.5rem;
  width: calc(100% + 3rem);
  height: 160px;
  pointer-events: none;
  z-index: -1;
}

.home-hero > .eyebrow,
.home-hero > h1 {
  position: relative;
}

/* ------------------------------------------------------------------- */
/* Prose                                                                  */
/* ------------------------------------------------------------------- */

.prose h2 {
  font-weight: 700;
  font-size: 1.35rem;
  margin: 2.6rem 0 1rem;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

.prose h3 {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 2rem 0 0.8rem;
  color: var(--text-1);
}

.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}

.prose p {
  margin: 1rem 0;
  color: var(--text-2);
}

.prose a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

.prose strong {
  font-weight: 700;
  color: var(--text-1);
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
  margin: 1rem 0;
  color: var(--text-2);
}

.prose li {
  margin: 0.35rem 0;
}

.prose li::marker {
  color: var(--accent);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.6rem 1.25rem;
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  color: var(--text-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose img,
.prose svg {
  max-width: 100%;
}

/* Inline code & code blocks --------------------------------------------- */

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.15em 0.4em;
}

.prose pre {
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px -16px rgba(16, 18, 21, 0.35);
}

.prose pre code {
  padding: 0;
  background: none;
  border: none;
  color: inherit;
}

/* Tables ------------------------------------------------------------------ */

.prose table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
  text-align: left;
  color: var(--text-2);
}

.prose th {
  font-weight: 700;
  color: var(--text-1);
  border-bottom: 2px solid var(--border-h);
}

/* ------------------------------------------------------------------- */
/* Cards (section / landing pages)                                       */
/* ------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 2.5rem 0 1rem;
}

.card-wrap {
  position: relative;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.2rem 1.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  min-height: 92px;
  box-shadow: 0 1px 2px rgba(16, 18, 21, 0.04);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(224, 89, 74, 0.35);
}

.card-index {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.card:hover .card-index {
  color: var(--accent);
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text-1);
}

/* ------------------------------------------------------------------- */
/* Footer                                                                 */
/* ------------------------------------------------------------------- */

.colophon {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.75rem;
  background: var(--bg-2);
}

.colophon-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-brand {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-3);
}

.footer-brand strong {
  color: var(--text-2);
  font-weight: 600;
}

/* ------------------------------------------------------------------- */
/* Responsive                                                             */
/* ------------------------------------------------------------------- */

@media (max-width: 920px) {
  .topbar-tagline {
    display: none;
  }

  .nav-burger {
    display: flex;
  }

  .shell {
    position: relative;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    height: calc(100vh - var(--topbar-height));
    width: min(80vw, 300px);
    background: var(--bg);
    border-right: 1px solid var(--border);
    box-shadow: 12px 0 30px -20px rgba(0, 0, 0, 0.6);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 20;
  }

  .nav-toggle:checked ~ .shell .sidebar {
    transform: translateX(0);
  }

  .content {
    padding: 2.5rem 1.5rem 4rem;
  }

  .doc > h1,
  .home .doc > h1,
  .home-hero > h1 {
    font-size: 2rem;
  }

  .cards {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar-inner {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .topbar-source {
    display: none;
  }

  .colophon-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}
