/* PlanExe — modern docs-like theme (static, no build pipeline) */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  --px-font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  --px-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;

  --px-bg: #f9f9fb;
  --px-surface: #ffffff;
  --px-surface-2: #f2f3f7;
  --px-topbar-bg: #ffffff;
  --px-border: rgba(17, 24, 39, 0.12);
  --px-border-strong: rgba(17, 24, 39, 0.18);

  --px-text: #101828;
  --px-text-2: #344054;
  --px-text-3: #667085;

  --px-primary: #3578e5; /* Docusaurus-ish blue */
  --px-primary-2: #2a62be;
  --px-focus: rgba(53, 120, 229, 0.35);

  --px-radius-sm: 10px;
  --px-radius: 14px;
  --px-radius-lg: 0.5rem;

  --px-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --px-shadow: 0 10px 30px rgba(16, 24, 40, 0.10);

  --px-content-width: 1024px;
  --px-gutter: 20px;
  --px-topbar-h: 56px;
  --px-hairline: 1px;
}

@media (min-resolution: 2dppx) {
  :root {
    --px-hairline: 0.5px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --px-bg: #0b1020;
    --px-surface: rgba(255, 255, 255, 0.06);
    --px-surface-2: rgba(255, 255, 255, 0.10);
    --px-topbar-bg: #0b1020;
    --px-border: rgba(255, 255, 255, 0.12);
    --px-border-strong: rgba(255, 255, 255, 0.18);
    --px-text: rgba(255, 255, 255, 0.92);
    --px-text-2: rgba(255, 255, 255, 0.72);
    --px-text-3: rgba(255, 255, 255, 0.56);
    --px-primary: #6aa3ff;
    --px-primary-2: #8ab7ff;
    --px-focus: rgba(106, 163, 255, 0.35);
    --px-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --px-shadow: 0 18px 50px rgba(0, 0, 0, 0.50);
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --px-bg: #f6f7fb;
  --px-surface: #ffffff;
  --px-surface-2: #f2f3f7;
  --px-topbar-bg: #ffffff;
  --px-border: rgba(17, 24, 39, 0.12);
  --px-border-strong: rgba(17, 24, 39, 0.18);
  --px-text: #101828;
  --px-text-2: #344054;
  --px-text-3: #667085;
  --px-primary: #3578e5;
  --px-primary-2: #2a62be;
  --px-focus: rgba(53, 120, 229, 0.35);
  --px-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --px-shadow: 0 10px 30px rgba(16, 24, 40, 0.10);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --px-bg: #0b1020;
  --px-surface: rgba(255, 255, 255, 0.06);
  --px-surface-2: rgba(255, 255, 255, 0.10);
  --px-topbar-bg: #0b1020;
  --px-border: rgba(255, 255, 255, 0.12);
  --px-border-strong: rgba(255, 255, 255, 0.18);
  --px-text: rgba(255, 255, 255, 0.92);
  --px-text-2: rgba(255, 255, 255, 0.72);
  --px-text-3: rgba(255, 255, 255, 0.56);
  --px-primary: #6aa3ff;
  --px-primary-2: #8ab7ff;
  --px-focus: rgba(106, 163, 255, 0.35);
  --px-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --px-shadow: 0 18px 50px rgba(0, 0, 0, 0.50);
}

/* ---------- Base / reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body.px-body {
  margin: 0;
  font-family: var(--px-font-sans);
  color: var(--px-text);
  /* Clean docs-like backdrop: solid color (no gradients/patterns to avoid scroll artifacts). */
  background: var(--px-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--px-primary);
  text-decoration: none;
}
a:hover {
  color: var(--px-primary-2);
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--px-focus);
  outline-offset: 3px;
}

.px-skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--px-surface);
  border: 1px solid var(--px-border);
  box-shadow: var(--px-shadow-sm);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
  z-index: 9999;
}
.px-skip-link:focus {
  transform: translateY(0);
}

.px-container {
  width: min(var(--px-content-width), 100% - (var(--px-gutter) * 2));
  margin: 0 auto;
}

/* ---------- Topbar ---------- */
.px-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: var(--px-hairline) solid var(--px-border);
  background: var(--px-topbar-bg);
  backdrop-filter: none;
  height: var(--px-topbar-h);
}

.px-topbar-inner {
  width: min(var(--px-content-width), 100% - (var(--px-gutter) * 2));
  margin: 0 auto;
  height: 100%;
  display: flex;
  gap: 14px;
  align-items: center;
}

.px-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
  position: relative;
}
.px-brand-link:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--px-surface-2) 70%, transparent);
}

.px-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--px-border);
  color: var(--px-text);
  font-weight: 800;
  overflow: hidden;
}

.px-brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 0;
}

.px-brand-text {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--px-text);
  position: relative;
  display: inline-block;
  line-height: 1;
}

.px-brand-link.is-active .px-brand-text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--px-primary);
}

