/*
Theme Name: September Advokatbyrå
Description: Ett minimalistiskt block-tema baserat på arkitektur och juridisk precision.
Version: 1.0
Author: September
*/

/* --- GLOBAL RESET --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

html {
    scroll-padding-top: 80px;
}

.wp-site-blocks {
    padding-top: 0 !important;
}

/* Prevent margin-top on first elements causing gaps */
body > *:first-child,
main > *:first-child,
.wp-site-blocks > *:first-child,
.wp-block-group > *:first-child,
.wp-block-cover > *:first-child {
    margin-top: 0 !important;
}

/* --- FIXED HEADER SYSTEM --- */
.site-header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: transparent !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid transparent;
}

@media screen and (max-width: 782px) {
    .site-header .header-inner {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 1rem 20px !important;
    }
    
    .mobile-menu-toggle {
        display: block !important;
    }

    .header-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%; /* Change to full width for better UX on small screens */
        max-width: 400px;
        height: 100vh;
        background: #ffffff;
        z-index: 10000;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    }

    .menu-open .header-nav {
        right: 0;
    }

    .header-nav ul {
        flex-direction: column !important;
        gap: 2rem !important;
        text-align: center;
    }

    .header-nav a {
        font-size: 1.25rem !important;
        color: #121416 !important;
    }

    .header-nav ul {
        flex-direction: column !important;
        gap: 2rem !important;
        text-align: center;
        color: #121416 !important;
    }

    /* Force dark colors for header elements when menu is open, even at the top */
    .menu-open .logo-text-main,
    .menu-open .logo-text-sub,
    .menu-open .mobile-menu-toggle svg,
    .menu-open .header-nav a {
        color: #121416 !important;
        stroke: #121416 !important;
    }

    .mobile-menu-toggle svg {
        stroke: #ffffff; /* Default for transparent hero */
    }

    .scrolled .mobile-menu-toggle svg,
    .menu-open .mobile-menu-toggle svg {
        stroke: #121416 !important;
    }

    .logo-text-main {
        font-size: 1.8rem !important;
    }

    /* Hamburger Animation */
    .menu-open .mobile-menu-toggle svg {
        stroke: #121416 !important;
    }

    .site-header::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
        z-index: 9999;
        pointer-events: none;
    }

    .menu-open::after {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .menu-open .top-line { transform: translateY(6px) rotate(45deg); transform-origin: center; }
    .menu-open .middle-line { opacity: 0; }
    .menu-open .bottom-line { transform: translateY(-6px) rotate(-45deg); transform-origin: center; }
    
    .mobile-menu-toggle svg line {
        transition: all 0.3s ease;
    }
}

/* Scrolled & Editor State Fix */
.site-header.scrolled,
.site-header.menu-open,
.editor-styles-wrapper .site-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* Base Link Colors (Dark by default) */
.site-header.scrolled a,
.site-header.menu-open a,
.site-header.scrolled .logo-text-main,
.site-header.menu-open .logo-text-main,
.site-header.scrolled .logo-text-sub,
.site-header.menu-open .logo-text-sub {
    color: #121416 !important;
}

.site-header a,
.site-header .logo-text-main,
.site-header .logo-text-sub {
    color: #121416 !important;
    transition: color 0.3s ease;
}

/* Specific state for Home page top hero (White text on dark bg) */
.home .site-header:not(.scrolled):not(.menu-open) {
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: none !important;
}

.home .site-header:not(.scrolled):not(.menu-open) a,
.home .site-header:not(.scrolled):not(.menu-open) .logo-text-main,
.home .site-header:not(.scrolled):not(.menu-open) .logo-text-sub {
    color: #ffffff !important;
}

.home .site-header:not(.scrolled):not(.menu-open) .mobile-menu-toggle svg {
    stroke: #ffffff !important;
}

/* Header Navigation Specifics */
.header-nav a {
    position: relative;
    padding-bottom: 4px;
}

.header-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.header-nav a:hover::after {
    width: 100%;
}

/* Hover States */
.site-header a:hover {
    color: var(--wp--preset--color--nordic-sage) !important;
}

/* Ensure editor behaves */
.editor-styles-wrapper .site-header {
    position: relative !important;
    top: 0 !important;
}

/* Accordion Styling */
.accordion-container {
    max-width: 600px;
}

.accordion-item {
    border-bottom: 1px solid rgba(26, 26, 26, 0.1);
}

