/*
Theme Name:   Hello Elementor - Realm
Theme URI:    https://realmserver.com
Description:  Hello Elementor child theme styled for The Realm Online
Author:       Digital Alchemy
Template:     hello-elementor
Version:      1.0.0
Text Domain:  hello-elementor-realm
*/

/* ── Global design tokens ──────────────────────────────────────────────── */
/* Aliases Elementor global color variables so the developer can change     */
/* the palette from Elementor Site Settings and have it propagate           */
/* everywhere — including plugin-generated pages and the custom header.     */
/* Fallback hex values ensure the theme works if Elementor is deactivated.  */
:root {
    --realm-gold:        var(--e-global-color-realm_gold,       #d4af37);
    --realm-gold-light:  var(--e-global-color-realm_gold_light, #ffd700);
    --realm-gold-dim:    var(--e-global-color-realm_gold_dim,   rgba(212, 175, 55, 0.35));
    --realm-bg:          var(--e-global-color-realm_primary,    #111111);
    --realm-bg-card:     var(--e-global-color-realm_surface,    #1a1a1a);
    --realm-bg-deep:     var(--e-global-color-realm_deep,       #0d0d0d);
    --realm-text:        var(--e-global-color-realm_text,       #cccccc);
    --realm-text-muted:  var(--e-global-color-realm_muted,      #777777);
    --realm-border:      var(--e-global-color-realm_border,     rgba(212, 175, 55, 0.3));
    --realm-success:     var(--e-global-color-realm_success,    #4caf50);
    --realm-error:       var(--e-global-color-realm_error,      #f44336);
    /* Fonts are not Elementor globals — kept hardcoded here */
    --realm-font-serif:  'Cinzel', Georgia, 'Times New Roman', serif;
    --realm-font-body:   'Crimson Text', Georgia, serif;
    --realm-font-sans:   'Segoe UI', system-ui, sans-serif;
    --realm-radius:      8px;
}

/* ── Base / body ───────────────────────────────────────────────────────── */
html,
body {
    background-color: var(--realm-bg) !important;
    color: var(--realm-text);
    font-family: var(--realm-font-body);
    font-size: 17px;
    line-height: 1.7;
}

/* ── Hello Elementor structural overrides ──────────────────────────────── */
.site-header,
.site-footer,
header.elementor-location-header,
footer.elementor-location-footer {
    background-color: var(--realm-bg-deep);
    border-bottom: 1px solid var(--realm-border);
}

.site-footer,
footer.elementor-location-footer {
    border-top: 1px solid var(--realm-border);
    border-bottom: none;
    color: var(--realm-text-muted);
}

/* ── Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--realm-font-serif);
    color: var(--realm-gold);
    line-height: 1.2;
}

p { color: var(--realm-text); }

a {
    color: var(--realm-gold);
    text-decoration: none;
    transition: color .2s;
}

a:hover {
    color: var(--realm-gold-light);
    text-decoration: underline;
}

/* ── Elementor page / section backgrounds ──────────────────────────────── */
.elementor-section,
.e-con,
.elementor-widget-wrap {
    background-color: transparent;
}

/* Default page content area */
.page-content,
.entry-content,
.elementor-widget-container p {
    color: var(--realm-text);
}

/* ── Elementor button widget ───────────────────────────────────────────── */
/* No theme overrides — Elementor controls all button styling. */

/* ── WordPress nav menus (non-Elementor) ───────────────────────────────── */
.site-navigation a,
nav.main-navigation a {
    color: var(--realm-text);
}

.site-navigation a:hover,
nav.main-navigation a:hover {
    color: var(--realm-gold);
    text-decoration: none;
}

/* ── Forms (Elementor Form widget / WP default) ────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
    background: rgba(0,0,0,.4);
    border: 1px solid var(--realm-gold-dim);
    border-radius: 5px;
    color: var(--realm-text);
    font-family: var(--realm-font-sans);
}

input:focus,
textarea:focus,
select:focus {
    outline: none !important;
    border-color: var(--realm-gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,.2);
}

/* ── Scrollbar (Webkit) ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--realm-bg-deep); }
::-webkit-scrollbar-thumb {
    background: var(--realm-gold-dim);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--realm-gold); }

/* ── WP admin bar adjustment ───────────────────────────────────────────── */
body.admin-bar .site-header { top: 32px; }

/* ── Auth nav item (Sign In / account dropdown) ────────────────────────────── */
.realm-nav-signin > a,
.realm-nav-account > a {
    border: 1px solid var(--realm-gold-dim) !important;
    border-radius: 4px !important;
    color: var(--realm-gold) !important;
    padding: 6px 14px !important;
}

.realm-nav-signin > a:hover,
.realm-nav-account > a:hover {
    border-color: var(--realm-gold) !important;
    background: rgba(212, 175, 55, 0.08) !important;
    color: var(--realm-gold-light) !important;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    body.admin-bar .site-header { top: 46px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REALM SITE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.realm-site-header {
    position: relative;
    width: 100%;
    z-index: 1000;

    /* Default height — shrinks on scroll via .is-scrolled */
    --header-height: 90px;
}

/* ── Background image layer ─────────────────────────────────────────────── */
.realm-header-bg {
    position: absolute;
    inset: 0;
    background-color: var(--realm-bg-deep);

    /* Drop your header image here — set via WP Customizer additional CSS
       or override in a page-specific stylesheet:
       background-image: url('/wp-content/uploads/your-header-bg.jpg');  */
    background-image: var(--realm-header-bg-image, none);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    transition: opacity .3s;
}

/* ── Gradient overlay — keeps text readable over any image ──────────────── */
.realm-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.72) 0%,
        rgba(13, 13, 13, 0.55) 60%,
        rgba(13, 13, 13, 0.85) 100%
    );
    pointer-events: none;
}

/* ── Inner layout ───────────────────────────────────────────────────────── */
.realm-header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    height: var(--header-height);
    transition: height .3s;
}

/* Compact on scroll */
.realm-site-header.is-scrolled {
    --header-height: 60px;
    position: sticky;
    top: 0;
}

.realm-site-header.is-scrolled .realm-header-bg {
    opacity: 0.92;
}

.realm-site-header.is-scrolled .realm-header-overlay {
    background: linear-gradient(to bottom, rgba(0,0,0,0.88), rgba(13,13,13,0.95));
}

/* Admin bar offset */
body.admin-bar .realm-site-header.is-scrolled { top: 32px; }

/* ── Site identity ──────────────────────────────────────────────────────── */
.realm-header-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.realm-site-title {
    font-family: var(--realm-font-serif);
    font-size: 26px;
    font-weight: 700;
    color: var(--realm-gold) !important;
    text-decoration: none !important;
    letter-spacing: .06em;
    text-shadow: 0 2px 12px rgba(0,0,0,.8);
    transition: color .2s;
}

.realm-site-title:hover {
    color: var(--realm-gold-light) !important;
}

.realm-site-tagline {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--realm-text-muted);
}

/* Custom logo sizing */
.realm-header-identity .custom-logo-link img {
    max-height: 58px;
    width: auto;
    transition: max-height .3s;
}

.realm-site-header.is-scrolled .custom-logo-link img {
    max-height: 36px;
}

/* ── Primary nav menu ───────────────────────────────────────────────────── */
.realm-primary-nav {
    display: flex;
    align-items: center;
}

.realm-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.realm-nav-menu li {
    position: relative;
    margin: 0;
}

.realm-nav-menu a {
    display: block;
    padding: 8px 14px;
    font-family: var(--realm-font-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--realm-text) !important;
    text-decoration: none !important;
    border-radius: 4px;
    transition: color .2s, background .2s;
    white-space: nowrap;
}

.realm-nav-menu a:hover,
.realm-nav-menu .current-menu-item > a,
.realm-nav-menu .current-page-ancestor > a {
    color: var(--realm-gold) !important;
    background: rgba(212, 175, 55, 0.08);
}

/* Gold underline accent on active item */
.realm-nav-menu .current-menu-item > a {
    position: relative;
}

.realm-nav-menu .current-menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 14px;
    right: 14px;
    height: 1px;
    background: var(--realm-gold);
    border-radius: 1px;
}

/* ── Dropdown sub-menus ─────────────────────────────────────────────────── */
.realm-nav-menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;          /* flush — no gap to lose hover over */
    left: 0;
    min-width: 200px;
    list-style: none;
    margin: 0;
    padding: 10px 0 6px; /* top padding replaces the old 6px gap visually */
    background: rgba(13, 13, 13, 0.97);
    border: 1px solid var(--realm-border);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.7);
    z-index: 100;
}

/* Invisible bridge fills the space between nav item bottom and submenu top,
   preventing the hover gap from dismissing the dropdown mid-travel. */
.realm-nav-menu li::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 10px;
    display: none;
}

.realm-nav-menu li:hover::after {
    display: block;
}

.realm-nav-menu li:hover > .sub-menu,
.realm-nav-menu li:focus-within > .sub-menu {
    display: block;
}

.realm-nav-menu .sub-menu a {
    font-size: 12px;
    padding: 8px 16px;
    border-radius: 0;
    letter-spacing: .05em;
}

.realm-nav-menu .sub-menu a:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* ── Mobile toggle button ───────────────────────────────────────────────── */
.realm-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: transparent;
    border: 1px solid var(--realm-border);
    border-radius: 4px;
    cursor: pointer;
}

.realm-nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--realm-gold);
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}

