/*
 * Hilm – right-to-left overrides (Persian). Loaded after theme.css / scene.css only when is_rtl() is true,
 * so Turkish and English output is not affected at all.
 *
 * theme.css was written with physical left/right values; here the ones that matter are mirrored.
 * The animated home page scene (collage + book shelf) is an absolutely positioned artwork on a fixed grid:
 * it keeps its left-to-right geometry (see the .hilm-scene block); only the text inside it is right-to-left.
 */

:root { --hilm-font-fa: "Vazirmatn", "Vazir", "IRANSansX", "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, "Geeza Pro", "Segoe UI", Arial, sans-serif; }

body, button, input, select, textarea,
.main-nav > li > a .menu-text, .mobile-main-nav li > a .menu-text,
.hilm-lang a, .hilm-lang .is-current > span {
	font-family: var(--hilm-font-fa);
}
/* Latin letter spacing and upper-casing make no sense for Arabic script (and break the letter joins). */
body { letter-spacing: 0; }
.hilm-lang a, .hilm-lang .is-current > span, h1, h2, h3, h4, h5, h6, .menu-text, .entry-title { letter-spacing: 0; text-transform: none; }
/* Script titles use a Latin handwriting font; Persian falls back to a normal face. */
.is-style-hilm-script, .wp-block-heading.is-style-hilm-script, .hilm-script { font-family: var(--hilm-font-fa) !important; font-style: normal !important; font-weight: 700; line-height: 1.6 !important; text-align: right !important; }
em, i, .hilm-lead, .hilm-lead p, p.hilm-lead { font-style: normal; }

blockquote { padding: 0 20px 0 0; border-left: 0; border-right: 3px solid var(--hilm-accent); }
th, td { text-align: right; }
.skip-link:focus { left: auto; right: 5px; }
.entry-content p, .single-post-entry .entry-content p, .hilm-bio p, .hilm-lead, .hilm-lead p, p.hilm-lead { text-align: justify; line-height: 1.9; }

/* ---------- Header ---------- */
.header-bar .nav-left { justify-content: flex-start; }
.header-bar .nav-right { justify-content: flex-end; }
.main-nav .sub-nav { left: auto; right: 0; text-align: right; }
.main-nav .sub-nav .sub-nav { left: auto; right: 100%; }
.main-nav .mega-wrap { left: auto; right: 0; text-align: right; }
.main-nav > li.mega-full-width > .mega-wrap { left: 40px; right: 40px; }
.mini-search { margin-left: 0; margin-right: 50px; }
.overlay-search .overlay-close { right: auto; left: 25px; }
.overlay-search .submit { right: auto; left: 15px; }
.searchform .submit { right: auto; left: 12px; }
.searchform-s, .hilm-searchform-wide .searchform-s { padding-right: 12px; padding-left: 40px; }
.hilm-lang-header { right: auto; left: clamp(16px, 2.8vw, 40px); }

/* ---------- Mobile menu: the slide-in panel opens from the left (the "end" side in RTL) ---------- */
.mobile-menu-icon { margin-left: 0; margin-right: auto; }
.mobile-menu-icon .menu-line { left: auto; right: 9px; }
.mobile-header { right: auto; left: 0; padding: 45px 30px 30px 28px; transform: translateX(-100%); text-align: right; }
.hilm-menu-open .mobile-header { transform: none; }
.close-mobile-menu { right: auto; left: 13px; }
.mobile-main-nav li > a { padding: 15.2px 0 15.2px 25px; }
.mobile-main-nav .next-level-button { margin-right: 0; margin-left: 5px; }
.mobile-main-nav li > ul { padding: 0 25px 15px 0; }
.mobile-search .searchform-s { padding-left: 0; padding-right: 30px; }
.mobile-search .submit { left: auto; right: 0; }

/* ---------- Breadcrumbs, alignments, lists ---------- */
.breadcrumbs li + li { margin-left: 0; padding-left: 0; margin-right: 8px; padding-right: 12px; }
.breadcrumbs li + li::before { left: auto; right: 0; }
.alignleft { float: left; margin: 0 0 10px 25px; }
.alignright { float: right; margin: 0 25px 10px 0; }
.wp-block-columns.is-style-hilm-book-row > .wp-block-column + .wp-block-column { border-left: 0; padding-left: 0; border-right: 1px solid rgba(var(--hilm-accent-rgb), .2); padding-right: 15px; }
.hilm-spec .hilm-spec-value { padding-left: 0; padding-right: 20px; }
.hilm-hero-right { text-align: left; }
.hdr-head .hdr-btn { margin-left: 0; margin-right: 5px; }
.hc-prev { left: auto; right: 30px; } .hc-next { right: auto; left: 30px; }
.hc-prev, .hc-next { transform: scaleX(-1); }

/* ---------- Posts, cards, comments ---------- */
.post-details .hilm-icon { margin-left: 0; margin-right: 7px; }
.post-details::after { left: auto; right: 0; }
.fancy-date { right: auto; left: 10px; }
.post-navigation .nav-next { margin-left: 0; margin-right: auto; text-align: left; }
.post-navigation .nav-previous { text-align: right; }
.post-navigation .nav-previous .hilm-icon { left: auto; right: 0; transform: scaleX(-1); }
.post-navigation .nav-next .hilm-icon { right: auto; left: 0; transform: scaleX(-1); }
.comment-list .children { margin-left: 0; margin-right: 40px; }
.comment-body { padding-left: 0; padding-right: 80px; }
.comment-author .avatar { left: auto; right: 0; }
.hm-count { right: auto; left: 10px; }
.hm-file input[type="file"]::file-selector-button { margin-right: 0; margin-left: 12px; }

/* Footnote numbers / superscripts keep their own direction */
sup, sub, .footnote, [id^="fn"] { unicode-bidi: isolate; }
/* Arabic quotations that are already in the text keep their own look */
[lang="ar"], .arabic { font-family: "Noto Naskh Arabic", "Amiri", "Geeza Pro", "Traditional Arabic", serif; }
/* Numbers, latin names, URLs inside Persian text */
a[href^="http"], .entry-content code { unicode-bidi: plaintext; }

@media (max-width: 1024px) {
	.hc-prev { left: auto; right: 5px; } .hc-next { right: auto; left: 5px; }
	.mini-search { margin-left: 0; margin-right: clamp(14px, calc(2.4vw - 10px), 50px); }
	.mobile-branding { padding-left: 0; padding-right: 42px; }
	.wp-block-heading.is-style-hilm-script, .is-style-hilm-script { text-align: right !important; }
	.hilm-hero-right img { margin-left: 0; margin-right: -40%; }
}
@media (max-width: 600px) {
	.mobile-branding { padding-right: 0; justify-content: flex-start; }
	.hilm-subpage > .hdr-head .hdr-btn { margin-right: 0; }
}

/* ---------- Home page scene: artwork geometry stays left-to-right, text stays right-to-left ---------- */
.hilm-scene, .hilm-scene * { direction: ltr; }
.hilm-scene [lang="fa"], .hilm-scene .hilm-scene-text, .hilm-scene a, .hilm-scene button, .hilm-scene p, .hilm-scene h1, .hilm-scene h2, .hilm-scene h3 { unicode-bidi: plaintext; }

/* Scene header buttons: the first half of the list sits on the right of the logo and reads right to left. */
.hilm-scene .hs-btn-group { flex-direction: row-reverse; }
.hilm-scene .hs-btn-flow { direction: rtl; }
@media (min-width: 481px) {
	.hilm-scene .hs-btn-left { left: 935.5px; justify-content: flex-start; }
	.hilm-scene .hs-btn-right { left: 0; justify-content: flex-end; }
}
.hilm-intro, .hilm-intro * { font-style: normal; }

/* No sideways page scroll: off-canvas parts (mobile panel, hidden spam-trap field) sit on the left, which is scrollable in RTL. */
html, body { overflow-x: clip; }
.hm-hp { left: auto !important; right: -9999px; }

/* Design rows (Tasarımlar): the full-bleed trick uses a left margin; mirror it. The slider track is moved with translateX, so it keeps left-to-right geometry. */
.hilm-design-row { margin: 0 calc(50% - 50vw) 80px 0; }
.hilm-design-row:first-child { margin-top: 0; }
.hilm-carousel .hc-viewport { direction: ltr; }
.hilm-carousel .hc-prev { left: 30px; right: auto; transform: none; }
.hilm-carousel .hc-next { right: 30px; left: auto; transform: none; }
@media (max-width: 1024px) {
	.hilm-carousel .hc-prev { left: 5px; right: auto; }
	.hilm-carousel .hc-next { right: 5px; left: auto; }
}

@media (max-width: 600px) {
	.entry-content p, .single-post-entry .entry-content p, .hilm-bio p, .hilm-lead, .hilm-lead p, p.hilm-lead { text-align: start; }
	.mobile-menu-icon .menu-line { left: auto; right: 10px; }
	.close-mobile-menu { right: auto; left: 6px; }
}
@media (max-width: 1180px) {
	.main-nav > li.mega-auto-width > .mega-wrap { left: 20px; right: 20px; }
}

@media (min-width: 481px) and (max-width: 1399px) {
	.hilm-scene .hs-btn-left { left: 935.5px; }
	.hilm-scene .hs-btn-right { left: 24px; }
}

/* Home scene, buttons placed one by one on the grid (6 buttons): mirror them so the first one is on the right */
.hilm-scene .hs-buttons > .hs-btn.hs-layer { left: calc(1400px - var(--x) - var(--w)); }
@media (min-width: 481px) and (max-width: 1399px) {
	.hilm-scene .hs-buttons > .hs-btn.hs-layer:nth-child(-n+3) { margin-left: -8px; }
	.hilm-scene .hs-buttons > .hs-btn.hs-layer:nth-child(n+4) { margin-left: 22px; }
}
@media (max-width: 480px) {
	.hilm-scene .hs-buttons > .hs-btn.hs-layer { left: calc(480px - var(--mx, var(--x)) - var(--mw, var(--w))); }
}
