/* =========================================================
   DR. FASELI — WEBSITE BACKGROUND
   ========================================================= */

html {
    background-color: #1a1a1a;
}

body.site {
    background-color: #1a1a1a !important;
    background-image: url('/images/faseli_office4.png') !important;
    background-position: center top !important;
    background-repeat: no-repeat !important;
    background-size: 100% auto !important;
    background-attachment: scroll !important;
}

body.site .body-wrapper {
    background: transparent !important;
}

@media (max-width: 768px) {
    body.site {
        background-position: center top !important;
        background-size: auto 100vh !important;
        background-attachment: scroll !important;
    }
}

/* ==== LOGO: name + gold line + Harvard lines, left-aligned ==== */
body #sp-header { height: auto !important; padding-bottom: 10px !important; }
body #sp-header #sp-logo { text-align: left !important; margin: 0 !important; }
body #sp-header #sp-logo .sp-column,
body #sp-header #sp-logo .logo {
    display: flex !important; flex-direction: column !important;
    align-items: flex-start !important; justify-content: flex-start !important;
    height: auto !important;
}

/* Name + secondary title */
body #sp-header #sp-logo .logo::before {
    content: "DR. OMID FASELI (MSocEcSc)";
    display: block; color: #ffffff;
    font-family: "Times New Roman", Times, serif;
    font-size: 28px; font-weight: 400; letter-spacing: 0.5px; line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* Hide the old logo text from the template settings */
body #sp-header #sp-logo .logo a {
    display: flex !important; flex-direction: column !important; align-items: flex-start !important;
    font-size: 0 !important; color: transparent !important; text-shadow: none !important;
}

/* Gold line */
body #sp-header #sp-logo .logo a::before {
    content: ""; width: 52px; height: 2px; background: #C9A86A; margin: 10px 0 12px;
}

/* Harvard lines (gold) */
body #sp-header #sp-logo .logo a::after,
body #sp-header #sp-logo .sp-column::after {
    display: block; font-family: Arial, Helvetica, sans-serif !important;
    font-size: 14px; font-weight: 600; letter-spacing: 0.6px; line-height: 1.3; text-align: left;
    color: #E6C98F;
    text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.6);
}
body #sp-header #sp-logo .logo a::after { content: "HARVARD MEDICAL SCHOOL"; }
body #sp-header #sp-logo .sp-column::after { content: "HARVARD T.H. CHAN SCHOOL OF PUBLIC HEALTH"; margin-top: 12px; }

/* Description lines (light) */
body #sp-header #sp-logo .logo::after,
body #sp-header #sp-logo::after {
    display: block; font-family: Arial, Helvetica, sans-serif;
    font-size: 12px; font-weight: 400; line-height: 1.4; margin-top: 3px; text-align: left;
    color: #f2f2f2;
    text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 8px rgba(0,0,0,.6);
}
body #sp-header #sp-logo .logo::after { content: "Lifestyle Medicine · Nutrition"; }
body #sp-header #sp-logo::after { content: "Evidence-based Optimal Nutrition"; }

@media (max-width: 768px) {
    body #sp-header #sp-logo .logo::before { font-size: 21px; }
    body #sp-header #sp-logo .logo a::after,
    body #sp-header #sp-logo .sp-column::after { font-size: 11px; }
    body #sp-header #sp-logo .logo::after,
    body #sp-header #sp-logo::after { font-size: 10px; }
}

/* ==== HEADER LAYOUT ==== */
body #sp-header {
    position: relative !important;
    top: auto !important;
    z-index: 10 !important;
    background: transparent !important;
    padding-top: 20px !important;
}

/* Top bar (social icons + flags): floats on top, takes no space */
body #sp-section-1 {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10001 !important;
    background: transparent !important;
    background-color: transparent !important;
    pointer-events: none !important;
}
body #sp-section-1 a,
body #sp-section-1 img,
body #sp-section-1 ul,
body #sp-section-1 .mod-languages {
    pointer-events: auto !important;
    cursor: pointer;
}

/* Hide the "^" above the flags */
body .mod-languages__pretext { display: none !important; }

/* Remove the lines under the menu */
body #sp-menu,
body .sp-megamenu-parent { border-bottom: none !important; }

