/* ==========================================================================
   FAMILY MEMORIES | ذكريات العائلة
   Premium front-end stylesheet - light / dark themes via CSS variables
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
    --fm-ivory: #fbf8f3;
    --fm-beige: #f3eade;
    --fm-sand: #e8dcc9;
    --fm-champagne: #b08d57;
    --fm-champagne-soft: #d4b483;
    --fm-charcoal: #2b2926;
    --fm-rose: #e0b3a8;
    --fm-muted: #7c746b;
    --fm-line: rgba(43, 41, 38, 0.1);
    --fm-line-strong: rgba(43, 41, 38, 0.18);

    --fm-bg: var(--fm-ivory);
    --fm-bg-alt: var(--fm-beige);
    --fm-surface: #ffffff;
    --fm-surface-2: rgba(255, 255, 255, 0.72);
    --fm-text: var(--fm-charcoal);
    --fm-text-soft: var(--fm-muted);
    --fm-primary: var(--fm-champagne);
    --fm-accent: var(--fm-rose);

    --fm-radius-sm: 10px;
    --fm-radius: 18px;
    --fm-radius-lg: 28px;
    --fm-radius-pill: 999px;

    --fm-shadow-sm: 0 2px 10px rgba(43, 41, 38, 0.06);
    --fm-shadow: 0 18px 40px -22px rgba(43, 41, 38, 0.35);
    --fm-shadow-lg: 0 40px 90px -40px rgba(43, 41, 38, 0.55);

    --fm-font-ar: "Tajawal", "Noto Kufi Arabic", "Segoe UI", system-ui, sans-serif;
    --fm-font-en: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
    --fm-font: var(--fm-font-en);

    --fm-header-h: 74px;
    --fm-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --fm-dur: 0.45s;

    --fm-primary-color: #b08d57;
    --fm-accent-color: #d4a373;
    --fm-font-ar-custom: "Tajawal", "Segoe UI", sans-serif;
    --fm-font-en-custom: "Cormorant Garamond", Georgia, serif;
}

html[data-theme="dark"] {
    --fm-bg: #0f172a;
    --fm-bg-alt: #141d31;
    --fm-surface: #172136;
    --fm-surface-2: rgba(23, 33, 54, 0.78);
    --fm-text: #f5f3ee;
    --fm-text-soft: #a3adc2;
    --fm-primary: #d4af7a;
    --fm-accent: #8f7bd6;
    --fm-line: rgba(245, 243, 238, 0.1);
    --fm-line-strong: rgba(245, 243, 238, 0.2);
    --fm-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
    --fm-shadow: 0 22px 50px -24px rgba(0, 0, 0, 0.75);
    --fm-shadow-lg: 0 50px 110px -50px rgba(0, 0, 0, 0.9);
}

html[lang="ar"] {
    --fm-font: var(--fm-font-ar);
}

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

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

body {
    margin: 0;
    background: var(--fm-bg);
    color: var(--fm-text);
    font-family: var(--fm-font);
    font-size: 17px;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    transition: background-color 0.4s var(--fm-ease), color 0.4s var(--fm-ease);
}

body.no-scroll { overflow: hidden; }
/* The installer uses the gate visual style but must be vertically scrollable. */
body.fm-gate.fm-installer-page {
    display: block;
    min-height: 100dvh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}
body.fm-gate.fm-installer-page::after { position: fixed; }


h1, h2, h3, h4, h5 {
    font-family: var(--fm-font);
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 0.6em;
    letter-spacing: 0.005em;
}

h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.65rem); }

html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3 { letter-spacing: 0; }

p { margin: 0 0 1.1em; }

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.25s var(--fm-ease), opacity 0.25s var(--fm-ease);
}

img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--fm-line); margin: 2rem 0; }
::selection { background: var(--fm-primary); color: #fff; }

/* ------------------------------------------------------------ structure */
.fm-container {
    width: min(1240px, 100% - 2.5rem);
    margin-inline: auto;
}

.fm-section { padding: clamp(3.2rem, 7vw, 6rem) 0; }
.fm-section--alt { background: var(--fm-bg-alt); }
.fm-section--tight { padding: clamp(2rem, 4vw, 3.2rem) 0; }

.fm-section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: clamp(1.8rem, 3.4vw, 3rem);
    flex-wrap: wrap;
}

