/*
Theme Name: Divar Theme
Theme URI: https://github.com/padeshahanin-del/Divar-sit
Author: Divar Sit
Description: قالب اختصاصی سایت آگهی و نیازمندی‌ها، ساخته‌شده برای افزونه‌ی Divar Core. راست‌چین، واکنش‌گرا و سبک.
Version: 0.1.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: divar-theme
Tags: rtl-language-support, classifieds, custom-menu, responsive-layout
*/

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--divar-bg-soft);
	color: var(--divar-fg);
	font-family: Vazirmatn, IRANSans, Tahoma, system-ui, sans-serif;
	font-size: 15px;
	line-height: 1.8;
	direction: rtl;
}

a { color: var(--divar-brand); }
img { max-width: 100%; height: auto; }

.dt-container { max-width: var(--divar-width); margin: 0 auto; padding: 0 16px; }

/* -------------------------------- header -------------------------------- */

.dt-header { background: var(--divar-bg); border-bottom: 1px solid var(--divar-line); position: sticky; top: 0; z-index: 20; }
.dt-header__inner { display: flex; align-items: center; gap: 16px; padding: 12px 16px; max-width: var(--divar-width); margin: 0 auto; }
.dt-logo { font-weight: 800; font-size: 1.25em; color: var(--divar-brand); text-decoration: none; white-space: nowrap; }
.dt-header__search { flex: 1; display: flex; gap: 8px; }
.dt-header__search input, .dt-header__search select {
	padding: 9px 12px; border: 1px solid var(--divar-line); border-radius: var(--divar-radius); font: inherit; background: var(--divar-bg);
}
/* Without min-width:0 a flex item refuses to shrink below its content, which
   is how a search box that is meant to be flexible pushes the whole page wider
   than the phone it is on. */
.dt-header__search input { flex: 1; min-width: 0; }
.dt-header__actions { display: flex; gap: 8px; align-items: center; }

.dt-nav { border-top: 1px solid var(--divar-line); background: var(--divar-bg); }
.dt-nav ul { list-style: none; display: flex; gap: 4px; margin: 0 auto; padding: 6px 16px; max-width: var(--divar-width); overflow-x: auto; }
.dt-nav a { display: block; padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--divar-fg); white-space: nowrap; font-size: .92em; }
.dt-nav a:hover { background: var(--divar-bg-soft); color: var(--divar-brand); }

/* --------------------------------- main --------------------------------- */

.dt-main { padding: 24px 0 48px; }
.dt-section { background: var(--divar-bg); border: 1px solid var(--divar-line); border-radius: var(--divar-radius); padding: 20px; margin-bottom: 20px; }
.dt-section__title { margin: 0 0 16px; font-size: 1.08em; display: flex; justify-content: space-between; align-items: center; }
.dt-section__title a { font-size: .82em; font-weight: 400; text-decoration: none; }

.dt-hero { background: linear-gradient(135deg, var(--divar-brand), var(--divar-brand-deep)); color: var(--divar-bg); border-radius: var(--divar-radius); padding: 40px 24px; text-align: center; margin-bottom: 20px; }
.dt-hero h1 { margin: 0 0 8px; font-size: 1.6em; }
.dt-hero p { margin: 0 0 20px; opacity: .9; }

/* ------------------------------ single listing --------------------------- */

.dt-listing { display: grid; grid-template-columns: 1fr 330px; gap: 24px; align-items: start; }
.dt-listing__gallery { border-radius: var(--divar-radius); overflow: hidden; background: var(--divar-bg-soft); }
/* Listing images now carry real width/height attributes so the browser can
   reserve their space; without height:auto that fixed height would fight the
   fluid width and squash every photo. */
.dt-listing__gallery img { width: 100%; height: auto; display: block; }
.dt-listing__thumbs { display: flex; gap: 8px; padding: 8px; overflow-x: auto; }
.dt-listing__thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.dt-listing__title { margin: 0 0 8px; font-size: 1.4em; }
.dt-listing__meta { color: var(--divar-muted); font-size: .88em; display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dt-listing__price { font-size: 1.25em; font-weight: 800; margin-bottom: 16px; }
.dt-listing__specs { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.dt-listing__specs li { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--divar-bg-soft); border-radius: 8px; }
.dt-listing__specs span:first-child { color: var(--divar-muted); }
.dt-listing__desc { white-space: pre-line; margin-bottom: 20px; }
.dt-listing__aside { position: sticky; top: 90px; }
.dt-listing__box { background: var(--divar-bg); border: 1px solid var(--divar-line); border-radius: var(--divar-radius); padding: 16px; margin-bottom: 16px; }
.dt-listing__box .divar-btn { width: 100%; justify-content: center; margin-bottom: 8px; }
.dt-listing__seller { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.dt-listing__report { text-align: center; }

/* -------------------------------- footer -------------------------------- */

.dt-footer { background: var(--divar-bg); border-top: 1px solid var(--divar-line); padding: 28px 0; margin-top: 40px; color: var(--divar-muted); font-size: .9em; }
.dt-footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.dt-footer ul { list-style: none; margin: 0; padding: 0; }
.dt-footer a { color: inherit; text-decoration: none; }
.dt-footer a:hover { color: var(--divar-brand); }

/* ------------------------------- utilities ------------------------------ */

.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dt-breadcrumbs { color: var(--divar-muted); font-size: .85em; margin-bottom: 16px; }
.dt-breadcrumbs a { text-decoration: none; }

@media (max-width: 900px) {
	.dt-listing { grid-template-columns: 1fr; }
	.dt-listing__aside { position: static; }
	.dt-header__inner { flex-wrap: wrap; }
	.dt-header__search { order: 3; width: 100%; }
}

@media (max-width: 480px) {
	/* Three controls in one row leaves the text field too narrow to read what
	   you typed, so the city and the button take a line of their own. */
	.dt-header__search { flex-wrap: wrap; }
	.dt-header__search input { flex: 1 0 100%; }
	.dt-header__search select { flex: 1; }
}

/* Gallery thumbnails are buttons now, so they need the frame the bare images
   used to carry — and a visible marker for the one on show, which colour
   alone would not give a keyboard user. */
.dt-thumb {
	padding: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	background: none;
	cursor: pointer;
	line-height: 0;
}

.dt-thumb[aria-current="true"] {
	border-color: var(--divar-brand);
}

/* The skip link stays off-screen until it is focused, then lands on top. */
.dt-skip:focus {
	position: fixed;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	z-index: 100000;
	width: auto;
	height: auto;
	clip-path: none;
	padding: 12px 20px;
	background: var(--divar-bg);
	border-radius: 8px;
	box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
