/* Apple-inspired design tokens (getdesign.md/apple) */
:root {
  --primary: #0066cc;
  --primary-hover: #0071e3;
  --primary-on-dark: #2997ff;
  --ink: #1d1d1f;
  --ink-muted: #86868b;
  --ink-muted-48: #6e6e73;
  --canvas: #ffffff;
  --canvas-parchment: #f5f5f7;
  --surface-pearl: #fafafc;
  --hairline: #d2d2d7;
  --divider-soft: #f0f0f0;
  --sidebar-width: 280px;
  --content-max: 980px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 980px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas-parchment);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

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

.site {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--hairline);
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.5rem;
}

.sidebar-brand:hover {
  text-decoration: none;
  color: var(--ink);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: var(--ink);
  color: var(--canvas);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar-brand strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-brand small {
  display: block;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--ink-muted-48);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
  text-decoration: none;
}

.nav-link.active {
  background: rgba(0, 102, 204, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 0.75rem 0;
  border-top: 1px solid var(--divider-soft);
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: auto;
}

.sidebar-resources-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  padding: 0 0.85rem 0.25rem;
}

.sidebar-footer a {
  color: var(--ink-muted-48);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
}

.sidebar-footer a:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  flex: 1;
  max-width: var(--content-max);
  padding: 3rem 3.5rem 4rem;
  width: 100%;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 0;
  border-bottom: none;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.page-lead {
  margin: 0;
  color: var(--ink-muted-48);
  font-size: 1.125rem;
  line-height: 1.5;
  font-weight: 400;
}

.content h1 {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-top: 0;
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  padding-bottom: 0;
  border-bottom: none;
}

.content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.75rem;
  letter-spacing: -0.01em;
}

.content p,
.content li {
  color: var(--ink);
}

.content strong {
  color: var(--ink);
  font-weight: 600;
}

.content pre {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.content code {
  background: var(--surface-pearl);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.875em;
}

.content pre code {
  background: none;
  padding: 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9375rem;
}

.content th,
.content td {
  border: none;
  border-bottom: 1px solid var(--divider-soft);
  padding: 0.85rem 1rem;
  text-align: left;
}

.content th {
  background: transparent;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.25rem 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--canvas);
}

.table-scroll table {
  margin: 0;
  min-width: 100%;
}

.content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: none;
  border-radius: var(--radius-md);
  background: var(--canvas);
  color: var(--ink-muted-48);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.content hr {
  border: none;
  border-top: 1px solid var(--divider-soft);
  margin: 2.5rem 0;
}

.content ul,
.content ol {
  padding-left: 1.35rem;
}

.hero-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 102, 204, 0.1);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.hero {
  margin: 0 0 2rem;
}

.content .banner {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: none;
  display: block;
  margin: 0 0 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.hero-badges a {
  line-height: 0;
  text-decoration: none;
}

.hero-badges img {
  display: block;
  height: 22px;
  width: auto;
}

.hero-lead {
  text-align: center;
  color: var(--ink-muted-48);
  font-size: 1.0625rem;
  line-height: 1.5;
  margin: 0 0 0.75rem;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-lead a {
  color: var(--primary);
}

.quick-links {
  text-align: center;
  margin: 1.5rem 0 2rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.quick-links a {
  margin: 0 0.2rem;
}

.site-footer {
  max-width: var(--content-max);
  padding: 1.5rem 3.5rem 3rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
  letter-spacing: -0.01em;
}

.site-footer p {
  margin: 0;
}

.mobile-header { display: none; }
.sidebar-overlay { display: none; }

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--canvas);
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

body.nav-open .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

body.nav-open .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hairline);
    z-index: 150;
  }

  .mobile-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 180;
  }

  body.nav-open .sidebar-overlay {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    width: min(300px, 88vw);
    z-index: 200;
    background: rgba(255, 255, 255, 0.95);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding-top: 56px;
    width: 100%;
  }

  .content {
    padding: 1.5rem 1.25rem 2.5rem;
    max-width: 100%;
  }

  .content h1,
  .page-header h1 {
    font-size: 1.75rem;
  }

  .site-footer {
    padding: 1rem 1.25rem 2rem;
    max-width: 100%;
  }

  .hero-badges img {
    height: 20px;
  }

  .content .banner {
    border-radius: var(--radius-md);
  }

  .table-scroll th,
  .table-scroll td {
    min-width: 100px;
    font-size: 0.85rem;
    padding: 0.65rem 0.75rem;
  }
}

.lang-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.75rem 1rem;
}

.lang-switcher a {
  font-size: 12px;
  line-height: 1.2;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  text-decoration: none;
  color: var(--ink-muted-48);
  background: var(--canvas);
}

.lang-switcher a:hover,
.lang-switcher a.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0, 102, 204, 0.06);
  text-decoration: none;
}

.mobile-lang-switcher {
  display: none;
}

.lang-picker {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.lang-picker-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.lang-picker-links a {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--canvas);
  font-weight: 500;
}

@media (max-width: 900px) {
  .sidebar .lang-switcher {
    display: none;
  }

  .mobile-lang-switcher {
    display: block;
    margin-left: auto;
    padding-right: 0.5rem;
  }

  .mobile-lang-switcher .lang-switcher {
    padding: 0;
  }

  .mobile-lang-switcher .lang-switcher a {
    font-size: 11px;
    padding: 0.2rem 0.45rem;
  }
}
