/**
 * charte.css — Ravivo Labs brand skin for the WordPress account page.
 *
 * Replicates the "Vintage Chaleureux" design system from the React studio:
 *   - Variables: src/styles/global.css → :root
 *   - Tokens:    tailwind.config.js (colors, shadows, radius, fonts)
 *   - Components: SiteHeader.tsx + SiteFooter.tsx layout logic
 *
 * Google Fonts are loaded via wp_enqueue_style() in ravivo-proxy.php.
 * Font families declared here assume the stylesheet is already loaded:
 *   - Fraunces (display / serif)
 *   - DM Sans  (body / sans-serif)
 *
 * Mobile-first: 375px base → 900px desktop breakpoint (matches studio).
 *
 * @package ravivo
 */

/* ============================================================
   1. CSS custom properties — design system tokens
============================================================ */
:root {
    /* Palette */
    --rv-cream:         #F7F1E6;
    --rv-ivory:         #EDE7D4;
    --rv-parchment:     #D9CEBC;
    --rv-sepia-light:   #C9A97A;
    --rv-amber:         #B8864E;
    --rv-terracotta:    #C1694F;
    --rv-terra-dark:    #9B4F38;
    --rv-brown-warm:    #6B4226;
    --rv-brown-deep:    #3D2314;
    --rv-sage:          #7A9A7E;
    --rv-sage-light:    #A8C5AC;
    --rv-ink:           #2C1A0E;

    /* Typography */
    --rv-font-display:  'Fraunces', Georgia, serif;
    --rv-font-body:     'DM Sans', system-ui, sans-serif;

    /* Shadows (from tailwind.config.js) */
    --rv-shadow-warm-sm: 0 4px 16px rgba(61, 35, 20, 0.18);
    --rv-shadow-warm-md: 0 8px 40px rgba(61, 35, 20, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
    --rv-shadow-terra:   0 4px 16px rgba(193, 105, 79, 0.35);
    --rv-shadow-terra-h: 0 8px 24px rgba(193, 105, 79, 0.45);

    /* Border-radius tokens */
    --rv-radius-pill:    20px;
    --rv-radius-card:    20px;
    --rv-radius-section: 16px;
    --rv-radius-input:   8px;
    --rv-radius-btn:     6px;
    --rv-radius-chip:    4px;

    /* Grain texture */
    --rv-grain-opacity: 0.045;
}

/* ============================================================
   2. Base reset — body & html for the account page context
   Only scoped styles live under .ravivo-account-wrap to avoid
   polluting the WordPress theme globals.
============================================================ */
.ravivo-account-wrap,
.ravivo-acc-header,
.ravivo-acc-footer {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ravivo-account-wrap *,
.ravivo-account-wrap *::before,
.ravivo-account-wrap *::after,
.ravivo-acc-header *,
.ravivo-acc-header *::before,
.ravivo-acc-header *::after,
.ravivo-acc-footer *,
.ravivo-acc-footer *::before,
.ravivo-acc-footer *::after {
    box-sizing: inherit;
}

/* ============================================================
   3. Grain paper overlay — body::before
   Matches global.css implementation exactly.
   Applied to body; pointer-events: none so it never blocks clicks.
============================================================ */
body.ravivo-account-body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--rv-grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

/* ============================================================
   4. Page layout wrapper
============================================================ */
.ravivo-account-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--rv-cream);
    font-family: var(--rv-font-body);
    color: var(--rv-brown-deep);
}

.ravivo-account-main {
    flex: 1 1 auto;
}

/* ============================================================
   5. HEADER — .ravivo-acc-header
   Matches SiteHeader.tsx: sticky, cream/0.88 bg, border-b, backdrop-blur,
   shadow-warm-md on scroll (toggled via JS class .is-scrolled).
============================================================ */
.ravivo-acc-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: rgba(247, 241, 230, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(201, 169, 122, 0.30); /* sepia-light/30 */
    padding: 0.85rem 0;
    transition: box-shadow 0.3s ease;
}

.ravivo-acc-header.is-scrolled {
    box-shadow: var(--rv-shadow-warm-md);
}