/* Animate to X when open */
.realm-nav-toggle[aria-expanded="true"] .realm-nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.realm-nav-toggle[aria-expanded="true"] .realm-nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.realm-nav-toggle[aria-expanded="true"] .realm-nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile layout ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .realm-header-inner {
        padding: 0 20px;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-height);
    }

    .realm-nav-toggle {
        display: flex;
    }

    .realm-nav-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        padding: 12px 0 16px;
        border-top: 1px solid var(--realm-border);
    }

    .realm-nav-menu.is-open {
        display: flex;
    }

    .realm-nav-menu a {
        padding: 10px 16px;
        font-size: 14px;
    }

    .realm-nav-menu .sub-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--realm-border);
        border-radius: 0;
        margin-left: 16px;
        padding: 0;
        background: transparent;
    }

    /* On mobile, show sub-menus when parent is hovered/focused */
    .realm-nav-menu li:hover > .sub-menu {
        display: block;
    }

    body.admin-bar .realm-site-header.is-scrolled { top: 46px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   REALM SITE FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.realm-site-footer {
    background: var(--realm-bg-deep);
    border-top: 1px solid var(--realm-border);
    padding: 48px 32px 32px;
    margin-top: auto;
}

.realm-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.realm-footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.realm-footer-title {
    font-family: var(--realm-font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--realm-gold);
    letter-spacing: .06em;
}

.realm-footer-tagline {
    font-size: 12px;
    color: var(--realm-text-muted);
    letter-spacing: .1em;
}

.realm-footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
}

