/*
Theme Name: Nexus
Theme URI: https://47-studio.com/base47
Author: Base47
Author URI: https://47-studio.com/base47
Description: Clean, responsive WordPress theme with customizable layouts, navigation options, and Canvas Mode for custom HTML layouts. Compatible with popular page builders and WooCommerce.
Version: 4.0.1
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nexus-theme
Tags: custom-header, custom-menu, featured-images, flexible-header, footer-widgets, full-width-template, theme-options, threaded-comments, translation-ready
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
*/

/* ------------------------------------
   1. BASE RESET (safe + minimal)
   Applied to ALL pages
------------------------------------ */

html, body {
    margin: 0;
    padding: 0;
}

/* Safe global box-sizing for all pages */
* {
    box-sizing: border-box;
}

/* Allow templates to manage spacing */
.entry-content {
    margin: 0 !important;
    padding: 0 !important;
}

/* Media should behave but not change layout */
img, video, picture, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Optional basic anchor behavior */
a {
    color: inherit;
    text-decoration: none;
}

/* ------------------------------------
   2. ACCESSIBILITY - Skip Link
   WCAG compliant skip-to-content link
------------------------------------ */

.skip-link,
.screen-reader-text {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.skip-link:focus {
    position: fixed;
    left: 16px;
    top: 16px;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
    z-index: 100000;
    padding: 12px 16px;
    background: #fff;
    color: #111;
    border: 2px solid #ff4d00;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ------------------------------------
   3. CANVAS/APP MODE - Layout Control
   Scoped to canvas/app pages ONLY
------------------------------------ */

body.base47-canvas,
body.base47-app-shell {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

/* Canvas/App mode: Remove WordPress layout interference - target specific wrappers */
body.base47-app-shell #page,
body.base47-app-shell .base47-site,
body.base47-app-shell .site-main,
body.base47-app-shell .entry-content,
body.base47-app-shell #base47-main,
body.base47-app-shell .b47-main,
body.base47-canvas #page,
body.base47-canvas .base47-site,
body.base47-canvas .site-main,
body.base47-canvas .entry-content,
body.base47-canvas #base47-main,
body.base47-canvas .b47-main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Canvas/App mode: Remove Base47 container padding */
body.base47-canvas .b47-container,
body.base47-canvas .b47-page-inner,
body.base47-app-shell .b47-container,
body.base47-app-shell .b47-page-inner {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
}

/* ------------------------------------
   4. MOBILE-SPECIFIC FIXES
   Scoped to canvas/app mode ONLY
------------------------------------ */

@media (max-width: 768px) {
    /* Canvas/App mode: Remove WordPress button styling */
    body.base47-app-shell .wp-block-button__link,
    body.base47-app-shell .wp-block-file__button,
    body.base47-canvas .wp-block-button__link,
    body.base47-canvas .wp-block-file__button {
        all: unset !important;
    }
    
    /* Canvas/App mode: Fix WordPress-added padding on mobile */
    body.base47-app-shell.page,
    body.base47-app-shell.single,
    body.base47-app-shell.home,
    body.base47-canvas.page,
    body.base47-canvas.single,
    body.base47-canvas.home {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Canvas/App mode: First section spacing fix */
    body.base47-app-shell #page,
    body.base47-app-shell .entry-content,
    body.base47-canvas #page,
    body.base47-canvas .entry-content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* ------------------------------------
   5. MOBILE SAFARI HEIGHT FIX
------------------------------------ */

:root {
    --vh: 1vh;
}

@media (max-width: 768px) {
    html, body {
        height: auto !important;
    }
}

/* ------------------------------------
   6. SCROLL-TO-TOP BUTTON STYLING
------------------------------------ */

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #ff4d00;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(255, 77, 0, 0.3);
}

.scroll-to-top:hover {
    background-color: #e63900;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 77, 0, 0.4);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top i {
    font-size: 18px;
}

/* Hide scroll-to-top on Canvas Mode pages */
body.base47-canvas .scroll-to-top,
body.base47-app-shell .scroll-to-top {
    display: none !important;
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .scroll-to-top i {
        font-size: 16px;
    }
}
