/* ==========================================================================
   Public site: logical-direction utilities, typography and EyeVoip brand tweaks.

   Loaded only on public routes (see App.razor), after the template sheets and after
   site-ltr.css. The template is Bootstrap 4.1.1 + Font Awesome Pro 5.12 and is authored
   right-to-left; nothing here is loaded in the admin panel and nothing in the admin's
   theme.css is loaded here.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Logical spacing utilities.

   Bootstrap 4 has no logical properties: .ml-3 is physically left, so it means
   "end" in this RTL-authored template and "start" in LTR. The ported markup uses
   the classes below instead, which mirror themselves and need no direction overrides.
   Same scale as Bootstrap's spacers (0 / .25 / .5 / 1 / 1.5 / 3rem).
   -------------------------------------------------------------------------- */

.ms-0 { margin-inline-start: 0 !important; }
.ms-1 { margin-inline-start: 0.25rem !important; }
.ms-2 { margin-inline-start: 0.5rem !important; }
.ms-3 { margin-inline-start: 1rem !important; }
.ms-4 { margin-inline-start: 1.5rem !important; }
.ms-5 { margin-inline-start: 3rem !important; }
.ms-auto { margin-inline-start: auto !important; }

.me-0 { margin-inline-end: 0 !important; }
.me-1 { margin-inline-end: 0.25rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.me-3 { margin-inline-end: 1rem !important; }
.me-4 { margin-inline-end: 1.5rem !important; }
.me-5 { margin-inline-end: 3rem !important; }
.me-auto { margin-inline-end: auto !important; }

.ps-0 { padding-inline-start: 0 !important; }
.ps-1 { padding-inline-start: 0.25rem !important; }
.ps-2 { padding-inline-start: 0.5rem !important; }
.ps-3 { padding-inline-start: 1rem !important; }
.ps-4 { padding-inline-start: 1.5rem !important; }
.ps-5 { padding-inline-start: 3rem !important; }

.pe-0 { padding-inline-end: 0 !important; }
.pe-1 { padding-inline-end: 0.25rem !important; }
.pe-2 { padding-inline-end: 0.5rem !important; }
.pe-3 { padding-inline-end: 1rem !important; }
.pe-4 { padding-inline-end: 1.5rem !important; }
.pe-5 { padding-inline-end: 3rem !important; }

.text-start { text-align: start !important; }
.text-end { text-align: end !important; }

.float-start { float: inline-start !important; }
.float-end { float: inline-end !important; }

.border-start { border-inline-start: 1px solid rgba(0, 0, 0, 0.1) !important; }
.border-end { border-inline-end: 1px solid rgba(0, 0, 0, 0.1) !important; }

/* Responsive variants, matching the template's use of text-md-right / text-lg-right. */
@media (min-width: 576px) {
    .text-sm-start { text-align: start !important; }
    .text-sm-end { text-align: end !important; }
}

@media (min-width: 768px) {
    .text-md-start { text-align: start !important; }
    .text-md-end { text-align: end !important; }
}

@media (min-width: 992px) {
    .text-lg-start { text-align: start !important; }
    .text-lg-end { text-align: end !important; }
    .float-lg-end { float: inline-end !important; }
}

/* xl (Bootstrap's 1200px tier). Only pe-xl-4 is used today (SiteFooter's address block), but this
   mirrors the ms-/me-/ps-/pe- scale above so the next xl-breakpoint class someone reaches for is
   already defined instead of silently doing nothing. */
@media (min-width: 1200px) {
    .ms-xl-0 { margin-inline-start: 0 !important; }
    .ms-xl-4 { margin-inline-start: 1.5rem !important; }
    .me-xl-0 { margin-inline-end: 0 !important; }
    .me-xl-4 { margin-inline-end: 1.5rem !important; }
    .ps-xl-0 { padding-inline-start: 0 !important; }
    .ps-xl-4 { padding-inline-start: 1.5rem !important; }
    .pe-xl-0 { padding-inline-end: 0 !important; }
    .pe-xl-4 { padding-inline-end: 1.5rem !important; }
}

/* --------------------------------------------------------------------------
   Typography

   The template ships IRANSans in the FaNum cut, which renders Persian-Indic digits -
   right for Persian, wrong for English. The @font-face rules live in the template's
   Style.css; the language switch happens here.
   -------------------------------------------------------------------------- */

html[lang|="en"] body,
html[lang|="en"] .IRANSans_Medium,
html[lang|="en"] .IRANSans_Bold,
html[lang|="en"] .IRANSans_Light {
    /* No "Inter" here: it is neither self-hosted (unlike IRANSans, see Style.css) nor linked from a
       CDN — the admin panel has no network font dependency either, so the public site does not get
       one. The system stack renders correctly everywhere without a flash of invisible text. */
    font-family: "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

html[lang|="en"] .IRANSans_Medium { font-weight: 500; }
html[lang|="en"] .IRANSans_Bold { font-weight: 700; }
html[lang|="en"] .IRANSans_Light { font-weight: 300; }

/* English copy reads better slightly looser than the Persian the template was tuned for. */
html[lang|="en"] p {
    line-height: 1.75;
}

/* --------------------------------------------------------------------------
   Brand
   -------------------------------------------------------------------------- */

:root {
    --site-accent: #1685ff;
    --site-dark: #071525;
    --danger: #b91c1c; /* app.css styles .validation-message with this */
}

.site-logo {
    max-height: 48px;
    width: auto;
}

/* The language switcher sits in the top info strip next to the social icons. */
.site-lang {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.3rem 0.75rem;
}

.site-lang:hover,
.site-lang:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.site-lang[aria-pressed="true"] {
    background: var(--site-accent);
    border-color: var(--site-accent);
    color: var(--site-dark);
}

.site-lang + .site-lang {
    margin-inline-start: 0.35rem;
}

/* The pill is comfortably clickable with a mouse at its native size, but its hit area (padding
   0.3rem + a 0.8rem/1 line) is under the 44px touch target a phone needs — and the off-canvas
   drawer, where a phone visitor actually reaches this control, has the room to spare. */
@media (max-width: 767.98px) {
    .site-lang {
        min-height: 44px;
        padding-inline: 1rem;
    }
}

/* SiteOffCanvas renders the same switcher on the drawer's white panel (.off-canvas-wrap), not the
   dark header strip the colours above were written for — white-on-white was otherwise invisible. */
.off-canvas-wrap .site-lang {
    border-color: rgba(0, 0, 0, 0.2);
    color: #555;
}

.off-canvas-wrap .site-lang:hover,
.off-canvas-wrap .site-lang:focus-visible {
    background: rgba(0, 0, 0, 0.05);
    color: #555;
}

/* --------------------------------------------------------------------------
   Heading outline

   The home page must render exactly one <h1>; AboutIntro.razor owns it. The two sections below
   used to carry their own <h1> for the vendor's font-size/line-height, so demoting them needs an
   equivalent rule under the tag they actually render now — Style.css itself only styles the h1
   element, not the class, for both of these.
   -------------------------------------------------------------------------- */

/* BlogTeasers' section title: was .singletitle h1, now .singletitle h2 (AboutIntro keeps the h1). */
.singletitle h2 {
    font-family: IRANSans_Bold;
    font-size: 1.1rem;
    line-height: 2.3;
}

/* StatsBand's "EyeVoip" brand line: was .banner-bui h1, now .banner-bui h3. */
.banner-bui h3 {
    font-family: IRANSans_Bold;
    font-size: 25px;
}

@media (max-width: 575px) {
    .banner-bui h3 {
        font-size: 20px;
    }
}

/* --------------------------------------------------------------------------
   Hero caption

   The template never actually styled .slide-caption, so the headline rode on the global h2 rule
   — 0.88rem on this theme's customised, non-size-ordered scale (see Style.css). The caption sits
   in normal flow below the slide image (there is no overlay positioning for it in the template),
   on the page's own background, so it keeps the inherited text colour; only size needed fixing.
   -------------------------------------------------------------------------- */

.slide-caption h2 {
    font-size: clamp(1.4rem, 4vw, 2.25rem);
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

.slide-caption p {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
}

/* Redesign: the caption now sits over the artwork, on a bottom gradient, instead of below it on the page background.
   The slide is the positioning context; the gradient keeps white text readable on any image. */
#owl-mainslider .item {
    position: relative;
}

#owl-mainslider .slide-caption-wrap {
    background: linear-gradient(to top, rgba(6, 12, 24, 0.88) 0%, rgba(6, 12, 24, 0.55) 55%, transparent 100%);
    inset-block-end: 0;
    inset-inline: 0;
    padding-block: 3rem 2.75rem;
    pointer-events: none;
    position: absolute;
}

#owl-mainslider .slide-caption {
    color: #fff;
    max-width: 40rem;
    padding-block: 0 !important;
    pointer-events: auto;
    text-align: start;
}

