/* SAPLE docs — mobile-first responsive stylesheet */

:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #7a1f1f;
  --accent-fg: #ffffff;
  --border: #e2e0d8;
  --code-bg: #1e1e2a;
  --code-fg: #e8e8e8;
  --code-keyword: #c792ea;
  --code-string: #c3e88d;
  --code-comment: #6b7280;
  --code-number: #f78c6c;
  --card-bg: #ffffff;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Cambria, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

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

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.25; margin: 1.5em 0 0.5em; }
h1 { font-size: clamp(1.75rem, 5vw, 2.75rem); margin-top: 0; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.35rem); }

p { margin: 0 0 1em; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(0,0,0,0.06);
  padding: 0.12em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 1em 0;
  -webkit-overflow-scrolling: touch;
}
pre code { background: transparent; padding: 0; font-size: inherit; color: inherit; }

.kw { color: var(--code-keyword); }
.str { color: var(--code-string); }
.cm { color: var(--code-comment); font-style: italic; }
.num { color: var(--code-number); }

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}
.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* Header / nav */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  background-color: rgba(250, 250, 247, 0.85);
}
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
  gap: 1rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand span { color: var(--accent); }

.nav-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 24px; height: 24px; }

.nav-links {
  display: none;
  flex-direction: column;
  gap: 0;
  width: 100%;
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
}
.nav-links.open { display: flex; }
.nav-links a {
  color: var(--fg);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.nav-links a.active { color: var(--accent); }
.nav-links a:last-child { border-bottom: none; }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-links {
    display: flex !important;
    flex-direction: row;
    width: auto;
    border-top: none;
    padding: 0;
    gap: 0.25rem;
  }
  .nav-links a {
    border-bottom: none;
    padding: 0.5rem 0.85rem;
    border-radius: 4px;
  }
  .nav-links a:hover { background: rgba(0,0,0,0.04); text-decoration: none; }
  .nav-links a.active { background: rgba(122, 31, 31, 0.08); }
}

/* Hero */
.hero {
  padding: 3rem 1rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(2rem, 7vw, 3.5rem);
  margin-bottom: 0.4em;
}
.hero .tagline {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--muted);
  max-width: 38em;
  margin: 0 auto 2em;
}
.hero .acronym {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(0,0,0,0.04);
  padding: 0.3em 0.7em;
  border-radius: 999px;
  margin-bottom: 1.5em;
}

/* Buttons */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.5em 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.85em 1.4em;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  min-height: 48px;
  border: 1px solid transparent;
  transition: transform 0.05s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: #5e1818; }
.btn-secondary { background: #2c2c2c; color: #fff; }
.btn-secondary:hover { background: #1a1a1a; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { background: rgba(0,0,0,0.04); }

.download-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5em;
  text-align: center;
}

/* Feature grid */
.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
@media (min-width: 640px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .features { grid-template-columns: repeat(4, 1fr); } }
.feature {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.feature h3 { margin-top: 0; font-size: 1.05rem; }
.feature p { font-size: 0.92rem; color: var(--muted); margin-bottom: 0; }

/* Example cards */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.example-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.example-card h3 { margin-top: 0; font-family: var(--mono); font-size: 1rem; }
.example-card .cwes {
  display: flex; flex-wrap: wrap; gap: 0.35em; margin: 0.5em 0;
}
.cwe-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.2em 0.55em;
  background: rgba(122, 31, 31, 0.08);
  color: var(--accent);
  border-radius: 3px;
  font-weight: 600;
}
.example-card p { font-size: 0.9rem; color: var(--muted); flex-grow: 1; }
.example-card pre { font-size: 0.78rem; margin-top: auto; }

/* Section */
.section { margin: 2.5rem 0; }
.section-title { text-align: center; margin-bottom: 0.3em; }
.section-sub { text-align: center; color: var(--muted); margin-bottom: 2em; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}
@media (min-width: 768px) { table { display: table; } }
th, td { text-align: left; padding: 0.55em 0.8em; border-bottom: 1px solid var(--border); }
th { background: rgba(0,0,0,0.04); font-weight: 600; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  background: rgba(0,0,0,0.02);
}
.site-footer a { color: var(--accent); }
.powered-by { margin-top: 0.5em; font-size: 0.85rem; }

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5em 1em;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Utility */
.text-center { text-align: center; }
.muted { color: var(--muted); }

/* ============================================================
   Docs layout — sidebar + content (Phase 1)
   ============================================================ */

.docs-shell {
  display: block;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}

.docs-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin: 1rem;
  padding: 0.55em 0.9em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.9rem;
  min-height: 44px;
}
.docs-menu-btn svg { width: 18px; height: 18px; }

