/*
Theme Name: Fireball RTL
Theme URI: https://example.com/fireball-rtl
Author: Nima
Author URI: https://example.com
Description: A minimalist, single-column blogging theme inspired by the classic Daring Fireball design, tuned for right-to-left (Persian / Arabic / Hebrew) blogging. Ships with the Vazirmatn typeface, a logical-property layout that is flawless in both RTL and LTR, and a Daring Fireball–style "Linked List" post mode (the ★ permalink).
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fireball-rtl
Tags: blog, one-column, rtl-language-support, translation-ready, custom-menu, custom-logo, featured-images, threaded-comments, editor-style, block-styles, full-width-template
*/

/* =========================================================================
   1. Design tokens
   ========================================================================= */
:root {
	--fb-bg:            #4a525a; /* Daring Fireball slate blue-grey (page gutter) */
	--fb-bg-dark:       #3e454c;
	--fb-surface:       #ffffff; /* the "sheet of paper" reading column          */
	--fb-surface-alt:   #f6f7f8;
	--fb-text:          #1b1b1b;
	--fb-text-soft:     #3a3a3a;
	--fb-muted:         #6d7278;
	--fb-border:        #e4e6e8;
	--fb-border-strong: #cfd3d6;
	--fb-link:          #4a6b8a; /* muted DF blue                                */
	--fb-link-hover:    #29435c;
	--fb-accent:        #b1741f; /* the ★ star (overridable in the Customizer)   */
	--fb-header-text:   #ffffff;
	--fb-header-muted:  #b9c0c7;
	--fb-code-bg:       #f4f5f6;
	--fb-selection:     #ffe9b8;

	--fb-measure:       44rem;   /* comfortable reading measure                  */
	--fb-radius:        4px;
	--fb-shadow:        0 1px 2px rgba(0, 0, 0, .18), 0 8px 30px rgba(0, 0, 0, .12);

	--fb-font-body:     "Vazirmatn", "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
	--fb-font-title:    "Vazirmatn", Georgia, "Times New Roman", serif;
	--fb-font-mono:     "Vazirmatn", ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;

	--fb-fs-base:       1.0625rem; /* 17px                                        */
	--fb-lh-base:       1.9;       /* Persian text wants generous leading         */
}

/* =========================================================================
   2. Reset / base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }

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

body {
	margin: 0;
	background-color: var(--fb-bg);
	color: var(--fb-text);
	font-family: var(--fb-font-body);
	font-size: var(--fb-fs-base);
	line-height: var(--fb-lh-base);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

::selection { background: var(--fb-selection); }

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

a {
	color: var(--fb-link);
	text-decoration: none;
	text-underline-offset: .18em;
	transition: color .12s ease;
}
a:hover, a:focus { color: var(--fb-link-hover); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--fb-link); outline-offset: 2px; }

p { margin: 0 0 1.4em; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--fb-font-title);
	color: var(--fb-text);
	line-height: 1.35;
	margin: 1.8em 0 .6em;
	font-weight: 700;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.08rem; }

ul, ol { padding-inline-start: 1.5em; margin: 0 0 1.4em; }
li { margin-block: .35em; }

blockquote {
	margin: 1.6em 0;
	padding-inline-start: 1.1em;
	border-inline-start: 3px solid var(--fb-border-strong);
	color: var(--fb-text-soft);
	font-style: normal;
}
blockquote p:last-child { margin-bottom: 0; }

hr {
	border: 0;
	height: 1px;
	background: var(--fb-border);
	margin: 2.4em 0;
}

code, kbd, pre, samp { font-family: var(--fb-font-mono); font-size: .92em; direction: ltr; }
code {
	background: var(--fb-code-bg);
	padding: .12em .4em;
	border-radius: var(--fb-radius);
	unicode-bidi: embed;
}
pre {
	background: var(--fb-code-bg);
	border: 1px solid var(--fb-border);
	border-radius: var(--fb-radius);
	padding: 1em 1.15em;
	overflow: auto;
	line-height: 1.6;
	text-align: left;
}
pre code { background: none; padding: 0; }

table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.6em 0;
	font-size: .95em;
}
th, td { padding: .5em .7em; border: 1px solid var(--fb-border); text-align: start; }
thead th { background: var(--fb-surface-alt); }

figure { margin: 1.6em 0; }
figcaption { color: var(--fb-muted); font-size: .85em; margin-top: .5em; text-align: center; }

/* =========================================================================
   3. Accessibility helpers
   ========================================================================= */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px; width: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	position: absolute !important;
	word-wrap: normal !important;
}
.skip-link {
	position: absolute;
	inset-inline-start: -9999px;
	top: 0;
	z-index: 100000;
	background: #fff;
	color: var(--fb-link);
	padding: .7em 1.2em;
	border-radius: 0 0 var(--fb-radius) var(--fb-radius);
}
.skip-link:focus { inset-inline-start: 0; }