.fm-section__title {
    position: relative;
    margin: 0;
}

.fm-section__title::after {
    content: "";
    display: block;
    width: 62px;
    height: 2px;
    margin-top: 0.85rem;
    background: linear-gradient(90deg, var(--fm-primary), transparent);
}

.fm-section__sub { color: var(--fm-text-soft); max-width: 56ch; margin: 0; }
.fm-eyebrow {
    display: inline-block;
    font-size: 0.76rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--fm-primary);
    margin-bottom: 0.9rem;
    font-family: var(--fm-font-ar);
    font-weight: 600;
}
html[lang="ar"] .fm-eyebrow { letter-spacing: 0.06em; text-transform: none; }

.fm-grid { display: grid; gap: clamp(1rem, 2vw, 1.8rem); }
.fm-grid--2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.fm-grid--3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.fm-grid--4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* --------------------------------------------------------------- header */
.fm-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: color-mix(in srgb, var(--fm-bg) 82%, transparent);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-bottom: 1px solid var(--fm-line);
    transition: transform 0.4s var(--fm-ease), background-color 0.4s var(--fm-ease);
}

.fm-header__inner {
    min-height: var(--fm-header-h);
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.fm-brand { display: flex; align-items: center; gap: 0.75rem; margin-inline-end: auto; }
.fm-brand__mark {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: linear-gradient(140deg, var(--fm-primary), var(--fm-accent));
    color: #fff;
    box-shadow: var(--fm-shadow-sm);
    flex: none;
}
.fm-brand__mark svg { width: 22px; height: 22px; }
.fm-brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.fm-brand__title { font-size: 1.06rem; font-weight: 700; letter-spacing: 0.02em; }
.fm-brand__sub { font-size: 0.72rem; color: var(--fm-text-soft); letter-spacing: 0.16em; text-transform: uppercase; }
html[lang="ar"] .fm-brand__sub { letter-spacing: 0; text-transform: none; }

.fm-nav { display: flex; align-items: center; gap: 0.25rem; }
.fm-nav__link {
    position: relative;
    padding: 0.5rem 0.85rem;
    border-radius: var(--fm-radius-pill);
    font-size: 0.94rem;
    color: var(--fm-text-soft);
    white-space: nowrap;
}
.fm-nav__link:hover,
.fm-nav__link.is-active { color: var(--fm-text); background: color-mix(in srgb, var(--fm-primary) 12%, transparent); }

.fm-header__tools { display: flex; align-items: center; gap: 0.4rem; }

.fm-icon-btn {
    width: 40px; height: 40px;
    display: inline-grid; place-items: center;
    border-radius: 50%;
    border: 1px solid var(--fm-line);
    background: var(--fm-surface-2);
    color: var(--fm-text);
    cursor: pointer;
    transition: all 0.25s var(--fm-ease);
}
.fm-icon-btn:hover { border-color: var(--fm-primary); color: var(--fm-primary); transform: translateY(-2px); }
.fm-icon-btn svg { width: 18px; height: 18px; }

.fm-lang-toggle { display: flex; gap: 2px; }
.fm-lang-toggle button {
    border: 0; background: transparent; cursor: pointer;
    font: inherit; font-size: 0.78rem; font-weight: 600;
    color: var(--fm-text-soft); padding: 0.35rem 0.6rem; border-radius: var(--fm-radius-pill);
}
.fm-lang-toggle button.is-active { background: var(--fm-primary); color: #fff; }

.fm-burger { display: none; }

/* mobile drawer */
.fm-drawer {
    position: fixed; inset: 0; z-index: 90;
    background: var(--fm-bg);
    padding: 1.4rem;
    transform: translateY(-100%);
    transition: transform 0.45s var(--fm-ease);
    overflow-y: auto;
}
.fm-drawer.is-open { transform: translateY(0); }
.fm-drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; }
.fm-drawer__links { display: grid; gap: 0.35rem; }
.fm-drawer__links a {
    padding: 0.85rem 0.4rem;
    border-bottom: 1px solid var(--fm-line);
    font-size: 1.06rem;
}

/* ----------------------------------------------------------------- hero */
.fm-hero {
    position: relative;
    min-height: min(78vh, 720px);
    display: grid;
    place-items: center;
    text-align: center;
    overflow: hidden;
    isolation: isolate;
}

.fm-hero__media { position: absolute; inset: 0; z-index: -2; }
.fm-hero__media img,
.fm-hero__media video {
    width: 100%; height: 100%; object-fit: cover;
    transform: scale(1.04);
    animation: fm-heroZoom 18s var(--fm-ease) infinite alternate;
}
@keyframes fm-heroZoom { from { transform: scale(1.02); } to { transform: scale(1.12); } }

.fm-hero::before {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(120% 90% at 50% 10%, rgba(176, 141, 87, 0.18), transparent 60%),
        linear-gradient(180deg, rgba(15, 12, 9, 0.55), rgba(15, 12, 9, 0.78));
}
html[data-theme="dark"] .fm-hero::before {
    background:
        radial-gradient(120% 90% at 50% 10%, rgba(212, 175, 122, 0.2), transparent 60%),
        linear-gradient(180deg, rgba(6, 10, 20, 0.6), rgba(6, 10, 20, 0.85));
}

.fm-hero__content { color: #fdfaf4; padding: 3rem 1.25rem; max-width: 60rem; }
.fm-hero__title { text-shadow: 0 10px 40px rgba(0, 0, 0, 0.4); }
.fm-hero__text { color: rgba(255, 255, 255, 0.88); max-width: 46rem; margin-inline: auto; font-size: 1.08rem; }
.fm-hero__actions { display: flex; gap: 0.85rem; justify-content: center; flex-wrap: wrap; margin-top: 1.8rem; }
.fm-hero__scroll {
    position: absolute; bottom: 1.8rem; left: 50%; transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7); font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase;
    display: grid; justify-items: center; gap: 0.5rem;
}
html[lang="ar"] .fm-hero__scroll { letter-spacing: 0; text-transform: none; }
.fm-hero__scroll svg { width: 18px; height: 18px; animation: fm-bob 2.2s ease-in-out infinite; }
@keyframes fm-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px); } }

