/* claudexml.com — site stylesheet */
/* Self-hosted fonts, SIL OFL 1.1 — see /static/fonts/LICENSES.md */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/InterVariable.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/static/fonts/JetBrainsMono-Medium.woff2') format('woff2');
}

:root {
  /* Dark theme — default */
  --bg: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-code: #0f0f17;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8e8f0;
  --text-dim: rgba(255, 255, 255, 0.62);
  --text-faint: rgba(255, 255, 255, 0.42);
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-2: #60a5fa;
  --accent-3: #34d399;
  --warn: #f59e0b;
  --danger: #f87171;
  --max-w: 880px;
  --max-w-wide: 1100px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-card-hover: rgba(0, 0, 0, 0.04);
    --bg-code: #f3f3f7;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.16);
    --text: #15151c;
    --text-dim: rgba(0, 0, 0, 0.66);
    --text-faint: rgba(0, 0, 0, 0.48);
    --accent: #6d28d9;
    --accent-hover: #5b21b6;
    --accent-2: #2563eb;
    --accent-3: #059669;
  }
  pre { background: var(--bg-code); }
  header.site { background: rgba(255,255,255,.85); }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

img { max-width: 100%; height: auto; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #000; padding: .5rem 1rem; z-index: 999;
}
.skip:focus { left: 1rem; top: 1rem; }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: var(--max-w-wide); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
header.site .inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: .85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: .92rem; color: var(--accent);
  letter-spacing: .04em; font-weight: 500;
}
.brand:hover { color: var(--accent-hover); text-decoration: none; }
nav.primary ul { list-style: none; display: flex; gap: 1.4rem; flex-wrap: wrap; }
nav.primary a { color: var(--text-dim); font-size: .88rem; }
nav.primary a:hover { color: var(--text); text-decoration: none; }
.lang-switch { font-size: .8rem; color: var(--text-faint); }
.lang-switch a { color: var(--text-dim); margin: 0 .25rem; }
.lang-switch a[aria-current="true"] { color: var(--accent); font-weight: 600; }

/* Hero */
main { min-height: calc(100vh - 200px); }
.hero {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}
.hero .lede {
  font-size: 1.18rem; color: var(--text-dim); max-width: 720px;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* Article */
article.page { padding: 2.5rem 0 4rem; }
article.page h1 { font-size: 2rem; line-height: 1.2; margin-bottom: .75rem; letter-spacing: -.015em; }
article.page h2 { font-size: 1.45rem; margin: 2.25rem 0 .85rem; letter-spacing: -.01em; padding-top: .5rem; }
article.page h3 { font-size: 1.12rem; margin: 1.5rem 0 .6rem; color: var(--text); }
article.page p { margin: .75rem 0; color: var(--text); }
article.page ul, article.page ol { margin: .75rem 0 .75rem 1.5rem; }
article.page li { margin: .35rem 0; }
article.page > .lede { font-size: 1.12rem; color: var(--text-dim); margin: 0 0 1.5rem; }
article.page hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* Answer box (above-the-fold definitive answer) */
.answer-box {
  background: linear-gradient(135deg, rgba(167,139,250,.08), rgba(96,165,250,.04));
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
  margin: 1.5rem 0 2rem;
}
.answer-box p { margin: .35rem 0; color: var(--text); }
.answer-box strong { color: var(--accent-hover); }

/* Code */
code, pre, kbd {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
:not(pre) > code {
  background: rgba(255,255,255,.06);
  padding: .12rem .4rem;
  border-radius: 4px;
  font-size: .9em;
  color: var(--accent-hover);
  border: 1px solid var(--border);
}
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  font-size: .87rem;
  line-height: 1.55;
  position: relative;
}
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .25rem .55rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); background: var(--bg-card-hover); }
.copy-btn.copied { color: var(--accent-3); border-color: var(--accent-3); }
pre code { background: none; padding: 0; border: 0; color: var(--text); font-size: inherit; }

