/* Naqsheen — shared base styles: shell, header, footer, menu, common components.
   Loaded on every page BEFORE studio-nav.css (theme overrides) and page styles. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- CUSTOM FONTS --- */
@font-face {
    font-family: 'Kalameh';
    src: url('../fonts/Kalameh-Regular.woff2') format('woff2'),
         url('../fonts/Kalameh-Regular.ttf') format('truetype');
    font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Mont';
    src: url('../fonts/Mont-ExtraLightDEMO.woff2') format('woff2'),
         url('../fonts/Mont-ExtraLightDEMO.otf') format('opentype');
    font-weight: 200; font-style: normal; font-display: swap;
}

/* --- APP SHELL --- */
html, body {
    height: 100%;
    margin: 0; padding: 0;
    background-color: var(--surface);
    font-family: 'Kalameh', sans-serif;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    z-index: 500;
    padding: 0.65rem 1rem;
    border: 1px solid var(--line-hover);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: var(--shadow-lift);
    text-decoration: none;
    transform: translate(-50%, -180%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translate(-50%, 0);
}

/* --- HEADER ---
   Sticky liquid-glass bar. It lives inside .scroll-container so the blur
   samples the content scrolling beneath it. Colours come from tokens, so
   theme.css only needs to override the dark values. */
.site-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: 110px;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    z-index: 100;
    flex-shrink: 0;
    background: var(--header-glass);
    backdrop-filter: blur(40px) saturate(200%);
    /* stylelint-disable-next-line property-no-vendor-prefix -- Safari */
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-bottom: 1px solid var(--header-line);
    box-shadow: var(--header-shadow);
}

/* Header slots: mark | logo | (theme toggle + menu) */
.header-start {
    justify-self: start;
    margin-left: -14px;
}

.header-mark-link {
    position: relative;
    display: block;
    width: 90px;
    height: 90px;
}

.header-logo-link {
    justify-self: center;
    display: flex;
    align-items: center;
    line-height: 0;
}

.header-end {
    justify-self: end;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

/* Light/dark brand marks are stacked, so the hidden one reserves no space */
.header-start .flower-mark {
    position: absolute;
    top: 0;
    left: 0;
    width: 90px;
    height: 90px;
    margin: 0;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Wordmark: light/dark artwork stacked, so the hidden one reserves no space.
   Box is 162x40 — the artwork's 4.04 ratio at the intended 40px height. */
.center-logo-stack {
    position: relative;
    display: block;
    width: 162px;
    height: 40px;
}

.center-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: 1px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.theme-toggle:hover {
    opacity: 0.9;
    border-color: var(--line);
    background: var(--glass);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--gold-soft);
    outline-offset: 2px;
}

.theme-icon {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
}

/* Only the icon for the *other* theme is shown (moon in light, sun in dark) */
html:not([data-theme="dark"]) .theme-icon--dark { display: none; }
html[data-theme="dark"] .theme-icon--light { display: none; }

.menu-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 6px;
    padding: 0;
    border: none;
    background: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}
.menu-trigger:hover { opacity: 1; }
.menu-trigger:focus-visible {
    outline: 2px solid var(--gold-soft);
    outline-offset: 3px;
    border-radius: 4px;
}

.lines-group { display: flex; flex-direction: column; gap: 5px; }
.line { width: 32px; height: 1px; background-color: var(--ink); }
.menu-label {
    font-family: 'Mont', sans-serif;
    font-size: 10px; letter-spacing: 0.15em;
    text-transform: uppercase; color: var(--ink);
}

/* Preserve the established header design while keeping all three slots
   visible on phone widths. The full-size artwork returns above 480px. */
@media (max-width: 480px) {
    .site-header {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .header-start {
        margin-left: -10px;
    }

    .header-mark-link,
    .header-start .flower-mark {
        width: 78px;
        height: 78px;
    }

    .center-logo-stack {
        width: 146px;
        height: 36px;
    }

    .header-end {
        gap: 0.4rem;
    }

    .theme-toggle {
        width: 34px;
        height: 34px;
    }

    .line {
        width: 30px;
    }

    .menu-label {
        font-size: 9.5px;
    }
}

@media (max-width: 360px) {
    .site-header {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .header-start {
        margin-left: -10px;
    }

    .header-mark-link,
    .header-start .flower-mark {
        width: 72px;
        height: 72px;
    }

    .center-logo-stack {
        width: 132px;
        height: 33px;
    }

    .header-end {
        gap: 0.35rem;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
    }

    .line {
        width: 28px;
    }

    .menu-label {
        font-size: 9px;
    }
}

/* --- SCROLL AREA --- */
.scroll-container {
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    background-color: var(--surface);
}
.scroll-container::-webkit-scrollbar { display: none; }

.site-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    scroll-margin-top: 110px;
}

body.menu-open .scroll-container {
    overflow: hidden;
}

/* --- FOOTER --- */
.footer-area {
    height: 90px;
    width: 100%;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface);
    z-index: 50;
    flex-shrink: 0;
    border-top: 1px solid var(--line);
}
/* Footer rendered inside the scroll area: pin it to the bottom of the
   viewport on short pages (few items) instead of it floating right under
   the content with dead space beneath it. `margin-top: auto` absorbs any
   leftover space in the flex column; on long pages it just collapses to 0
   and the content's own bottom padding provides the breathing room. */