/* ==== ARTICLE BOX: same white window in all languages ==== */
body #sp-main-body,
body #sp-component {
    background-color: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border-radius: 12px !important;
    padding: 30px 40px !important;
    margin: 20px auto !important;
    max-width: 1100px !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
}

body #sp-main-body p,
body #sp-main-body h1,
body #sp-main-body h2,
body #sp-main-body h3,
body #sp-main-body h4,
body #sp-main-body li {
    color: #222222 !important;
    text-shadow: none !important;
}
body #sp-main-body a { color: #0066cc !important; }

@media (max-width: 768px) {
    body #sp-main-body,
    body #sp-component {
        padding: 20px 18px !important;
        margin: 12px !important;
    }
}

/* ==== ARTICLE POSITION: box starts where the photo ends (desktop) ==== */
@media (min-width: 992px) {
    /* same header + menu height in every language */
    body.site:not(.tool-page) #sp-main { padding-top: 0 !important; }
    body #sp-section-3 { height: 80px !important; min-height: 0 !important; overflow: visible !important; }
    body #sp-section-3 #sp-menu { padding-bottom: 0 !important; margin-top: 10px !important; }
    body #sp-section-3 .sp-megamenu-parent > li > a,
    body #sp-section-3 .sp-megamenu-parent > li > span {
        line-height: 60px !important; padding-top: 0 !important; padding-bottom: 0 !important;
    }

    /* empty spacer under the menu: grows with the photo height (photo = 56.31% of width) */
    body.site:not(.tool-page) section#sp-hero {
        padding: 0 !important;
        min-height: 0 !important;
        height: calc(56.31vw - 300px) !important;   /* bigger number = box higher */
        overflow: hidden !important;
    }
    body.site:not(.tool-page) section#sp-hero > * { display: none !important; }
}
/* ==== BODY ANALYSIS POP-UP WINDOW (faseli-modal) — all languages ==== */
#faseli-modal {
  --z: 0.8;
  width: min(calc(820px * var(--z)), 96vw);
  height: min(calc(860px * var(--z)), 96vh);
  height: min(calc(860px * var(--z)), 96dvh);
  max-width: 96vw;
  max-height: 96dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
