/* ============================================================
   EVAS Docs — Apple Developer Documentation style
   ============================================================ */

/* ---------- Fonts ---------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    font-size: 17px;
    line-height: 1.47059;
}

/* ---------- Light mode ---------- */
:root, [data-theme="light"] {
    --color-brand-primary:        #0071e3;
    --color-brand-content:        #0071e3;
    --color-background-primary:   #ffffff;
    --color-background-secondary: #f5f5f7;
    --color-background-hover:     #e8e8ed;
    --color-foreground-primary:   #1d1d1f;
    --color-foreground-secondary: #6e6e73;
    --color-sidebar-background:   #f5f5f7;
    --color-sidebar-link-text:    #1d1d1f;
    --color-api-name:             #0071e3;
    --color-api-pre-name:         #6e6e73;
    --color-highlight-on-target:  rgba(0, 113, 227, 0.08);
    --color-announcement-background: #f5f5f7;
    --color-announcement-text:    #1d1d1f;
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
    --color-brand-primary:        #2997ff;
    --color-brand-content:        #2997ff;
    --color-background-primary:   #1d1d1f;
    --color-background-secondary: #2c2c2e;
    --color-background-hover:     #3a3a3c;
    --color-foreground-primary:   #f5f5f7;
    --color-foreground-secondary: #a1a1a6;
    --color-sidebar-background:   #242426;
    --color-sidebar-link-text:    #f5f5f7;
    --color-api-name:             #2997ff;
    --color-api-pre-name:         #a1a1a6;
    --color-highlight-on-target:  rgba(41, 151, 255, 0.12);
    --color-announcement-background: #2c2c2e;
    --color-announcement-text:    #f5f5f7;
}

/* ---------- Typography ---------- */
h1 {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.003em;
    line-height: 1.07143;
    color: var(--color-foreground-primary);
    margin-bottom: 0.6em;
}
h2 {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.003em;
    line-height: 1.2;
    margin-top: 1.6em;
}
h3 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-top: 1.4em;
}
h4, h5 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}
p { line-height: 1.6; margin-bottom: 0.9em; }
li { line-height: 1.6; }

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

/* ---------- Sidebar ---------- */
.sidebar-brand {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
                 "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.015em;
}
.sidebar-tree .reference {
    border-radius: 6px;
    font-size: 0.94rem;
    padding: 0.3rem 0.65rem;
    transition: background 0.1s;
}
.sidebar-tree .current-page > .reference {
    background: rgba(0, 113, 227, 0.1);
    color: var(--color-brand-primary);
    font-weight: 600;
}
[data-theme="dark"] .sidebar-tree .current-page > .reference {
    background: rgba(41, 151, 255, 0.15);
}
.sidebar-tree .reference:hover {
    background: var(--color-background-hover);
}

/* ---------- Code ---------- */
pre, code {
    font-family: "SF Mono", ui-monospace, "Menlo", "Monaco",
                 "Courier New", monospace;
    font-size: 0.875em;
}
pre {
    border-radius: 12px;
    padding: 1.1rem 1.3rem;
    background: var(--color-background-secondary);
    border: none;
    box-shadow: none;
}
[data-theme="dark"] pre {
    background: #111113;
}
code.literal {
    background: var(--color-background-secondary);
    border-radius: 6px;
    padding: 0.15em 0.45em;
    font-size: 0.9em;
}

/* ---------- Tables ---------- */
table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.94rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
[data-theme="dark"] table {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
thead tr { background: var(--color-background-secondary); }
th {
    font-weight: 600;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-foreground-secondary);
    text-align: left;
}
td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--color-background-secondary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-background-secondary); }

/* ---------- Admonitions ---------- */
.admonition {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
    background: var(--color-background-secondary);
}
.admonition.note    { background: rgba(0, 113, 227, 0.07); }
.admonition.warning { background: rgba(255, 159, 10, 0.09); }
.admonition.danger  { background: rgba(255, 69, 58, 0.08); }
.admonition.tip     { background: rgba(48, 209, 88, 0.08); }
.admonition-title {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4em;
}

/* ---------- Announcement bar ---------- */
.announcement { font-size: 0.85rem; font-weight: 500; }
.announcement a { font-weight: 600; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
}

/* ---------- Selection ---------- */
::selection { background: rgba(0, 113, 227, 0.2); }

/* ---------- Language switcher ---------- */
.lang-switch {
    display: inline-block;
    padding: 3px 12px;
    border: 1px solid currentColor;
    border-radius: 20px;
    font-size: 0.83em;
    font-weight: 500;
    text-decoration: none;
    opacity: 0.75;
}
.lang-switch:hover { opacity: 1; text-decoration: none; }
