/* MemoryMantle Shared Styles
 * Common header, footer, nav, and utility styles used across all pages.
 * Include this in every page to reduce CSS duplication.
 */

/* ========== ACCESSIBILITY: TEXT SIZE ========== */
html.text-large  { font-size: 112.5%; overflow-x: clip; }
html.text-larger { font-size: 125%;   overflow-x: clip; }

/* Protect header chrome from growing — logo/nav use rem which scales with root */
html.text-large .logo,
html.text-larger .logo { font-size: 17px !important; }

html.text-large .header,
html.text-larger .header { padding-left: 32px !important; padding-right: 32px !important; }

html.text-large .nav-links a,
html.text-larger .nav-links a { font-size: 16px !important; }

html.text-large .nav-login-btn,
html.text-larger .nav-login-btn { font-size: 15px !important; padding: 8px 20px !important; }

html.text-large .hamburger-menu,
html.text-larger .hamburger-menu { padding: 12px !important; }

/* Protect mobile quick-actions bottom bar (memorial/notice view pages) */
html.text-large .hero-quick-link,
html.text-larger .hero-quick-link { font-size: 14px !important; padding: 12px 20px !important; }

@media (max-width: 768px) {
    html.text-large .hero-quick-link,
    html.text-larger .hero-quick-link { font-size: 10px !important; padding: 8px 4px !important; }
    html.text-large .hero-quick-actions,
    html.text-larger .hero-quick-actions { padding: 12px 8px !important; gap: 0 !important; }
}

/* A−/A+ toggle buttons injected by accessibility.js */
#mm-a11y-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 12px;
}

@media (max-width: 768px) {
    #mm-a11y-controls { display: none; }
}

.a11y-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 600;
    line-height: 1;
    padding: 3px 6px;
    transition: border-color 0.2s, color 0.2s;
    font-family: inherit;
}

.a11y-btn:hover {
    border-color: #d4a853;
    color: #2a2a2a;
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Kill horizontal sideswipe at the viewport level. Any element that
 * overflows horizontally (long inline styles with min-width, a stray
 * 100vw, an embed wider than the column) used to let mobile users
 * swipe the whole page sideways. `clip` is preferred over `hidden`
 * because it doesn't create a new scrolling context, so
 * position:sticky on descendants keeps working. Tables that
 * legitimately need horizontal scroll already wrap themselves in
 * .table-scroll (overflow-x:auto), which still works — the scroll
 * happens inside the wrapper, not at the body level.
 *
 * The accessibility rules above (html.text-large / .text-larger)
 * had this in place for zoom modes only; this extends it to the
 * default state. Repro 2026-06-16 on the director portal at <=768px;
 * fix is universal across every page that includes shared.css. */
html, body {
    overflow-x: clip;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #333;
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ========== HEADER ========== */
.header {
    background-color: white;
    border-bottom: 1px solid #e8e4df;
    padding: 1rem 2rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    /* 1.5rem matches the my-mantles / my-notices / account-settings
       local overrides — those were the "loud" header that diverged
       from the previously-canonical 1.05rem (dashboard, edit-*,
       view-* etc.). Promoting the larger size here unifies every page
       to one rule. */
    font-size: 1.5rem;
    font-weight: 600;
    color: #2a2a2a;
    text-decoration: none;
    font-family: 'Playfair Display', serif;
}

.logo i { margin-right: 0.5rem; color: var(--mm-accent, #d4a853); }

/* Brand mark (replaces the old fa-feather-alt glyph in the logo and in
 * section headings). Sized in em so it scales to its context the same
 * way the font glyph used to. */
.mm-mark {
    height: 1.1em;
    width: auto;
    vertical-align: -0.22em;
    margin-right: 0.4em;
}
.logo .mm-mark {
    height: 2.1em;
    margin-right: 0.5rem;
    vertical-align: middle;
}
/* Stacked wordmark: "Memory" over "Mantle" beside the mark. */
.logo .logo-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.02;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #666666;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--mm-accent, #2a2a2a);
}

.nav-login-btn {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: white !important;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
}

.nav-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.4);
    color: white !important;
}

/* ========== HAMBURGER & MOBILE MENU ========== */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    min-width: 44px;
    min-height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-menu span {
    width: 25px;
    height: 3px;
    background-color: #2a2a2a;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 1rem;
    z-index: 1000;
    min-width: 220px;
    margin-top: 0.5rem;
    /* Long signed-in menus (7 page links + Admin + Log Out) can overflow
       the viewport on small phones — let them scroll instead of being
       clipped. The 100px subtraction keeps the header + a comfortable
       bottom margin in view. */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    /* Flex column so the injected A−/A+ "Text size" row can be pinned to the
       bottom via `order` regardless of DOM insertion order. accessibility.js
       appends the text-size row, then auth-helper.js appends login/logout
       links after it — without this the text-size row gets stranded mid-menu. */
    display: flex;
    flex-direction: column;
}

/* Always render the injected text-size control as the last row of the drawer.
   Every other item defaults to order:0 (DOM order); this forces it last. */
.mobile-menu #mm-a11y-controls-mobile {
    order: 100;
}