/* --------------------------------------------------------------- buttons */
.fm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.78rem 1.6rem;
    border-radius: var(--fm-radius-pill);
    border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.28s var(--fm-ease);
}
.fm-btn svg { width: 17px; height: 17px; }
.fm-btn--primary {
    background: linear-gradient(120deg, var(--fm-primary), var(--fm-accent));
    color: #fff;
    box-shadow: 0 14px 30px -16px color-mix(in srgb, var(--fm-primary) 90%, transparent);
}
.fm-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 20px 38px -18px color-mix(in srgb, var(--fm-primary) 95%, transparent); }
.fm-btn--ghost { background: transparent; border-color: var(--fm-line-strong); color: var(--fm-text); }
.fm-btn--ghost:hover { border-color: var(--fm-primary); color: var(--fm-primary); }
.fm-btn--light { background: rgba(255, 255, 255, 0.94); color: #26211b; }
.fm-btn--light:hover { background: #fff; transform: translateY(-2px); }
.fm-btn--block { width: 100%; }
.fm-btn--sm { padding: 0.48rem 1rem; font-size: 0.85rem; }

/* ---------------------------------------------------------------- cards */
.fm-card {
    position: relative;
    background: var(--fm-surface);
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
    overflow: hidden;
    box-shadow: var(--fm-shadow-sm);
    transition: transform 0.4s var(--fm-ease), box-shadow 0.4s var(--fm-ease), border-color 0.4s var(--fm-ease);
    display: flex;
    flex-direction: column;
}
.fm-card:hover { transform: translateY(-6px); box-shadow: var(--fm-shadow); border-color: color-mix(in srgb, var(--fm-primary) 45%, transparent); }

.fm-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--fm-bg-alt); }
.fm-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--fm-ease); }
.fm-card:hover .fm-card__media img { transform: scale(1.07); }
.fm-card__media--tall { aspect-ratio: 3 / 4; }
.fm-card__media--square { aspect-ratio: 1 / 1; }
.fm-card__body { padding: 1.1rem 1.25rem 1.35rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.fm-card__title { font-size: 1.15rem; margin: 0; }
.fm-card__meta { font-size: 0.82rem; color: var(--fm-text-soft); display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.fm-card__text { color: var(--fm-text-soft); font-size: 0.93rem; margin: 0; }
.fm-card__foot { margin-top: auto; padding-top: 0.6rem; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }

.fm-badge {
    display: inline-flex; align-items: center; gap: 0.32rem;
    padding: 0.22rem 0.7rem;
    border-radius: var(--fm-radius-pill);
    background: color-mix(in srgb, var(--fm-primary) 16%, transparent);
    color: color-mix(in srgb, var(--fm-primary) 80%, var(--fm-text));
    font-size: 0.76rem; font-weight: 600;
}
.fm-badge--muted { background: color-mix(in srgb, var(--fm-text-soft) 16%, transparent); color: var(--fm-text-soft); }
.fm-badge--accent { background: color-mix(in srgb, var(--fm-accent) 20%, transparent); color: color-mix(in srgb, var(--fm-accent) 85%, var(--fm-text)); }

.fm-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius-pill);
    background: var(--fm-surface);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s var(--fm-ease);
}
.fm-chip:hover, .fm-chip.is-active { border-color: var(--fm-primary); color: var(--fm-primary); }

