/**
 * Orbit Theme Stylesheet - Backbone
 * 
 * Table of Contents:
 * 1. Reset & Base Styles
 * 2. Layout & Containers
 * 3. Typography & Text
 * 4. Forms & Inputs
 * 5. Button Base
 * 6. Tooltips
 * 7. Header & Navigation (Structural)
 * 8. Mobile Navigation (Structural)
 * 9. Grid & Flex System (Gutenberg Compatible)
 * 10. Media Queries
 */


/* ==========================================================================
   1. RESET & BASE STYLES
   ========================================================================== */

html {
    line-height: 1.1;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    margin: 0;
    overflow-x: hidden;
}

figure {
    margin: 0;
}

img {
    border-style: none;
    max-width: 100%;
    height: auto;
}

iframe {
    display: block;
    max-width: 100%;
}

hr {
    box-sizing: content-box;
    height: 0;
    overflow: visible;
}

blockquote {
    margin: 0;
}

template {
    display: none;
}

[hidden] {
    display: none;
}

details {
    display: block;
}

summary {
    display: list-item;
}


/* ==========================================================================
   2. LAYOUT & CONTAINERS
   ========================================================================== */

.wrap {
    margin: auto;
    width: 100%;
    max-width: var(--wp--style--global--content-size, 1200px);
    padding-left: var(--wp--preset--spacing--medium, 20px);
    padding-right: var(--wp--preset--spacing--medium, 20px);
}

/* Core Gutenberg Layout Controls - Center standard content */
.block-wrap> :not(.alignfull):not(.alignwide):not(.alignleft):not(.alignright),
.is-layout-constrained> :not(.alignfull):not(.alignwide):not(.alignleft):not(.alignright) {
    max-width: var(--wp--style--global--content-size, 1200px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Wide Width */
.block-wrap>.alignwide,
.is-layout-constrained>.alignwide {
    max-width: var(--wp--style--global--wide-size, 1400px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Keep padding on elements touching the viewport edge to prevent double-padding bugs */
.block-wrap> :not(.alignfull),
.alignfull> :not(.alignfull) {
    padding-left: var(--wp--preset--spacing--medium, 20px);
    padding-right: var(--wp--preset--spacing--medium, 20px);
}


/* ==========================================================================
   3. TYPOGRAPHY & TEXT
   ========================================================================== */

a {
    background-color: transparent;
    color: inherit;
    word-break: break-word;
    outline-offset: 2px;
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid #276EF1;
}

b,
strong {
    font-weight: 700;
}

small {
    font-size: 80%;
}

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

abbr[title] {
    border-bottom: none;
    text-decoration: underline dotted;
}

pre,
code,
kbd,
samp {
    font-family: monospace, monospace;
    font-size: 1em;
}


/* ==========================================================================
   4. FORMS & INPUTS
   ========================================================================== */

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

button,
input {
    overflow: visible;
}

input[type=search] {
    box-sizing: border-box;
}

button,
[type=button],
[type=reset],
[type=submit] {
    -webkit-appearance: button;
}

button::-moz-focus-inner,
[type=button]::-moz-focus-inner,
[type=reset]::-moz-focus-inner,
[type=submit]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

button:-moz-focusring,
[type=button]:-moz-focusring,
[type=reset]:-moz-focusring,
[type=submit]:-moz-focusring {
    outline: 1px dotted ButtonText;
}

fieldset {
    padding: 0;
    border: none;
    margin: 0;
}

legend {
    box-sizing: border-box;
    color: inherit;
    display: table;
    max-width: 100%;
    padding: 0;
    white-space: normal;
}

progress {
    vertical-align: baseline;
}

textarea {
    overflow: auto;
    resize: vertical;
}

[type=checkbox],
[type=radio] {
    box-sizing: border-box;
    padding: 0;
}

[type=number]::-webkit-inner-spin-button,
[type=number]::-webkit-outer-spin-button {
    height: auto;
}

[type=search] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}

[type=search]::-webkit-search-decoration {
    -webkit-appearance: none;
}

::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

/* Placeholders */
::-moz-placeholder {
    color: inherit;
    opacity: 0.6;
}

::-ms-input-placeholder {
    color: inherit;
    opacity: 0.6;
}

::-webkit-input-placeholder {
    color: inherit;
    opacity: 0.6;
}


/* ==========================================================================
   5. BUTTON BASE
   ========================================================================== */

.btn,
.button,
.wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    padding: 0.5em 1em;
    font-family: inherit;
    transition: all 0.2s ease;
}


/* ==========================================================================
   6. TOOLTIPS
   ========================================================================== */

[data-tooltip] {
    position: relative;
    z-index: 10;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    visibility: hidden;
    width: max-content;
    max-width: 150px;
    background-color: var(--wp--preset--color--black, #000);
    color: var(--wp--preset--color--white, #fff);
    text-align: center;
    padding: 8px 10px;
    border-radius: var(--wp--custom--border--radius--small, 4px);
    position: absolute;
    z-index: 1000;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

[data-tooltip]::before {
    content: '';
    visibility: hidden;
    position: absolute;
    z-index: 1000;
    width: 0;
    height: 0;
    border: 7px solid transparent;
    opacity: 0;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--wp--preset--color--black, #000);
    transition: opacity 0.2s;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-within::after,
[data-tooltip]:focus-within::before {
    visibility: visible;
    opacity: 1;
}


/* ==========================================================================
   7. HEADER & NAVIGATION (Structural)
   ========================================================================== */

.site-header {
    width: 100%;
    position: relative;
    z-index: 99999;
}

.site-header .wrap {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    gap: var(--wp--preset--spacing--medium, 20px);
}

.site-header__logo {
    display: inline-flex;
    text-decoration: none;
    align-items: center;
}

/* Desktop Navigation */
#nav-menu {
    display: none;
}

#nav-menu ul.menu {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

#nav-menu .menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

#nav-menu li a {
    display: block;
    text-decoration: none;
}

/* Submenu Button */
.submenu-btn {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Submenu Dropdown */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 9999;
}

#nav-menu li.menu-item-has-children:hover .submenu,
#nav-menu li.menu-item-has-children:focus-within .submenu {
    opacity: 1;
    visibility: visible;
}

.submenu-inner-wrap {
    min-width: 200px;
    padding: 10px;
}

.submenu-inner .menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Mobile Toggle */
#toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    z-index: 9999;
}

#toggle {
    height: 50px;
    width: 50px;
    position: relative;
    display: flex;
    background: transparent;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

#toggle .bar {
    height: 3px;
    width: 30px;
    position: absolute;
    background-color: currentColor;
    transition: 0.3s;
}

#toggle .bar:nth-of-type(1) {
    top: 16px;
}