/* Sidebar */
.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 60;
}
.docs-sidebar.open { transform: translateX(0); box-shadow: 2px 0 12px rgba(0,0,0,0.08); }
.docs-sidebar-close {
  display: flex;
  justify-content: flex-end;
  padding: 0 1rem 0.5rem;
}
.docs-sidebar-close button {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  color: var(--muted);
}
.docs-sidebar h4 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 1rem 1.25rem 0.4rem;
  margin: 0;
  border: none;
}
.docs-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
}
.docs-sidebar li a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-size: 0.92rem;
  color: var(--fg);
  border-left: 2px solid transparent;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.docs-sidebar li a:hover { background: rgba(0,0,0,0.03); text-decoration: none; }
.docs-sidebar li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(122, 31, 31, 0.05);
  font-weight: 600;
}

/* Backdrop on mobile when sidebar is open */
.docs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 55;
}
.docs-backdrop.open { display: block; }

/* Content */
.docs-content {
  padding: 1.5rem 1rem 4rem;
  max-width: 820px;
  margin: 0 auto;
}
.docs-content h1 { font-size: clamp(1.75rem, 4.5vw, 2.4rem); margin-top: 0.5em; }
.docs-content h2 {
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  margin-top: 2em;
  scroll-margin-top: 80px;
}
.docs-content h3 {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  margin-top: 1.5em;
  scroll-margin-top: 80px;
}
.docs-content h2:hover .anchor,
.docs-content h3:hover .anchor { opacity: 1; }
.anchor {
  opacity: 0;
  margin-left: 0.3em;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85em;
  transition: opacity 0.15s;
}

.docs-content table { font-size: 0.88rem; }
.docs-content table th { white-space: nowrap; }

/* Eyebrow / breadcrumb on each doc page */
.docs-breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5em;
}

/* Prev / Next */
.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.docs-pagination a {
  display: block;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--fg);
}
.docs-pagination a:hover { border-color: var(--accent); text-decoration: none; }
.docs-pagination .nav-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25em;
}
.docs-pagination .nav-next { text-align: right; }
.docs-pagination a[hidden] { visibility: hidden; }

/* Definition lists, common in language reference pages */
.docs-content dl { margin: 1em 0; }
.docs-content dl dt { font-family: var(--mono); font-size: 0.9rem; color: var(--accent); margin-top: 0.8em; }
.docs-content dl dd { margin: 0.2em 0 0 1.2em; color: var(--fg); }

/* Callout boxes for "Note", "Tip", "Warning" */
.callout {
  border-left: 4px solid var(--accent);
  background: rgba(122, 31, 31, 0.04);
  padding: 0.85em 1em;
  margin: 1.25em 0;
  border-radius: 0 4px 4px 0;
}
.callout-title {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.3em;
}
.callout.note { border-left-color: #2563eb; background: rgba(37, 99, 235, 0.05); }
.callout.note .callout-title { color: #2563eb; }
.callout.warn { border-left-color: #d97706; background: rgba(217, 119, 6, 0.06); }
.callout.warn .callout-title { color: #d97706; }

/* Tablet & desktop: persistent sidebar, content shifts right */
@media (min-width: 1024px) {
  .docs-menu-btn { display: none; }
  .docs-backdrop { display: none !important; }
  .docs-sidebar {
    position: sticky;
    top: 57px; /* header height */
    height: calc(100vh - 57px);
    transform: none;
    box-shadow: none;
    width: 260px;
    flex-shrink: 0;
  }
  .docs-sidebar-close { display: none; }
  .docs-shell {
    display: flex;
    align-items: flex-start;
    gap: 0;
  }
  .docs-content {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.5rem 4rem;
    max-width: 820px;
  }
}