/* Syntax color hints */
.xml-tag { color: #f472b6; }
.xml-attr { color: #fbbf24; }
.xml-text { color: var(--text); }
.comment { color: var(--text-faint); font-style: italic; }

/* Cards / grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.3rem;
  transition: background .15s, border-color .15s, transform .15s;
}
.card:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.card h3 { margin: 0 0 .35rem; font-size: 1.02rem; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent-hover); text-decoration: none; }
.card p { margin: 0; color: var(--text-dim); font-size: .92rem; }
.card .tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  color: var(--accent);
  margin-bottom: .4rem;
}

/* Breadcrumbs */
.crumbs {
  font-size: .82rem; color: var(--text-faint);
  margin-bottom: 1rem; font-family: 'JetBrains Mono', monospace;
}
.crumbs a { color: var(--text-dim); }
.crumbs span[aria-current] { color: var(--accent); }

/* FAQ */
details.faq {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  margin: .6rem 0;
  overflow: hidden;
}
details.faq[open] { background: var(--bg-card-hover); }
details.faq > summary {
  cursor: pointer;
  padding: 1rem 1.2rem;
  font-weight: 500;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::after {
  content: "+"; position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%);
  font-family: monospace; color: var(--accent); font-size: 1.2rem; transition: transform .2s;
}
details.faq[open] > summary::after { content: "−"; }
details.faq .faq-body { padding: 0 1.2rem 1rem; color: var(--text-dim); }
details.faq .faq-body p { margin: .5rem 0; }
details.faq .faq-body code { color: var(--accent-hover); }

/* Callouts */
.callout {
  border-radius: 8px; padding: .9rem 1.1rem; margin: 1rem 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  font-size: .94rem;
}
.callout.warn { border-left: 3px solid var(--warn); }
.callout.danger { border-left: 3px solid var(--danger); }
.callout.tip { border-left: 3px solid var(--accent-3); }
.callout strong { color: var(--text); }

/* Footer */
footer.site {
  border-top: 1px solid var(--border);
  padding: 2rem 0 2.5rem;
  margin-top: 3rem;
  color: var(--text-faint);
  font-size: .85rem;
}
footer.site .inner {
  max-width: var(--max-w-wide); margin: 0 auto; padding: 0 1.25rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
footer.site a { color: var(--text-dim); }

/* Chips — for related tags / patterns links */
.chip {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .65rem;
  margin: 0 .3rem .3rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: .78rem;
  color: var(--accent);
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--bg-card-hover); border-color: var(--border-strong); text-decoration: none; }

/* Example library — category jump nav */
.ex-jump {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 1.5rem 0 2.25rem;
  padding: .75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ex-jump a {
  font-family: 'JetBrains Mono', monospace;
  font-size: .82rem;
  color: var(--text-dim);
  padding: .25rem .6rem;
  border-radius: 5px;
  background: rgba(255,255,255,.03);
}
.ex-jump a:hover { color: var(--text); background: var(--bg-card-hover); text-decoration: none; }
.ex-cat { margin: 2.5rem 0; scroll-margin-top: 4rem; }
.ex-cat .cat-blurb { color: var(--text-dim); margin: 0 0 1rem; }

/* Citation block */
.citation {
  margin-top: 2.5rem; padding: 1rem 1.2rem;
  background: var(--bg-card); border: 1px dashed var(--border-strong); border-radius: 8px;
  font-size: .88rem; color: var(--text-dim);
}
.citation code { user-select: all; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .93rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
th { color: var(--accent); font-weight: 600; }

/* Accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  header.site, footer.site, .copy-btn, .lang-switch, nav.primary { display: none !important; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
  pre, code { background: #f3f3f7 !important; color: #15151c !important; border: 1px solid #ddd !important; }
  .answer-box { background: #fafafa !important; border-left: 3px solid #6d28d9; }
  article.page { padding: 0; }
  .container { max-width: none; padding: 0; }
}

@media (max-width: 600px) {
  header.site .inner { flex-wrap: wrap; }
  nav.primary ul { gap: 1rem; }
  .hero { padding: 2.5rem 0 1.5rem; }
  article.page { padding: 1.5rem 0 2.5rem; }
}
