/* staging.xapserver.net -- site theme.
 *
 * Linked by the framework's theming API: Master_PageTemplate sets $STYLE_SHEET
 * and PageTemplate::stylesheet() emits the <link> (mtime-busted in the site's
 * override).  One authored file; no inline <style>.
 *
 * LAYOUT (root, 2026-09-22): a vertical nav is a SIDEBAR on desktop and BEHIND
 * A MENU BUTTON on mobile.  Mobile-first here: the base rules are the phone
 * (single column, nav collapsed behind a <summary> button); the min-width query
 * promotes it to a two-column sidebar + reading column and shows the nav always.
 * No JavaScript -- the collapse is a native <details>/<summary>. */

:root {
  --ink:        #1f2328;
  --muted:      #57606a;
  --bg:         #ffffff;
  --soft:       #f6f8fa;
  --line:       #d8dee4;
  --accent:     #4f46e5;
  --accent-ink: #3730a3;
  --radius:     8px;
  --sidebar:    14rem;
  --measure:    44rem;
  --bp:         48rem;    /* sidebar at/above this width (reference only) */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }

h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.8rem 0 0.5rem; }
p { margin: 0 0 1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
       font-size: 0.9em; background: var(--soft); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius);
      padding: 1rem 1.1rem; overflow: auto; font-size: 0.88em; line-height: 1.5; }
pre code { background: none; padding: 0; }
blockquote { margin: 1rem 0; padding: 0.25rem 0 0.25rem 1rem;
             border-left: 3px solid var(--line); color: var(--muted); }

/* ---- layout shell (mobile-first: single column) --------------------- */
.layout { max-width: 40rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.main   { min-width: 0; }
.main > :first-child { margin-top: 0; }

/* ---- brand row ------------------------------------------------------ */
.site-header { display: flex; align-items: baseline; gap: 0.55rem; margin: 0 0 0.9rem; }
.site-brand  { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--ink); }
.site-brand:hover { text-decoration: none; color: var(--ink); }
.site-badge  { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
               color: var(--accent); background: #eef0fe; padding: 0.12em 0.5em; border-radius: 999px; }

/* ---- nav: <details> disclosure ------------------------------------- */
.nav-disclose { margin: 0 0 1.5rem; }
.nav-button {                    /* the <summary> -- the mobile "Menu" button */
  list-style: none; cursor: pointer; display: inline-flex; align-items: center;
  gap: 0.5rem; font-size: 0.95rem; font-weight: 600; color: var(--ink);
  padding: 0.5rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius);
  user-select: none; -webkit-user-select: none;
}
.nav-button::-webkit-details-marker { display: none; }
.nav-button::marker { content: ""; }
.nav-button::before { content: "\2630"; font-size: 1.05em; line-height: 1; }  /* hamburger */
.nav-button:hover { border-color: var(--accent); color: var(--accent); }

.site-nav { font-size: 0.95rem; margin: 0.75rem 0 0; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav ul ul { margin: 0.1rem 0 0.4rem 0.3rem; padding-left: 0.85rem;
                  border-left: 2px solid var(--soft); }
.site-nav li { margin: 0.05rem 0; }
.site-nav a { display: block; padding: 0.4rem 0.15rem; color: var(--ink); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav .tool-links { margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px dashed var(--line); }
.site-nav .tool-links a { font-weight: 600; color: var(--accent); }

/* ---- footer -------------------------------------------------------- */
.site-footer { max-width: 40rem; margin: 2rem auto 0; padding: 1.25rem;
               border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

/* ---- desktop: sidebar + reading column ----------------------------- */
@media (min-width: 48rem) {
  .layout { display: flex; align-items: flex-start; gap: 2.75rem;
            max-width: 64rem; padding: 2.5rem 1.75rem 4rem; }
  .sidebar { flex: 0 0 var(--sidebar); position: sticky; top: 2.5rem; }
  .main    { flex: 1 1 auto; max-width: var(--measure); }
  .nav-disclose > .nav-button { display: none; }   /* no toggle -- it's a sidebar */
  /* Show the nav regardless of the <details> open state.  Newer engines gate
     closed content through the ::details-content pseudo (content-visibility),
     which display: on the child does not reach -- so override both models. */
  .nav-disclose::details-content { content-visibility: visible; }
  .nav-disclose > .site-nav   { display: block; margin-top: 0; }  /* always shown */
  .site-footer { max-width: 64rem; padding-left: 1.75rem; padding-right: 1.75rem; }
}
