/*
Theme Name:     Planeteria Base
Description:    A modern block theme for government and municipal websites with full site editing support. Features clean design, accessibility, and performance optimization.
Author:         Planeteria
Author URI:     https://planeteria.com/
Version:        2.0.0
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: planeteria-media
Domain Path: /languages
Tags: block-styles, custom-colors, custom-logo, custom-menu, featured-images, full-site-editing, full-width-template, one-column, two-columns, three-columns, left-sidebar, right-sidebar, responsive-design, accessibility-ready, translation-ready, rtl-language-support, style-variations, wide-blocks, blog, news, portfolio, sticky-post, threaded-comments
*/

/* Reset and base styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
}

/* Typography */
a {
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Block styles */

/* Override WordPress core layout spacing (24px) - theme.json blockGap applies in editor
   but not on frontend. Use theme spacing preset for consistency. 
:root :where(.is-layout-constrained) > * {
    margin-block-start: var(--wp--preset--spacing--6) !important;
    margin-block-end: 0;
}*/

:root :where(.is-layout-constrained) > :first-child {
    margin-block-start: 0 !important;
}

.wp-block-group {
    margin-bottom: 0;
}

.wp-block-button__link {
    display: inline-block;
    text-decoration: none;
    transition: all 0.2s ease;
}

/* Responsive design */
@media (max-width: 768px) {
    
    .wp-block-column {
        flex-basis: 100%;
    }
    
    .wp-block-navigation__responsive-container-open {
        display: block;
    }
    
    .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: none;
    }
}

/* Accessibility */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background-color: var(--wp--preset--color--primary);
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: var(--wp--preset--color--background);
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--4);
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Skip Links */
.skip-links {
    position: absolute;
    top: -100px;
    left: 0;
    right: 0;
    z-index: 100000;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 6px;
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--background);
    padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--4);
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
    font-size: 14px;
    z-index: 100000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--wp--preset--color--focus, var(--wp--preset--color--secondary));
    outline-offset: 2px;
}

.skip-link + .skip-link {
    left: 120px;
}

.skip-link + .skip-link + .skip-link {
    left: 240px;
}

/* Focus styles — uses `focus` preset when present (e.g. Wireframe Focus Purple) */
*:focus {
    outline: 2px solid var(--wp--preset--color--focus, var(--wp--preset--color--secondary));
    outline-offset: 2px;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .wp-block-columns {
    direction: rtl;
}

[dir="rtl"] .wp-block-columns > * {
    direction: ltr;
}

/* Header Shrink on Scroll */
header {
    transition: all 0.3s ease;
}

header.shrink {
    transform: scale(0.95);
    opacity: 0.9;
}

.bodyshrink {
    padding-top: 60px; /* Adjust based on your header height */
}

/* Alert System */
.alert-area {
    position: relative;
    z-index: 1001;
    display: block;
    margin-bottom: 0; /* Remove margin between stacked alerts */
}

.alert-area.alert-dismissed {
    display: none !important;
}

/* Alert container for stacking multiple alerts */
.alert-container {
    position: relative;
    z-index: 1001;
}

.alert-container .alert-area {
    margin-bottom: 0;
}

.alert-bar {
    margin: 0;
    border-radius: 0;
    border: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--background);
    width: 100%; /* Full width background */
    position: relative;
}

/* Alert content wrapper to constrain content to wide width */
.alert-content {
    max-width: var(--wp--style--global--wide-size, 1200px); /* Theme's wide width */
    margin: 0 auto;
    padding: var(--wp--preset--spacing--3) var(--wp--preset--spacing--4);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Alert text */
.alert-text {
    flex: 1;
    margin-right: var(--wp--preset--spacing--4);
}

.alert-bar a {
    color: var(--wp--preset--color--background);
    text-decoration: underline;
}

.alert-bar a:hover {
    color: var(--wp--preset--color--light-gray);
}

.alert-bar .close {
    background: none;
    border: none;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--wp--preset--color--background);
    opacity: 0.8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.alert-bar .close:hover {
    opacity: 1;
}

.alert-bar .close span {
    display: block;
    width: 20px;
    height: 20px;
    line-height: 1;
    text-align: center;
    transition: background-color 0.3s ease;
}

.alert-bar .close span:hover {
    background-color: transparent;
    color: var(--wp--preset--color--secondary);
}

/* Alert positioning containers */
#alert-container-before {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    left: 0;
    right: 0;
    z-index: 9999;
    width: 100%;
    margin: 0 !important;
}

/* Ensure theme/core "block gap" rules do not create alert gaps */
:where(.wp-site-blocks) > .planeteria-alerts,
:where(.wp-site-blocks) > #planeteria-alerts-before,
:root :where(.is-layout-constrained) > .planeteria-alerts,
:root :where(.is-layout-constrained) > #planeteria-alerts-before,
:root :where(.is-layout-constrained) > #alert-container-before {
    margin-block-start: 0 !important;
    margin-block-end: 0 !important;
}