.mobile-menu a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #666666;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.mobile-menu a:hover {
    background-color: #f5f3f0;
    color: #2a2a2a;
}

.mobile-menu .mobile-login-btn {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: white;
    text-align: center;
    margin-top: 0.5rem;
}

.mobile-menu .mobile-login-btn:hover {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    color: white;
}

/* ========== NAV AUTH BUTTONS ========== */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
}

.nav-auth-login {
    color: #666666 !important;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
    padding: 0.4rem 0;
    white-space: nowrap;
}

.nav-auth-login:hover {
    color: #2a2a2a !important;
}

.nav-auth-signup {
    background: linear-gradient(135deg, #d4a853 0%, #c49a48 100%);
    color: white !important;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-auth-signup:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.4);
    color: white !important;
}

.nav-auth-dashboard {
    color: #666666 !important;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-auth-dashboard:hover {
    color: #2a2a2a !important;
}

.nav-auth-dashboard i {
    margin-right: 0.25rem;
}

.nav-auth-logout {
    color: #999 !important;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
    white-space: nowrap;
}

.nav-auth-logout:hover {
    color: #c45050 !important;
}

/* Mobile auth buttons */
.mobile-auth-divider {
    border-top: 1px solid #e8e4df;
    margin: 0.5rem 0;
}

.mobile-menu .mobile-auth-login,
.mobile-menu .mobile-auth-signup {
    display: block;
    text-align: center;
}