/* =========================================================================
   4. Layout shell
   ========================================================================= */
.site {
	max-width: 52rem;
	margin-inline: auto;
	padding: 0 1rem 3rem;
}

.site-content {
	background: var(--fb-surface);
	box-shadow: var(--fb-shadow);
	border-radius: var(--fb-radius);
	padding: clamp(1.4rem, 4vw, 3rem);
}

.site-main { max-width: var(--fb-measure); margin-inline: auto; }

/* =========================================================================
   5. Header
   ========================================================================= */
.site-header {
	text-align: center;
	padding: 2.6rem 1rem 1.8rem;
	color: var(--fb-header-text);
}
.site-header__inner { max-width: var(--fb-measure); margin-inline: auto; }

.site-logo img { margin: 0 auto 1rem; }

.site-title {
	font-family: var(--fb-font-title);
	font-weight: 900;
	font-size: clamp(2rem, 6vw, 3rem);
	line-height: 1.1;
	margin: 0;
	letter-spacing: -0.01em;
}
.site-title a { color: var(--fb-header-text); text-decoration: none; }
.site-title a:hover { color: #fff; text-decoration: none; }

.site-description {
	color: var(--fb-header-muted);
	font-size: 1.0rem;
	margin: .5rem 0 0;
}

/* Primary navigation */
.main-navigation { margin-top: 1.4rem; }
.main-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0 1.4rem;
	justify-content: center;
}
.main-navigation li { margin: 0; }
.main-navigation a {
	color: var(--fb-header-muted);
	text-transform: uppercase;
	letter-spacing: .05em;
	font-size: .82rem;
	text-decoration: none;
	padding: .3em 0;
	border-bottom: 2px solid transparent;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a {
	color: #fff;
	border-bottom-color: var(--fb-accent);
}
.main-navigation .sub-menu { display: none; }

.menu-toggle {
	display: none;
	align-items: center;
	gap: .5em;
	margin: 0 auto;
	background: rgba(255, 255, 255, .08);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, .25);
	border-radius: var(--fb-radius);
	padding: .5em 1em;
	font: inherit;
	font-size: .85rem;
	cursor: pointer;
}
.menu-toggle__bar,
.menu-toggle__bar::before,
.menu-toggle__bar::after {
	display: block;
	width: 18px; height: 2px;
	background: currentColor;
	position: relative;
}
.menu-toggle__bar::before,
.menu-toggle__bar::after { content: ""; position: absolute; inset-inline: 0; }
.menu-toggle__bar::before { top: -5px; }
.menu-toggle__bar::after  { top: 5px; }

/* =========================================================================
   6. Posts & entries
   ========================================================================= */
.entry { padding-block: 1.6rem 2rem; }
.entry + .entry { border-top: 1px solid var(--fb-border); }
.site-main > .entry:first-child { padding-top: 0; }

.entry-header { margin-bottom: 1rem; }