/* ------------------------------------------------------------- member card */
.fm-member { text-align: center; }
.fm-member__avatar {
    width: 118px; height: 118px; margin: 0 auto 0.9rem;
    border-radius: 50%; overflow: hidden;
    border: 3px solid color-mix(in srgb, var(--fm-primary) 45%, transparent);
    background: var(--fm-bg-alt);
}
.fm-member__avatar img { width: 100%; height: 100%; object-fit: cover; }
.fm-member__name { font-size: 1.08rem; margin: 0 0 0.2rem; }
.fm-member__role { font-size: 0.84rem; color: var(--fm-text-soft); }

/* --------------------------------------------------------------- timeline */
.fm-timeline { position: relative; padding-inline-start: 2.2rem; }
.fm-timeline::before {
    content: ""; position: absolute; inset-block: 0.6rem; inset-inline-start: 6px; width: 2px;
    background: linear-gradient(180deg, transparent, var(--fm-primary), transparent);
}
.fm-timeline__item { position: relative; margin-bottom: 2rem; }
.fm-timeline__item::before {
    content: ""; position: absolute; inset-inline-start: -2.05rem; top: 0.7rem;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--fm-bg); border: 3px solid var(--fm-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--fm-primary) 18%, transparent);
}
.fm-timeline__date { font-size: 0.82rem; color: var(--fm-primary); font-weight: 600; letter-spacing: 0.06em; }

