/* Imen Tahvieh — PDF / print documents (articles and engineering reports). */
@font-face { font-family: "ImenSans"; src: url("../fonts/vazirmatn-fd.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: block; }
@font-face { font-family: "ImenSansLatin"; src: url("../fonts/vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: block; }

:root {
	--navy: #0E2638; --navy-2: #143650; --cool: #16AFC0; --cool-ink: #0A7280; --cool-soft: #E3F6F8;
	--heat: #F08A3C; --ink: #13212C; --text: #2B3B47; --muted: #5A6B78; --line: #D6DFE5; --line-2: #E6ECF0; --soft: #F3F6F8;
	--grad: linear-gradient(to left, #F08A3C 0%, #F5A35C 30%, #16AFC0 62%, #9BE7EE 100%);
}

@page {
	size: A4;
	margin: 18mm 15mm 20mm;
	@bottom-center { content: "صفحه " counter(page) " از " counter(pages); font-family: "ImenSans", sans-serif; font-size: 8.5pt; color: #5A6B78; }
	@top-right { font-family: "ImenSans", sans-serif; font-size: 8pt; color: #5A6B78; }
	@top-left { font-family: "ImenSans", sans-serif; font-size: 8pt; color: #5A6B78; }
}

* { box-sizing: border-box; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body.pdf {
	margin: 0; direction: rtl; background: #E6ECF0; color: var(--text);
	font-family: "ImenSans", "ImenSansLatin", Tahoma, sans-serif; font-size: 11pt; line-height: 1.95;
	text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--cool-ink); }

/* Screen toolbar */
.pdf-toolbar { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #DCE6ED; font-size: 13px; box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .5); }
.pdf-toolbar__inner { max-width: 210mm; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.pdf-toolbar strong { color: #fff; }
.pdf-toolbar__hint { flex: 1 1 260px; color: #A9BCCB; line-height: 1.7; }
.pdf-toolbar__actions { display: flex; gap: 8px; }
.pdf-btn { display: inline-flex; align-items: center; min-height: 38px; padding: 6px 16px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .25); background: transparent; color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.pdf-btn--primary { background: var(--heat); border-color: var(--heat); color: #1E1206; }

/* Page (screen preview looks like A4 paper) */
.pdf-doc { width: 210mm; max-width: 100%; min-height: 297mm; margin: 24px auto 48px; padding: 18mm 15mm 20mm; background: #fff; box-shadow: 0 20px 50px -24px rgba(14, 38, 56, .45); }

/* Cover */
.pdf-cover { position: relative; padding-bottom: 12pt; margin-bottom: 14pt; }
.pdf-cover::after { content: ""; position: absolute; inset: auto 0 0; height: 3pt; border-radius: 3pt; background: var(--grad); }
.pdf-cover__brand { display: flex; align-items: center; gap: 10pt; padding-bottom: 10pt; margin-bottom: 14pt; border-bottom: 1px solid var(--line-2); }
.pdf-cover__logo { height: 13mm; width: auto; object-fit: contain; }
.pdf-cover__name { font-weight: 900; font-size: 14pt; color: var(--navy); }
.pdf-cover__type { margin-inline-start: auto; padding: 3pt 10pt; border-radius: 99px; background: var(--cool-soft); color: var(--cool-ink); font-size: 9pt; font-weight: 800; }
.pdf-cover__kicker { margin: 0 0 4pt; color: var(--cool-ink); font-size: 9.5pt; font-weight: 800; }
.pdf-cover__title { margin: 0 0 8pt; color: var(--navy); font-size: 21pt; font-weight: 900; line-height: 1.5; }
.pdf-cover__lead { margin: 0 0 12pt; color: var(--muted); font-size: 11.5pt; line-height: 2; text-align: justify; }
.pdf-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6pt; margin: 0 0 12pt; }
.pdf-meta > div { padding: 6pt 9pt; border-radius: 6pt; background: var(--soft); border: 1px solid var(--line-2); min-width: 0; }
.pdf-meta dt { color: var(--muted); font-size: 8pt; }
.pdf-meta dd { margin: 0; color: var(--ink); font-size: 9.5pt; font-weight: 800; overflow-wrap: anywhere; }
.pdf-meta a { color: var(--cool-ink); text-decoration: none; font-weight: 600; font-size: 8.5pt; }
.pdf-cover__image { margin: 0; border-radius: 8pt; overflow: hidden; }
.pdf-cover__image img { display: block; width: 100%; max-height: 85mm; object-fit: cover; }

/* Table of contents */
.pdf-toc { margin: 0 0 16pt; padding: 10pt 14pt; border-radius: 8pt; border: 1px solid var(--line); background: #FBFCFD; }
.pdf-toc__title { margin: 0 0 6pt; font-size: 12pt; color: var(--navy); }
.pdf-toc ol { margin: 0; padding: 0; list-style: none; columns: 2; column-gap: 18pt; font-size: 9.5pt; line-height: 1.8; counter-reset: toc; }
.pdf-toc li { break-inside: avoid; }
.pdf-toc .pdf-toc__l2 { counter-increment: toc; font-weight: 700; color: var(--ink); margin-top: 3pt; }
.pdf-toc .pdf-toc__l2::before { content: counter(toc) ". "; color: var(--cool-ink); }
.pdf-toc .pdf-toc__l3 { padding-inline-start: 14pt; color: var(--muted); font-size: 9pt; }
.pdf-toc .pdf-toc__l3::before { content: "– "; }
.pdf-toc a { color: inherit; text-decoration: none; }

/* Article body */
.pdf-body { text-align: justify; text-justify: inter-word; orphans: 3; widows: 3; }
.pdf-body h1, .pdf-body h2, .pdf-body h3, .pdf-body h4, .pdf-body h5 { color: var(--navy); line-height: 1.6; text-align: start; break-after: avoid-page; break-inside: avoid; }
.pdf-body h2 { margin: 18pt 0 8pt; padding-inline-start: 9pt; border-inline-start: 4pt solid var(--cool); font-size: 15pt; font-weight: 900; }
.pdf-body h3 { margin: 14pt 0 6pt; font-size: 12.5pt; font-weight: 800; color: var(--navy-2); }
.pdf-body h4 { margin: 12pt 0 4pt; font-size: 11.5pt; font-weight: 800; }
.pdf-body p { margin: 0 0 8pt; }
.pdf-body ul, .pdf-body ol { margin: 0 0 10pt; padding-inline-start: 18pt; }
.pdf-body li { margin: 2pt 0; }
.pdf-body a { color: var(--cool-ink); text-decoration: underline; text-underline-offset: 2pt; overflow-wrap: anywhere; }
.pdf-body img { display: block; margin: 8pt auto; border-radius: 6pt; break-inside: avoid; page-break-inside: avoid; max-height: 150mm; width: auto; }
.pdf-body figure { margin: 10pt 0; break-inside: avoid; }
.pdf-body figcaption, .pdf-body .wp-caption-text { text-align: center; color: var(--muted); font-size: 8.5pt; margin-top: 3pt; }
.pdf-body blockquote { margin: 10pt 0; padding: 8pt 12pt; border-inline-start: 3pt solid var(--heat); background: #FFF8F1; border-radius: 4pt; break-inside: avoid; }
.pdf-body pre, .pdf-body code { font-family: "ImenSansLatin", monospace; font-size: 9pt; white-space: pre-wrap; word-break: break-word; }
.pdf-body table { width: 100% !important; max-width: 100%; border-collapse: collapse; margin: 10pt 0; font-size: 9.5pt; line-height: 1.7; break-inside: auto; }
.pdf-body thead { display: table-header-group; }
.pdf-body tr { break-inside: avoid; page-break-inside: avoid; }
.pdf-body th, .pdf-body td { padding: 5pt 7pt; border: 1px solid var(--line); text-align: start; vertical-align: top; }
.pdf-body th { background: #E8F1F6; color: var(--navy); font-weight: 800; }
.pdf-body tr:nth-child(even) td { background: #FAFCFD; }
.pdf-body iframe, .pdf-body video, .pdf-body audio, .pdf-body button, .pdf-body input, .pdf-body select, .pdf-body textarea, .pdf-body .calc, .pdf-body .imt-form, .pdf-body .share { display: none !important; }
.pdf-body details { margin: 6pt 0; padding: 6pt 10pt; border: 1px solid var(--line-2); border-radius: 6pt; break-inside: avoid; }
.pdf-body summary { font-weight: 800; color: var(--navy); list-style: none; }
.pdf-embed { padding: 6pt 10pt; border: 1px dashed var(--line); border-radius: 6pt; font-size: 9pt; color: var(--muted); }
.pdf-body .imt-table-scroll { overflow: visible !important; }
.pdf-body > .imt-ugc { overflow: visible; }

/* Closing block */
.pdf-end { margin-top: 18pt; padding-top: 10pt; border-top: 2px solid var(--navy); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 4pt 16pt; font-size: 9pt; color: var(--muted); break-inside: avoid; }
.pdf-end__brand strong { display: block; color: var(--navy); font-size: 11pt; }
.pdf-end__contact { list-style: none; margin: 0; padding: 0; display: grid; gap: 1pt; }
.pdf-end__source { grid-column: 1 / -1; margin: 6pt 0 0; font-size: 8pt; }

/* Engineering report (tools) */
.rpt-title { margin: 0 0 4pt; color: var(--navy); font-size: 18pt; font-weight: 900; }
.rpt-sub { margin: 0 0 12pt; color: var(--muted); }
.rpt-section { margin: 14pt 0; break-inside: avoid; }
.rpt-section h2 { margin: 0 0 6pt; padding-inline-start: 8pt; border-inline-start: 4pt solid var(--cool); color: var(--navy); font-size: 13pt; }
.rpt-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.rpt-table th, .rpt-table td { padding: 5pt 8pt; border: 1px solid var(--line); text-align: start; }
.rpt-table th { width: 45%; background: var(--soft); color: var(--ink); font-weight: 700; }
.rpt-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6pt; }
.rpt-kpi { padding: 8pt 10pt; border-radius: 6pt; background: var(--navy); color: #fff; }
.rpt-kpi small { display: block; color: #9BE7EE; font-size: 8pt; }
.rpt-kpi b { font-size: 14pt; }
.rpt-note { font-size: 8.5pt; color: var(--muted); line-height: 1.8; }
.rpt-chart svg { width: 100%; height: auto; }

@media print {
	body.pdf { background: #fff; }
	.pdf-toolbar { display: none !important; }
	.pdf-doc { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
	a { color: var(--cool-ink); }
}
@media screen and (max-width: 820px) {
	.pdf-doc { margin: 0; padding: 16px; min-height: 0; box-shadow: none; }
	.pdf-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.pdf-toc ol { columns: 1; }
	.pdf-end { grid-template-columns: 1fr; }
	.rpt-kpis { grid-template-columns: 1fr 1fr; }
}

/* Anti-bot gate before the PDF */
body.pdf-gate-page { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; direction: rtl; font-family: "ImenSans", "ImenSansLatin", Tahoma, sans-serif; color: var(--text); background: radial-gradient(70% 60% at 100% 0%, rgba(22, 175, 192, .28), transparent 60%), linear-gradient(160deg, #11324A, var(--navy) 65%); }
.pdf-gate { width: 100%; max-width: 440px; padding: 30px 28px; border-radius: 24px; background: #fff; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .6); }
.pdf-gate__brand { display: flex; align-items: center; gap: 10px; color: var(--navy); font-weight: 900; letter-spacing: .02em; }
.pdf-gate__brand svg { flex-shrink: 0; }
.pdf-gate h1 { margin: 18px 0 4px; font-size: 1.35rem; color: var(--ink); }
.pdf-gate__title { margin: 0 0 18px; color: var(--muted); font-size: .9rem; line-height: 1.9; }
.pdf-gate__form { display: grid; gap: 12px; }
.pdf-gate__form label { font-size: .875rem; font-weight: 700; color: var(--ink); line-height: 1.9; }
.pdf-gate__cap { display: flex; align-items: center; gap: 12px; }
.pdf-gate__cap img { border-radius: 12px; border: 1px solid var(--line); max-width: 100%; height: auto; }
.pdf-gate__cap a { font-size: .8rem; font-weight: 700; color: var(--cool-ink); }
.pdf-gate__form input[type=text] { height: 52px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--soft); font: inherit; font-size: 1.35rem; font-weight: 800; letter-spacing: .3em; text-align: center; color: var(--ink); }
.pdf-gate__form input[type=text]:focus { outline: none; border-color: var(--cool); background: #fff; box-shadow: 0 0 0 4px var(--cool-soft); }
.pdf-gate__hp { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; clip-path: inset(50%); }
.pdf-gate__error { margin: 0; padding: 10px 14px; border-radius: 12px; background: #FDECEA; color: #A3261B; font-size: .85rem; font-weight: 700; }
.pdf-gate .pdf-btn { justify-content: center; min-height: 50px; font-size: 1rem; border-radius: 14px; }
.pdf-gate__back { justify-self: center; font-size: .85rem; color: var(--muted); }
