/*
Theme Name: Bilge News
Theme URI: https://ahiskagazetesi.com/themes/bilge-news
Author: DATUB ADES / Bilge Digital Media
Author URI: https://ahiskagazetesi.com
Description: A modern, high-performance, multi-language digital newspaper WordPress theme engineered for PHP 8.3+, zero jQuery dependency, and full Cyrillic & Latin-Extended typography (Turkish, Russian, Kazakh, and Azerbaijani). Built with a first-class hook architecture for BILGE Subs, BILGE Ads, and BILGE SEO plugins.
Version: 1.0.1
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.3
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bilge-news
Domain Path: /languages
Tags: news, newspaper, editorial, multi-language, dark-mode, accessibility-ready, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ==========================================================================
   1. CORE DESIGN TOKENS — "CLASSIC & INSTITUTIONAL NEWS PORTAL"
   ========================================================================== */

:root {
	color-scheme: light;

	/* --- Institutional Brand & Accent Colors (Light Mode) --- */
	--bilge-color-brand: #0F2537;            /* Primary Brand: Deep Navy */
	--bilge-color-brand-hover: #16354F;
	--bilge-color-brand-soft: #E8EEF3;
	--bilge-color-navy-dark: #091724;        /* Deepest Navy for Footer Bottom / Sub-bars */

	--bilge-color-accent: #C8102E;           /* Breaking / Editorial Red */
	--bilge-color-accent-hover: #A50D26;
	--bilge-color-accent-soft: #FDE8EC;
	--bilge-color-breaking: #C8102E;

	/* --- Surface & Background Palette --- */
	--bilge-bg-body: #FFFFFF;
	--bilge-bg-primary: #FFFFFF;             /* Background Primary */
	--bilge-bg-secondary: #F4F6F8;           /* Background Secondary (Cards/Meta) */
	--bilge-bg-tertiary: #E9EDF2;
	--bilge-bg-elevated: #FFFFFF;
	--bilge-bg-inverse: #0F2537;
	--bilge-bg-glass: rgba(255, 255, 255, 0.94);
	--bilge-bg-ad-slot: #F4F6F8;

	/* --- Ink & Typography Hierarchy --- */
	--bilge-text-primary: #1A1D20;           /* Text Primary */
	--bilge-text-secondary: #333B42;
	--bilge-text-muted: #5A6570;             /* Text Muted */
	--bilge-text-subtle: #7B8794;
	--bilge-text-inverse: #FFFFFF;
	--bilge-text-inverse-muted: #B8C4CE;

	/* --- Editorial Hairlines & Borders --- */
	--bilge-border-subtle: #E1E5EA;          /* Border Subtle */
	--bilge-border-default: #CBD2D9;
	--bilge-border-strong: #0F2537;
	--bilge-border-accent: #C8102E;

	/* --- Semantic & Status Colors --- */
	--bilge-color-live: #C8102E;
	--bilge-color-success: #15803D;
	--bilge-color-warning: #B45309;
	--bilge-color-danger: #C8102E;
	--bilge-color-info: #0F2537;

	/* --- Typography Families (Full Cyrillic + Latin-Ext Support) --- */
	--bilge-font-serif: "Merriweather", "PT Serif", "Noto Serif", Georgia, "Times New Roman", serif;
	--bilge-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--bilge-font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;

	/* --- Fluid Typography Scale --- */
	--bilge-text-2xs: 0.6875rem;                                      /* 11px - Kickers, Ad labels */
	--bilge-text-xs: 0.75rem;                                         /* 12px - Utility bar, Captions */
	--bilge-text-sm: 0.875rem;                                        /* 14px - Meta, Nav links */
	--bilge-text-base: 1rem;                                          /* 16px - Standard UI / Excerpts */
	--bilge-text-article: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem); /* 17px–19px - Long-form reading */
	--bilge-text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);      /* 18px–20px - Card Titles */
	--bilge-text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);         /* 20px–24px - Secondary Headlines */
	--bilge-text-2xl: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);            /* 24px–32px - Section Leads */
	--bilge-text-3xl: clamp(1.875rem, 1.55rem + 1.4vw, 2.625rem);     /* 30px–42px - Article Headlines */
	--bilge-text-display: clamp(2.25rem, 1.8rem + 2vw, 3.375rem);     /* 36px–54px - Front Page Hero */

	/* --- Line Heights (Tuned for Turkish/Azerbaijani & Russian/Kazakh) --- */
	--bilge-leading-none: 1;
	--bilge-leading-tight: 1.22;
	--bilge-leading-snug: 1.34;
	--bilge-leading-normal: 1.55;
	--bilge-leading-relaxed: 1.75;

	/* --- Letter Spacing --- */
	--bilge-tracking-tighter: -0.02em;
	--bilge-tracking-tight: -0.01em;
	--bilge-tracking-normal: 0em;
	--bilge-tracking-wide: 0.04em;
	--bilge-tracking-wider: 0.08em;

	/* --- Font Weights --- */
	--bilge-weight-regular: 400;
	--bilge-weight-medium: 500;
	--bilge-weight-semibold: 600;
	--bilge-weight-bold: 700;
	--bilge-weight-black: 900;

	/* --- Spatial Scale (4px / 8px Base Grid) --- */
	--bilge-space-0: 0rem;
	--bilge-space-1: 0.25rem;   /* 4px */
	--bilge-space-2: 0.5rem;    /* 8px */
	--bilge-space-3: 0.75rem;   /* 12px */
	--bilge-space-4: 1rem;      /* 16px */
	--bilge-space-5: 1.25rem;   /* 20px */
	--bilge-space-6: 1.5rem;    /* 24px */
	--bilge-space-8: 2rem;      /* 32px */
	--bilge-space-10: 2.5rem;   /* 40px */
	--bilge-space-12: 3rem;     /* 48px */
	--bilge-space-16: 4rem;     /* 64px */
	--bilge-space-20: 5rem;     /* 80px */
	--bilge-space-24: 6rem;     /* 96px */

	/* --- Border Radius Tokens --- */
	--bilge-radius-none: 0px;
	--bilge-radius-xs: 2px;
	--bilge-radius-sm: 4px;
	--bilge-radius-md: 6px;
	--bilge-radius-lg: 10px;
	--bilge-radius-xl: 14px;
	--bilge-radius-full: 9999px;

	/* --- Layout & Container Tokens --- */
	--bilge-container-max: 1320px;
	--bilge-container-wide: 1440px;
	--bilge-article-max: 740px;
	--bilge-gutter: clamp(1rem, 2.5vw, 2rem);
	--bilge-grid-gap: var(--bilge-space-6);

	/* --- Elevation & Shadows --- */
	--bilge-shadow-xs: 0 1px 2px 0 rgba(15, 37, 55, 0.05);
	--bilge-shadow-sm: 0 2px 6px -1px rgba(15, 37, 55, 0.08), 0 1px 3px -1px rgba(15, 37, 55, 0.04);
	--bilge-shadow-md: 0 8px 20px -4px rgba(15, 37, 55, 0.12), 0 4px 8px -2px rgba(15, 37, 55, 0.05);
	--bilge-shadow-lg: 0 16px 32px -6px rgba(15, 37, 55, 0.18), 0 6px 12px -3px rgba(15, 37, 55, 0.08);

	/* --- Motion & Transitions --- */
	--bilge-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
	--bilge-transition-fast: 150ms var(--bilge-ease-out);
	--bilge-transition-base: 250ms var(--bilge-ease-out);

	/* --- Z-Index Scale --- */
	--bilge-z-base: 1;
	--bilge-z-sticky: 100;
	--bilge-z-header: 200;
	--bilge-z-drawer: 300;
	--bilge-z-modal: 400;
	--bilge-z-toast: 500;
}

