/* AviSoft - Custom Styles */

html {
    scroll-behavior: smooth;
}

/* Fade-in animation on scroll */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #3B3085, #2BB5A0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero gradient overlay */
.hero-gradient {
    background: linear-gradient(135deg, #3B3085 0%, #2A2260 50%, #1E8C7A 100%);
}

/* Mega dropdown */
.mega-dropdown {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
}

.mega-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mobile menu */
.mobile-menu {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

[dir="rtl"] .mobile-menu {
    transform: translateX(-100%);
}

.mobile-menu.active {
    transform: translateX(0);
}

/* Carousel */
.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-dot {
    transition: all 0.3s ease;
}

.carousel-dot.active {
    width: 2rem;
    border-radius: 9999px;
}

/* FAQ Accordion */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.open {
    max-height: 500px;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-icon.rotated {
    transform: rotate(180deg);
}

/* Pricing tabs */
.pricing-tab {
    transition: all 0.3s ease;
}

.pricing-tab.active {
    color: #2BB5A0;
    border-bottom-color: #2BB5A0;
}

/* Card hover lift */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
}

/* Sticky header shadow */
.header-scrolled {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Blog category filter */
.category-pill {
    transition: all 0.3s ease;
}

.category-pill.active {
    background-color: #2BB5A0;
    color: white;
}

/* RTL Arabic typography */
[dir="rtl"] body {
    line-height: 1.8;
}

/* Focus styles */
:focus-visible {
    outline: 2px solid #2BB5A0;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    header, footer, .no-print {
        display: none !important;
    }
}

/* ==========================================================================
   AviSoft Technical Publishing — dark book-site theme
   Everything above this line belongs to the archived FR/AR software site and
   is intentionally left untouched. Rules below are additive.
   ========================================================================== */

/* Paint the page dark on the very first frame. The Tailwind CDN is
   render-blocking JS that resolves utility classes at runtime, so without a
   real stylesheet setting this, every navigation flashes white before the
   dark theme lands. :has() scopes it to the book site so the archived
   light-themed FR/AR pages are unaffected. */
html:has(> body.theme-books),
html:has(> body.theme-books) body {
    background-color: #0D1117;
}

/* The shared `.mobile-menu` parks the closed drawer at translateX(100%). Being
   `position: fixed`, it escapes body's clipping and widens the document, giving
   phones a horizontal scrollbar. Clipping the root removes the scrollbar but
   breaks `position: sticky` on the header, so instead the closed drawer rests
   INSIDE the viewport and is hidden with opacity + visibility. No off-screen
   box, so nothing to overflow, and the sticky header is untouched.
   `visibility` also keeps keyboard focus out of the closed menu, which the
   translate-only version allowed. */
.theme-books .mobile-menu {
    transform: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.theme-books .mobile-menu.active {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

/* No-JS fallback: if the reveal observer never runs, show the content rather
   than leaving it stuck at opacity:0. Paired with the `js` class set in
   tailwind-config.js. */
html:not(.js) .fade-in-up {
    opacity: 1;
    transform: none;
}

.theme-books {
    background-color: #0D1117;
    color: #C9D1D9;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.theme-books ::selection {
    background: rgba(139, 108, 240, 0.35);
    color: #fff;
}

/* `components-books.js` injects the sticky <header> into <div id="header">.
   A sticky element can only travel within its containing block, and that
   wrapper is exactly as tall as the header — so the header had zero sticky
   range and scrolled away immediately. `display: contents` removes the
   wrapper box from layout, making <header> a direct child of <body> so it
   sticks against the full page height. Same for the footer wrapper. */
.theme-books #header,
.theme-books #footer {
    display: contents;
}

/* Dark sticky-header shadow (overrides the light one for this theme) */
.theme-books .header-scrolled {
    box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.8);
}

/* Hero backdrop: soft purple/orange glow over the ink ground */
.hero-books {
    background:
        radial-gradient(60rem 30rem at 12% -10%, rgba(139, 108, 240, 0.20), transparent 60%),
        radial-gradient(45rem 25rem at 92% 8%, rgba(245, 162, 107, 0.13), transparent 62%),
        #0D1117;
}

.section-glow {
    background:
        radial-gradient(40rem 20rem at 50% 0%, rgba(139, 108, 240, 0.09), transparent 65%),
        #0D1117;
}

/* Purple → orange display gradient, matching the cover treatment */
.gradient-brand {
    background: linear-gradient(100deg, #8B6CF0 0%, #A88FF5 45%, #F5A26B 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Thin orange rule used under headings on the covers */
.rule-orange::after {
    content: "";
    display: block;
    width: 3.5rem;
    height: 2px;
    margin-top: 1rem;
    background: #F5A26B;
    border-radius: 2px;
}

.rule-orange.rule-center::after {
    margin-left: auto;
    margin-right: auto;
}

/* Cover art: subtle lift + edge so dark covers separate from a dark page */
.cover-shadow {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 24px 48px -20px rgba(0, 0, 0, 0.85),
        0 0 0 1px #232A34;
    border-radius: 6px;
}

.cover-tilt {
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.cover-tilt:hover {
    transform: translateY(-6px) rotate(-0.6deg);
}

/* Table-of-contents accordion: the default 500px cap is far too short for a
   25-chapter part list, so give TOC panels their own ceiling. */
.toc-accordion .accordion-content.open {
    max-height: 240rem;
}

/* Inline code must not break mid-token. Without this, `record class` wraps
   between the two words on narrow screens and the surrounding prose goes
   ragged. Scoped with :not(pre) so real code blocks still wrap normally. */
.theme-books :not(pre) > code {
    white-space: nowrap;
}

/* Version / tech chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid #232A34;
    background: #161B22;
    color: #C9D1D9;
    font-size: 0.75rem;
    line-height: 1;
    white-space: nowrap;
}

/* Code sample block */
.code-block {
    background: #11161D;
    border: 1px solid #232A34;
    border-radius: 0.75rem;
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.7;
}

.code-block .tok-key { color: #8B6CF0; }
.code-block .tok-type { color: #F5A26B; }
.code-block .tok-str { color: #7EE0C0; }
.code-block .tok-com { color: #6B7684; font-style: italic; }

/* Dark focus ring */
.theme-books :focus-visible {
    outline: 2px solid #8B6CF0;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Respect reduced-motion for every animation on the site */
@media (prefers-reduced-motion: reduce) {
    .fade-in-up {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .cover-tilt,
    .card-hover,
    .accordion-content,
    .mega-dropdown,
    .mobile-menu {
        transition: none;
    }
    html {
        scroll-behavior: auto;
    }
}