.mobile-menu .mobile-auth-signup {
    background: linear-gradient(135deg, #d4a853 0%, #c49a48 100%);
    color: white;
    margin-top: 0.5rem;
}

.mobile-menu .mobile-auth-signup:hover {
    background: linear-gradient(135deg, #c49a48 0%, #b88d3d 100%);
    color: white;
}

.mobile-menu .mobile-auth-dashboard,
.mobile-menu .mobile-auth-userlink {
    display: block;
}

.mobile-menu .mobile-auth-userlink i {
    width: 1.25rem;
    margin-right: 0.4rem;
    color: var(--mm-accent, #d4a853);
}

.mobile-menu .mobile-auth-logout {
    display: block;
    color: #999;
    text-align: center;
}

.mobile-menu .mobile-auth-logout:hover {
    color: #c45050;
    background-color: #fef2f2;
}

@media (max-width: 768px) {
    .nav-auth {
        display: none;
    }
}

/* ========== BUTTONS ========== */
.btn-primary {
    background: linear-gradient(135deg, #2a2a2a 0%, #363636 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(42, 42, 42, 0.3);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: #5a8a5a;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

/* ========== FOOTER ========== */
.footer {
    background-color: #1a1a1a;
    color: #d5d0c8;
    padding: 3rem 2rem 2rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: #d4a853;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section ul { list-style: none; }
.footer-section ul li { margin-bottom: 0.5rem; }

.footer-section ul li a {
    color: #777777;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-section ul li a:hover { color: #d4a853; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.footer-logo {
    color: white;
    font-weight: 600;
    font-family: 'Playfair Display', serif;
}

.social-links { display: flex; gap: 1rem; }
.social-links a { color: #777777; font-size: 1.2rem; text-decoration: none; transition: color 0.2s; }
.social-links a:hover { color: #d4a853; }

/* ========== FORM STYLES ========== */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    color: #2a2a2a;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #d5d0c8;
    border-radius: 10px;
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #d4a853;
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

/* ========== STATUS MESSAGES ========== */
.error-message {
    background: #faf5f2;
    border: 1px solid #f0ddd0;
    color: #c45050;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: none;
}

.success-message {
    background: #f2f8f2;
    border: 1px solid #daeeda;
    color: #5a8a5a;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: none;
}

/* ========== AUTH PAGES (login, signup, forgot-password) ========== */
.auth-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { color: #1a1a1a; font-size: 1.75rem; margin-bottom: 0.5rem; }
.auth-header p { color: #888888; font-size: 0.95rem; line-height: 1.5; }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8e4df;
    color: #888888;
}

.auth-footer a { color: #2a2a2a; font-weight: 600; text-decoration: none; }

.password-wrapper { position: relative; }

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888888;
    cursor: pointer;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.remember-me { display: flex; align-items: center; gap: 0.5rem; color: #666666; }
.remember-me input { width: 16px; height: 16px; accent-color: #2a2a2a; }
.forgot-link { color: #2a2a2a; text-decoration: none; font-weight: 500; }

/* Full-width button variant */
.btn {
    width: 100%;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: #999999;
    font-size: 0.85rem;
}

.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #e8e4df; }
.divider span { padding: 0 1rem; }

/* Social login buttons */
.social-buttons { display: flex; flex-direction: column; gap: 0.75rem; }
.btn-social { background: white; border: 2px solid #e8e4df; color: #363636; }
.btn-social:hover { background: #faf8f5; }
.btn-google i { color: #c45050; }
.btn-facebook i { color: #2a2a2a; }

/* Signup benefits box */
.benefits {
    background-color: #f2f8f2;
    border: 1px solid #daeeda;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.benefits-title { font-weight: 600; color: #3d6a3d; font-size: 0.9rem; margin-bottom: 0.5rem; }
.benefits ul { list-style: none; font-size: 0.85rem; color: #4d7a4d; }
.benefits li { padding: 0.25rem 0; }
.benefits li i { margin-right: 0.5rem; color: #5a8a5a; }

/* Terms checkbox */
.terms-group {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #666666;
}

.terms-group input { margin-top: 0.2rem; accent-color: #2a2a2a; }
.terms-group a { color: #2a2a2a; }

/* ========== ACCESSIBILITY ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========== RESPONSIVE ========== */
/* Nav switches to hamburger at 1024px (iPad portrait) rather than 768px:
   a signed-in dashboard nav has 7 page links + Admin badge + user-menu,
   which crams between 800–1200px viewports. !important wins against the
   12 pages that still carry inline @media 768px nav rules so we don't
   have to chase them down individually. Marketing pages with fewer items
   also use hamburger here — clean, expected on tablet portrait. */
@media (max-width: 1024px) {
    .nav-links { display: none !important; }
    .hamburger-menu { display: flex !important; }
    /* Mobile/tablet lockup: centre the logo + wordmark and pin the
     * hamburger to the right corner. The hamburger is lifted out of flow
     * so the logo is the only in-flow flex child and centres cleanly,
     * regardless of which page it's on. */
    .nav-container { justify-content: center !important; }
    .hamburger-menu {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }
}
@media (max-width: 768px) {
    /* Symmetric padding so the centred logo sits dead-centre and the
     * hamburger tucks an equal inset into the right corner. */
    .header { padding: 1rem; }
    .footer-content { grid-template-columns: repeat(2, 1fr); }
    .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
}

@media (max-width: 480px) {
    /* Matches the my-mantles.css <480px override of 1.25rem so the
       header stays at the same height across every page on narrow
       phones. */
    .logo { font-size: 1.25rem; }
    .header { padding: 0.75rem; }
    .footer-content { grid-template-columns: 1fr; }
    .auth-container { padding: 1.25rem; margin: 0.5rem; }
}

/* ========== MOBILE TOUCH & SAFE AREA ========== */
@media (hover: none) and (pointer: coarse) {
    /* Active states for touch devices (replaces hover) */
    .btn:active, .btn-primary:active, .btn-social:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    .nav-links a:active, .mobile-menu a:active {
        background-color: #f5f3f0;
    }
    /* Ensure password toggle is tappable */
    .password-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========== FOOTER ========== */
.footer {
    background-color: #2a2a2a;
    color: #ccc;
    padding: 3rem 2rem 0;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid #444;
}

.footer-section h3 {
    color: #fff;
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-section a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: #d4a853;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0 2rem;
    font-size: 0.85rem;
    color: #888;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-logo {
    color: #d4a853;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: #888;
    font-size: 1.1rem;
    text-decoration: none;
    transition: color 0.2s;
}

.social-links a:hover {
    color: #d4a853;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ── Owner "View as public" preview mode ─────────────────────────────
   Lets the memorial / notice owner temporarily hide every owner-only
   widget so they can see exactly what a visitor sees. The toggle is
   wired in public/js/owner-preview.js — it just flips
   body[data-mm-preview="public"] and these rules do the work.

   When extending, prefer hiding by the same .edit-btn / .delete-btn /
   data-owner-only conventions already in use rather than minting new
   selectors per widget. */
body[data-mm-preview="public"] .edit-btn,
body[data-mm-preview="public"] .delete-btn,
body[data-mm-preview="public"] .handover-btn,
body[data-mm-preview="public"] .upgrade-btn,
body[data-mm-preview="public"] .create-memorial-btn,
body[data-mm-preview="public"] [data-owner-only],
body[data-mm-preview="public"] #mm-condolence-owner-toggle,
body[data-mm-preview="public"] #slideshow-review-banner {
    display: none !important;
}

/* The toggle itself stays visible in preview mode so the owner can
   exit. Its label flips to "Exit preview" via the JS. */
body[data-mm-preview="public"] .mm-preview-toggle {
    background: rgba(255, 245, 217, 0.92);
    color: #5a4422;
}

/* Slim sticky banner that appears at the top of the page in preview
   mode. Reuses the brand cream + gold to feel native. Position fixed
   so it stays visible while the owner scrolls. */
#mm-preview-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #2a2a2a;
    color: #fdfaf2;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

#mm-preview-banner i {
    color: #d4a853;
    margin-right: 0.35rem;
}

#mm-preview-banner button {
    background: #d4a853;
    color: #1a1a1a;
    border: none;
    padding: 0.3rem 0.85rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.825rem;
    cursor: pointer;
}

#mm-preview-banner button:hover {
    background: #e0b663;
}

/* Push the page down so the banner doesn't cover the fixed header. */
body[data-mm-preview="public"] {
    padding-top: 44px;
}