/* ------------------------------------------------------------ family tree */
.fm-tree {
    position: relative; overflow: hidden;
    height: min(72vh, 640px);
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius-lg);
    background:
        radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--fm-primary) 12%, transparent), transparent 60%),
        var(--fm-surface);
    cursor: grab;
    touch-action: none;
}
.fm-tree.is-dragging { cursor: grabbing; }
.fm-tree__canvas { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.fm-tree__node {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 168px;
    padding: 0.85rem 0.6rem;
    background: var(--fm-surface);
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
    text-align: center;
    box-shadow: var(--fm-shadow-sm);
    cursor: pointer;
    transition: transform 0.25s var(--fm-ease), box-shadow 0.25s var(--fm-ease), border-color 0.25s var(--fm-ease);
}
.fm-tree__node:hover { transform: translate(-50%, -50%) scale(1.05); border-color: var(--fm-primary); box-shadow: var(--fm-shadow); }
.fm-tree__node img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; margin: 0 auto 0.5rem; }
.fm-tree__node-name { font-weight: 600; font-size: 0.92rem; }
.fm-tree__node-role { font-size: 0.74rem; color: var(--fm-text-soft); }
.fm-tree__toolbar {
    position: absolute; inset-block-end: 1rem; inset-inline-end: 1rem;
    display: flex; gap: 0.4rem; z-index: 5;
}
.fm-tree__legend {
    position: absolute; inset-block-start: 1rem; inset-inline-start: 1rem;
    display: grid; gap: 0.4rem; font-size: 0.78rem; color: var(--fm-text-soft);
    background: color-mix(in srgb, var(--fm-surface) 85%, transparent);
    padding: 0.8rem 1rem; border-radius: var(--fm-radius); border: 1px solid var(--fm-line);
}

/* ---------------------------------------------------------------- forms */
.fm-field { margin-bottom: 1.1rem; }
.fm-label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.4rem; }
.fm-input, .fm-select, .fm-textarea {
    width: 100%;
    padding: 0.72rem 0.95rem;
    border: 1px solid var(--fm-line-strong);
    border-radius: var(--fm-radius-sm);
    background: var(--fm-surface);
    color: var(--fm-text);
    font: inherit; font-size: 0.95rem;
    transition: border-color 0.25s var(--fm-ease), box-shadow 0.25s var(--fm-ease);
}
.fm-input:focus, .fm-select:focus, .fm-textarea:focus {
    outline: none;
    border-color: var(--fm-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fm-primary) 22%, transparent);
}
.fm-textarea { min-height: 130px; resize: vertical; }
.fm-field__error { color: #c0554b; font-size: 0.8rem; margin-top: 0.35rem; }
html[data-theme="dark"] .fm-field__error { color: #ef8f84; }
.fm-field__hint { color: var(--fm-text-soft); font-size: 0.78rem; margin-top: 0.3rem; }

.fm-alert {
    padding: 0.9rem 1.1rem; border-radius: var(--fm-radius-sm);
    border: 1px solid var(--fm-line);
    margin-bottom: 1.2rem; font-size: 0.92rem;
    display: flex; gap: 0.6rem; align-items: flex-start;
}
.fm-alert--success { border-color: rgba(52, 168, 120, 0.4); background: rgba(52, 168, 120, 0.1); }
.fm-alert--error { border-color: rgba(200, 85, 75, 0.4); background: rgba(200, 85, 75, 0.1); }
.fm-alert--info { border-color: color-mix(in srgb, var(--fm-primary) 40%, transparent); background: color-mix(in srgb, var(--fm-primary) 10%, transparent); }

/* ----------------------------------------------------------------- gate */
.fm-gate {
    min-height: 100dvh;
    display: grid; place-items: center;
    padding: 2rem 1.25rem;
    position: relative; overflow: hidden;
    background:
        radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--fm-primary) 20%, transparent), transparent 65%),
        var(--fm-bg);
}
.fm-gate::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
    background-image: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
    background-size: 34px 34px;
}
.fm-gate__card {
    position: relative; z-index: 2;
    width: min(470px, 100%);
    padding: clamp(1.8rem, 4vw, 3rem);
    background: color-mix(in srgb, var(--fm-surface) 92%, transparent);
    backdrop-filter: blur(20px);
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius-lg);
    box-shadow: var(--fm-shadow-lg);
    text-align: center;
}
.fm-gate__logo {
    width: 74px; height: 74px; margin: 0 auto 1.2rem;
    border-radius: 26px; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--fm-primary), var(--fm-accent));
    color: #fff; box-shadow: var(--fm-shadow);
}
.fm-gate__logo svg { width: 36px; height: 36px; }
.fm-gate__title { font-size: 1.75rem; margin-bottom: 0.3rem; }
.fm-gate__sub { color: var(--fm-text-soft); font-size: 0.95rem; margin-bottom: 1.6rem; }
.fm-gate__code {
    text-align: center; letter-spacing: 0.35em; text-transform: uppercase;
    font-size: 1.05rem; font-weight: 600;
}
.fm-gate__tools { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1.2rem; }