#owl-mainslider .slide-caption h2 {
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

#owl-mainslider .slide-caption p {
    color: rgba(255, 255, 255, 0.85);
}

#owl-mainslider .slide-caption .btn {
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(22, 133, 255, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#owl-mainslider .slide-caption .btn:hover {
    box-shadow: 0 8px 22px rgba(22, 133, 255, 0.5);
    transform: translateY(-2px);
}

/* Round glass arrows and pill dots, in place of the template's bare chevrons. */
#owl-mainslider .owl-nav button.owl-prev,
#owl-mainslider .owl-nav button.owl-next {
    align-items: center;
    backdrop-filter: blur(6px);
    background: rgba(6, 12, 24, 0.45);
    border-radius: 50%;
    display: inline-flex;
    height: 2.75rem;
    justify-content: center;
    margin: 0 1rem;
    top: 40%;
    transition: background 0.15s ease;
    width: 2.75rem;
}

#owl-mainslider .owl-nav button.owl-prev:hover,
#owl-mainslider .owl-nav button.owl-next:hover {
    background: rgba(22, 133, 255, 0.85);
}

#owl-mainslider .owl-nav button.owl-prev { left: 0; }
#owl-mainslider .owl-nav button.owl-next { right: 0; }

#owl-mainslider .owl-nav button:before,
#owl-mainslider .owl-nav button:after {
    font-size: 1.1rem !important;
}