#faseli-modal::backdrop { background: rgba(0, 0, 0, 0.6); }
#faseli-modal iframe {
  display: block;
  width: calc(100% / var(--z));
  height: calc(100% / var(--z));
  border: 0;
  transform: scale(var(--z));
  transform-origin: 0 0;
}
#faseli-modal .faseli-close {
  position: absolute !important; top: 8px !important; right: 10px !important;
  width: 36px !important; height: 36px !important; min-width: 0 !important;
  padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 50% !important;
  background: #333333 !important; color: #ffffff !important;
  font-size: 24px !important; line-height: 36px !important; font-weight: bold !important;
  text-align: center !important; cursor: pointer !important; z-index: 100000 !important;
}
#faseli-modal .faseli-close:hover { background: #c94c16 !important; }
@media (max-width: 768px) {
  #faseli-modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

/* RTL FIX for pop-up: keep the tool aligned in Persian and Arabic pages */
#faseli-modal { direction: ltr !important; }
#faseli-modal iframe { position: absolute !important; top: 0 !important; left: 0 !important; }

/* ==== TOOL PAGES — all languages (BMI calculator, Nutrition Explorer) ==== */
/* no big empty spacer: the tool starts right under the menu */
body.site.tool-page section#sp-hero,
body.site.tool-page .sp-hero,
body.site.tool-page .hero-main { display: none !important; }
body.site.tool-page #sp-main-body { margin-top: 20px !important; }
/* hide page title, author/date line and share buttons on tool pages */
body.site.tool-page .article-header,
body.site.tool-page .article-info,
body.site.tool-page .article-ratings-social-share,
body.site.tool-page .article-social-share { display: none !important; }

/* ==== RIGHT-TO-LEFT pages (Persian, Arabic): keep logo block and flags like the other languages ==== */
[dir="rtl"] body #sp-section-1,
[dir="rtl"] body #sp-header #sp-logo { direction: ltr !important; }
/* ==== ONE BACKGROUND: office photo fills the whole window ==== */
html { background: #1a1a1a !important; }
html body.site,
html body.site .body-wrapper,
html body.site .body-innerwrapper { background: transparent !important; background-image: none !important; }
html body.site #sp-hero { background-image: none !important; }
html body.site::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: #1a1a1a url('/images/faseli_office4.png') center top / cover no-repeat;
}

/* ==== CLOSE (X) BUTTON on tool windows ==== */
body.site.tool-page #sp-component { position: relative !important; }
body #sp-component a.faseli-tool-close {
    position: absolute; top: 12px; right: 14px; z-index: 50;
    width: 36px; height: 36px; border-radius: 50%;
    background: #333333; color: #ffffff !important;
    font: bold 24px/36px Arial, sans-serif; text-align: center;
    text-decoration: none !important; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
body #sp-component a.faseli-tool-close:hover { background: #c94c16; }
[dir="rtl"] body #sp-component a.faseli-tool-close { right: auto; left: 14px; }

/* ==== ANIMATED COUNTER — all languages ==== */
.faseli-counter {
    position: relative;
    max-width: 1100px;
    margin: 20px auto;
    color: #ffffff;
}
body #sp-main .faseli-counter {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1320px;
    padding: 10px 18px;
    border-radius: 12px;
    background: rgba(10, 16, 32, 0.34) !important;
}
.faseli-counter-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.faseli-counter-grid li {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: center;
}
.faseli-counter-icon {
    grid-row: span 2;
    display: block;
    width: 20px;
    height: 20px;
    color: #E6C98F;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
}
.faseli-counter-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}
.faseli-counter-label {
    display: block;
    font-size: 11px;
    line-height: 1.2;
    color: #f2f2f2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
body #sp-main .faseli-counter-more {
    flex: none;
    padding: 6px 14px;
    border: 1px solid #C9A86A;
    border-radius: 999px;
    background: rgba(10, 16, 32, 0.35);
    color: #ffffff !important;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
body #sp-main .faseli-counter-more:hover { background: #C9A86A; color: #111827 !important; }

/* Homepage: the counter takes the place of the article window.
   The article stays on the page and opens with the button. */
body.faseli-home #sp-main-body { display: none !important; }
body.faseli-home.faseli-article-open #sp-main-body { display: block !important; }
/* slim strip at the bottom of the screen: the empty spacer takes all free height,
   whatever the header height of each language (the footer is empty, so it is hidden here) */
body.faseli-home #sp-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body.faseli-home:not(.faseli-article-open) #sp-footer { display: none; }
body.faseli-home.site:not(.tool-page) section#sp-hero {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
@media (max-width: 991px) {
    body #sp-main .faseli-counter { flex-wrap: wrap; justify-content: center; margin: 12px; }
    .faseli-counter-grid { flex-basis: 100%; grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    body #sp-main .faseli-counter { gap: 8px; padding: 8px 8px; }
    .faseli-counter-grid li { display: block; text-align: center; }
    .faseli-counter-icon { display: none; }
    .faseli-counter-value { font-size: 18px; }
    .faseli-counter-label { font-size: 10px; }
    body #sp-main .faseli-counter-more { padding: 3px 12px; font-size: 12px; }
}

/* ==== SPINNING LOGO (gold coin above the counter) ==== */
.faseli-coin {
    position: absolute;
    left: 14px;
    bottom: calc(100% + 14px);
    width: 104px;
    height: 104px;
    perspective: 700px;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55));
}
.faseli-coin-spin {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: faseli-coin-spin 7s linear infinite;
}
.faseli-coin-spin img,
.faseli-coin-spin span {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.faseli-coin-spin span { background: #b98a45; }
.faseli-coin-spin .faseli-coin-front { transform: translateZ(4px); }
.faseli-coin-spin .faseli-coin-back { transform: rotateY(180deg) translateZ(4px); }
@keyframes faseli-coin-spin {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}
@media (max-width: 768px) {
    .faseli-coin { left: 6px; bottom: calc(100% + 10px); width: 72px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) {
    .faseli-coin-spin { animation: none; }
}
