/* =============================================================
   layout.css — Global base, reset, buttons, section utilities,
   motion system, reveal animations
   ============================================================= */

/*
 * Google Fonts are loaded dynamically via <link> in layouts/frontend/main.php
 * so the font family can be overridden from Admin → Settings → Branding.
 */

:root {
    color-scheme: light;

    /* ── Fixed header height — keeps site-main and hero offsets in sync ── */
    --header-h: 96px;   /* inner margin-top (14px) + inner min-height (82px)  */

    /* ── Brand colours (overridable from Admin → Settings → Branding) ── */
    --color-primary:      #e3870a;   /* maps to branding.primary_color   */
    --color-primary-strong: #e6982f;
    --color-secondary:    #03264f;   /* maps to branding.secondary_color  */
    --color-secondary-soft: #334963;

    /* Legacy aliases — kept so existing CSS rules don't break */
    --color-gold:         var(--color-primary);
    --color-gold-strong:  var(--color-primary-strong);
    --color-navy:         var(--color-secondary);
    --color-navy-soft:    var(--color-secondary-soft);

    /* ── Typography (overridable from Admin → Settings → Branding) ── */
    --font-body:    'Manrope', system-ui, sans-serif;
    --font-display: 'Cormorant Garamond', Georgia, serif;

    /* ── Neutral palette ── */
    --color-ink:     #212121;
    --color-text:    #5b6671;
    --color-white:   #ffffff;
    --color-surface: #f6f7f9;
    --color-border:  rgba(3, 38, 79, 0.12);

    /* ── Shadows, radii, container ── */
    --shadow-soft: 0 24px 60px rgba(3, 38, 79, 0.12);
    --shadow-card: 0 20px 45px rgba(3, 38, 79, 0.08);
    --container:   1170px;
    --radius-sm:   4px;
    --radius-md:   12px;
    --radius-lg:   18px;
}

* {
    box-sizing: border-box;
}

/* ── Keyboard focus ring — visible only for keyboard navigation ── */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
    border-radius: 4px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
summary:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
    outline: none;
}

html {
    scroll-behavior: smooth;
    /* Offset anchor-scroll targets so they're not hidden under the fixed header */
    scroll-padding-top: var(--header-h);
}

/* ── Responsive header height (matches padding-top + min-height in header.css) ── */
@media (max-width: 1023.98px) {
    :root { --header-h: 84px; }   /* padding-top 10px + min-height 74px */
}

@media (max-width: 767.98px) {
    :root { --header-h: 84px; }   /* padding-top 10px + min-height 74px */
}

@media (max-width: 639.98px) {
    :root { --header-h: 80px; }   /* padding-top 10px + min-height 70px */
}

body {
    margin: 0;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    background: var(--color-white);
}

body.site-frontend {
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

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

iframe {
    display: block;
    width: 100%;
    border: 0;
}

/* ── Utility: surface background (replaces inline style="background:#f7f9fc") ── */
.bg-surface {
    background: var(--color-surface);
}

.container {
    width: min(calc(100% - 32px), var(--container));
    margin: 0 auto;
}

.site-main {
    min-height: 100vh;
    /* Push all page content below the fixed header */
    padding-top: var(--header-h);
}

/* ----- Buttons ----- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s ease;
    cursor: pointer;
}

.button:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: var(--color-gold-strong);
    color: var(--color-white);
}

.button--outline {
    border-color: var(--color-gold);
    color: var(--color-gold);
    background: transparent;
}

.button--light {
    border-color: rgba(255, 255, 255, 0.85);
    color: var(--color-white);
}

.button--header {
    background: rgba(230, 152, 47, 0.98);
    color: var(--color-white);
}

.button--full {
    width: 100%;
}

/* ----- Form Fields ----- */
.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    font-size: 14px;
    font-weight: 600;
}

.form-field input,
.form-field textarea,
.contact-form-card input,
.contact-form-card textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-white);
    padding: 12px 14px;
}

.form-field input::placeholder,
.form-field textarea::placeholder,
.contact-form-card input::placeholder,
.contact-form-card textarea::placeholder {
    color: rgba(255, 255, 255, 0.74);
}

/* ----- Section Utilities ----- */
.section-block {
    padding: 90px 0;
}

@media (max-width: 1023.98px) {
    .section-block {
        padding: 64px 0;
    }
}

@media (max-width: 767.98px) {
    .section-block {
        padding: 48px 0;
    }
}