#owl-mainslider .owl-dots {
    inset-block-end: 0.9rem;
    inset-inline: 0;
    position: absolute;
    text-align: center;
}

#owl-mainslider .owl-dots .owl-dot span {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    display: block;
    height: 0.5rem;
    margin: 0 0.25rem;
    transition: width 0.25s ease, background 0.25s ease;
    width: 0.5rem;
}

#owl-mainslider .owl-dots .owl-dot.active span {
    background: #1685ff;
    width: 1.75rem;
}

/* Phones: the template forced every slide to a 300px-tall cover crop, which sliced a dedicated mobile artwork (usually
   square or portrait) down to a thin strip, so an uploaded mobile image looked like it had not applied. Let it keep its
   own proportions, and tuck the caption in tighter. The nav arrows are dropped; swiping and the dots do the job. */
@media (max-width: 767.98px) {
    #owl-mainslider img {
        height: auto !important;
        min-height: 0 !important;
    }

    #owl-mainslider .slide-caption-wrap {
        padding-block: 2rem 2.25rem;
    }

    #owl-mainslider .slide-caption .btn {
        font-size: 0.85rem;
        padding: 0.4rem 1.1rem !important;
    }

    #owl-mainslider .slide-caption p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        margin-bottom: 0.75rem !important;
        overflow: hidden;
    }

    #owl-mainslider .owl-nav {
        display: none;
    }
}

/* Keyboard users must be able to see where they are; the template has no focus styles. */
.main_header a:focus-visible,
footer a:focus-visible,
.site-lang:focus-visible,
.grid:focus-visible {
    outline: 2px solid var(--site-accent);
    outline-offset: 2px;
}

.skip-link {
    background: var(--site-dark);
    color: #fff;
    inset-block-start: -3rem;
    inset-inline-start: 1rem;
    padding: 0.5rem 1rem;
    position: absolute;
    transition: inset-block-start 0.15s ease-in-out;
    z-index: 2000;
}

.skip-link:focus {
    color: #fff;
    inset-block-start: 1rem;
}

/* --------------------------------------------------------------------------
   Detail-page meta line and prose body.

   Shared by BlogPost.razor and DocsDetail.razor, so this lives here rather than in either
   page's scoped CSS. MarkdownRenderer emits raw HTML (MarkupString), not Razor markup, so a
   component-scoped file could not reach it without ::deep anyway — a plain global selector
   does the same job with no extra syntax.
   -------------------------------------------------------------------------- */

.site-post-meta {
    color: #7b8794;
    font-size: 0.85rem;
}

.site-post-meta a {
    color: inherit;
    text-decoration: underline;
}

.site-post-meta a:hover {
    color: var(--site-accent);
}

.site-prose {
    line-height: 2;
}

.site-prose h1,
.site-prose h2,
.site-prose h3 {
    font-family: IRANSans_Bold;
    line-height: 1.6;
    margin-block: 1.5rem 0.75rem;
}

.site-prose h1 { font-size: 1.5rem; }
.site-prose h2 { font-size: 1.25rem; }
.site-prose h3 { font-size: 1.1rem; }

.site-prose p {
    margin-bottom: 1rem;
}

.site-prose ul,
.site-prose ol {
    margin-bottom: 1rem;
    padding-inline-start: 1.5rem;
}

.site-prose li {
    margin-bottom: 0.25rem;
}

.site-prose blockquote {
    border-inline-start: 3px solid var(--site-accent);
    color: #55606a;
    font-style: italic;
    margin-bottom: 1rem;
    padding-inline-start: 1rem;
}

/* Code stays left-to-right even on the Persian page, and scrolls instead of stretching. */
.site-prose pre {
    background: #f5f7fa;
    border-radius: 0.5rem;
    direction: ltr;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding: 1rem;
    text-align: left;
}

.site-prose pre code {
    background: none;
    color: #24292e;
    font-size: 0.85rem;
    padding: 0;
    white-space: pre;
}

.site-prose :not(pre) > code {
    background: #f2f4f7;
    border-radius: 0.25rem;
    font-size: 0.9em;
    padding: 0.1rem 0.35rem;
}