.px-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.px-nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.px-nav-spacer {
  flex: 1 1 auto;
  min-width: 12px;
}

.px-nav-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--px-text-2);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.px-nav-link:hover {
  text-decoration: none;
  color: var(--px-text);
  background: color-mix(in srgb, var(--px-surface-2) 70%, transparent);
}
.px-nav-link.is-active {
  color: var(--px-text);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  position: relative;
}
.px-nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--px-primary);
}

.px-topbar-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.px-button {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--px-border);
  background: var(--px-surface);
  color: var(--px-text);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--px-shadow-sm);
}
.px-button:hover {
  text-decoration: none;
  border-color: var(--px-border-strong);
}
.px-button-primary {
  border-color: color-mix(in srgb, var(--px-primary) 50%, var(--px-border));
  background: color-mix(in srgb, var(--px-primary) 12%, var(--px-surface));
  color: var(--px-text);
}
.px-button-primary:hover {
  background: color-mix(in srgb, var(--px-primary) 16%, var(--px-surface));
}

.px-theme-toggle {
  appearance: none;
  border: 1px solid var(--px-border);
  background: var(--px-surface);
  color: var(--px-text);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  box-shadow: var(--px-shadow-sm);
  cursor: pointer;
}
.px-theme-toggle:hover {
  border-color: var(--px-border-strong);
}

.px-theme-toggle-icon::before {
  content: "◐";
  font-size: 22px;
  line-height: 1;
}

/* ---------- Main / prose ---------- */
.px-main {
  padding: calc(var(--px-topbar-h) + 32px) 0 60px;
}

.px-article {
  background: var(--px-surface);
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-lg);
  padding: clamp(18px, 3.2vw, 34px);
}

.px-page-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--px-border);
}

.px-page-title {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.post-header {
  margin-top: 0;
}

.post-title {
  margin: 0 0 8px;
}

.px-page-meta,
.px-page-subtitle {
  margin: 0;
  color: var(--px-text-3);
}

.px-prose {
  color: var(--px-text-2);
  font-size: 1.03rem;
}

.px-prose h1,
.px-prose h2,
.px-prose h3,
.px-prose h4 {
  color: var(--px-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.px-prose h1 {
  font-size: 2.2rem;
}
.px-prose h2 {
  font-size: 1.65rem;
}
.px-prose h3 {
  font-size: 1.25rem;
}

.px-prose p {
  margin: 0.9em 0;
}

.px-prose ul,
.px-prose ol {
  margin: 0.9em 0 1.1em;
  padding-left: 1.25em;
}
.px-prose li {
  margin: 0.35em 0;
}

.px-prose hr {
  border: 0;
  border-top: 1px solid var(--px-border);
  margin: 1.4em 0;
}

.px-prose blockquote {
  margin: 1.2em 0;
  padding: 14px 16px;
  border-left: 3px solid var(--px-primary);
  background: var(--px-surface-2);
  border-radius: 12px;
  color: var(--px-text);
}

.px-prose code {
  font-family: var(--px-font-mono);
  font-size: 0.95em;
  background: color-mix(in srgb, var(--px-surface-2) 80%, transparent);
  border: 1px solid var(--px-border);
  border-radius: 10px;
  padding: 0.18em 0.45em;
}

.px-prose pre {
  margin: 1.2em 0;
  padding: 16px;
  background: #0f172a;
  color: rgba(255, 255, 255, 0.92);
  border-radius: var(--px-radius);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.px-prose pre code {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.95rem;
}

.px-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1em 0;
  overflow: hidden;
  border-radius: var(--px-radius);
  border: 1px solid var(--px-border);
}
.px-prose th,
.px-prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--px-border);
}
.px-prose th {
  text-align: left;
  background: var(--px-surface-2);
  color: var(--px-text);
  font-weight: 750;
}

/* ---------- Footer ---------- */
.px-footer {
  padding: 26px 0 44px;
  color: var(--px-text-3);
}

.px-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.px-footer a {
  color: var(--px-text-3);
}
.px-footer a:hover {
  color: var(--px-text);
  text-decoration: none;
}

.px-footer-sep {
  padding: 0 8px;
  opacity: 0.7;
}

/* ---------- Examples cards (homepage + /examples) ---------- */
.examples-card-wrapper {
  border: 1px solid var(--px-border);
  border-radius: 0;
  background: color-mix(in srgb, var(--px-surface) 92%, transparent);
  overflow: hidden;
  box-shadow: var(--px-shadow-sm);
}

.examples-card {
  position: relative;
  padding: 18px;
  margin: 0;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: transparent;
  transition: background 0.2s ease, transform 0.2s ease;
}

.examples-card + .examples-card {
  border-top: 1px solid var(--px-border);
}

.examples-card:hover {
  background: var(--px-surface-2);
}

.examples-card-image-wrapper {
  /* Make thumbnails smaller (less JPEG artifacts), but preserve original aspect ratio. */
  flex: 0 0 clamp(160px, 22vw, 240px);
  width: clamp(160px, 22vw, 240px);
  min-width: 0;
}

.examples-card-thumbnail {
  width: 100%;
  height: auto;
  border-radius: var(--px-radius);
  display: block;
  border: 1px solid var(--px-border);
}

.examples-card-content {
  flex: 1 1 auto;
  min-width: 0;
}

.examples-card-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--px-text);
}