/* Inner container — centred, full-bleed header, constrained content */
.ravivo-acc-header-inner {
    max-width: 87.5rem; /* 1400px */
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

/* ── Logo ── */
.ravivo-acc-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
}

.ravivo-acc-logo:focus {
    outline: 2px underline solid transparent;
    text-decoration: underline;
}

.ravivo-acc-logo-img {
    width: 2.25rem;   /* 36px — w-9 */
    height: 2.25rem;
    object-fit: contain;
    flex-shrink: 0;
}

.ravivo-acc-logo-text {
    font-family: var(--rv-font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--rv-brown-deep);
    letter-spacing: 0.04em;
    line-height: 1;
    white-space: nowrap;
}

.ravivo-acc-logo-text span {
    color: var(--rv-terracotta);
}

/* ── Desktop nav — hidden below 900 px ── */
.ravivo-acc-nav {
    display: none;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ravivo-acc-nav a {
    position: relative;
    font-family: var(--rv-font-body);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--rv-brown-warm);
    letter-spacing: 0.02em;
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.ravivo-acc-nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    height: 1.5px;
    width: 0;
    background: var(--rv-terracotta);
    transition: width 0.25s ease-out;
}

.ravivo-acc-nav a:hover {
    color: var(--rv-brown-deep);
}

.ravivo-acc-nav a:hover::after,
.ravivo-acc-nav a[aria-current="page"]::after {
    width: 100%;
}

.ravivo-acc-nav a[aria-current="page"] {
    color: var(--rv-brown-deep);
    font-weight: 500;
}

/* ── Right group ── */
.ravivo-acc-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ── Beta badge ── */
.ravivo-acc-badge-beta {
    display: none; /* hidden < sm; shown via media query below */
    align-items: center;
    font-family: var(--rv-font-body);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #ffffff;
    background: var(--rv-terracotta);
    padding: 0.2rem 0.55rem;
    border-radius: var(--rv-radius-chip);
    white-space: nowrap;
}

/* ── Language selector ── */
.ravivo-acc-lang {
    display: flex;
    align-items: center;
    gap: 0;
    font-family: var(--rv-font-body);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.ravivo-acc-lang a,
.ravivo-acc-lang span.ravivo-acc-lang-sep {
    color: var(--rv-brown-warm);
    text-decoration: none;
    padding: 0.15rem 0.3rem;
    transition: color 0.2s ease;
}

.ravivo-acc-lang a:hover {
    color: var(--rv-brown-deep);
}

.ravivo-acc-lang a.active {
    color: var(--rv-terracotta);
    font-weight: 600;
}

.ravivo-acc-lang-sep {
    opacity: 0.45;
}

/* ── Account menu (logged-in user) ── */
.ravivo-acc-user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* Avatar — circle with user initial */
.ravivo-acc-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;       /* 32px */
    height: 2rem;
    border-radius: 50%;
    background: var(--rv-ivory);
    border: 1.5px solid var(--rv-parchment);
    font-family: var(--rv-font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rv-brown-deep);
    flex-shrink: 0;
    text-transform: uppercase;
}

/* User name — truncated on small viewports */
.ravivo-acc-username {
    font-family: var(--rv-font-body);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--rv-brown-warm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 7rem; /* prevent overflow on narrow viewports */
    display: none;   /* hidden on mobile, visible ≥ 540px */
}

/* Credit balance badge */
.ravivo-acc-credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--rv-font-body);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--rv-terracotta);
    background: rgba(193, 105, 79, 0.10);
    border: 1px solid rgba(193, 105, 79, 0.22);
    border-radius: var(--rv-radius-pill);
    padding: 0.18rem 0.6rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* Logout link */
.ravivo-acc-logout {
    font-family: var(--rv-font-body);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--rv-brown-warm);
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
    white-space: nowrap;
    display: none; /* hidden on mobile, visible ≥ 540px */
}

.ravivo-acc-logout:hover {
    color: var(--rv-terracotta);
    text-decoration: underline;
}

/* ── CTA "Essayer gratuitement" — desktop only ── */
.ravivo-acc-cta {
    display: none; /* hidden below 900px */
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: var(--rv-radius-btn);
    font-family: var(--rv-font-body);
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    color: #ffffff;
    background: var(--rv-terracotta);
    text-decoration: none;
    box-shadow: var(--rv-shadow-terra);
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 2.75rem; /* 44px touch target */
    white-space: nowrap;
}