@media (max-width: 479.98px) {
    .section-block {
        padding: 40px 0;
    }
}

.section-kicker {
    margin: 0 0 10px;
    color: var(--color-gold);
    font-weight: 600;
}

.section-heading {
    margin-bottom: 34px;
}

.section-heading--center {
    text-align: center;
}

.section-heading h2,
.about-section__content h2,
.cta-section h2,
.quote-section h2,
.contact-section h2,
.project-overview h2,
.faq-section h2,
.amenities-section h2,
.floorplans-section h2,
.testimonials-section h2,
.listing-section h2,
.contact-details h2 {
    margin: 0;
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.15;
}

.about-section__content h3,
.section-copy,
.project-card__body h3,
.contact-detail-card__title,
.amenity-card h3,
.testimonial-card h3,
.faq-item summary,
.unit-type,
.listing-filter {
    color: var(--color-ink);
}

.about-section__content h3,
.section-copy {
    margin: 14px 0;
    font-size: 18px;
}

.about-section__grid,
.contact-section__grid,
.project-overview__grid,
.faq-section__grid,
.floorplans-layout {
    display: grid;
    gap: 34px;
    align-items: center;
}

.about-section__media img,
.faq-section__media img {
    width: 100%;
    border-radius: 3px;
}

.about-section__media img {
    max-width: 520px;
    box-shadow: -45px 6px 0 -23px var(--color-navy);
}

.stats-grid {
    display: grid;
    gap: 18px;
    margin-top: 42px;
}

.stat-card {
    padding: 18px 0;
    border-bottom: 1px solid var(--color-border);
}

.stat-card strong {
    display: block;
    color: var(--color-navy);
    font-family: var(--font-body);
    font-size: clamp(52px, 10vw, 77px);
    font-weight: 300;
    line-height: 1;
}

.stat-card span {
    display: block;
    margin-top: 8px;
    color: var(--color-ink);
    font-size: 28px;
    line-height: 1.1;
}

/* ----- Motion System ----- */
:root {
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --duration-fast: 240ms;
    --duration-base: 520ms;
    --duration-slow: 820ms;
}

.site-header,
.site-header__brand,
.site-header__toggle,
.button,
.city-card,
.property-card,
.blog-card,
.testimonial-card,
.project-card,
.amenity-card,
.contact-detail-card,
.gallery-card,
.floorplan-card,
.attraction-card,
.project-map-card,
.hero-form-card,
.contact-form-card,
.faq-item {
    transition:
        transform var(--duration-base) var(--ease-smooth),
        box-shadow var(--duration-base) var(--ease-smooth),
        border-color var(--duration-fast) ease,
        background-color var(--duration-fast) ease,
        opacity var(--duration-fast) ease;
}

.city-card img,
.property-card__gallery img,
.blog-card img,
.project-card__media img,
.gallery-card img,
.floorplan-card img,
.about-section__media img,
.faq-section__media img {
    transition: transform var(--duration-slow) var(--ease-smooth), filter var(--duration-base) var(--ease-smooth);
}

.button {
    position: relative;
    overflow: hidden;
}

.button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.18) 45%, transparent 100%);
    transform: translateX(-130%);
    transition: transform 700ms var(--ease-smooth);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(3, 38, 79, 0.14);
}

.button:hover::after {
    transform: translateX(130%);
}

.site-header {
    transition: background-color var(--duration-fast) ease, backdrop-filter var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

body.is-scrolled .site-header {
    background: rgba(3, 38, 79, 0.72);
    backdrop-filter: blur(14px);
    box-shadow: 0 16px 40px rgba(3, 38, 79, 0.14);
}

@media (max-width: 1023.98px) {
    .site-header__panel {
        display: flex;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-14px) scale(0.985);
        transform-origin: top center;
        transition:
            opacity 280ms var(--ease-smooth),
            transform 280ms var(--ease-smooth),
            visibility 280ms ease;
    }

    .site-header__panel.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }
}

.hero-section__content,
.hero-form-card,
.page-hero__content,
.site-header__brand,
.site-header__actions {
    opacity: 0;
    transform: translateY(26px);
}

.hero-section__content {
    transition: opacity 900ms var(--ease-smooth), transform 900ms var(--ease-smooth);
}

.hero-form-card,
.page-hero__content {
    transition: opacity 980ms var(--ease-smooth), transform 980ms var(--ease-smooth);
    transition-delay: 120ms;
}

.site-header__brand,
.site-header__actions {
    transition: opacity 700ms var(--ease-smooth), transform 700ms var(--ease-smooth);
}