.px-prose .examples-card-title {
  font-size: 1.7rem;
  font-weight: 800;
}

.examples-card-description {
  margin: 0 0 10px;
  color: var(--px-text-3);
  font-style: italic;
}

.examples-card-prompt {
  color: var(--px-text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stretched overlay link */
.examples-card a.examples-card-arrow-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  font-size: 0;
}

/* Ensure inner links are clickable above the stretched link */
.examples-card-description a,
.examples-card-prompt a {
  position: relative;
  z-index: 2;
}

/* ---------- CTA button ---------- */
.planexe-cta-block {
  margin-top: 8px;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.planexe-cta-helper {
  color: var(--px-text-3);
  font-size: 0.95rem;
}

.planexe-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 12px;
}

.planexe-split-panel {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--px-border);
  background: var(--px-surface);
  box-shadow: 0 12px 30px rgba(15, 20, 34, 0.03);
}

.planexe-split-panel h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--px-text);
}

.planexe-split-panel p {
  margin: 0 0 10px;
  color: var(--px-text-2);
}

.planexe-split-panel p:last-child {
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .planexe-split {
    grid-template-columns: 1fr;
  }
}

.planexe-cta-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--px-primary) 45%, var(--px-border));
  background: linear-gradient(120deg, #ff6b4a 0%, #ffb347 45%, #ffe26f 100%);
  color: #0b1020;
  font-weight: 850;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 0 14px 34px rgba(255, 107, 74, 0.25);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  overflow: hidden;
}
.planexe-cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 48px rgba(255, 107, 74, 0.35);
  filter: saturate(1.04);
  text-decoration: none;
}
.planexe-cta-button:active {
  transform: translateY(0);
}
.planexe-cta-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.planexe-cta-button:hover .planexe-cta-arrow {
  transform: translateX(4px);
}

/* ---------- Small utilities ---------- */
.px-section {
  margin-top: 28px;
}

.px-post-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 12px;
}

.px-post-list-item {
  padding: 14px 14px;
  border-radius: var(--px-radius);
  border: 1px solid var(--px-border);
  background: var(--px-surface);
}
.px-post-list-link {
  font-weight: 800;
}
.px-post-list-date {
  margin-left: 10px;
  color: var(--px-text-3);
  font-size: 0.95rem;
}
.px-post-list-excerpt {
  margin-top: 8px;
  color: var(--px-text-2);
}

/* Callouts / small panels */
.px-callout {
  margin: 18px 0;
  padding: 16px 16px;
  border-radius: var(--px-radius);
  border: 1px solid var(--px-border);
  background: var(--px-surface-2);
}

.px-callout h2 {
  margin: 0 0 10px;
}

.px-codebox {
  border-radius: var(--px-radius);
  border: 1px solid var(--px-border);
  background: var(--px-surface);
  padding: 12px 12px;
  font-family: var(--px-font-mono);
  white-space: pre-wrap;
  min-height: 52px;
  color: var(--px-text);
}

.px-note {
  margin: 10px 0 0;
  color: var(--px-text-3);
  font-size: 0.95rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  :root {
    --px-topbar-h: 64px;
  }
  .px-topbar-inner {
    height: auto;
    padding: 10px 0;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .px-nav {
    order: 0;
    width: auto;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .px-nav::-webkit-scrollbar {
    display: none;
  }
  .px-nav-list {
    flex-wrap: nowrap;
  }
  .px-brand {
    order: 0;
  }
  .px-topbar-actions {
    order: 0;
    margin-left: auto;
  }
}

.px-cta-label-short {
  display: none;
}

@media (max-width: 640px) {
  .px-brand-mark {
    display: none;
  }
  .px-nav-item-github,
  .px-nav-item-discord {
    display: none;
  }
  .px-nav-spacer {
    display: none;
  }
  .px-cta-label-long {
    display: none;
  }
  .px-cta-label-short {
    display: inline;
  }
}

@media (max-width: 550px) {
  .px-article {
    border: none;
    padding: 0;
    background: transparent;
  }
  .px-footer {
    border-top: 1px solid var(--px-border);
    padding-top: 22px;
  }
}

@media (max-width: 768px) {
  .examples-card {
    flex-direction: row;
    gap: 14px;
  }
  .examples-card-image-wrapper {
    flex: 0 0 auto;
    width: 96px;
  }
  .examples-card-thumbnail {
    width: 100%;
    height: auto;
  }
  .examples-card-description,
  .examples-card-prompt {
    display: none;
  }
}