/* ==========================================================================
   2. DARK MODE OVERRIDES (`[data-theme="dark"]` & System Preference)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;

		--bilge-bg-body: #0D1117;
		--bilge-bg-primary: #0D1117;
		--bilge-bg-secondary: #161B22;
		--bilge-bg-tertiary: #21262D;
		--bilge-bg-elevated: #161B22;
		--bilge-bg-inverse: #091724;
		--bilge-bg-glass: rgba(13, 17, 23, 0.92);
		--bilge-bg-ad-slot: #161B22;

		--bilge-text-primary: #E6EDF3;
		--bilge-text-secondary: #C9D1D9;
		--bilge-text-muted: #8B949E;
		--bilge-text-subtle: #6E7681;
		--bilge-text-inverse: #E6EDF3;
		--bilge-text-inverse-muted: #8B949E;

		--bilge-color-brand: #3B82F6;
		--bilge-color-brand-hover: #60A5FA;
		--bilge-color-brand-soft: rgba(59, 130, 246, 0.15);

		--bilge-color-accent: #EF4444;
		--bilge-color-accent-hover: #F87171;
		--bilge-color-accent-soft: rgba(239, 68, 68, 0.16);
		--bilge-color-breaking: #EF4444;

		--bilge-border-subtle: #21262D;
		--bilge-border-default: #30363D;
		--bilge-border-strong: #E6EDF3;
		--bilge-border-accent: #EF4444;

		--bilge-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
		--bilge-shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.5);
		--bilge-shadow-md: 0 8px 20px -4px rgba(0, 0, 0, 0.6);
		--bilge-shadow-lg: 0 16px 32px -6px rgba(0, 0, 0, 0.7);
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;

	--bilge-bg-body: #0D1117;
	--bilge-bg-primary: #0D1117;
	--bilge-bg-secondary: #161B22;
	--bilge-bg-tertiary: #21262D;
	--bilge-bg-elevated: #161B22;
	--bilge-bg-inverse: #091724;
	--bilge-bg-glass: rgba(13, 17, 23, 0.92);
	--bilge-bg-ad-slot: #161B22;

	--bilge-text-primary: #E6EDF3;
	--bilge-text-secondary: #C9D1D9;
	--bilge-text-muted: #8B949E;
	--bilge-text-subtle: #6E7681;
	--bilge-text-inverse: #E6EDF3;
	--bilge-text-inverse-muted: #8B949E;

	--bilge-color-brand: #3B82F6;
	--bilge-color-brand-hover: #60A5FA;
	--bilge-color-brand-soft: rgba(59, 130, 246, 0.15);

	--bilge-color-accent: #EF4444;
	--bilge-color-accent-hover: #F87171;
	--bilge-color-accent-soft: rgba(239, 68, 68, 0.16);
	--bilge-color-breaking: #EF4444;

	--bilge-border-subtle: #21262D;
	--bilge-border-default: #30363D;
	--bilge-border-strong: #E6EDF3;
	--bilge-border-accent: #EF4444;

	--bilge-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
	--bilge-shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.5);
	--bilge-shadow-md: 0 8px 20px -4px rgba(0, 0, 0, 0.6);
	--bilge-shadow-lg: 0 16px 32px -6px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   3. BASE RESET & MULTI-SCRIPT TYPOGRAPHY NORMALIZATION
   ========================================================================== */

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

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

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

