/* =========================================================
   ashrafmag — site stylesheet
   Sections: tokens · base · layout · header/nav · hero ·
   buttons · cards · slider · gallery · lightbox · footer ·
   currency selector · utilities · responsive
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --accent: #2b7cff;
    --primary: var(--accent);
    --muted: #666;
    --maxw: 1100px;
    --radius: 12px;
    --gap: 18px;
    --section-gap: 32px;
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: #111;
    line-height: 1.5;
}

img {
    max-width: 100%;
}

/* Browsers give <figure> a 40px left/right margin; the galleries use it. */
figure {
    margin: 0;
}

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

:focus-visible {
    outline: 3px solid rgba(43, 124, 255, 0.55);
    outline-offset: 2px;
}

.muted {
    color: var(--muted);
}

/* Skip link: hidden until a keyboard user tabs to it */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    z-index: 2000;
    padding: 10px 14px;
    background: #fff;
    color: #111;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    left: 12px;
    top: 12px;
}

/* ---------- Layout ---------- */
.wrap {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 20px;
}

main {
    flex: 1 0 auto;
}

/* One rule controls the space between page sections */
main > section,
main > .card {
    margin-top: var(--section-gap);
}

main > section.hero {
    margin-top: 0;
}

/* Headings and paragraphs: predictable spacing */
h1,
h2,
h3,
h4 {
    line-height: 1.25;
}

main h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
}

main h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

main p {
    margin: 0 0 12px;
}

/* ---------- Header + navigation ---------- */
.site-header {
    position: relative;
    z-index: 50;
    background: linear-gradient(180deg, #fff, #f7f8fb);
    border-bottom: 1px solid #e6e9ef;
}

/* The header is allowed to be wider than the page content so the full menu fits */
.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1280px;
}

#logo {
    flex: 0 0 auto;
}

#logo a {
    display: block;
}

#logo img {
    display: block;
    height: 56px;
    width: auto;
}

#site-nav {
    flex: 0 0 auto;
}

/* "#site-nav > ul" is the top-level menu only (not the dropdowns) */
#site-nav > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
}

#site-nav > ul a {
    display: inline-block;
    padding: 10px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

#site-nav > ul a:hover,
#site-nav > ul a.active {
    background: #eef4ff;
    color: var(--accent);
}

.has-sub {
    position: relative;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 40;
    min-width: 200px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #e6e9ef;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, 0.08);
}

#site-nav > ul .submenu a {
    display: block;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 500;
}

.has-sub.open > .submenu {
    display: block;
}

/* Hover opens the dropdown only on devices that really hover (not phones) */
@media (hover: hover) and (min-width: 721px) {
    .has-sub:hover > .submenu {
        display: block;
    }
}

.nav-toggle {
    display: none;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e6e9ef;
    border-radius: 10px;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px 0;
    background: #333;
}

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 28px;
    align-items: start;
    padding: 28px 0;
}

.hero.single {
    grid-template-columns: 1fr;
}

.hero-left {
    padding: 28px;
    background: linear-gradient(180deg, #fff, #fcfdff);
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, 0.06);
}

.hero-left h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.hero-left p {
    margin: 0 0 16px;
    color: var(--muted);
}

.hero-left > :last-child {
    margin-bottom: 0;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 10px 14px;
    background: var(--accent);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.3;
}

.btn:hover {
    filter: brightness(0.94);
}

.btn.ghost {
    background: transparent;
    color: var(--accent);
    border-color: rgba(43, 124, 255, 0.12);
}

.btn.ghost:hover {
    background: #eef4ff;
    filter: none;
}

/* ---------- Cards ---------- */
.card {
    padding: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(16, 24, 40, 0.04);
}

.card > :first-child {
    margin-top: 0;
}

.card > :last-child {
    margin-bottom: 0;
}

.card h3 {
    margin-top: 0;
}

.card h4 {
    margin: 8px 0;
}

.card ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.card img {
    height: auto;
}

/* Lists whose items already start with a check mark */
.card ul.checks {
    list-style: none;
    padding-left: 0;
}

.checks li {
    padding-left: 1.5em;
    text-indent: -1.5em;
}

/* Grid of cards: 3 or 4 fit across, wrap on smaller screens */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
}

.cards.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cards.pricing {
    max-width: 760px;
}

.service p {
    color: var(--muted);
}

/* ---------- Slider ---------- */
.slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
}

.slides {
    display: flex;
    width: 100%;
    transition: transform 400ms ease;
}

.slide {
    min-width: 100%;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.slide .media {
    height: 220px;
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
}

.slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide h3 {
    margin: 0 0 6px;
}

.slide p {
    margin: 0;
}

.slider-controls {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.slider-controls button {
    pointer-events: auto;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 0;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.08);
    cursor: pointer;
}

/* ---------- Image gallery ---------- */
.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 0;
}