.ravivo-acc-cta:hover {
    background: var(--rv-terra-dark);
    transform: translateY(-2px);
    box-shadow: var(--rv-shadow-terra-h);
}

.ravivo-acc-cta:active {
    transform: scale(0.95);
}

/* ============================================================
   6. FOOTER — .ravivo-acc-footer
   Matches SiteFooter.tsx: brown-deep background, 3-col grid,
   brand column + 2 link columns, bottom copyright bar.
============================================================ */
.ravivo-acc-footer {
    background-color: var(--rv-brown-deep);
    color: rgba(247, 241, 230, 0.70); /* cream/70 */
    font-family: var(--rv-font-body);
}

.ravivo-acc-footer-inner {
    max-width: 62.5rem; /* 1000px — max-w-5xl */
    margin: 0 auto;
    padding: 3rem 1.25rem 2rem;
}

/* ── Upper grid ── */
.ravivo-acc-footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(247, 241, 230, 0.10); /* cream/10 */
}

/* ── Brand column ── */
.ravivo-acc-footer-brand {}

.ravivo-acc-footer-logo-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ravivo-acc-footer-logo-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--rv-cream);
    flex-shrink: 0;
}

.ravivo-acc-footer-logo-circle img {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
}

.ravivo-acc-footer-brand-name {
    font-family: var(--rv-font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--rv-cream);
    line-height: 1;
    white-space: nowrap;
}

.ravivo-acc-footer-brand-name span {
    color: var(--rv-sepia-light);
}

.ravivo-acc-footer-tagline {
    font-family: var(--rv-font-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.8rem;
    color: rgba(247, 241, 230, 0.45); /* cream/45 */
    margin: 0.5rem 0 0;
    line-height: 1.5;
}

/* AI badge */
.ravivo-acc-footer-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    border-radius: var(--rv-radius-pill);
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.ravivo-acc-footer-ai-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rv-sage-light);
    flex-shrink: 0;
    animation: rvPulseDot 2s ease-in-out infinite;
}

.ravivo-acc-footer-ai-text {
    color: rgba(247, 241, 230, 0.55); /* cream/55 */
}

@keyframes rvPulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.85); }
}

/* ── Link columns ── */
.ravivo-acc-footer-col-title {
    font-family: var(--rv-font-body);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rv-sepia-light);
    margin: 0 0 0.75rem;
}

.ravivo-acc-footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ravivo-acc-footer-links a {
    font-family: var(--rv-font-body);
    font-size: 0.82rem;
    color: rgba(247, 241, 230, 0.60); /* cream/60 */
    text-decoration: none;
    transition: color 0.2s ease;
}

.ravivo-acc-footer-links a:hover {
    color: var(--rv-sepia-light);
}

/* ── Bottom bar ── */
.ravivo-acc-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 1.5rem;
}

.ravivo-acc-footer-copy {
    font-family: var(--rv-font-body);
    font-size: 0.75rem;
    color: rgba(247, 241, 230, 0.30); /* cream/30 */
    margin: 0;
}

.ravivo-acc-footer-motto {
    font-family: var(--rv-font-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.75rem;
    color: rgba(247, 241, 230, 0.30); /* cream/30 */
    margin: 0;
}

/* ============================================================
   7. Responsive — 540px breakpoint (show username + logout)
============================================================ */
@media (min-width: 540px) {
    .ravivo-acc-header-inner {
        padding: 0 1.5rem;
    }

    .ravivo-acc-badge-beta {
        display: inline-flex;
    }

    .ravivo-acc-username {
        display: block;
    }

    .ravivo-acc-logout {
        display: inline;
    }
}

/* ============================================================
   8. Responsive — 900px desktop breakpoint (nav + CTA visible)
============================================================ */
@media (min-width: 900px) {
    .ravivo-acc-nav {
        display: flex;
    }

    .ravivo-acc-cta {
        display: inline-flex;
    }

    .ravivo-acc-footer-grid {
        grid-template-columns: 1fr auto auto;
        gap: 3rem;
    }
}
