/*
Theme Name: COPAJE
Theme URI: https://copaje.org
Author: COPAJE
Description: Thème WordPress FSE pour l'association COPAJE — palette bleu institutionnel et rouge action, typographie Barlow Condensed & Lora, design responsive chaleureux et engagé.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: copaje
Tags: full-site-editing, block-patterns, block-styles, wide-blocks, custom-colors, custom-fonts, translation-ready
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
*/

/* ============================================================
   Google Fonts
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,400;0,600;0,700;0,800;1,400;1,700&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* ============================================================
   Base & Reset
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root,
body,
.wp-site-blocks {
    overflow: visible;
}

html {
    scroll-behavior: smooth;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   Body & Prose Polish
   ============================================================ */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

p {
    max-width: 70ch;
}

/* Paragraphs inside constrained groups that center content
   should also center their measure-limited blocks */
.is-layout-constrained > p {
    margin-inline: auto;
}

/* ============================================================
   Headings – extra polish
   ============================================================ */
h1, h2, h3, h4, h5, h6,
.wp-block-heading {
    text-wrap: balance;
}

/* ============================================================
   Links – body prose
   ============================================================ */
a {
    transition: color 0.2s ease;
}

.entry-content a:not(.wp-block-button__link):not(.wp-block-navigation-item__content) {
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
}

.entry-content a:not(.wp-block-button__link):not(.wp-block-navigation-item__content):hover {
    text-decoration-thickness: 2px;
}

/* ============================================================
   Buttons – variants & polish
   ============================================================ */
.wp-block-button__link,
.wp-element-button {
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wp-block-button__link:hover,
.wp-element-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(200, 32, 45, 0.25);
}

.wp-block-button__link:active,
.wp-element-button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Outline button variant */
.wp-block-button.is-style-outline .wp-block-button__link {
    background-color: transparent;
    border-width: 2px;
    border-style: solid;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background-color: var(--wp--preset--color--accent);
    color: var(--wp--preset--color--white);
    border-color: var(--wp--preset--color--accent);
    box-shadow: 0 8px 20px rgba(200, 32, 45, 0.25);
}

/* ============================================================
   Navigation – desktop polish
   ============================================================ */
.wp-block-navigation .wp-block-navigation-item__content {
    position: relative;
    transition: color 0.25s ease;
}

.wp-block-navigation .wp-block-navigation-item__content::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--wp--preset--color--accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.25s ease;
}

.wp-block-navigation .wp-block-navigation-item__content:hover::after,
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content::after {
    transform: scaleX(1);
}

/* ============================================================
   Navigation – mobile hamburger overlay
   ============================================================ */
.wp-block-navigation__responsive-container.is-menu-open {
    padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--50);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
    gap: var(--wp--preset--spacing--40);
    align-items: flex-start;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
    font-size: var(--wp--preset--font-size--large);
}

/* ============================================================
   Sticky Header
   ============================================================ */
