/* Open Atelier docs — static site styles */

:root {
  --color-primary: #a55237;
  --color-primary-dark: #8c462f;
  --color-primary-light: #c97256;
  --color-bg: #fdfaf7;
  --color-bg-raised: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-border: #e6ddd6;
  --color-code-bg: #f2ece6;
  --color-link: var(--color-primary);
  --font-base: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --header-height: 3.75rem;
  --sidebar-width: 17rem;
}

:root[data-theme='dark'] {
  --color-primary: #c97256;
  --color-primary-dark: #be5e44;
  --color-primary-light: #dda084;
  --color-bg: #1a1a1a;
  --color-bg-raised: #232323;
  --color-text: #f0ece8;
  --color-text-muted: #b7aea6;
  --color-border: #3a3530;
  --color-code-bg: #2a2622;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-primary: #c97256;
    --color-primary-dark: #be5e44;
    --color-primary-light: #dda084;
    --color-bg: #1a1a1a;
    --color-bg-raised: #232323;
    --color-text: #f0ece8;
    --color-text-muted: #b7aea6;
    --color-border: #3a3530;
    --color-code-bg: #2a2622;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.65;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

img { max-width: 100%; }

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.site-header-inner {
  max-width: 80rem;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}
.site-logo:hover { text-decoration: none; }
.site-logo img { height: 1.75rem; width: auto; }
.logo-dark { display: none; }
:root[data-theme='dark'] .logo-light { display: none; }
:root[data-theme='dark'] .logo-dark { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .logo-light { display: none; }
  :root:not([data-theme='light']) .logo-dark { display: inline-block; }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.site-nav a {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--color-primary); text-decoration: none; }

.theme-toggle, .nav-toggle {
  border: 1px solid var(--color-border);
  background: var(--color-bg-raised);
  color: var(--color-text);
  border-radius: 0.4rem;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--color-primary); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.icon-sun { display: none; }
:root[data-theme='dark'] .icon-moon { display: none; }
:root[data-theme='dark'] .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-moon { display: none; }
  :root:not([data-theme='light']) .icon-sun { display: block; }
}

.nav-toggle { display: none; font-size: 1.1rem; }

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  background: #1f1a17;
  color: #e8e0da;
  margin-top: 4rem;
}
:root[data-theme='dark'] .site-footer { background: #141210; }

.site-footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b7aea6;
}
.footer-col a {
  display: block;
  color: #e8e0da;
  padding: 0.2rem 0;
  font-size: 0.9rem;
}
.footer-col a:hover { color: var(--color-primary-light); text-decoration: none; }

.footer-copyright {
  text-align: center;
  font-size: 0.82rem;
  color: #a89e96;
  padding: 1rem 1.5rem 1.5rem;
  margin: 0;
}

/* Homepage */

.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 3rem;
  max-width: 48rem;
  margin: 0 auto;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.75rem; }
.hero p { font-size: 1.2rem; color: var(--color-text-muted); margin: 0 auto 2rem; }

.button-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
}
.button--primary {
  background: var(--color-primary);
  color: #fff;
}
.button--primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.button--secondary {
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.button--secondary:hover { border-color: var(--color-primary); text-decoration: none; }

/* Doc layout */

.doc-layout {
  max-width: 80rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 0 1.5rem;
}

.sidebar {
  padding: 2rem 0;
  align-self: start;
  position: sticky;
  top: var(--header-height);
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.sidebar-category { margin-bottom: 1.4rem; }
.sidebar-category-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
  padding: 0 0.6rem;
}
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 0.35rem;
  color: var(--color-text);
  font-size: 0.92rem;
}
.sidebar-list a:hover { background: var(--color-code-bg); text-decoration: none; }
.sidebar-list a.active {
  background: var(--color-code-bg);
  color: var(--color-primary);
  font-weight: 600;
}

.doc-main { padding: 2rem 0 4rem; min-width: 0; }

.doc-content h1 { font-size: 2rem; margin-top: 0; }
.doc-content h2 { font-size: 1.5rem; margin-top: 2.2rem; padding-top: 0.5rem; border-top: 1px solid var(--color-border); }
.doc-content h2:first-child { border-top: none; padding-top: 0; }
.doc-content h3 { font-size: 1.2rem; margin-top: 1.6rem; }
.doc-content :is(h1, h2, h3, h4) { position: relative; }
.doc-content :is(h1, h2, h3, h4) .heading-anchor {
  position: absolute;
  left: -1.1rem;
  opacity: 0;
  color: var(--color-text-muted);
  font-weight: 400;
  text-decoration: none;
}
.doc-content :is(h1, h2, h3, h4):hover .heading-anchor { opacity: 1; }

.doc-content p, .doc-content ul, .doc-content ol { color: var(--color-text); }
.doc-content ul, .doc-content ol { padding-left: 1.4rem; }
.doc-content li { margin: 0.3rem 0; }

.doc-content code {
  background: var(--color-code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.doc-content pre {
  background: var(--color-code-bg);
  padding: 1rem 1.2rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}
.doc-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.doc-content blockquote {
  margin: 1rem 0;
  padding: 0.2rem 1rem;
  border-left: 3px solid var(--color-primary);
  color: var(--color-text-muted);
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  display: block;
  overflow-x: auto;
}
.doc-content th, .doc-content td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.8rem;
  text-align: left;
}
.doc-content th { background: var(--color-code-bg); }

.doc-content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }

.doc-loading, .doc-error { color: var(--color-text-muted); }
.doc-error { color: #b3261e; }

.doc-pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.doc-pager a {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.doc-pager a:hover { border-color: var(--color-primary); text-decoration: none; }
.doc-pager a span { display: block; color: var(--color-text); font-weight: 600; font-size: 0.98rem; margin-top: 0.2rem; }
.doc-pager .pager-next { text-align: right; }

/* Changelog */

.changelog-entry {
  padding: 2.2rem 0;
  border-bottom: 1px solid var(--color-border);
}
.changelog-entry:first-child { padding-top: 0; }
.changelog-entry:last-child { border-bottom: none; }

.changelog-entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.5rem;
}
.changelog-entry-header h2 {
  margin: 0;
  font-size: 1.5rem;
  border-top: none;
  padding-top: 0;
}
.changelog-entry-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.changelog-date { color: var(--color-text-muted); font-size: 0.85rem; white-space: nowrap; }
.changelog-release-link {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Responsive */

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .site-nav a { display: none; }
  .doc-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 17rem;
    max-width: 80vw;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 15;
    padding: 1.5rem;
  }
  .sidebar.is-open { transform: translateX(0); }
}