.entry-title {
	margin: 0 0 .35rem;
	font-size: clamp(1.4rem, 3.2vw, 1.9rem);
	line-height: 1.3;
	font-weight: 800;
}
.entry-title a { color: var(--fb-text); text-decoration: none; }
.entry-title a:hover { color: var(--fb-link); text-decoration: none; }

/* Daring Fireball "Linked List" ★ */
.entry-title.is-linked .entry-title-link::after {
	content: " \2197"; /* ↗ outbound hint */
	font-size: .7em;
	color: var(--fb-muted);
	vertical-align: middle;
}
.permalink-star {
	color: var(--fb-accent);
	text-decoration: none;
	font-size: .85em;
	margin-inline-start: .15em;
}
.permalink-star:hover { color: var(--fb-accent); filter: brightness(.85); text-decoration: none; }

.entry-meta,
.entry-footer {
	color: var(--fb-muted);
	font-size: .82rem;
	line-height: 1.8;
}
.entry-meta a,
.entry-footer a { color: var(--fb-muted); text-decoration: none; border-bottom: 1px dotted var(--fb-border-strong); }
.entry-meta a:hover,
.entry-footer a:hover { color: var(--fb-link); }
.entry-meta > span::after { content: "·"; margin-inline: .5em; color: var(--fb-border-strong); }
.entry-meta > span:last-child::after { content: ""; margin: 0; }

.entry-thumbnail { margin: 1.2rem 0; }
.entry-thumbnail img { border-radius: var(--fb-radius); width: 100%; }

.entry-content { margin-top: 1.1rem; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content a { border-bottom: 1px solid rgba(74, 107, 138, .35); }
.entry-content a:hover { border-bottom-color: var(--fb-link-hover); text-decoration: none; }

.entry-content .wp-block-image,
.entry-content .alignwide { margin-inline: auto; }
.entry-content .alignfull { margin-inline: calc(50% - 50vw); max-width: 100vw; }

.entry-footer { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px dashed var(--fb-border); }
.entry-footer .fb-star { color: var(--fb-accent); }

.more-link {
	display: inline-block;
	margin-top: .5rem;
	font-weight: 700;
	border-bottom: 0 !important;
}

/* Sticky posts */
.sticky .entry::before {
	content: "★";
	color: var(--fb-accent);
	margin-inline-end: .35em;
}

/* =========================================================================
   7. Pagination & post navigation
   ========================================================================= */
.pagination,
.posts-navigation,
.post-navigation { margin: 2.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--fb-border); }
.nav-links { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; }
.pagination .nav-links { justify-content: center; }
.pagination .page-numbers {
	display: inline-block;
	padding: .35em .8em;
	border: 1px solid var(--fb-border);
	border-radius: var(--fb-radius);
	color: var(--fb-link);
	text-decoration: none;
}
.pagination .page-numbers.current { background: var(--fb-link); color: #fff; border-color: var(--fb-link); }
.pagination .page-numbers:hover { background: var(--fb-surface-alt); text-decoration: none; }

.post-navigation .nav-links { justify-content: space-between; }
.post-navigation .nav-previous,
.post-navigation .nav-next { max-width: 48%; }
.post-navigation .nav-subtitle { display: block; font-size: .75rem; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .05em; }
.post-navigation .nav-title { font-weight: 700; }

/* =========================================================================
   8. Page headers (archives, search, 404)
   ========================================================================= */
.page-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--fb-accent); }
.page-title { margin: 0; font-size: 1.5rem; }
.page-title span { color: var(--fb-link); }
.archive-description { color: var(--fb-muted); margin-top: .6rem; }

/* =========================================================================
   9. Comments
   ========================================================================= */
