/* Apple Developer Documentation Design System */
:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0c;
  --surface: #161617;
  --surface-hover: #1f1f22;
  --surface-border: #2c2c2e;
  --surface-glass: rgba(22, 22, 23, 0.75);
  --text-primary: #f5f5f7;
  --text-secondary: #86868b;
  --text-tertiary: #6e6e73;
  --accent: #2997ff;
  --accent-glow: rgba(41, 151, 255, 0.15);
  --accent-purple: #bf5af2;
  --accent-green: #30d158;
  --accent-orange: #ff9f0a;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header & Frosted Navigation */
.apple-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--surface-border);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.sg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #2c2c30 0%, #161618 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.brand-badge:hover .sg-icon {
  transform: scale(1.05);
  border-color: var(--accent);
}

.brand-name {
  font-weight: 600;
  font-size: 0.925rem;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.nav-separator {
  color: var(--text-tertiary);
  font-weight: 300;
}

.doc-title {
  font-size: 0.875rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(41, 151, 255, 0.25);
}

.nav-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 3px;
  gap: 4px;
}

.nav-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.github-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.github-link:hover {
  color: #ffffff;
  background: var(--surface-hover);
}

/* Documentation Layout */
.doc-container {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
}

/* Sidebar */
.doc-sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--surface-border);
  padding: 2rem 1.25rem;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  flex-shrink: 0;
}

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

.sidebar-title {
  font-size: 0.725rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 0.6rem;
  padding-left: 0.5rem;
}

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

.sidebar-link {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s ease;
  font-weight: 400;
}

.sidebar-link:hover {
  color: #ffffff;
  background: var(--surface-hover);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 500;
}

/* Main Content */
.doc-content {
  flex: 1;
  max-width: 900px;
  padding: 3rem 4rem;
  margin: 0 auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Apple Topic Header */
.topic-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 2rem;
}

.topic-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.topic-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 1rem;
}

.topic-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Sections & Typography */
h2 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #ffffff;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

p {
  color: #c7c7cc;
  font-size: 0.975rem;
  margin-bottom: 1.25rem;
  line-height: 1.65;
}

ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: #c7c7cc;
}

li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

/* Code Blocks with macOS traffic lights */
.code-window {
  background: #111113;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.code-header {
  background: #18181b;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface-border);
}

.traffic-lights {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.code-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
}

.copy-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

pre {
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: #e5e5ea;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #70baff;
}

/* Callout Banners */
.callout {
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid transparent;
  display: flex;
  gap: 1rem;
}

.callout.note {
  background: rgba(41, 151, 255, 0.08);
  border-color: rgba(41, 151, 255, 0.2);
}

.callout.tip {
  background: rgba(48, 209, 88, 0.08);
  border-color: rgba(48, 209, 88, 0.2);
}

.callout.important {
  background: rgba(255, 159, 10, 0.08);
  border-color: rgba(255, 159, 10, 0.2);
}

.callout-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.callout-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #ffffff;
}

.callout-content p {
  margin-bottom: 0;
  font-size: 0.875rem;
  color: #d1d1d6;
}

/* Apple Parameter Tables */
.apple-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: #111113;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

.apple-table th {
  background: #18181b;
  text-align: left;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--surface-border);
}

.apple-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
  font-size: 0.875rem;
  color: #c7c7cc;
}

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

/* FAQ Accordion */
.faq-item {
  border: 1px solid var(--surface-border);
  background: #111113;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: all 0.2s ease;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #ffffff;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-chevron {
  transition: transform 0.2s ease;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1.25rem 1.25rem;
  color: #a1a1a6;
  font-size: 0.9rem;
  line-height: 1.6;
}

.faq-item.open .faq-answer {
  display: block;
}

/* Footer */
footer {
  border-top: 1px solid var(--surface-border);
  padding: 3rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .doc-sidebar {
    display: none;
  }
  .doc-content {
    padding: 2rem 1.5rem;
  }
}