.accordion-header {
    cursor: pointer;
    padding: 1.5rem 0;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.accordion-header:hover h3 {
    color: var(--wp--preset--color--nordic-sage);
}

.accordion-header h3 {
    margin: 0 !important;
    transition: color 0.3s ease;
    flex: 1;
}

.accordion-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(26, 26, 26, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    margin-left: auto;
}

.accordion-item.is-open .accordion-icon {
    background: #1a1a1a;
    color: #fff;
    transform: rotate(45deg);
}

.accordion-item.is-open .accordion-icon .icon-plus {
    /* No change needed as we rotate the whole icon container */
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    will-change: max-height, opacity;
}

.accordion-item.is-open .accordion-content {
    max-height: 500px; /* Adjust as needed */
    opacity: 1;
    padding-bottom: 2rem;
}

.accordion-content p {
    font-size: 1rem;
    line-height: 1.6;
    color: #1a1a1a;
    margin: 0 0 1rem 0;
}

.accordion-content p:last-child {
    margin-bottom: 0;
}

/* Practice Areas Grid */
.practice-areas-grid-container {
    border: 1px solid rgba(26, 26, 26, 0.1);
    background: rgba(26, 26, 26, 0.1);
    overflow: hidden;
    border-radius: 4px;
}

.practice-areas-grid {
    display: grid !important;
    grid-template-columns: repeat(1, 1fr) !important;
    gap: 1px !important;
}

@media (min-width: 768px) {
    .practice-areas-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.practice-area-card {
    padding: 3rem !important;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.practice-area-card:hover {
    background-color: var(--wp--preset--color--nordic-sand) !important;
}

.area-icon {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--wp--preset--color--nordic-sage);
    transition: color 0.5s ease;
}

.practice-area-card:hover .area-icon {
    color: var(--wp--preset--color--nordic-charcoal);
}

.area-number {
    font-size: 10px;
    font-weight: 700;
    color: rgba(26, 26, 26, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Sticky Image Column */
@media (min-width: 1024px) {
    .sticky-image-column {
        position: sticky !important;
        top: 120px;
    }
}

.relative-container {
    padding-bottom: 2rem;
}

.founder-badge {
    position: absolute;
    bottom: -20px;
    right: -20px;
    background: #121416;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

@media screen and (max-width: 768px) {
    .founder-badge {
        position: relative;
        bottom: 0;
        right: 0;
        margin-top: -40px;
        margin-left: 20px;
        padding: 1.5rem;
    }
    
    .founder-badge .badge-title {
        font-size: 1.5rem;
    }
}

.founder-badge .badge-title {
    display: block;
    font-family: var(--wp--preset--font-family--playfair);
    font-size: 1.8rem;
    font-style: italic;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.founder-badge .badge-subtitle {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    font-weight: 700;
    color: #a3a3a3;
    text-align: right;
}

/* Logo Typography Spacing */
.logo-text-main {
    margin-bottom: 5px !important;
    padding-top: 5px;
}

.logo-text-sub {
    margin-top: 5px !important;
    display: block;
}

.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: opacity 1s ease-out, transform 1s ease-out !important;
}

.delay-1 { transition-delay: 0.2s !important; }
.delay-2 { transition-delay: 0.4s !important; }
.delay-3 { transition-delay: 0.6s !important; }

/* Animations - Progressive Enhancement */
.js-enabled .wp-block-heading, 
.js-enabled .wp-block-columns, 
.js-enabled .wp-block-image, 
.js-enabled .wp-block-cover,
.js-enabled .practice-area-card,
.js-enabled .staff-card {
    opacity: 0;
    transform: translateY(20px);
    will-change: opacity, transform;
    transition: opacity 1.2s cubic-bezier(0.2, 0, 0.2, 1), transform 1.2s cubic-bezier(0.2, 0, 0.2, 1) !important;
}

.js-enabled .animate-fade-in-up {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Fallback: ensure visibility */
.wp-block-heading, 
.wp-block-columns, 
.wp-block-image, 
.wp-block-cover,
.wp-block-group {
    opacity: 1;
    transform: translateY(0);
}

/* Grayscale effect for images mirroring the React version */
.wp-block-image img {
    filter: grayscale(0.2);
    transition: filter 0.5s ease;
}

.wp-block-image img:hover {
    filter: grayscale(0);
}

@media screen and (max-width: 600px) {
    .practice-area-card {
        padding: 2rem 1.5rem !important;
    }
    
    .practice-area-card h3 {
        font-size: 1.5rem !important;
    }
    
    .area-icon {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
}

/* Staff Grid Responsive */
@media screen and (max-width: 600px) {
    .staff-grid .wp-block-column {
        text-align: center;
        margin-bottom: 40px;
    }
    
    .staff-grid .wp-block-image {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Global Section Padding Responsive */
@media screen and (max-width: 768px) {
    .wp-block-group[style*="padding"] {
        padding-top: 64px !important;
        padding-bottom: 64px !important;
    }
    
    .wp-block-heading {
        font-size: clamp(2rem, 8vw, 3rem) !important;
    }
    
    /* Hero specific responsiveness */
    .wp-block-cover h1 {
        font-size: clamp(2.5rem, 10vw, 4rem) !important;
    }
}

/* Transitions and hover effects for grid items */
.staff-grid .wp-block-column,
.practice-grid .wp-block-group {
    transition: all 0.7s ease;
}

.practice-grid .wp-block-group:hover {
    background-color: var(--wp--preset--color--nordic-sand) !important;
}

/* Contact Form Styling */
.contact-form-container {
    width: 100%;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-row {
    display: flex;
    gap: 2rem;
    width: 100%;
}

@media screen and (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 1.5rem;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.form-group label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #999;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem 0;
    border: none;
    border-bottom: 1px solid rgba(18, 20, 22, 0.1);
    border-radius: 0;
    font-family: inherit;
    font-size: 1rem;
    background: transparent;
    transition: border-color 0.3s ease;
    width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #ccc;
    font-weight: 300;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--wp--preset--color--nordic-charcoal);
}

.submit-button {
    background-color: #121416;
    color: white;
    padding: 1.5rem 2.5rem;
    border: none;
    border-radius: 2px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
    margin-top: 1rem;
}

@media screen and (max-width: 600px) {
    .submit-button {
        align-self: stretch;
        text-align: center;
    }
}

.submit-button:hover {
    background-color: var(--wp--preset--color--nordic-sage);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.privacy-notice {
    font-size: 9px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: 1.6;
}

@media screen and (max-width: 600px) {
    footer .footer-links,
    footer .footer-contact {
        text-align: center;
    }
    
    footer .footer-links ul {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    footer .footer-contact a {
        display: inline-block;
    }
}

/* Typography refinements */
body {
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body.no-scroll {
    overflow: hidden !important;
}

.is-style-outline {
    border: 1px solid currentColor;
}