.scroll-container .footer-area { margin-top: auto; }

.social-group { display: flex; gap: 1rem; }
.minimal-glass {
    padding: 8px; border-radius: 50%;
    background: var(--glass);
    display: flex; align-items: center; justify-content: center;
    color: var(--ink); transition: all 0.3s;
}
.handmade-art-logo { height: 75px; width: auto; object-fit: contain; opacity: 0.9; }

/* --- MENU OVERLAY --- */
#menu-overlay {
    position: fixed; inset: 0;
    background-color: var(--overlay);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
    direction: ltr;
}
#menu-overlay[hidden] { display: none; }
#menu-overlay.active { display: flex; opacity: 1; pointer-events: auto; }

.menu-box-container {
    width: 86%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-link-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--line);
    background: var(--surface-raised);
    border-radius: 14px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-rest);
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    opacity: 0;
    transform: translateY(20px);
}
.menu-en {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ink);
}
.menu-fa {
    font-family: 'Kalameh', sans-serif;
    font-size: 1.35rem;
    direction: rtl;
    color: var(--ink);
}

#menu-overlay.active .menu-link-box {
    animation: slideUpFade 0.6s forwards cubic-bezier(0.16, 1, 0.3, 1);
}
#menu-overlay.active .menu-link-box:nth-child(1) { animation-delay: 0.1s; }
#menu-overlay.active .menu-link-box:nth-child(2) { animation-delay: 0.2s; }
#menu-overlay.active .menu-link-box:nth-child(3) { animation-delay: 0.3s; }
#menu-overlay.active .menu-link-box:nth-child(4) { animation-delay: 0.4s; }
#menu-overlay.active .menu-link-box:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideUpFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-link-box:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
}

.close-btn {
    position: absolute;
    top: 2rem; right: 2rem;
    font-family: 'Mont', sans-serif;
    font-size: 4rem;
    font-weight: 200;
    line-height: 1;
    color: var(--ink);
    background: none; border: none;
    cursor: pointer;
    padding: 1rem;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.close-btn:hover { opacity: 1; }
.close-btn:focus-visible {
    outline: 2px solid var(--gold-soft);
    outline-offset: 2px;
}

/* --- SECTION / CATEGORY TITLE CARDS (store, event, workshop, training) --- */
.section-header,
.category-header {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-rest);
}

.section-fa,
.category-fa {
    font-family: 'Kalameh', sans-serif;
    font-size: 1.2rem;
    color: var(--ink);
    direction: rtl;
    line-height: 1.5;
}

.section-en,
.category-en {
    margin-top: 0.1rem;
    font-family: 'Kalameh', sans-serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--ink-soft);
}

.section-fa,
.section-en,
.category-fa,
.category-en {
    margin: 0;
    font-weight: normal;
}

/* --- IMAGE CAROUSEL (store, workshop) --- */
.flower-block { position: relative; width: 100%; }

.carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: var(--surface);
    border-radius: 2px;
}

.carousel {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}
.carousel::-webkit-scrollbar { display: none; }

.carousel-item {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    position: relative;
}

.flower-img {
    width: 100%;
    height: auto;
    opacity: 1;
    transform: scale(1);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.has-js .flower-img {
    opacity: 0;
    transform: scale(0.98);
}
.has-js .flower-img.loaded { opacity: 1; transform: scale(1); }

.counter-pill {
    position: absolute; top: 15px; right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 20px;
    /* System font to avoid the "DEMO" artifact in Mont */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 400;
    letter-spacing: 1px;
    z-index: 20;
    pointer-events: none;
    opacity: 0.9;
}

.dots-container {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 4px;
}

.dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background-color: var(--dot);
    transition: all 0.3s ease;
}

.dot.active {
    background-color: var(--dot-active);
    transform: scale(1.2);
}

/* --- REEL CARD (event, workshop) --- */
.reel-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--line);
    background: var(--reel-surface);
    border-radius: 14px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-rest);
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.reel-card:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
}

.reel-card-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
}

/* --- CATEGORY CARDS (store categories, branding categories) --- */
.category-card {
    display: block;
    text-decoration: none;
    background: linear-gradient(135deg, var(--surface-raised) 0%, var(--surface-muted) 100%);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.2rem 1.1rem;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    box-shadow: var(--shadow-rest);
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-color: var(--line-hover);
}

.card-topline {
    font-family: 'Mont', sans-serif;
    letter-spacing: 0.09em;
    font-size: 0.72rem;
    color: var(--gold-soft);
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    text-align: left;
}

.card-fa {
    font-family: 'Kalameh', sans-serif;
    direction: rtl;
    text-align: right;
    font-size: 1.28rem;
    color: var(--ink);
    line-height: 1.4;
    margin-bottom: 0.15rem;
}

.card-en {
    font-family: 'Kalameh', sans-serif;
    font-size: 0.95rem;
    font-style: italic;
    color: var(--ink-soft);
    text-align: right;
}
