/* ==========================================================================
   3akarat.com — Theme & Layout System
   Mobile-first, responsive, RTL-Arabic, 3-mode theming (light/dark/auto)
   ========================================================================== */

/* ---- Design tokens ---- */
:root {
	/* Brand */
	--c-ink:        #0F2438;   /* deep navy — primary brand */
	--c-ink-soft:   #1B3A56;
	--c-gold:       #C9963E;   /* sand/gold accent — ties to "gold listing" tier */
	--c-gold-soft:  #E4C988;
	--c-silver:     #9AA5B1;

	/* Light surface */
	--bg:           #F7F5F1;
	--bg-raised:    #FFFFFF;
	--bg-sunken:    #EFEBE3;
	--text:         #1C2530;
	--text-muted:   #5B6573;
	--border:       #E2DCCE;
	--shadow:       0 1px 2px rgba(15,36,56,.06), 0 4px 14px rgba(15,36,56,.07);

	/* Listing tiers */
	--tier-gold-bg:   #FFF7E6;
	--tier-gold-bd:   #E8C064;
	--tier-silver-bg: #F1F2F3;
	--tier-silver-bd: #C7CCD1;
	--tier-free-bg:   var(--bg-raised);
	--tier-free-bd:   var(--border);

	--radius-sm: 8px;
	--radius-md: 14px;
	--radius-lg: 22px;

	--font-display: "Plus Jakarta Sans", "Noto Kufi Arabic", "Tahoma", sans-serif;
	--font-body: "Noto Kufi Arabic", "Cairo", "Tahoma", "Segoe UI", sans-serif;

	--header-h: 64px;
	color-scheme: light;
}

html[data-theme="dark"] {
	--c-ink:        #0B1420;
	--c-ink-soft:   #16263A;
	--c-gold:       #E0AC52;
	--c-gold-soft:  #8A6A2E;
	--c-silver:     #7C8794;

	--bg:           #0E1620;
	--bg-raised:    #16212E;
	--bg-sunken:    #0A111A;
	--text:         #E7E5E0;
	--text-muted:   #9AA4B0;
	--border:       #243245;
	--shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);

	--tier-gold-bg:   #261F0F;
	--tier-gold-bd:   #6B5526;
	--tier-silver-bg: #1B232C;
	--tier-silver-bd: #364150;
	--tier-free-bg:   var(--bg-raised);
	--tier-free-bd:   var(--border);
	color-scheme: dark;
}

/* Auto mode: when no explicit theme chosen, follow OS preference */
@media (prefers-color-scheme: dark) {
	html[data-theme="auto"] {
		--c-ink:        #0B1420;
		--c-ink-soft:   #16263A;
		--c-gold:       #E0AC52;
		--c-gold-soft:  #8A6A2E;
		--c-silver:     #7C8794;

		--bg:           #0E1620;
		--bg-raised:    #16212E;
		--bg-sunken:    #0A111A;
		--text:         #E7E5E0;
		--text-muted:   #9AA4B0;
		--border:       #243245;
		--shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);

		--tier-gold-bg:   #261F0F;
		--tier-gold-bd:   #6B5526;
		--tier-silver-bg: #1B232C;
		--tier-silver-bd: #364150;
		color-scheme: dark;
	}
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
	font-family: var(--font-body);
	font-size: 15px;
	line-height: 1.7;
	color: var(--text);
	background: var(--bg);
	direction: rtl;
	transition: background-color .25s ease, color .25s ease;
	min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a {
	color: var(--c-ink-soft);
	text-decoration: none;
}
html[data-theme="dark"] a,
html[data-theme="auto"] a { color: var(--c-gold-soft); }
@media (prefers-color-scheme: dark) {
	html[data-theme="auto"] a { color: var(--c-gold-soft); }
}

a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
	outline: 2px solid var(--c-gold);
	outline-offset: 2px;
	border-radius: 4px;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--text); font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; margin-bottom: .75em; }
h3 { font-size: .95rem; }
p, ul, ol { margin-bottom: 1em; }
ul, ol { list-style: none; }

/* ---- Skip link (a11y) ---- */
.skip-link {
	position: absolute; right: -9999px; top: 0;
	background: var(--c-gold); color: var(--c-ink); padding: .6em 1em; z-index: 200;
}
.skip-link:focus { right: 1em; top: 1em; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
	background: linear-gradient(135deg, var(--c-ink) 0%, var(--c-ink-soft) 100%);
	color: #fff;
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: var(--shadow);
}

.site-header__bar {
	max-width: 1180px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0 1rem;
	height: var(--header-h);
}

.brand {
	display: flex;
	align-items: center;
	gap: .6rem;
	color: #fff;
	font-family: var(--font-display);
}

.brand__mark {
	width: 38px; height: 38px;
	border-radius: var(--radius-sm);
	background: var(--c-gold);
	color: var(--c-ink);
	display: flex; align-items: center; justify-content: center;
	font-weight: 800;
	font-size: 1.05rem;
	flex-shrink: 0;
}

.brand__text h1 {
	font-size: 1.15rem;
	color: #fff;
	margin: 0;
	line-height: 1.15;
}
.brand__text p {
	font-size: .68rem;
	color: rgba(255,255,255,.7);
	margin: 0;
	font-family: var(--font-body);
}

.site-header__actions { display: flex; align-items: center; gap: .5rem; }

/* Hamburger (mobile nav toggle) */
.nav-toggle {
	display: none;
	width: 40px; height: 40px;
	border-radius: var(--radius-sm);
	background: rgba(255,255,255,.08);
	border: 1px solid rgba(255,255,255,.15);
	color: #fff;
	align-items: center; justify-content: center;
	cursor: pointer;
}