body.is-loaded .hero-section__content,
body.is-loaded .hero-form-card,
body.is-loaded .page-hero__content,
body.is-loaded .site-header__brand,
body.is-loaded .site-header__actions {
    opacity: 1;
    transform: none;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(34px) scale(0.985);
    transition:
        opacity var(--duration-slow) var(--ease-smooth),
        transform var(--duration-slow) var(--ease-smooth);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: transform, opacity;
}

.reveal-on-scroll[data-reveal='left'] {
    transform: translateX(-38px);
}

.reveal-on-scroll[data-reveal='right'] {
    transform: translateX(38px);
}

.reveal-on-scroll[data-reveal='zoom'] {
    transform: translateY(20px) scale(0.94);
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: none;
}

.city-card:hover,
.property-card:hover,
.blog-card:hover,
.testimonial-card:hover,
.project-card:hover,
.amenity-card:hover,
.contact-detail-card:hover,
.gallery-card:hover,
.floorplan-card:hover,
.attraction-card:hover,
.project-map-card:hover,
.hero-form-card:hover,
.contact-form-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 28px 70px rgba(3, 38, 79, 0.16);
}

.city-card:hover img,
.property-card:hover .property-card__gallery img,
.blog-card:hover img,
.project-card:hover .project-card__media img,
.gallery-card:hover img,
.floorplan-card:hover img,
.about-section__media:hover img,
.faq-section__media:hover img {
    transform: scale(1.045);
}

.city-card:hover .city-card__overlay {
    background: linear-gradient(180deg, rgba(3, 38, 79, 0.08), rgba(3, 38, 79, 0.84));
}

.listing-filter,
.unit-type,
.contact-list a,
.site-nav > a,
.site-nav__submenu a,
.site-header__socials a,
.site-footer__list a {
    transition: color var(--duration-fast) ease, transform var(--duration-fast) ease, opacity var(--duration-fast) ease;
}

.listing-filter:hover,
.unit-type:hover,
.contact-list a:hover,
.site-nav > a:hover,
.site-nav__submenu a:hover,
.site-header__socials a:hover,
.site-footer__list a:hover {
    color: var(--color-gold);
    transform: translateY(-1px);
}

.faq-item {
    overflow: clip;
}

.faq-item summary {
    position: relative;
    padding-right: 54px;
}

.faq-item summary::after {
    content: '+';
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(227, 135, 10, 0.12);
    color: var(--color-gold);
    font-size: 18px;
    line-height: 1;
    transition: transform var(--duration-fast) ease, background-color var(--duration-fast) ease;
}

.faq-item[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
    background: rgba(227, 135, 10, 0.2);
}

.faq-item p {
    max-height: 0;
    opacity: 0;
    padding-bottom: 0;
    overflow: hidden;
    transition:
        max-height 420ms var(--ease-smooth),
        opacity 280ms ease,
        padding-bottom 280ms ease;
}

.faq-item[open] p {
    max-height: 800px;
    opacity: 1;
    padding-bottom: 20px;
}

.quote-section .container {
    position: relative;
}

.quote-section .container::before {
    content: '';
    position: absolute;
    inset: -20px auto auto 50%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(227, 135, 10, 0.18), transparent 70%);
    transform: translateX(-50%);
    pointer-events: none;
}

/* ----- Reduced Motion ----- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .hero-section__content,
    .hero-form-card,
    .page-hero__content,
    .site-header__brand,
    .site-header__actions,
    .reveal-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ----- Page-Home Base ----- */
.page-home {
    --home-shell: min(100% - 28px, 1240px);
}

.page-home .container {
    width: var(--home-shell);
}

.page-home .section-block {
    padding: clamp(76px, 8vw, 124px) 0;
}

.page-home .home-section-intro {
    display: grid;
    gap: 18px;
    margin-bottom: clamp(28px, 4vw, 44px);
}

.page-home .home-section-intro__copy {
    margin-bottom: 0;
}

.page-home .home-section-intro__support {
    max-width: 620px;
    margin: 0;
    color: #667483;
    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.9;
}

/* ----- Homepage Spacing Normalization ----- */
.page-home .section-block {
    padding: clamp(62px, 7vw, 96px) 0;
}

.page-home .home-section-intro {
    gap: 14px;
    margin-bottom: clamp(18px, 2.6vw, 28px);
}

.page-home .home-section-intro__support {
    max-width: 34rem;
    margin: 0;
    color: #778496;
    font-size: 14px;
    line-height: 1.72;
}

