/* ==========================================================================
   BASE — Sıfırlama ve tipografi
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color var(--tr), color var(--tr);
}

img, svg, video { max-width: 100%; height: auto; display: block; }
svg { display: inline-block; }

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

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.2rem 0;
}

/* Başlıklara çapa ile atlarken üst barın altında kalmasın */
:target { scroll-margin-top: calc(var(--header-h) + 16px); }

/* Gizleme yardımcıları */
.muted  { color: var(--text-muted); }
.faint  { color: var(--text-faint); }
.small  { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 999;
    background: var(--primary); color: var(--primary-contrast);
    padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   İçerik tipografisi (.doc-content)
   ========================================================================== */

.doc-content {
    max-width: var(--content-max);
    /* Güvenlik ağı: uzun kesintisiz metin/kod parçaları sütundan taşmasın. */
    overflow-wrap: break-word;
}

.doc-content > *:first-child { margin-top: 0; }

.doc-content h1 {
    font-size: 2rem;
    line-height: 1.25;
    letter-spacing: -.02em;
    margin: 0 0 1.2rem;
    font-weight: 700;
}

.doc-content h2 {
    font-size: 1.42rem;
    line-height: 1.3;
    letter-spacing: -.01em;
    font-weight: 700;
    margin: 2.8rem 0 1rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border);
}

.doc-content h3 {
    font-size: 1.12rem;
    font-weight: 700;
    margin: 2rem 0 .7rem;
}

.doc-content h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 .5rem;
    color: var(--text-muted);
}

.doc-content p { margin: 0 0 1.05rem; }

.doc-content strong { font-weight: 650; }

.doc-content ul,
.doc-content ol { margin: 0 0 1.1rem; padding-left: 1.45rem; }
.doc-content li { margin-bottom: .4rem; }
.doc-content li > ul,
.doc-content li > ol { margin-top: .4rem; }

/* İçerik içi bağlantılar: varsayılan olarak altı çizili DEĞİL (sitenin geri kalanıyla
   tutarlı), üzerine gelince çizilir. Böylece kart/buton gibi blok bağlantıların tüm
   metni çizgi altında kalmaz ve metin akışı bozulmaz. */
.doc-content a {
    text-decoration: none;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    text-decoration-color: currentColor;
}
.doc-content a:hover { text-decoration: underline; }

/* Blok hâlindeki bağlantılar (kart, buton, sayfalama) hiç çizilmesin. */
.doc-content a.doc-card,
.doc-content a.btn,
.doc-content a.pager__link { text-decoration: none; }

.doc-content blockquote {
    margin: 1.4rem 0;
    padding: .9rem 1.1rem;
    border-left: 3px solid var(--primary);
    background: var(--primary-softer);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-muted);
}
.doc-content blockquote > *:last-child { margin-bottom: 0; }

/* Tablo */
.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
    font-size: var(--fs-sm);
}
.doc-content th,
.doc-content td {
    border: 1px solid var(--border);
    padding: .62rem .78rem;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}
.doc-content thead th {
    background: var(--surface-2);
    font-weight: 650;
    white-space: normal;
}
.doc-content tbody tr:nth-child(even) { background: var(--surface-2); }

/* Satır içi kod */
.doc-content :not(pre) > code {
    font-family: var(--font-mono);
    font-size: .87em;
    background: var(--code-inline-bg);
    color: var(--code-inline-fg);
    padding: .12em .38em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    /* Uzun kod parçaları (ör. $user_group[...]['admin_blockip']) kutudan taşmasın.
       "anywhere" kısa kod parçalarını bölmez; yalnızca sığmayınca kırar. */
    overflow-wrap: anywhere;
}