/* --------------------------------------------------------------- gallery */
.fm-masonry { columns: 3 280px; column-gap: 1rem; }
.fm-masonry > * { break-inside: avoid; margin-bottom: 1rem; }
.fm-lightbox {
    position: fixed; inset: 0; z-index: 120;
    background: rgba(10, 8, 6, 0.94);
    display: none; place-items: center;
}
.fm-lightbox.is-open { display: grid; }
.fm-lightbox__img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 8px; }
.fm-lightbox__close, .fm-lightbox__nav {
    position: absolute; z-index: 2;
    width: 46px; height: 46px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: #fff; display: grid; place-items: center; cursor: pointer;
}
.fm-lightbox__close { top: 1.2rem; inset-inline-end: 1.2rem; }
.fm-lightbox__nav--prev { inset-inline-start: 1.2rem; top: 50%; transform: translateY(-50%); }
.fm-lightbox__nav--next { inset-inline-end: 1.2rem; top: 50%; transform: translateY(-50%); }
.fm-lightbox__caption { position: absolute; bottom: 1.4rem; color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; }

/* ---------------------------------------------------------- music player */
.fm-player {
    position: fixed; inset-block-end: 1rem; inset-inline-start: 1rem; z-index: 70;
    width: min(330px, calc(100vw - 2rem));
    padding: 0.8rem 0.9rem;
    background: color-mix(in srgb, var(--fm-surface) 92%, transparent);
    backdrop-filter: blur(16px);
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
    box-shadow: var(--fm-shadow);
    display: none;
}
.fm-player.is-visible { display: block; }
.fm-player__row { display: flex; align-items: center; gap: 0.7rem; }
.fm-player__info { flex: 1; min-width: 0; }
.fm-player__title { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-player__meta { font-size: 0.74rem; color: var(--fm-text-soft); }
.fm-player__controls { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.6rem; }
.fm-player__btn {
    width: 34px; height: 34px; border-radius: 50%; border: 0;
    background: transparent; color: var(--fm-text); cursor: pointer;
    display: grid; place-items: center; transition: background 0.25s var(--fm-ease);
}
.fm-player__btn:hover { background: color-mix(in srgb, var(--fm-primary) 18%, transparent); }
.fm-player__btn svg { width: 17px; height: 17px; }
.fm-player__btn--main { background: var(--fm-primary); color: #fff; }
.fm-player__volume { flex: 1; accent-color: var(--fm-primary); height: 4px; }

/* -------------------------------------------------------- seasonal layer */
.fm-effects { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
.fm-effects canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.fm-banner {
    position: fixed; inset-block-start: calc(var(--fm-header-h) + 1rem); inset-inline: 0;
    margin-inline: auto; width: min(760px, calc(100% - 2rem));
    z-index: 58; padding: 1.1rem 1.4rem;
    background: color-mix(in srgb, var(--fm-surface) 94%, transparent);
    backdrop-filter: blur(14px);
    border: 1px solid color-mix(in srgb, var(--fm-primary) 45%, transparent);
    border-radius: var(--fm-radius);
    box-shadow: var(--fm-shadow);
    display: none; align-items: center; gap: 1rem;
}
.fm-banner.is-visible { display: flex; }
.fm-banner__icon {
    width: 52px; height: 52px; border-radius: 16px; flex: none;
    display: grid; place-items: center; font-size: 1.5rem;
    background: linear-gradient(140deg, var(--fm-primary), var(--fm-accent)); color: #fff;
}
.fm-banner__title { font-weight: 700; margin: 0; }
.fm-banner__text { margin: 0; font-size: 0.88rem; color: var(--fm-text-soft); }
.fm-banner__close { margin-inline-start: auto; }

/* ------------------------------------------------------------- pagination */
.fm-pagination { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; margin-top: 2.4rem; }
.fm-pagination a, .fm-pagination span {
    min-width: 40px; height: 40px; padding-inline: 0.75rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--fm-radius-sm);
    border: 1px solid var(--fm-line);
    font-size: 0.9rem;
}
.fm-pagination a:hover { border-color: var(--fm-primary); color: var(--fm-primary); }
.fm-pagination .is-current { background: var(--fm-primary); color: #fff; border-color: var(--fm-primary); }

/* ---------------------------------------------------------------- footer */
.fm-footer {
    margin-top: 4rem;
    padding: 3.2rem 0 2rem;
    background: var(--fm-bg-alt);
    border-top: 1px solid var(--fm-line);
}
.fm-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2.4rem; }
.fm-footer h4 { font-size: 1rem; margin-bottom: 0.9rem; }
.fm-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.fm-footer a { color: var(--fm-text-soft); font-size: 0.92rem; }
.fm-footer a:hover { color: var(--fm-primary); }
.fm-footer__bottom {
    margin-top: 2.4rem; padding-top: 1.4rem; border-top: 1px solid var(--fm-line);
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    font-size: 0.84rem; color: var(--fm-text-soft);
}

/* ------------------------------------------------------------ empty state */
.fm-empty { text-align: center; padding: 3rem 1rem; color: var(--fm-text-soft); }
.fm-empty__icon { width: 62px; height: 62px; margin: 0 auto 1rem; border-radius: 20px; display: grid; place-items: center; background: color-mix(in srgb, var(--fm-primary) 14%, transparent); color: var(--fm-primary); }
.fm-empty__icon svg { width: 26px; height: 26px; }

/* ------------------------------------------------------------ article page */
.fm-article { max-width: 780px; margin-inline: auto; }
.fm-article__cover { border-radius: var(--fm-radius-lg); overflow: hidden; box-shadow: var(--fm-shadow); margin-bottom: 2rem; }
.fm-article__body { font-size: 1.05rem; line-height: 1.95; }
.fm-article__body p { color: color-mix(in srgb, var(--fm-text) 88%, transparent); }
.fm-meta-row { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; color: var(--fm-text-soft); font-size: 0.88rem; margin-bottom: 1.4rem; }
.fm-meta-row span { display: inline-flex; align-items: center; gap: 0.4rem; }
.fm-meta-row svg { width: 16px; height: 16px; }

.fm-filters {
    display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
    padding: 1rem; margin-bottom: 2rem;
    background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-radius);
}
.fm-filters select, .fm-filters input { padding: 0.5rem 0.8rem; border-radius: var(--fm-radius-pill); border: 1px solid var(--fm-line); background: var(--fm-bg); color: var(--fm-text); font: inherit; font-size: 0.88rem; }

/* ------------------------------------------------------------- animations */
[data-reveal] { opacity: 0; transform: translateY(26px); }
[data-reveal].is-visible { opacity: 1; transform: none; transition: opacity 0.8s var(--fm-ease), transform 0.8s var(--fm-ease); }

.fm-fade-up { animation: fmFadeUp 0.7s var(--fm-ease) both; }
@keyframes fmFadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
    .fm-footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    body { font-size: 16px; }
    .fm-nav { display: none; }
    .fm-burger { display: inline-grid; }
    .fm-header__inner { justify-content: space-between; }
    .fm-masonry { columns: 2 180px; }
    .fm-player { inset-inline: 1rem; width: auto; }
}

@media (max-width: 560px) {
    .fm-container { width: calc(100% - 1.6rem); }
    .fm-footer__grid { grid-template-columns: 1fr; }
    .fm-masonry { columns: 1; }
    .fm-hero { min-height: 68vh; }
    .fm-timeline { padding-inline-start: 1.5rem; }
    .fm-timeline__item::before { inset-inline-start: -1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal] { opacity: 1; transform: none; }
}

/* print */
@media print {
    .fm-header, .fm-footer, .fm-player, .fm-effects, .fm-banner, .fm-lightbox { display: none !important; }
    body { background: #fff; color: #000; }
}