.realm-footer-menu a {
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--realm-text-muted) !important;
    text-decoration: none !important;
    padding: 4px 8px;
    transition: color .2s;
}

.realm-footer-menu a:hover {
    color: var(--realm-gold) !important;
}

.realm-footer-copy {
    font-size: 12px;
    color: var(--realm-text-muted);
    margin: 0;
}

/* ── WP page title (non-Elementor pages that still show the H1) ────────────── */
.page-header {
    padding: 40px 32px 24px;
    text-align: center;
    border-bottom: 1px solid var(--realm-border);
    margin-bottom: 40px;
}

.page-header .entry-title {
    font-family: var(--realm-font-serif);
    font-size: clamp(28px, 5vw, 48px);
    color: var(--realm-gold);
    letter-spacing: .04em;
    margin: 0;
}

/* ── Remove Hello Elementor's default header/footer so ours takes over ─── */
.site-header:not(.realm-site-header),
.site-footer:not(.realm-site-footer) {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REALM AUTH PAGES (Login / Register)
   ═══════════════════════════════════════════════════════════════════════════ */

.realm-auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: var(--realm-bg);
}

.realm-auth-container {
    width: 100%;
    max-width: 440px;
}

.realm-auth-card {
    background: var(--realm-bg-card);
    border: 1px solid var(--realm-border);
    border-radius: 10px;
    padding: 40px 36px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.realm-auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.realm-auth-title {
    font-family: var(--realm-font-serif);
    font-size: 28px;
    color: var(--realm-gold);
    margin: 0 0 6px;
    letter-spacing: .06em;
}

.realm-auth-subtitle {
    font-size: 14px;
    color: var(--realm-text-muted);
    margin: 0;
}

/* ── Notices ─────────────────────────────────────────────────────────────── */
.realm-auth-notice {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 3px solid;
}

.realm-auth-error {
    background: rgba(244, 67, 54, 0.12);
    border-color: var(--realm-error);
    color: #f88;
}

.realm-auth-success {
    background: rgba(76, 175, 80, 0.12);
    border-color: var(--realm-success);
    color: #8d8;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.realm-auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.realm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.realm-field-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.realm-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--realm-text);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.realm-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid var(--realm-gold-dim) !important;
    border-radius: 5px !important;
    color: var(--realm-text) !important;
    font-family: var(--realm-font-sans);
    font-size: 15px;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.realm-input:focus {
    outline: none !important;
    border-color: var(--realm-gold) !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2) !important;
}

.realm-field-hint {
    font-size: 12px;
    color: var(--realm-text-muted);
}

/* ── Checkbox row ────────────────────────────────────────────────────────── */
.realm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--realm-text-muted);
    cursor: pointer;
}