.page-home .home-section-intro--sales-single {
    display: block;
    margin-bottom: 14px;
}

.page-home .home-section-intro--sales-single .section-heading {
    max-width: 760px;
}

.page-home .home-about {
    padding-top: clamp(72px, 8vw, 104px);
}

.page-home .cities-section--premium,
.page-home .properties-section--premium,
.page-home .blog-section--premium,
.page-home .contact-section--premium {
    padding-top: clamp(64px, 7vw, 92px);
    padding-bottom: clamp(64px, 7vw, 92px);
}

.page-home .home-about__shell,
.page-home .cta-section__inner--premium,
.page-home .contact-form-card--premium {
    border-radius: 28px;
}

.page-home .home-about__feature-cards,
.page-home .home-about__stats-panel,
.page-home .city-grid--decision,
.page-home .properties-grid--sales,
.page-home .blog-grid--premium {
    gap: 18px;
}

.page-home .blog-section--premium .home-section-intro--split {
    margin-bottom: 16px;
}

.page-home .contact-section__grid--premium {
    gap: 24px;
}

@media (max-width: 1023.98px) {
    .page-home .section-block {
        padding: 56px 0;
    }

    .page-home .home-section-intro {
        margin-bottom: 18px;
    }
}

@media (max-width: 767.98px) {
    .page-home .section-block {
        padding: 48px 0;
    }

    .page-home .home-section-intro {
        gap: 10px;
        margin-bottom: 16px;
    }

    .page-home .home-section-intro__support {
        font-size: 13px;
        line-height: 1.65;
    }
}

/* =============================================================
   Premium Motion System (motion.js companion styles)
   ============================================================= */

/* ── Text Split / Word Reveal ─────────────────────────────── */
.word-outer {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    line-height: 1.15;
}

.word-inner {
    display: inline-block;
    transform: translateY(112%);
    transition: transform 0.72s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: calc(var(--wi, 0) * 62ms);
}

.words-revealed .word-inner {
    transform: translateY(0);
}

/* ── Page Transitions ─────────────────────────────────────── */
@keyframes forsah-page-enter {
    from { opacity: 0; transform: translateY(13px); }
    to   { opacity: 1; transform: none; }
}

@keyframes forsah-page-leave {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-9px); }
}

.is-page-entering {
    animation: forsah-page-enter 0.54s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.is-page-leaving {
    animation: forsah-page-leave 0.37s cubic-bezier(0.7, 0, 1, 1) both;
    pointer-events: none;
}

/* ── Magnetic — will-change hint (applied only on hover, not globally) ── */
.button--primary:hover,
.button--outline:hover,
.button--light:hover,
.site-header__cta:hover,
.floating-actions__button:hover,
.site-footer__cta:hover {
    will-change: transform;
}

/* ── Reduced motion overrides ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .word-inner {
        transform: none !important;
        transition: none !important;
    }
    .is-page-entering,
    .is-page-leaving {
        animation: none !important;
    }
}

/* ── Cookie Consent Banner ─────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 420px;
    width: calc(100vw - 48px);
    padding: 20px 22px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    background: rgba(7, 22, 44, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(2, 12, 28, 0.45), 0 0 0 1px rgba(255,255,255,.06);
    color: #fff;
    animation: cookieSlideUp 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@supports not (backdrop-filter: blur(1px)) {
    .cookie-banner {
        background: rgba(7, 22, 44, 0.97);
    }
}

.cookie-banner[hidden] {
    display: none;
}

@keyframes cookieSlideUp {
    from { transform: translateY(32px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.cookie-banner__icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--color-gold);
}

.cookie-banner__body {
    flex: 1;
    min-width: 0;
}

.cookie-banner__title {
    margin: 0 0 5px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.cookie-banner__text {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
}

.cookie-banner__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.cookie-banner__btn {
    min-width: 90px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 150ms ease, transform 150ms ease;
    font-family: inherit;
}

.cookie-banner__btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.cookie-banner__btn--accept {
    border: none;
    background: var(--color-gold-strong, #e3870a);
    color: #fff;
}

.cookie-banner__btn--decline {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 480px) {
    .cookie-banner {
        bottom: 16px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        flex-direction: column;
        gap: 12px;
    }

    .cookie-banner__actions {
        flex-direction: row;
        width: 100%;
    }

    .cookie-banner__btn {
        flex: 1;
        text-align: center;
    }
}
