/* ============================================================
   Familiar / Calendar Wizard Documentation Stylesheet
   help.westoverlabs.eu
   ============================================================ */

/* ---- Reset & base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg:           #f8fafc;
  --color-surface:      #ffffff;
  --color-border:       #e2e8f0;
  --color-border-light: #f1f5f9;

  --color-primary:      #1a365d;
  --color-accent:       #2b6cb0;
  --color-accent-light: #ebf4ff;
  --color-accent-hover: #2c5282;

  --color-text:         #1a202c;
  --color-text-muted:   #4a5568;
  --color-text-faint:   #718096;

  --color-success:      #276749;
  --color-success-bg:   #f0fff4;
  --color-warning:      #744210;
  --color-warning-bg:   #fffbeb;
  --color-danger:       #742a2a;
  --color-danger-bg:    #fff5f5;
  --color-info-bg:      #ebf8ff;
  --color-info:         #2c5282;

  --sidebar-width:      260px;
  --content-max-width:  720px;
  --header-height:      58px;

  --font-sans:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:   'SF Mono', 'Cascadia Code', 'Fira Mono', Consolas, 'Liberation Mono', monospace;
  --radius:      6px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  z-index: 9999;
}

/* ---- Site header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-primary);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
}

.site-header .inner {
  width: 100%;
  max-width: calc(var(--sidebar-width) + var(--content-max-width) + 6rem);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.site-header .brand-icon {
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.header-nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color .15s;
}

.header-nav a:hover,
.header-nav a[aria-current="page"] {
  color: #fff;
}

/* Hamburger (mobile only) */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius);
  color: #fff;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

/* ---- Page layout ---- */
.docs-layout {
  display: flex;
  max-width: calc(var(--sidebar-width) + var(--content-max-width) + 6rem);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

/* ---- Sidebar ---- */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 2rem 0 2rem 1.5rem;
  position: sticky;
  top: var(--header-height);
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-section {
  margin-bottom: 1.75rem;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--color-text-faint);
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.125rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background .12s, color .12s;
}

.sidebar-nav a:hover {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.sidebar-nav a.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

/* ---- Main content ---- */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 2rem 4rem 2.5rem;
  max-width: var(--content-max-width);
}

/* ---- Typography ---- */
.docs-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-meta {
  font-size: 0.8125rem;
  color: var(--color-text-faint);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.docs-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--color-border);
  letter-spacing: -0.01em;
}

.docs-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.docs-content p {
  margin-bottom: 1rem;
  color: var(--color-text);
}

.docs-content ul,
.docs-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.docs-content li {
  margin-bottom: 0.375rem;
}

.docs-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: rgba(43,108,176,.3);
  text-underline-offset: 2px;
  transition: text-decoration-color .15s;
}

.docs-content a:hover {
  text-decoration-color: var(--color-accent);
}

.docs-content code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--color-border-light);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  color: var(--color-primary);
}

.docs-content pre {
  background: #1e2433;
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm);
}

.docs-content pre code {
  font-size: 0.8125rem;
  background: none;
  border: none;
  padding: 0;
  color: #cbd5e0;
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* ---- Callout boxes ---- */
.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 3px solid;
  font-size: 0.9375rem;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-info {
  background: var(--color-info-bg);
  border-color: var(--color-accent);
  color: var(--color-info);
}

.callout-success {
  background: var(--color-success-bg);
  border-color: #38a169;
  color: var(--color-success);
}

.callout-warning {
  background: var(--color-warning-bg);
  border-color: #d69e2e;
  color: var(--color-warning);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: block;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- Data tables ---- */
.docs-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--color-surface);
}

.docs-table th {
  background: var(--color-border-light);
  font-weight: 600;
  color: var(--color-text);
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--color-border);
}

.docs-table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  vertical-align: top;
}

.docs-table tr:last-child td {
  border-bottom: none;
}

.docs-table tr:hover td {
  background: var(--color-border-light);
}

/* ---- Cards ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.doc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .15s, box-shadow .15s;
}

.doc-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}

.doc-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.doc-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.doc-card p {
  font-size: 0.8125rem;
  color: var(--color-text-faint);
  margin: 0;
}

/* ---- Step list ---- */
.step-list {
  list-style: none;
  padding: 0;
  counter-reset: steps;
}

.step-list li {
  counter-increment: steps;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.step-list li::before {
  content: counter(steps);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}

/* ---- Badge ---- */
.badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
  margin-left: 0.375rem;
}

.badge-blue {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.badge-green {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  color: var(--color-text-faint);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.25rem;
  color: var(--color-border);
}

.breadcrumb a {
  color: var(--color-text-faint);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-accent);
}

/* ---- Footer ---- */
.docs-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text-faint);
  max-width: calc(var(--sidebar-width) + var(--content-max-width) + 6rem);
  margin: 0 auto;
}

.docs-footer a {
  color: var(--color-text-faint);
  text-decoration: none;
  margin: 0 0.625rem;
}

.docs-footer a:hover {
  color: var(--color-accent);
}

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

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .docs-sidebar {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--color-surface);
    width: 100%;
    max-height: none;
    padding: 1.5rem;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
  }

  .docs-sidebar.open {
    display: block;
  }

  .docs-layout {
    display: block;
  }

  .docs-content {
    padding: 1.5rem 1rem 3rem;
  }

  .docs-content h1 {
    font-size: 1.5rem;
  }

  .menu-toggle {
    display: block;
  }

  .header-nav {
    display: none;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .docs-footer {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}