.wp-site-blocks > header.wp-block-template-part {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Scrolled-state backdrop pseudo-element */
.wp-site-blocks > header.wp-block-template-part {
    position: sticky;
    top: 0;
    z-index: 100;
}

.wp-site-blocks > header.wp-block-template-part::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

body.is-scrolled .wp-site-blocks > header.wp-block-template-part::before {
    background: var(--wp--preset--color--surface);
    box-shadow: 0 4px 20px rgba(10, 35, 66, 0.08);
}

/* ============================================================
   Header inner group – site-header class
   ============================================================ */
.site-header {
    transition: padding 0.25s ease;
}

/* ============================================================
   Hero Section – diagonal clip pattern from reference
   ============================================================ */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section .wp-block-cover__inner-container {
    position: relative;
    z-index: 10;
}

/* Highlight wrap – the red underline swatch from the reference */
.highlight-wrap {
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.highlight-wrap::after {
    content: '';
    position: absolute;
    left: -3%;
    bottom: 12%;
    width: 106%;
    height: 25%;
    background-color: var(--wp--preset--color--accent);
    z-index: -1;
    transform: rotate(-1.5deg);
    border-radius: 2px;
}

/* ============================================================
   Cards – surface treatment
   ============================================================ */
.wp-block-group.has-surface-background-color,
.card-surface {
    border: 1px solid var(--wp--preset--color--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wp-block-group.has-surface-background-color:hover,
.card-surface:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(10, 35, 66, 0.08);
}

/* ============================================================
   Images – athletic edge (sharp, no border-radius from theme.json)
   ============================================================ */
.wp-block-image img,
.wp-block-post-featured-image img {
    transition: transform 0.3s ease;
}

.wp-block-image:hover img,
.wp-block-post-featured-image:hover img {
    transform: scale(1.02);
}

.wp-block-image {
    overflow: hidden;
}

.wp-block-post-featured-image {
    overflow: hidden;
}

/* ============================================================
   Cover blocks – overlay gradient polish
   ============================================================ */
.wp-block-cover {
    overflow: hidden;
}

.wp-block-cover .wp-block-cover__image-background,
.wp-block-cover video.wp-block-cover__video-background {
    transition: transform 6s ease;
}

.wp-block-cover:hover .wp-block-cover__image-background,
.wp-block-cover:hover video.wp-block-cover__video-background {
    transform: scale(1.03);
}

/* ============================================================
   Quote – accent bar
   ============================================================ */
.wp-block-quote {
    position: relative;
}

.wp-block-quote cite {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 700;
    font-size: var(--wp--preset--font-size--small);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--wp--preset--color--text-muted);
    margin-top: var(--wp--preset--spacing--20);
    display: block;
}

/* ============================================================
   Pullquote – bold athletic treatment
   ============================================================ */
.wp-block-pullquote cite {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 600;
    font-size: var(--wp--preset--font-size--small);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--wp--preset--color--accent);
}

/* ============================================================
   Separator – subtle polish
   ============================================================ */
.wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
    max-width: 120px;
    margin-left: auto;
    margin-right: auto;
}

.wp-block-separator.is-style-wide {
    max-width: 100%;
}

/* ============================================================
   Tables
   ============================================================ */
.wp-block-table table {
    border-collapse: collapse;
    width: 100%;
}

.wp-block-table td,
.wp-block-table th {
    border: 1px solid var(--wp--preset--color--border);
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
}

.wp-block-table th {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: var(--wp--preset--font-size--small);
    background-color: var(--wp--preset--color--surface-alt);
}

.wp-block-table tr:nth-child(even) {
    background-color: var(--wp--preset--color--surface-alt);
}

/* ============================================================
   Search block
   ============================================================ */
.wp-block-search__input {
    border: 1px solid var(--wp--preset--color--border);
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
    font-family: var(--wp--preset--font-family--body);
    font-size: var(--wp--preset--font-size--medium);
    color: var(--wp--preset--color--text);
    background-color: var(--wp--preset--color--surface);
    transition: border-color 0.2s ease;
}

.wp-block-search__input:focus {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 1px;
    border-color: var(--wp--preset--color--primary);
}

.wp-block-search__button {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================
   Categories & Tag Cloud – sidebar widgets
   ============================================================ */
.wp-block-categories li,
.wp-block-archives li {
    padding-block: var(--wp--preset--spacing--10);
    border-bottom: 1px solid var(--wp--preset--color--border);
}

.wp-block-categories li:last-child,
.wp-block-archives li:last-child {
    border-bottom: none;
}

.wp-block-tag-cloud a {
    display: inline-block;
    padding: var(--wp--preset--spacing--10) var(--wp--preset--spacing--20);
    background-color: var(--wp--preset--color--surface-alt);
    color: var(--wp--preset--color--text);
    text-decoration: none;
    margin: 0 var(--wp--preset--spacing--10) var(--wp--preset--spacing--10) 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-block-tag-cloud a:hover {
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--white);
}

/* ============================================================
   Post template cards – blog grid polish
   ============================================================ */
.wp-block-post-template .wp-block-post-featured-image {
    margin-bottom: var(--wp--preset--spacing--30);
}

.wp-block-post-template .wp-block-post-title {
    margin-bottom: var(--wp--preset--spacing--10);
}

/* ============================================================
   Pagination
   ============================================================ */
.wp-block-query-pagination {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    gap: var(--wp--preset--spacing--20);
}

.wp-block-query-pagination-numbers .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: var(--wp--preset--spacing--10);
    text-decoration: none;
    color: var(--wp--preset--color--text);
    border: 2px solid var(--wp--preset--color--border);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.wp-block-query-pagination-numbers .page-numbers:hover {
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--white);
    border-color: var(--wp--preset--color--primary);
}

