/* =========================================================
   Fonts
   ========================================================= */

@font-face {
    font-family: "IRANSansXFaNum";
    src: url("../fonts/IRANSansXFaNum/IRANSansXFaNum-regular.5d6bb45f442a.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IRANSansXFaNum";
    src: url("../fonts/IRANSansXFaNum/IRANSansXFaNum-medium.4a471769956e.woff") format("woff");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IRANSansXFaNum";
    src: url("../fonts/IRANSansXFaNum/IRANSansXFaNum-bold.8e724a4a15cc.woff") format("woff");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* =========================================================
   Shared project variables
   ========================================================= */

:root {
    --kh-radius-sm: 0.75rem;
    --kh-radius: 1rem;
    --kh-header-height: 4.25rem;
    --kh-transition: 150ms ease;
}


/* =========================================================
   Base
   ========================================================= */

html {
    max-width: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    max-width: 100%;
    overflow-x: clip;

    font-family:
        "IRANSansXFaNum",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;

    font-size: 0.95rem;
    line-height: 1.85;
    text-rendering: optimizeLegibility;
}

a {
    text-underline-offset: 0.2em;
}

button,
input,
select,
textarea {
    font: inherit;
}

img,
svg,
picture,
figure,
iframe,
video {
    max-width: 100%;
}

picture,
picture>img {
    display: block;
}

.min-w-0 {
    min-width: 0 !important;
}


/* =========================================================
   Accessibility
   ========================================================= */

.visually-hidden-focusable {
    z-index: 2000;

    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;

    border-radius: var(--kh-radius-sm);

    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    box-shadow: var(--bs-box-shadow);
}

:where(a,
    button,
    input,
    select,
    textarea,
    [tabindex]):focus-visible {
    outline: 3px solid rgba(var(--bs-primary-rgb), 0.35);
    outline-offset: 3px;
}


/* =========================================================
   Main layout
   ========================================================= */

.kh-main {
    min-height: 65vh;
    overflow-x: clip;
}

.kh-content-page {
    width: 100%;
    max-width: 900px;
    min-width: 0;
    margin-inline: auto;
}


/* =========================================================
   Header
   ========================================================= */

.kh-header {
    z-index: 1080;
}

.kh-navbar,
.kh-header .navbar {
    min-height: var(--kh-header-height);
}

.kh-navbar {
    padding-block: 0.4rem;
}

.kh-navbar>.container {
    flex-wrap: nowrap;
}


/* =========================================================
   Header actions
   ========================================================= */

.kh-header-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.4rem;
}

.kh-header-actions .kh-header-action {
    display: inline-flex;
    width: 2.375rem;
    height: 2.375rem;
    flex: 0 0 2.375rem;

    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 0;

    border-radius: 50%;
    line-height: 1;
}

.kh-header-actions .kh-header-action i,
.kh-theme-icon {
    display: block;
    margin: 0;
    font-size: 1rem;
    line-height: 1;
}


/* =========================================================
   Brand
   ========================================================= */

.navbar-brand {
    min-width: 0;
    margin-inline-end: 1rem;

    color: var(--bs-body-color);

    font-size: 0.95rem;
    font-weight: 700;
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: var(--bs-body-color);
}

.kh-brand-logo {
    display: block;

    width: auto;
    max-width: 2rem;
    height: 2rem;
    flex: 0 0 auto;

    object-fit: contain;
}

.kh-logo {
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
}

.kh-brand-title {
    display: block;
    overflow: hidden;

    max-width: 10rem;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.kh-logo-dark,
.kh-brand-logo-dark {
    display: none;
}

[data-bs-theme="dark"] .kh-logo-light,
[data-bs-theme="dark"] .kh-brand-logo-light {
    display: none;
}

[data-bs-theme="dark"] .kh-logo-dark,
[data-bs-theme="dark"] .kh-brand-logo-dark {
    display: block;
}


/* =========================================================
   Desktop navigation
   ========================================================= */

.kh-desktop-nav {
    min-width: 0;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.1rem;
    white-space: nowrap;
}

.kh-desktop-nav .nav-link {
    padding: 0.5rem 0.55rem;

    border-radius: 0.55rem;

    color: var(--bs-body-color);

    font-size: 0.855rem;
    font-weight: 500;
}

.kh-desktop-nav .nav-link:hover,
.kh-desktop-nav .nav-link:focus-visible {
    color: var(--bs-primary);
    background: var(--bs-tertiary-bg);
}

.kh-desktop-nav .nav-link.active {
    color: var(--bs-primary-text-emphasis);
    font-weight: 700;
    background: var(--bs-primary-bg-subtle);
}

.kh-desktop-nav button.nav-link {
    border: 0;
    background-color: transparent;
}

.kh-desktop-nav .dropdown-toggle::after {
    margin-inline-start: 0.35rem;
}


/* =========================================================
   Desktop dropdown
   ========================================================= */

.kh-desktop-dropdown {
    width: 15rem;
    padding: 0.45rem;

    border-radius: 0.85rem;
    box-shadow: var(--bs-box-shadow);
}

.kh-desktop-dropdown .dropdown-item {
    display: flex;
    min-height: 2.75rem;

    align-items: center;
    gap: 0.65rem;

    padding: 0.55rem 0.75rem;

    border-radius: 0.6rem;

    font-size: 0.875rem;
}

.kh-desktop-dropdown .dropdown-item i {
    width: 1.25rem;
    flex: 0 0 1.25rem;

    color: var(--bs-secondary-color);
    text-align: center;
}

.kh-desktop-dropdown .dropdown-item:hover,
.kh-desktop-dropdown .dropdown-item:focus {
    background: var(--bs-tertiary-bg);
}

.kh-desktop-dropdown .dropdown-item.active {
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
}

.kh-desktop-dropdown .dropdown-item.active i {
    color: var(--bs-primary);
}


/* =========================================================
   Mobile header
   ========================================================= */

.kh-mobile-header {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 3.5rem;

    align-items: center;
    gap: 0.5rem;
}

.kh-mobile-menu-button {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;

    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 50%;

    color: var(--bs-body-color);
    background: transparent;
}

.kh-mobile-menu-button:hover,
.kh-mobile-menu-button:focus-visible {
    color: var(--bs-primary);
    background: var(--bs-tertiary-bg);
}

.kh-mobile-menu-button i {
    display: block;
    margin: 0;

    font-size: 1.5rem;
    line-height: 1;
}

.kh-mobile-brand {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;

    align-items: center;
    gap: 0.45rem;

    color: var(--bs-body-color);
    text-align: right;
    text-decoration: none;
}

.kh-mobile-brand:hover,
.kh-mobile-brand:focus {
    color: var(--bs-body-color);
}

.kh-mobile-brand-title {
    display: block;
    overflow: hidden;

    max-width: 100%;

    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.kh-mobile-header .kh-brand-logo {
    max-width: 1.85rem;
    height: 1.85rem;
}

.kh-mobile-header .kh-header-actions {
    margin-inline-start: auto;
}

.kh-mobile-header .kh-header-action {
    width: 2.35rem;
    height: 2.35rem;
    flex-basis: 2.35rem;
}


/* =========================================================
   Mobile offcanvas navigation
   ========================================================= */

.kh-mobile-nav {
    --bs-offcanvas-width: min(19rem, 88vw);

    z-index: 1100;
    width: var(--bs-offcanvas-width);
}

.offcanvas-backdrop {
    z-index: 1090;
}

.kh-mobile-nav-header {
    min-height: 4.25rem;
    padding: 0.7rem 0.9rem;
}

.kh-mobile-nav-logo {
    display: block;

    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;

    object-fit: contain;
}

.kh-mobile-nav-description {
    overflow: hidden;

    max-width: 12rem;

    color: var(--bs-secondary-color);

    font-size: 0.7rem;
    line-height: 1.5;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.kh-mobile-nav .offcanvas-body {
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

.kh-mobile-nav-list {
    display: grid;
    gap: 0.1rem;

    margin: 0;
    padding: 0.45rem;

    list-style: none;
}

.kh-mobile-nav-list a {
    display: flex;
    min-height: 2.7rem;

    align-items: center;
    gap: 0.7rem;

    padding: 0.48rem 0.7rem;

    border-radius: 0.65rem;

    color: var(--bs-body-color);

    font-size: 0.825rem;
    font-weight: 500;
    line-height: 1.4;

    text-decoration: none;
}

.kh-mobile-nav-list a:hover,
.kh-mobile-nav-list a:focus-visible {
    color: var(--bs-primary);
    background: var(--bs-tertiary-bg);
}

.kh-mobile-nav-list a.active {
    color: var(--bs-primary-text-emphasis);
    font-weight: 700;
    background: var(--bs-primary-bg-subtle);
}

.kh-mobile-nav-list i {
    width: 1.3rem;
    flex: 0 0 1.3rem;

    color: var(--bs-secondary-color);

    font-size: 1rem;
    line-height: 1;
    text-align: center;
}

.kh-mobile-nav-list a.active i {
    color: var(--bs-primary);
}

.kh-mobile-nav-divider {
    height: 1px;
    margin: 0.3rem 0.7rem;
    background: var(--bs-border-color);
}


/* =========================================================
   Breadcrumbs
   ========================================================= */

.breadcrumb a,
.breadcrumb a:hover,
.breadcrumb a:focus,
.breadcrumb a:active {
    text-decoration: none;
}


/* =========================================================
   Sticky archive toolbars
   ========================================================= */

.kh-book-toolbar {
    z-index: 1030;
}


/* =========================================================
   Home hero
   ========================================================= */

.kh-hero {
    background:
        linear-gradient(180deg,
            var(--bs-tertiary-bg) 0%,
            rgba(var(--bs-tertiary-bg-rgb), 0) 100%);
}

.kh-hero h1 {
    line-height: 1.5;
}


/* =========================================================
   Cards
   ========================================================= */

.card,
.kh-section-card {
    border-radius: var(--kh-radius);
}

.card-body,
.flex-grow-1 {
    min-width: 0;
}

.kh-section-card {
    height: 100%;

    transition:
        transform var(--kh-transition),
        border-color var(--kh-transition),
        box-shadow var(--kh-transition);
}

.kh-section-card:hover {
    border-color: var(--bs-primary);
}

.kh-section-card:focus-within {
    border-color: var(--bs-primary);
    box-shadow:
        0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.12);
}

.kh-section-card a {
    color: inherit;
    text-decoration: none;
}

.kh-section-icon {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;

    align-items: center;
    justify-content: center;

    border-radius: 0.75rem;

    color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.1);

    font-size: 1.25rem;
}


/* =========================================================
   Error pages
   ========================================================= */

.kh-error-page {
    max-width: 38rem;
    padding-block: 3rem;
}

.kh-error-code {
    margin-bottom: 1rem;

    color: var(--bs-primary);

    font-size: clamp(4rem, 15vw, 7rem);
    font-weight: 700;
    line-height: 1;

    opacity: 0.18;
}


/* =========================================================
   Prose
   ========================================================= */

.kh-prose {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.kh-prose p,
.kh-prose ul,
.kh-prose ol,
.kh-prose table,
.kh-prose blockquote {
    margin-block-end: 1.25rem;
}

.kh-prose h2,
.kh-prose h3,
.kh-prose h4,
.kh-prose h5,
.kh-prose h6 {
    margin-block-start: 2rem;
    margin-block-end: 1rem;
    line-height: 1.6;
}

.kh-prose img {
    display: block;

    max-width: 100%;
    height: auto;

    margin-inline: auto;

    border-radius: var(--kh-radius);
}

.kh-prose table {
    width: 100%;
}

.kh-prose pre,
.kh-content-block pre {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.kh-prose code,
.kh-content-block code {
    max-width: 100%;
}


/* =========================================================
   Structured content
   ========================================================= */

.kh-content-blocks {
    margin-block-start: 2.5rem;
}

.kh-content-block {
    min-width: 0;
    margin-block: 2rem;
    overflow-wrap: anywhere;
}

.kh-content-block> :first-child {
    margin-block-start: 0;
}

.kh-content-block> :last-child {
    margin-block-end: 0;
}

.kh-content-figure {
    margin-block: 1.5rem;
}

.kh-content-figure img {
    display: block;

    max-width: 100%;
    height: auto;

    margin-inline: auto;

    border-radius: var(--kh-radius);
}

.kh-content-figure figcaption {
    margin-block-start: 0.75rem;

    color: var(--bs-secondary-color);

    font-size: 0.875rem;
    text-align: center;
}

.kh-content-list {
    display: grid;
    gap: 0.5rem;
    padding-inline-start: 1.5rem;
}

.kh-content-table {
    margin-block: 1.5rem;
    border-radius: var(--kh-radius-sm);
}

.kh-content-table caption {
    color: var(--bs-secondary-color);
}


/* =========================================================
   Embedded video
   ========================================================= */

.kh-content-video {
    margin-block: 1.5rem;
}

.kh-content-video-frame {
    overflow: hidden;

    border: 1px solid var(--bs-border-color);
    border-radius: var(--kh-radius);

    background: #000;
}

.kh-content-video-frame iframe {
    display: block;
    width: 100%;
    border: 0;
}


/* =========================================================
   Callouts
   ========================================================= */

.kh-callout {
    display: flex;
    gap: 0.875rem;

    padding: 1rem 1.125rem;

    border: 1px solid var(--bs-border-color);
    border-inline-start-width: 0.3rem;
    border-radius: var(--kh-radius-sm);

    background: var(--bs-tertiary-bg);
}

.kh-callout>.bi {
    flex: 0 0 auto;

    margin-block-start: 0.25rem;

    font-size: 1.1rem;
}

.kh-callout-note {
    border-inline-start-color: var(--bs-info);
}

.kh-callout-warning {
    border-inline-start-color: var(--bs-warning);
}

.kh-callout .kh-prose> :last-child {
    margin-bottom: 0;
}


/* =========================================================
   FAQ and sources
   ========================================================= */

.kh-faq-section,
.kh-sources-section {
    margin-block-start: 3rem;
}

.kh-faq-list {
    display: grid;
    gap: 0.75rem;
}

.kh-faq-item {
    overflow: hidden;

    border: 1px solid var(--bs-border-color);
    border-radius: var(--kh-radius-sm);

    background: var(--bs-body-bg);
}

.kh-faq-item summary {
    padding: 1rem 1.125rem;

    cursor: pointer;
    font-weight: 700;
}

.kh-faq-item[open] summary {
    border-bottom: 1px solid var(--bs-border-color);
}

.kh-faq-answer {
    padding: 1rem 1.125rem;
}

.kh-faq-answer> :last-child {
    margin-bottom: 0;
}

.kh-source-list {
    display: grid;
    gap: 0.875rem;
    padding-inline-start: 1.5rem;
}

.kh-review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

    margin-block-start: 2.5rem;
    padding-block-start: 1rem;

    border-top: 1px solid var(--bs-border-color);
}


/* =========================================================
   Forms
   ========================================================= */

.form-control,
.form-select,
textarea {
    border-radius: var(--kh-radius-sm);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(var(--bs-primary-rgb), 0.65);
    box-shadow:
        0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.12);
}

textarea {
    min-height: 8rem;
    resize: vertical;
}

.btn {
    border-radius: var(--kh-radius-sm);
}


/* =========================================================
   Alerts
   ========================================================= */

.alert {
    border-radius: var(--kh-radius-sm);
}


/* =========================================================
   Responsive safety
   ========================================================= */

.kh-publication-detail-container,
.kh-content-page,
.kh-content-block,
.kh-prose,
.card-body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.table-responsive {
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   Footer
   ========================================================= */

.kh-footer {
    background: var(--bs-tertiary-bg);
}

.kh-footer a {
    color: var(--bs-body-color);
    text-decoration: none;
}

.kh-footer a:hover,
.kh-footer a:focus {
    color: var(--bs-primary);
}

.kh-footer-description {
    max-width: 38rem;
}


/* =========================================================
   Mobile and tablet
   ========================================================= */

@media (max-width: 991.98px) {

    .kh-navbar,
    .kh-header .navbar {
        min-height: 4rem;
        padding-block: 0.25rem;
    }

    .kh-header {
        z-index: 1080;
    }

    .navbar-collapse {
        padding-block-start: 0.75rem;
        padding-block-end: 0.5rem;
    }

    .kh-book-toolbar {
        top: 4rem;
        z-index: 1030;
    }
}

@media (max-width: 575.98px) {
    .display-6 {
        font-size: clamp(1.65rem, 7vw, 2rem);
    }

    .lead {
        font-size: 1rem;
    }
}


/* =========================================================
   Desktop
   ========================================================= */

@media (min-width: 992px) {
    body {
        font-size: 1rem;
    }

    .navbar-brand {
        font-size: 0.95rem;
    }
}

@media (min-width: 1200px) {
    .kh-brand-title {
        max-width: 13rem;
    }

    .kh-desktop-nav .nav-link {
        padding-inline: 0.65rem;
        font-size: 0.88rem;
    }
}


/* =========================================================
   Short mobile screens
   ========================================================= */

@media (max-height: 700px) {
    .kh-mobile-nav-header {
        min-height: 3.75rem;
        padding-block: 0.5rem;
    }

    .kh-mobile-nav-description {
        display: none;
    }

    .kh-mobile-nav-list {
        padding-block: 0.3rem;
    }

    .kh-mobile-nav-list a {
        min-height: 2.45rem;
        padding-block: 0.38rem;
        font-size: 0.78rem;
    }

    .kh-mobile-nav-list i {
        font-size: 0.95rem;
    }
}


/* =========================================================
   Hover-capable devices
   ========================================================= */

@media (hover: hover) and (pointer: fine) {
    .kh-section-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--bs-box-shadow-sm);
    }
}


/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}