#toggle .bar:nth-of-type(2) {
    top: 24px;
    opacity: 1;
}

#toggle .bar:nth-of-type(3) {
    top: 32px;
}

.active #toggle .bar:nth-of-type(1) {
    top: 24px;
    transform: rotate(45deg);
}

.active #toggle .bar:nth-of-type(2) {
    opacity: 0;
}

.active #toggle .bar:nth-of-type(3) {
    top: 24px;
    transform: rotate(-45deg);
}


/* ==========================================================================
   8. MOBILE NAVIGATION (Structural)
   ========================================================================== */

#mobile-nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    opacity: 0;
    visibility: hidden;
    z-index: 900;
    transition: all 0.3s ease;
    transform: translateY(-10px);
    overflow-y: auto;
    padding-top: 80px;
    /* Space for header */
}

.active #mobile-nav-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

#mobile-menu li {
    position: relative;
}

#mobile-menu a,
#mobile-menu span {
    display: block;
    padding: 15px;
    text-decoration: none;
}

#mobile-menu li.menu-item-has-children {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

#mobile-menu li.menu-item-has-children>a {
    flex: 1;
}

#mobile-menu li ul {
    display: none;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    padding-left: 20px;
}

#mobile-menu button {
    background: transparent;
    border: 0;
    padding: 15px;
    cursor: pointer;
}


/* ==========================================================================
   9. GRID & FLEX SYSTEM (Gutenberg Compatible)
   ========================================================================== */

/* Grid Base */
.grid,
.is-layout-grid {
    display: grid;
    gap: var(--wp--preset--spacing--medium, 24px);
}

/* Flex Columns Base */
.flex-row,
.wp-block-columns.is-layout-flex {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wp--preset--spacing--medium, 24px);
}

/* Individual Column */
.col,
.wp-block-column {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Column Widths (Grid) */
.columns-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.columns-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.columns-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Flex Column Width Utilities */
.col-100 {
    flex: 0 0 100%;
    max-width: 100%;
}

.col-75 {
    flex: 0 0 75%;
    max-width: 75%;
}

.col-66 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
}

.col-50 {
    flex: 0 0 50%;
    max-width: 50%;
}

.col-33 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

.col-25 {
    flex: 0 0 25%;
    max-width: 25%;
}

.col-20 {
    flex: 0 0 20%;
    max-width: 20%;
}

/* Gutenberg specific flex column overrides */
.wp-block-columns.has-2-columns>.wp-block-column {
    flex-basis: calc(50% - (var(--wp--preset--spacing--medium, 24px) / 2));
}

.wp-block-columns.has-3-columns>.wp-block-column {
    flex-basis: calc(33.33333% - (var(--wp--preset--spacing--medium, 24px) * 2 / 3));
}

.wp-block-columns.has-4-columns>.wp-block-column {
    flex-basis: calc(25% - (var(--wp--preset--spacing--medium, 24px) * 3 / 4));
}

.wp-block-columns.has-5-columns>.wp-block-column {
    flex-basis: calc(20% - (var(--wp--preset--spacing--medium, 24px) * 4 / 5));
}

.wp-block-columns.has-6-columns>.wp-block-column {
    flex-basis: calc(16.66666% - (var(--wp--preset--spacing--medium, 24px) * 5 / 6));
}

/* Utility Alignment */
.v-align {
    align-items: center;
}

.h-align {
    justify-content: center;
}


/* ==========================================================================
   10. MEDIA QUERIES
   ========================================================================== */

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    #nav-menu {
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    #mobile-nav-menu {
        display: none !important;
    }

    #toggle-wrap {
        display: none;
    }
}

/* WordPress Admin Bar Fixes */
@media (max-width: 782px) {
    #wpadminbar {
        display: none !important;
    }
}

/* Mobile Fallbacks container spacing */
@media (max-width: 782px) {
    .is-layout-grid[class*="columns-"] {
        grid-template-columns: 1fr;
    }

    .wp-block-columns.is-layout-flex {
        flex-direction: column;
    }

    .wp-block-columns.is-layout-flex>.wp-block-column {
        flex-basis: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}