.comments-area { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 3px double var(--fb-border-strong); }
.comments-title, .comment-reply-title { font-size: 1.25rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list ol.children { list-style: none; margin: 0; padding-inline-start: 1.6rem; }
.comment-body { padding: 1.1rem 0; border-bottom: 1px solid var(--fb-border); }
.comment-author { display: flex; align-items: center; gap: .6em; font-weight: 700; }
.comment-author .avatar { border-radius: 50%; }
.comment-author .says { display: none; }
.comment-metadata { font-size: .78rem; color: var(--fb-muted); }
.comment-metadata a { color: var(--fb-muted); }
.reply { font-size: .82rem; }
.comment-form label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .3em; }
.comment-respond { margin-top: 1.5rem; }

/* Forms */
input[type="text"], input[type="email"], input[type="url"], input[type="password"],
input[type="search"], input[type="tel"], input[type="number"], textarea, select {
	width: 100%;
	max-width: 100%;
	font: inherit;
	font-size: .95rem;
	color: var(--fb-text);
	background: var(--fb-surface);
	border: 1px solid var(--fb-border-strong);
	border-radius: var(--fb-radius);
	padding: .55em .75em;
	margin-bottom: 1em;
}
input:focus, textarea:focus, select:focus { border-color: var(--fb-link); outline: none; }

.wp-block-button__link,
button, input[type="submit"], .button {
	display: inline-block;
	background: var(--fb-link);
	color: #fff;
	border: 0;
	border-radius: var(--fb-radius);
	padding: .6em 1.4em;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: background .12s ease;
}
button:hover, input[type="submit"]:hover, .button:hover { background: var(--fb-link-hover); color: #fff; }

/* =========================================================================
   10. Search form
   ========================================================================= */
.search-form { display: flex; gap: .5em; align-items: stretch; }
.search-form label { flex: 1; margin: 0; }
.search-form .search-field { margin: 0; }
.search-form .search-submit { flex: 0 0 auto; margin: 0; }

/* =========================================================================
   11. Widgets / sidebar
   ========================================================================= */
.widget-area { margin-top: 2.5rem; }
.widget {
	background: var(--fb-surface-alt);
	border: 1px solid var(--fb-border);
	border-radius: var(--fb-radius);
	padding: 1.2rem 1.4rem;
	margin-bottom: 1.2rem;
	font-size: .95rem;
}
.widget-title { margin: 0 0 .8rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fb-muted); }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { padding: .3em 0; border-bottom: 1px solid var(--fb-border); }
.widget li:last-child { border-bottom: 0; }

/* =========================================================================
   12. Footer
   ========================================================================= */
.site-footer {
	color: var(--fb-header-muted);
	text-align: center;
	padding: 2rem 1rem 0;
	font-size: .82rem;
	line-height: 1.9;
}
.site-footer a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.25); }
.site-footer a:hover { color: #fff; }
.site-footer .footer-star { color: var(--fb-accent); }
.footer-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.2rem; justify-content: center; padding: 0; margin: 0 0 .8rem; }
.footer-menu a { border: 0; }

/* =========================================================================
   13. Responsive
   ========================================================================= */
@media (max-width: 600px) {
	:root { --fb-fs-base: 1rem; }
	.menu-toggle { display: inline-flex; }
	.main-navigation ul {
		display: none;
		flex-direction: column;
		gap: 0;
		margin-top: 1rem;
		background: rgba(0,0,0,.15);
		border-radius: var(--fb-radius);
		padding: .5rem 0;
	}
	.main-navigation.is-open ul { display: flex; }
	.main-navigation li { border-top: 1px solid rgba(255,255,255,.08); }
	.main-navigation li:first-child { border-top: 0; }
	.main-navigation a { display: block; padding: .6em 1em; }
	.post-navigation .nav-links { flex-direction: column; }
	.post-navigation .nav-previous,
	.post-navigation .nav-next { max-width: 100%; }
}

/* =========================================================================
   14. Print
   ========================================================================= */
@media print {
	body { background: #fff; color: #000; }
	.site-header, .site-footer, .main-navigation, .comments-area, .widget-area, .post-navigation, .pagination { display: none; }
	.site-content { box-shadow: none; }
}
