/* ==========================================================================
   Persona X Documentation — stylesheet
   Tokens mirror the PersonaX design system (personax-front/src/app/global.css)
   so the docs site stays visually consistent with the product. Light values
   map 1:1 to the app's light-mode primitives; the [data-theme="dark"] block
   mirrors the app's `.dark` primitives.
   ========================================================================== */

:root {
  /* --- Brand / accent (primary-500 family) --- */
  --blue: #3B82F6;           /* primary-500 */
  --blue-primary: #2563EB;   /* primary-600 */
  --blue-light: #EFF6FF;     /* primary-50 */
  --blue-dark-mode: #60A5FA; /* primary-600 (dark-mode value) */
  --purple: #A855F7;
  --purple-deep: #8B2BE2;
  --green: #16A34A;          /* success-600 */
  --red: #DC2626;            /* destructive-600 */
  --holo-start: #5CE6E6;
  --holo-mid: #8BA4F9;
  --holo-end: #C084FC;

  /* --- Surfaces / text (neutral scale) --- */
  --canvas: #FAFAFA;     /* neutral-50 */
  --surface: #FFFFFF;    /* background-primary */
  --edge: #E5E5E5;       /* neutral-200 / border-primary */
  --text: #0A0A0A;       /* neutral-950 / foreground-primary */
  --text-muted: #404040; /* neutral-700 / foreground-secondary */
  --text-faint: #737373; /* neutral-500 / foreground-tertiary */

  /* --- Tint backgrounds (chips, callouts, hero) --- */
  --tint-blue: #EFF6FF;    /* primary-50 */
  --tint-purple: #FAF5FF;
  --tint-green: #F0FDF4;   /* success-50 */
  --tint-amber: #FFFBEB;   /* warning-50 */
  --tint-neutral: #F5F5F5; /* neutral-100 */
  --amber: #D97706;        /* warning-600 */
  --green-text: #15803D;   /* success-700 */

  --radius: 0.625rem;   /* --radius (shadcn default) */
  --radius-lg: 1rem;    /* --radius-2xl */
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --sidebar-w: 272px;
  --content-max: 860px;
  --header-h: 60px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  /* --- Brand / accent (dark-mode primitives) --- */
  --blue: #3B82F6;           /* primary-500 (dark mode keeps 500 as base) */
  --blue-primary: #60A5FA;   /* primary-600 (dark mode) */
  --blue-light: #172554;     /* primary-950 (dark mode) */
  --purple: #C084FC;
  --purple-deep: #A855F7;
  --green: #4ADE80;          /* success-400 (dark mode) */
  --red: #F87171;            /* destructive-400 (dark mode) */

  /* --- Surfaces / text (dark-mode background/foreground layers) --- */
  --canvas: #00060C;     /* background-primary (dark) */
  --surface: #0B1220;    /* background-tertiary (dark) */
  --edge: #2B3852;       /* border-primary (dark) */
  --text: #FAFAFA;       /* foreground-primary (dark) */
  --text-muted: #E5E5E5; /* foreground-secondary (dark) */
  --text-faint: #A3A3A3; /* foreground-tertiary (dark) */

  --tint-blue: #172554;    /* primary-950 (dark) */
  --tint-purple: #3B0764;
  --tint-green: #052E16;   /* success-950 (dark) */
  --tint-amber: #451A03;   /* warning-950 (dark) */
  --tint-neutral: #171717; /* neutral-100 (dark) */
  --amber: #FBBF24;        /* warning-400 (dark) */
  --green-text: #4ADE80;   /* success-400 (dark) */

  --shadow: 0 1px 3px 0 rgba(0,0,0,0.4), 0 1px 2px -1px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.4);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --blue: #3B82F6;
    --blue-primary: #60A5FA;
    --blue-light: #172554;
    --purple: #C084FC;
    --purple-deep: #A855F7;
    --green: #4ADE80;
    --red: #F87171;

    --canvas: #00060C;
    --surface: #0B1220;
    --edge: #2B3852;
    --text: #FAFAFA;
    --text-muted: #E5E5E5;
    --text-faint: #A3A3A3;

    --tint-blue: #172554;
    --tint-purple: #3B0764;
    --tint-green: #052E16;
    --tint-amber: #451A03;
    --tint-neutral: #171717;
    --amber: #FBBF24;
    --green-text: #4ADE80;

    --shadow: 0 1px 3px 0 rgba(0,0,0,0.4), 0 1px 2px -1px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.4);

    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--canvas);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .15s ease, color .15s ease;
}

h1, h2, h3, h4, .brand-mark, .header-cta, .tile h4, .card h4 {
  font-family: "Lexend", "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

img { max-width: 100%; display: block; }

/* ---------- Top header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--edge);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 50;
  gap: 16px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  flex-shrink: 0;
}

.brand-mark .logo-mark {
  width: 28px; height: 28px;
  display: block;
}

/* Two logo assets ship — the maroon mark for light backgrounds, the white
   lockup mark for dark. CSS swaps them so the correct one always renders,
   independent of when nav.js finishes hydrating the header. */
.brand-mark .logo-mark-dark { display: none; }
:root[data-theme="dark"] .brand-mark .logo-mark-light { display: none; }
:root[data-theme="dark"] .brand-mark .logo-mark-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .brand-mark .logo-mark-light { display: none; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .brand-mark .logo-mark-dark { display: block; }
}

.brand-mark .docs-tag {
  font-weight: 600;
  color: var(--text-faint);
  font-size: 13px;
  border-left: 1px solid var(--edge);
  padding-left: 10px;
  margin-left: 2px;
}

.header-spacer { flex: 1; }

.header-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 8px;
}
.header-link:hover { background: var(--canvas); text-decoration: none; color: var(--text); }