.gallery img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(16, 24, 40, 0.16);
}

/* ---------- Lightbox (opened by js/lightbox.js) ---------- */
html.lb-open,
html.lb-open body {
    overflow: hidden;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 72px;
    background: rgba(12, 14, 22, 0.92);
    animation: lb-fade 0.18s ease-out;
}

.lightbox[hidden] {
    display: none;
}

.lb-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.lb-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 170px);
    max-height: calc(100dvh - 170px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: opacity 0.15s ease;
}

.lightbox.is-loading .lb-img {
    opacity: 0.25;
}

.lb-caption {
    max-width: 70ch;
    color: #e8ebf2;
    font-size: 14px;
    text-align: center;
}

.lb-caption:empty {
    display: none;
}

.lb-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: 0;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.lb-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}

.lightbox :focus-visible {
    outline-color: #fff;
}

.lb-close {
    top: 14px;
    right: 14px;
}

.lb-nav {
    top: 50%;
    transform: translateY(-50%);
}

.lb-prev {
    left: 14px;
}

.lb-next {
    right: 14px;
}

.lb-count {
    position: absolute;
    top: 24px;
    left: 20px;
    color: #cfd5e3;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

@keyframes lb-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: var(--section-gap);
    border-top: 1px solid #e9edf3;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 18px;
    padding-bottom: 18px;
}

/* ---------- Currency selector (used by js/pricing.js) ---------- */
.currency-select {
    --currency-accent: #6c5ce7;
    position: relative;
    display: inline-block;
}

.currency-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1.5px solid var(--currency-accent);
    border-radius: 999px;
    background: #fff;
    color: var(--currency-accent);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.currency-select-btn .chevron {
    transition: transform 0.15s;
}

.currency-select-btn[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.currency-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    min-width: 100%;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.currency-select-menu[hidden] {
    display: none;
}

.currency-select-menu li {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
}

.currency-select-menu li:hover {
    background: #f5f3ff;
}

.currency-select-menu li.selected {
    color: var(--currency-accent);
    font-weight: 600;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .cards.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- Collapsed (hamburger) menu ----------
   Used on phones, and by js/main.js (class "nav-collapsed" on <html>) on any
   screen where the full menu does not fit. Keep both copies in sync. */
@media (max-width: 720px) {
    #site-nav {
        margin-left: auto;
    }

    .nav-toggle {
        display: block;
    }

    #site-nav > ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 20px;
        right: 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        max-height: calc(100vh - 100px);
        padding: 10px;
        overflow-y: auto;
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    }

    #site-nav > ul.open {
        display: flex;
    }

    .submenu {
        position: static;
        min-width: 0;
        padding: 0 0 0 12px;
        border: 0;
        box-shadow: none;
    }

    #site-nav > ul .submenu a {
        padding: 10px 12px;
    }
}

.nav-collapsed #site-nav {
    margin-left: auto;
}

.nav-collapsed .nav-toggle {
    display: block;
}

.nav-collapsed #site-nav > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: auto;
    right: 20px;
    width: min(340px, calc(100vw - 40px));
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    max-height: calc(100vh - 100px);
    padding: 10px;
    overflow-y: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.nav-collapsed #site-nav > ul.open {
    display: flex;
}

.nav-collapsed .submenu {
    position: static;
    min-width: 0;
    padding: 0 0 0 12px;
    border: 0;
    box-shadow: none;
}

.nav-collapsed #site-nav > ul .submenu a {
    padding: 10px 12px;
}

.nav-collapsed .has-sub:hover > .submenu {
    display: none;
}

.nav-collapsed .has-sub.open > .submenu {
    display: block;
}

@media (max-width: 600px) {
    .lightbox {
        padding: 64px 12px 72px;
    }

    .lb-nav {
        top: auto;
        bottom: 12px;
        transform: none;
    }

    .lb-prev {
        left: calc(50% - 56px);
    }

    .lb-next {
        right: calc(50% - 56px);
    }

    .lb-img {
        max-height: calc(100vh - 210px);
        max-height: calc(100dvh - 210px);
    }
}

@media (max-width: 520px) {
    .cards.cols-4 {
        grid-template-columns: 1fr;
    }

    .wrap {
        padding: 16px;
    }

    .hero {
        padding: 20px 0;
    }

    .hero-left {
        padding: 20px;
    }

    .hero-left h1 {
        font-size: 22px;
    }

    .site-footer .wrap {
        flex-direction: column;
        text-align: center;
    }

    #site-nav > ul,
    .nav-collapsed #site-nav > ul {
        left: 16px;
        right: 16px;
        width: auto;
    }
}

@media (max-width: 360px) {
    .gallery {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