.wp-block-query-pagination-numbers .page-numbers.current {
    background-color: var(--wp--preset--color--accent);
    color: var(--wp--preset--color--white);
    border-color: var(--wp--preset--color--accent);
}

/* ============================================================
   Form Elements (general)
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--wp--preset--color--border);
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
    font-family: var(--wp--preset--font-family--body);
    font-size: var(--wp--preset--font-size--medium);
    color: var(--wp--preset--color--text);
    background-color: var(--wp--preset--color--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 1px;
    border-color: var(--wp--preset--color--primary);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

label {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 600;
    font-size: var(--wp--preset--font-size--small);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--wp--preset--color--text);
    display: block;
    margin-bottom: var(--wp--preset--spacing--10);
}

/* ============================================================
   Section Accent Stripe – top border treatment
   ============================================================ */
.accent-stripe-top {
    border-top: 4px solid var(--wp--preset--color--accent);
}

/* ============================================================
   Footer polish
   ============================================================ */
footer.wp-block-template-part a {
    transition: color 0.2s ease;
}

/* ============================================================
   Utility: visually hidden
   ============================================================ */
.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================================
   Focus visible – accessibility ring
   ============================================================ */
:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 2px;
}

/* ============================================================
   Selection highlight
   ============================================================ */
::selection {
    background-color: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--white);
}

/* ---------- Loop layout utilities ---------- */
/* These classes are wired to the wp:query blocks emitted by content/pages and
   templates. Do not rename. Tune colours and spacing to theme.json tokens. */

/* Horizontal scrollable rail */
.wp-block-query.is-style-loop-rail .wp-block-post-template {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding-bottom: var(--wp--preset--spacing--20);
}
.wp-block-query.is-style-loop-rail .wp-block-post-template > * {
    flex: 0 0 320px;
    scroll-snap-align: start;
}

/* Compact list with hairline row dividers */
.wp-block-query.is-style-loop-list .wp-block-post-template > * {
    border-bottom: 1px solid var(--wp--preset--color--border);
    padding-block: var(--wp--preset--spacing--30);
}
.wp-block-query.is-style-loop-list .wp-block-post-template > *:last-child {
    border-bottom: 0;
}

/* Zigzag — flip the columns inside every even entry */
.wp-block-query.is-style-loop-zigzag .wp-block-post-template > *:nth-child(even) .wp-block-columns {
    flex-direction: row-reverse;
}

/* Timeline — vertical line with node markers per entry */
.wp-block-query.is-style-loop-timeline .wp-block-post-template {
    position: relative;
    padding-inline-start: 2.5rem;
}
.wp-block-query.is-style-loop-timeline .wp-block-post-template::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0.5rem;
    width: 2px;
    background: var(--wp--preset--color--border);
    opacity: 0.5;
}
.wp-block-query.is-style-loop-timeline .wp-block-post-template > * {
    position: relative;
}
.wp-block-query.is-style-loop-timeline .wp-block-post-template > *::before {
    content: '';
    position: absolute;
    inset-inline-start: -2.25rem;
    inset-block-start: 0.6rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--wp--preset--color--primary);
    border-radius: 50%;
    background: var(--wp--preset--color--background);
}

/* Magazine — first child spans 2 columns of the grid */
.wp-block-query.is-style-loop-magazine .wp-block-post-template > *:first-child {
    grid-column: span 2;
}
@media (max-width: 600px) {
    .wp-block-query.is-style-loop-magazine .wp-block-post-template > *:first-child {
        grid-column: auto;
    }
}

/* ============================================================
   Responsive adjustments
   ============================================================ */
@media (max-width: 768px) {
    .wp-block-columns {
        flex-wrap: wrap;
    }

    .wp-block-columns > .wp-block-column {
        flex-basis: 100% !important;
    }

    /* Tighten spacing on mobile */
    .wp-block-group.alignfull,
    .wp-block-group.alignwide {
        padding-left: var(--wp--preset--spacing--40);
        padding-right: var(--wp--preset--spacing--40);
    }

    /* Navigation – ensure the hamburger toggle is large enough */
    .wp-block-navigation__responsive-container-open {
        padding: var(--wp--preset--spacing--20);
    }
}

@media (max-width: 480px) {
    /* Even tighter on very small screens */
    .wp-block-group.alignfull,
    .wp-block-group.alignwide {
        padding-left: var(--wp--preset--spacing--30);
        padding-right: var(--wp--preset--spacing--30);
    }
}