.header-cta {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: var(--blue-primary);
  padding: 8px 14px;
  border-radius: 8px;
}
.header-cta:hover { background: var(--blue); text-decoration: none; }

.menu-toggle {
  display: none;
  border: 1px solid var(--edge);
  background: var(--surface);
  border-radius: 8px;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}

.theme-toggle {
  border: 1px solid var(--edge);
  background: var(--surface);
  border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--canvas); color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
}

/* ---------- Layout shell ---------- */
.shell {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 22px 14px 60px;
  border-right: 1px solid var(--edge);
  background: var(--surface);
}

.nav-group { margin-bottom: 20px; }

.nav-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0 10px 6px;
}

.nav-link {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.nav-link:hover { background: var(--canvas); text-decoration: none; color: var(--text); }

.nav-link.active {
  background: var(--tint-blue);
  color: var(--blue-primary);
  font-weight: 600;
}

/* ---------- Main content ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.content {
  width: 100%;
  max-width: var(--content-max);
  padding: 48px 32px 100px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue-primary);
  background: var(--tint-blue);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  line-height: 1.2;
}

h2 {
  font-size: 23px;
  font-weight: 750;
  margin: 44px 0 14px;
  letter-spacing: -0.005em;
  scroll-margin-top: 80px;
}

h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 10px;
  scroll-margin-top: 80px;
}

.lede {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 720px;
}

p { margin: 0 0 16px; color: var(--text); }
.content ul, .content ol { margin: 0 0 16px; padding-left: 22px; }
.content li { margin-bottom: 6px; }
strong { font-weight: 650; }
code {
  background: var(--tint-neutral);
  color: var(--text);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 13.5px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}

hr.divider {
  border: none;
  border-top: 1px solid var(--edge);
  margin: 40px 0;
}

/* ---------- Callouts ---------- */
.callout {
  border: 1px solid var(--edge);
  border-left: 3px solid var(--blue);
  background: var(--tint-blue);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14.5px;
}
.callout.tip { border-left-color: var(--green); background: var(--tint-green); }
.callout.warn { border-left-color: var(--amber); background: var(--tint-amber); }
.callout.credit { border-left-color: var(--purple); background: var(--tint-purple); }
.callout strong.label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  color: var(--text-muted);
}

/* ---------- Screenshot frames ---------- */
figure.screenshot {
  margin: 22px 0 28px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}
figure.screenshot img { width: 100%; display: block; }
figure.screenshot figcaption {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--edge);
  background: var(--canvas);
}

/* ---------- Cards / grids ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 20px 0 28px;
}
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface);
}
.card h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}
.card p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--canvas);
  color: var(--text-muted);
  border: 1px solid var(--edge);
  margin: 0 6px 6px 0;
}
.pill.market { background: var(--tint-blue); color: var(--blue-primary); border-color: transparent; }
.pill.deal { background: var(--tint-purple); color: var(--purple-deep); border-color: transparent; }
.pill.workspace { background: var(--tint-green); color: var(--green-text); border-color: transparent; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; margin: 16px 0 28px; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--edge); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); font-weight: 700; }

/* ---------- Step list ---------- */
.steps { list-style: none; padding: 0; margin: 20px 0 28px; counter-reset: step; }
.steps li {
  position: relative;
  padding: 2px 0 18px 40px;
  margin: 0;
  border-left: 2px solid var(--edge);
  margin-left: 15px;
}
.steps li:last-child { border-left: 2px solid transparent; padding-bottom: 0; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -15px;
  top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--blue-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps li strong { display: block; margin-bottom: 2px; }

/* ---------- Pager ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--edge);
}
.pager a {
  flex: 1;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.pager a:hover { border-color: var(--blue); text-decoration: none; background: var(--tint-blue); }
.pager a.next { text-align: right; }
.pager span.dir { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }

/* ---------- Home page hero ---------- */
.hero {
  border-radius: 20px;
  padding: 56px 40px;
  background: linear-gradient(120deg, var(--tint-blue) 0%, var(--tint-purple) 55%, var(--tint-green) 100%);
  margin-bottom: 40px;
  border: 1px solid var(--edge);
}
.hero h1 { font-size: 40px; }
.hero .lede { font-size: 19px; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 40px;
}
@media (max-width: 880px) { .tile-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .tile-grid { grid-template-columns: 1fr; } }

.tile {
  display: block;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--surface);
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.tile:hover { box-shadow: var(--shadow-md); border-color: var(--blue-dark-mode); text-decoration: none; transform: translateY(-1px); }
.tile .tile-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: 12px;
}
.tile-icon.tint-blue { background: var(--tint-blue); }
.tile-icon.tint-purple { background: var(--tint-purple); }
.tile-icon.tint-green { background: var(--tint-green); }
.tile-icon.tint-amber { background: var(--tint-amber); }
.tile h4 { margin: 0 0 6px; font-size: 15.5px; color: var(--text); font-weight: 700; }
.tile p { margin: 0; font-size: 13.5px; color: var(--text-muted); }

/* mobile */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 60;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 32px 20px 80px; }
  h1 { font-size: 28px; }
  .hero { padding: 32px 22px; }
  .hero h1 { font-size: 28px; }
}