/* --------------------------------------------------------------------------
   FAQ accordion (native <details>, see FaqSection.razor and Pages/Site/Faq.razor).

   The template never styled this - it shipped as a JS-collapsible widget this port replaced
   with <details> for keyboard access and no re-init after a Blazor re-render - so without this
   block it renders as a bare browser disclosure triangle next to the unstyled .fa-plus icon.
   -------------------------------------------------------------------------- */

.site-faq {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem 1.25rem;
}

.site-faq summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    padding-block: 1rem;
}

.site-faq summary::-webkit-details-marker {
    display: none;
}

.site-faq summary span {
    font-family: IRANSans_Medium;
}

.site-faq summary i {
    color: var(--site-accent);
    flex-shrink: 0;
    margin-inline-start: 1rem;
    transition: transform 0.15s ease-in-out;
}

.site-faq[open] summary i {
    transform: rotate(45deg);
}

.site-faq-answer {
    color: #55606a;
    padding-block-end: 1.25rem;
}

/* Placeholder shown while the content API call is in flight. */
.site-skeleton {
    animation: site-pulse 1.4s ease-in-out infinite;
    background: #e9edf3;
    border-radius: 0.5rem;
}

@keyframes site-pulse {
    50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
    .site-skeleton { animation: none; }
}

/* The hero holds its height before the slider initialises, so the page does not jump. */
#owl-mainslider:not(.owl-loaded) .item:not(:first-child) {
    display: none;
}

/* --------------------------------------------------------------------------
   Blazor chrome on public pages (the admin's copies live in MainLayout.razor.css)
   -------------------------------------------------------------------------- */

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    color: #3d2f00;
    color-scheme: light only;
    display: none;
    inset-inline-start: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    inset-block-start: 0.5rem;
    inset-inline-end: 0.75rem;
    position: absolute;
}

/* ---- Mobile header: the menu button and the search icon -------------------------------------------------------------
   The template pins BOTH to the same physical corner (.mobile-nav-button a: left/right 0 + 50px padding; .m_search: left
   or right 10px), so on a phone they were drawn on top of each other and looked like one garbled icon. Below 998px, where
   the desktop menu is hidden, each gets its own square, side by side, at the inline END of the bar (the logo is at the
   inline start: right in Persian, left in English). The template's physical offsets are reset first and logical ones
   are used, so one rule serves both directions. */
@media (max-width: 998px) {
    .mobnav .mobile-nav-button a,
    .mobnav .m_search {
        align-items: center !important;
        display: inline-flex !important;
        height: 2.75rem !important;
        inset-inline-start: auto !important;
        justify-content: center !important;
        left: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        right: auto !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 2.75rem !important;
    }

    /* The menu button takes the corner... */
    .mobnav .mobile-nav-button a {
        inset-inline-end: 0.25rem !important;
    }

    .mobnav .mobile-nav-button i {
        margin: 0 !important;
    }

    /* ...and the search icon sits one square further in. */
    .mobnav .m_search {
        border-radius: 0 !important;
        inset-inline-end: 3rem !important;
    }

    .mobnav .m_search i {
        line-height: 1;
    }
}

/* The drawer's open and close controls are role="button" anchors without an href (see SiteHeader), so they need the
   pointer cursor and a visible keyboard focus that a link would have given them. */
#of-trigger,
#of-close-off-canvas {
    cursor: pointer;
}

#of-trigger:focus-visible,
#of-close-off-canvas:focus-visible {
    outline: 2px solid #1685ff;
    outline-offset: 2px;
}

/* The hero image sits in a <picture> so phones can get their own artwork; keep it a block like the bare <img> was. */
#owl-mainslider picture { display: block; }

/* ---- Hero motion ------------------------------------------------------------------------------------------------------
   A cinematic feel with no extra download: the visible slide's picture drifts in slowly (Ken Burns) and its caption
   rises into place. Owl marks the visible slide .active, so the animation restarts on every change. The picture is
   clipped by its slide so the zoom never spills. Nothing moves for visitors who ask for reduced motion. */
#owl-mainslider .owl-item .item {
    overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
    #owl-mainslider .owl-item.active picture img,
    #owl-mainslider .owl-item.active > .item > img,
    #owl-mainslider .owl-item.active > .item > a > img {
        animation: hero-drift 7s ease-out both;
        transform-origin: 60% 40%;
    }

    #owl-mainslider .owl-item.active .slide-caption > * {
        animation: hero-rise 0.9s cubic-bezier(0.22, 0.8, 0.3, 1) both;
    }

    #owl-mainslider .owl-item.active .slide-caption > :nth-child(2) { animation-delay: 0.15s; }
    #owl-mainslider .owl-item.active .slide-caption > :nth-child(3) { animation-delay: 0.3s; }
}

@keyframes hero-drift {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

@keyframes hero-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}