body {
	margin: 0;
	background-color: var(--bilge-bg-body);
	color: var(--bilge-text-primary);
	font-family: var(--bilge-font-sans);
	font-size: var(--bilge-text-base);
	line-height: var(--bilge-leading-normal);
	font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

body.bilge-nav-open {
	overflow: hidden;
}

/* Multi-Script Language Optimizations:
   Russian (ru) and Kazakh (kk) Cyrillic strings average 15-25% wider than Latin;
   Turkish (tr) and Azerbaijani (az) have tall uppercase diacritics (İ, Ğ, Ş, Ə). */
:lang(ru),
:lang(kk) {
	--bilge-leading-tight: 1.28;
	--bilge-leading-snug: 1.38;
	overflow-wrap: break-word;
	word-break: normal;
}

:lang(tr),
:lang(az) {
	--bilge-leading-tight: 1.25;
	font-synthesis: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin-top: 0;
	margin-bottom: var(--bilge-space-3);
	font-family: var(--bilge-font-serif);
	font-weight: var(--bilge-weight-bold);
	line-height: var(--bilge-leading-tight);
	letter-spacing: var(--bilge-tracking-tight);
	color: var(--bilge-text-primary);
	text-wrap: balance;
}

p {
	margin-top: 0;
	margin-bottom: var(--bilge-space-4);
}

a {
	color: inherit;
	text-decoration-color: var(--bilge-border-default);
	text-underline-offset: 0.2em;
	transition: color var(--bilge-transition-fast), text-decoration-color var(--bilge-transition-fast);
}

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

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

time,
.bilge-tabular-nums {
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   4. ACCESSIBILITY, LAYOUT PRIMITIVES & ECOSYSTEM HOOK CONTAINERS
   ========================================================================== */

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--bilge-bg-elevated);
	border-radius: var(--bilge-radius-sm);
	box-shadow: var(--bilge-shadow-md);
	clip: auto !important;
	clip-path: none;
	color: var(--bilge-color-accent);
	display: block;
	font-size: var(--bilge-text-sm);
	font-weight: var(--bilge-weight-bold);
	height: auto;
	left: var(--bilge-space-4);
	line-height: normal;
	padding: var(--bilge-space-3) var(--bilge-space-4);
	text-decoration: none;
	top: var(--bilge-space-4);
	width: auto;
	z-index: var(--bilge-z-toast);
}

:focus-visible {
	outline: 2px solid var(--bilge-color-accent);
	outline-offset: 2px;
}

.bilge-container {
	width: 100%;
	max-width: var(--bilge-container-max);
	margin-inline: auto;
	padding-inline: var(--bilge-gutter);
}

.bilge-article-body {
	max-width: var(--bilge-article-max);
	margin-inline: auto;
	font-family: var(--bilge-font-serif);
	font-size: var(--bilge-text-article);
	line-height: var(--bilge-leading-relaxed);
}

/* Ecosystem Hook Wrappers (BILGE Ads & BILGE Subs) */
.bilge-ad-slot {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin-block: var(--bilge-space-6);
	padding: var(--bilge-space-3);
	background-color: var(--bilge-bg-ad-slot);
	border: 1px solid var(--bilge-border-subtle);
	border-radius: var(--bilge-radius-xs);
	min-height: 90px;
}

.bilge-ad-slot__label {
	font-family: var(--bilge-font-sans);
	font-size: var(--bilge-text-2xs);
	text-transform: uppercase;
	letter-spacing: var(--bilge-tracking-wider);
	color: var(--bilge-text-muted);
	margin-bottom: var(--bilge-space-1);
}

.bilge-paywall-gate {
	position: relative;
	margin-block: var(--bilge-space-8);
	padding: var(--bilge-space-8) var(--bilge-space-6);
	background: linear-gradient(180deg, transparent 0%, var(--bilge-bg-secondary) 28%);
	border-top: 2px solid var(--bilge-color-accent);
	border-radius: var(--bilge-radius-md);
	text-align: center;
}