.realm-checkbox-label input[type="checkbox"] {
    accent-color: var(--realm-gold);
    width: 15px;
    height: 15px;
}

/* ── Submit button ───────────────────────────────────────────────────────── */
.realm-auth-btn {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
    background: linear-gradient(160deg, var(--realm-gold) 0%, #9a7a1a 100%);
    color: #111;
    border: none;
    border-radius: 6px;
    font-family: var(--realm-font-serif);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter .2s, transform .15s;
}

.realm-auth-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.realm-auth-btn:active {
    transform: translateY(0);
}

/* ── Footer links ────────────────────────────────────────────────────────── */
.realm-auth-switch {
    text-align: center;
    margin: 20px 0 0;
    font-size: 14px;
    color: var(--realm-text-muted);
}

.realm-auth-link {
    color: var(--realm-gold);
    text-decoration: none;
    transition: color .2s;
}

.realm-auth-link:hover {
    color: var(--realm-gold-light);
    text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .realm-auth-card {
        padding: 28px 20px;
    }

    .realm-field-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ── Turnstile widget centering ──────────────────────────────────────────── */
.realm-turnstile {
    display: flex;
    justify-content: center;
}

/* ── Social Login (Nextend) ──────────────────────────────────────────────── */
.realm-social-login {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.realm-social-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 16px;
    background: var(--realm-bg-deep);
    border: 1px solid var(--realm-border);
    border-radius: 6px;
    text-decoration: none !important;
    color: var(--realm-text) !important;
    font-family: var(--realm-font-sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    box-sizing: border-box;
    cursor: pointer;
}

.realm-social-btn:hover {
    border-color: var(--realm-gold);
    background: rgba(212, 175, 55, 0.06);
    color: var(--realm-gold) !important;
    transform: translateY(-1px);
    text-decoration: none !important;
}

.realm-social-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.realm-social-label {
    flex: 1;
    text-align: center;
}

/* Divider between social and form */
.realm-social-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: var(--realm-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.realm-social-divider::before,
.realm-social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--realm-border);
}

/* ── Mobile auth bar ───────────────────────────────────────────────────── */
.realm-mobile-auth {
    display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
    .realm-mobile-auth {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: rgba(13, 13, 13, 0.97);
        border-top: 1px solid var(--realm-border);
        padding: 10px 16px;
        gap: 10px;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        /* keep page content from hiding behind the bar */
        box-shadow: 0 -2px 16px rgba(0,0,0,0.5);
    }

    /* push page footer up so it isn't hidden behind the bar */
    body { padding-bottom: 68px; }

    .realm-mobile-auth-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 11px 12px;
        border-radius: var(--realm-radius);
        font-family: var(--realm-font-sans);
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        text-align: center;
        transition: opacity 0.15s;
    }
    .realm-mobile-auth-btn:active { opacity: 0.8; }

    .realm-mobile-auth-signin {
        background: transparent;
        border: 1px solid var(--realm-border);
        color: var(--realm-gold);
    }

    .realm-mobile-auth-register {
        background: var(--realm-gold);
        border: 1px solid var(--realm-gold);
        color: #111;
    }

    .realm-mobile-auth-account {
        background: rgba(212, 175, 55, 0.12);
        border: 1px solid var(--realm-border);
        color: var(--realm-gold);
    }

    /* hide the bar on the login/register pages themselves — redundant there */
    body.page-template-page-login .realm-mobile-auth,
    body.page-template-page-register .realm-mobile-auth {
        display: none;
    }
    body.page-template-page-login,
    body.page-template-page-register {
        padding-bottom: 0;
    }
}

/* hide nav Sign In item on mobile — sticky bar handles it */
@media (max-width: 768px) {
    .realm-nav-signin,
    .realm-nav-account {
        display: none !important;
    }
}
