:root {
  color-scheme: light dark;
  --accent: #df3139;
  --accent-soft: rgba(223, 49, 57, 0.11);
  --success: #35ad74;
  --success-soft: rgba(53, 173, 116, 0.12);
  --bg: #f6f5f2;
  --bg-elevated: rgba(255, 255, 255, 0.82);
  --surface: #ffffff;
  --surface-muted: #eeece8;
  --text: #17181b;
  --text-secondary: #5e6068;
  --text-tertiary: #85878e;
  --line: rgba(23, 24, 27, 0.10);
  --code-bg: #1a1b20;
  --code-text: #f3f3f4;
  --shadow: 0 18px 50px rgba(32, 25, 27, 0.08);
  --radius-large: 24px;
  --radius-medium: 16px;
  --page: min(1180px, calc(100vw - 40px));
  --article: 800px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d10;
    --bg-elevated: rgba(18, 19, 23, 0.82);
    --surface: #15161a;
    --surface-muted: #1d1f24;
    --text: #f4f4f5;
    --text-secondary: #b8bac1;
    --text-tertiary: #858791;
    --line: rgba(255, 255, 255, 0.09);
    --code-bg: #090a0c;
    --code-text: #f3f3f4;
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -8%, rgba(223, 49, 57, 0.12), transparent 32rem),
    radial-gradient(circle at 92% 16%, rgba(53, 173, 116, 0.07), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 58%, transparent);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

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

a:focus-visible,
button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 4px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
  backdrop-filter: saturate(160%) blur(22px);
  -webkit-backdrop-filter: saturate(160%) blur(22px);
}

.header-inner {
  width: var(--page);
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.015em;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(223, 49, 57, 0.18);
}

.header-actions,
.document-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link,
.language-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.nav-link:hover,
.nav-link[aria-current="page"],
.language-link:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.language-link {
  margin-left: 8px;
  border: 1px solid var(--line);
}

.language-picker {
  position: relative;
  flex: 0 0 auto;
}

.language-picker::after {
  content: "⌄";
  position: absolute;
  right: 13px;
  top: 50%;
  color: var(--text-tertiary);
  pointer-events: none;
  transform: translateY(-56%);
}

.language-picker select {
  min-height: 40px;
  max-width: 190px;
  padding: 8px 34px 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.language-picker select:hover { color: var(--text); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[dir="rtl"] .language-picker::after { right: auto; left: 13px; }
[dir="rtl"] .language-picker select { padding: 8px 13px 8px 34px; }
[dir="rtl"] .article,
[dir="rtl"] th,
[dir="rtl"] td { text-align: right; }
[dir="rtl"] pre,
[dir="rtl"] code { direction: ltr; text-align: left; }

.hero {
  width: var(--page);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 128px) 0 68px;
}

.hero-mark {
  width: 84px;
  height: 84px;
  margin-bottom: 28px;
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(223, 49, 57, 0.22);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.18;
  letter-spacing: -0.032em;
}

.hero h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(44px, 7vw, 76px);
}

.hero-copy {
  max-width: 720px;
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.55;
}

.document-cards {
  width: var(--page);
  margin: 0 auto;
  padding-bottom: 100px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.locale-hero { padding-bottom: 42px; }

.locale-grid {
  width: var(--page);
  margin: 0 auto;
  padding-bottom: 100px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.locale-grid a {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 700;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease;
}

.locale-grid a:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  transform: translateY(-2px);
}

.document-card {
  min-height: 230px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.document-card:hover {
  color: var(--text);
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
}

.card-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
}

.document-card h2 {
  margin-bottom: 9px;
  font-size: 24px;
}

.document-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.55;
}

.card-action {
  margin-top: auto;
  padding-top: 24px;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 700;
}

.document-hero {
  width: min(var(--article), calc(100vw - 40px));
  margin: 0 auto;
  padding: clamp(60px, 8vw, 96px) 0 44px;
}

.document-hero h1 {
  margin-bottom: 16px;
  font-size: clamp(38px, 6vw, 60px);
}

.document-summary {
  max-width: 680px;
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1.55;
}

.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.document-layout {
  width: var(--page);
  margin: 0 auto;
  padding-bottom: 110px;
  display: grid;
  grid-template-columns: 220px minmax(0, var(--article));
  justify-content: center;
  gap: 48px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 100px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: var(--bg-elevated);
}

.toc strong {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
}

.toc a {
  display: block;
  padding: 5px 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
}

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

.article {
  min-width: 0;
  padding: clamp(26px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.article h2 {
  margin: 64px 0 18px;
  padding-top: 2px;
  font-size: 29px;
}

.article h2:first-child { margin-top: 0; }

.article h3 {
  margin: 36px 0 12px;
  font-size: 21px;
}

.article p,
.article ul,
.article ol { margin: 0 0 20px; }

.article li + li { margin-top: 7px; }

.article strong { font-weight: 760; }

.callout {
  margin: 26px 0;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--success) 32%, var(--line));
  border-radius: var(--radius-medium);
  background: var(--success-soft);
}

.callout.warning {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--accent-soft);
}

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

.code-wrap {
  position: relative;
  margin: 24px 0;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-medium);
  background: var(--code-bg);
  color: var(--code-text);
  font: 14px/1.62 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  tab-size: 2;
}

.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 56px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #d6d7dc;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.copy-button:hover { background: rgba(255, 255, 255, 0.14); }

.table-scroll {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tr:last-child td { border-bottom: 0; }
th { background: var(--surface-muted); }

code:not(pre code) {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-muted);
  font: 0.88em ui-monospace, SFMono-Regular, Menlo, monospace;
}

.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  width: var(--page);
  min-height: 108px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer-links { display: flex; gap: 18px; }

.footer-links a { text-decoration: none; }

@media (max-width: 860px) {
  .document-nav { display: none; }
  .document-cards { grid-template-columns: 1fr; }
  .document-card { min-height: 190px; }
  .document-layout { display: block; width: min(var(--article), calc(100vw - 28px)); }
  .locale-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc { position: static; margin-bottom: 18px; }
}

@media (max-width: 560px) {
  :root { --page: calc(100vw - 28px); }
  body { font-size: 16px; }
  .header-inner { min-height: 64px; }
  .brand span { display: none; }
  .brand img { width: 36px; height: 36px; }
  .language-link { margin-left: 0; }
  .language-picker select { max-width: 150px; }
  .locale-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 58px; }
  .hero h1 { font-size: 44px; }
  .document-hero { width: calc(100vw - 28px); padding-top: 52px; }
  .document-summary { font-size: 18px; }
  .article { padding: 26px 20px; border-radius: 20px; }
  .article h2 { margin-top: 50px; font-size: 26px; }
  .footer-inner { padding: 26px 0; display: block; }
  .footer-links { margin-top: 10px; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

@media print {
  .site-header,
  .toc,
  .copy-button,
  .site-footer { display: none; }
  body { background: #fff; color: #000; }
  .document-hero,
  .document-layout { width: 100%; padding: 0; }
  .article { padding: 0; border: 0; box-shadow: none; background: #fff; }
  a { color: #000; }
}