/* ==========================================================================
   Theme toggle — icon only, 3-way segmented control
   ========================================================================== */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	background: rgba(255,255,255,.08);
	border: 1px solid rgba(255,255,255,.18);
	border-radius: 999px;
	padding: 3px;
	gap: 2px;
}

.theme-toggle__btn {
	width: 34px; height: 34px;
	display: flex; align-items: center; justify-content: center;
	border-radius: 999px;
	border: none;
	background: transparent;
	color: rgba(255,255,255,.65);
	cursor: pointer;
	transition: background-color .2s, color .2s, transform .15s;
}

.theme-toggle__btn:hover { color: #fff; transform: translateY(-1px); }

.theme-toggle__btn[aria-pressed="true"] {
	background: var(--c-gold);
	color: var(--c-ink);
}

.theme-toggle__btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   Layout grid
   ========================================================================== */
.layout {
	max-width: 1180px;
	margin: 0 auto;
	padding: 1rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

@media (min-width: 880px) {
	.layout {
		grid-template-columns: 200px minmax(0,1fr) 220px;
		align-items: start;
		padding: 1.5rem 1rem;
	}
	/* RTL: visual order right→left = right-sidebar, center, left-sidebar */
	.col-left   { order: 3; }
	.col-center { order: 2; }
	.col-right  { order: 1; }
}

.panel {
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1.1rem;
	box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 1rem; }

.panel h2 {
	font-size: .85rem;
	text-transform: uppercase;
	letter-spacing: .03em;
	border-right: 3px solid var(--c-gold);
	padding-right: .6rem;
	margin-bottom: .8rem;
}

.panel ul { line-height: 1.4; }
.panel li {
	padding: .45em 0;
	border-bottom: 1px dashed var(--border);
	font-size: .88rem;
}
.panel li:last-child { border-bottom: none; }
.panel a { color: var(--text); }
.panel a:hover { color: var(--c-gold); text-decoration: none; }

/* Collapsible sidebars on mobile */
@media (max-width: 879px) {
	.col-left, .col-right { display: none; }
	.col-left.is-open, .col-right.is-open { display: block; }
}

/* ==========================================================================
   Search box
   ========================================================================== */
.search-box {
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: 1rem;
	box-shadow: var(--shadow);
	margin-bottom: 1rem;
}

.search-box form {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	align-items: center;
}

.search-box input[type="text"] {
	flex: 1 1 200px;
	min-width: 0;
	padding: .65em .9em;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--text);
	font-family: inherit;
	font-size: .92rem;
}

.search-box select {
	padding: .65em .7em;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg);
	color: var(--text);
	font-family: inherit;
	font-size: .92rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4em;
	padding: .65em 1.3em;
	border-radius: var(--radius-sm);
	border: none;
	background: var(--c-gold);
	color: var(--c-ink);
	font-weight: 700;
	font-size: .9rem;
	cursor: pointer;
	transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }

.cta-line {
	font-size: .9rem;
	color: var(--text-muted);
	margin: .8rem 0;
}
.cta-line a { font-weight: 700; color: var(--c-ink-soft); }
html[data-theme="dark"] .cta-line a { color: var(--c-gold); }

/* ==========================================================================
   Listing cards — replaces old plain dash-separated link list
   ========================================================================== */
.listing-group + .listing-group { margin-top: 1.4rem; }

.listing-group__title {
	display: flex;
	align-items: center;
	gap: .5rem;
	font-size: .95rem;
	margin-bottom: .7rem;
}

.tier-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tier-dot--gold { background: var(--c-gold); }
.tier-dot--silver { background: var(--c-silver); }
.tier-dot--free { background: var(--text-muted); }

.listing-card {
	display: flex;
	align-items: flex-start;
	gap: .7rem;
	padding: .9rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--tier-free-bd);
	background: var(--tier-free-bg);
	margin-bottom: .6rem;
	transition: transform .15s, box-shadow .15s;
}
.listing-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.listing-card--gold   { background: var(--tier-gold-bg);   border-color: var(--tier-gold-bd); }
.listing-card--silver { background: var(--tier-silver-bg); border-color: var(--tier-silver-bd); }

.listing-card__icon {
	width: 34px; height: 34px;
	border-radius: 50%;
	background: var(--bg-sunken);
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
	font-size: 1rem;
}

.listing-card__body { flex: 1; min-width: 0; }
.listing-card__title {
	font-weight: 700;
	font-size: .92rem;
	color: var(--text);
	display: block;
	margin-bottom: .2rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.listing-card__link {
	font-size: .8rem;
	color: var(--c-ink-soft);
}
html[data-theme="dark"] .listing-card__link,
html[data-theme="auto"] .listing-card__link { color: var(--c-gold-soft); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
	background: var(--c-ink);
	color: rgba(255,255,255,.75);
	margin-top: 2rem;
	padding: 1.5rem 1rem;
	text-align: center;
	font-size: .82rem;
}
.site-footer a { color: var(--c-gold-soft); }

/* ==========================================================================
   Utility
   ========================================================================== */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.divider {
	border: none;
	border-top: 1px dashed var(--border);
	margin: .8rem 0;
}

/* Ad slot placeholders — neutral container so ad code doesn't break layout */
.ad-slot {
	display: flex;
	justify-content: center;
	margin: 1rem 0;
	overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}

/* Mobile nav toggle visibility */
@media (max-width: 879px) {
	.nav-toggle { display: flex; }
}
