/*
Theme Name: Carré Rond
Theme URI: https://carrerond.ch
Author: Carré Rond
Author URI: https://carrerond.ch
Description: Thème sur mesure pour la compagnie de théâtre Carré Rond, Genève. Design inspiré de collectifmxm.com.
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: carrerond
Tags: theater, arts, custom-logo, custom-menu, featured-images
*/

/* ===================================================
   FONTS
=================================================== */
@font-face {
    font-family: 'RulesExtended';
    src: url('assets/fonts/RulesExtended-Regular.woff2') format('woff2'),
         url('assets/fonts/RulesExtended-Regular.woff') format('woff');
    font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'roboto';
    src: url('assets/fonts/Roboto-Regular-webfont.woff') format('woff');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'roboto';
    src: url('assets/fonts/Roboto-Medium-webfont.woff') format('woff');
    font-weight: 700; font-style: normal; font-display: swap;
}

/* ===================================================
   DESIGN TOKENS
=================================================== */
:root {
    --color-bg: #ECECEC;
    --color-black: #1c1c1c;
    --color-white: #ffffff;
    --color-border: #1c1c1c;
    --color-rose: #e59fa2;
    --color-jaune: #fff6d6;
    --color-gris: #f6f6f6;
    --header-height: 4.2rem;
    --nav-width: 38rem;
    --font-primary: 'RulesExtended', Arial, Helvetica, sans-serif;
    --font-body: 'roboto', 'Inter', Arial, Helvetica, sans-serif;
    --transition-speed: 0.3s;
    --gap: 1px;
    --vh: 1vh;
}

/* ===================================================
   RESET
=================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -ms-overflow-style: none; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html { font-size: 1.75ch; line-height: 135%; -webkit-font-smoothing: antialiased; background-color: var(--color-bg); }
@media (min-width: 640px) { html { font-size: 1.15ch; } }
@media (min-width: 768px) { html { font-size: 1.35ch; } }
@media (min-width: 1024px) { html { font-size: 1.55ch; } }
@media (min-width: 1280px) { html { font-size: 1.75ch; } }
html, body, .container { width: 100%; height: 100%; }
@media (min-width: 769px) {
    html, body, .container { height: calc(var(--vh, 1vh) * 100); overflow: hidden; }
}
body { font-family: var(--font-body); background-color: var(--color-bg); color: var(--color-black); }
a { text-decoration: none; display: inline-block; width: fit-content; color: inherit; }
li > a, p > a { text-decoration: underline; }
ul, ol { list-style: none; }
img, video { height: auto; max-width: 100%; }
h1,h2,h3,h4,h5,h6 { font-size: 100%; font-weight: 400; }
button { cursor: pointer; background: unset; border: 0; color: inherit; font-family: inherit; font-size: 100%; }
::selection { background-color: var(--color-rose); color: var(--color-black); }

/* ===================================================
   CONTAINER
=================================================== */
.container { position: relative; display: flex; flex-direction: column; }

/* ===================================================
   HEADER
=================================================== */
header {
    position: relative; height: var(--header-height); width: 100%; z-index: 99998;
    display: flex; justify-content: flex-end; align-items: center;
    background-color: var(--color-bg); border-bottom: 1px solid var(--color-border);
    font-family: var(--font-primary); flex-shrink: 0;
}
.site-logo { position: absolute; left: 1.8rem; top: 50%; transform: translateY(-50%); }
.site-logo img { height: calc(var(--header-height) - 1rem); width: auto; }
.site-logo h1 { display: none; }

#nav { position: absolute; opacity: 0; width: 3rem; height: 3rem; cursor: pointer; z-index: 100000; right: 1.5rem; top: 50%; transform: translateY(-50%); }
#nav + label { cursor: pointer; padding: 0 2rem; display: flex; align-items: center; z-index: 99999; position: relative; }
#nav + label svg { height: 1.5rem; width: 1.5rem; pointer-events: none; }
#nav + label .icon-close { display: none; }
#nav:checked + label .icon-open { display: none; }
#nav:checked + label .icon-close { display: block; }

/* ===================================================
   NAVIGATION (hamburger menu)
=================================================== */
nav[aria-label="nav-main"] {
    position: fixed; z-index: 99997; overflow: hidden; overflow-y: scroll; right: 0;
    width: var(--nav-width); top: calc(var(--vh, 1vh) * -100);
    height: calc(var(--vh, 1vh) * 100 - var(--header-height) + 1px);
    transition: top var(--transition-speed) ease;
    background-color: var(--color-bg); font-family: var(--font-primary);
    border-left: 1px solid var(--color-border);
}
#nav:checked ~ nav[aria-label="nav-main"] { top: var(--header-height); }

nav[aria-label="nav-main"] > a,
nav[aria-label="nav-main"] > details > summary {
    text-transform: uppercase; font-size: 1.4rem; padding: 1rem 2rem;
    border-bottom: 1px solid var(--color-border); width: 100%; display: block; cursor: pointer;
}
nav[aria-label="nav-main"] > details > summary {
    position: sticky; top: 0; background: var(--color-bg); z-index: 1;
    list-style: none; line-height: 125%;
}
nav[aria-label="nav-main"] > details > summary::marker,
nav[aria-label="nav-main"] > details > summary::-webkit-details-marker { display: none; }
nav[aria-label="nav-main"] > details > div {
    padding: 1rem 2rem; display: flex; flex-direction: column; gap: 1rem; font-family: var(--font-body);
}

/* Spectacles sub-items in nav */
.nav-spectacle-item {
    display: block; padding: 0.5rem 0; font-family: var(--font-body);
    font-size: 0.95rem; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,0.08);
}
.nav-spectacle-item:last-child { border-bottom: none; }
.nav-spectacle-item:hover { opacity: 0.6; }

.agenda-item > summary {
    font-size: 1rem; padding: 0.8rem 0; border-top: 1px solid var(--color-border);
    cursor: pointer; text-transform: uppercase; list-style: none; font-family: var(--font-primary);
}
.agenda-item > summary::marker,
.agenda-item > summary::-webkit-details-marker { display: none; }
.agenda-item > div { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.5rem 0 1rem; font-family: var(--font-body); font-size: 0.9rem; }
.agenda-event { display: flex; flex-direction: column; gap: 2px; padding: 0.3rem 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
.agenda-event:last-child { border-bottom: none; }
.agenda-event a { text-decoration: underline; }

/* Soutenir inside contact */
.soutenir-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.soutenir-card { background: var(--color-white); padding: 1rem; border-radius: 8px; border: 1px solid rgba(0,0,0,0.06); }
.soutenir-card h3 { font-family: var(--font-primary); font-size: 0.9rem; color: var(--color-rose); margin-bottom: 0.4rem; }
.soutenir-card p { font-size: 0.85rem; line-height: 150%; }

/* ===================================================
   MAIN
=================================================== */
main {
    height: calc(var(--vh, 1vh) * 100 - var(--header-height) + 1px); width: 100%;
    display: grid; grid-template-columns: 1fr var(--nav-width);
    background-color: var(--color-white); gap: var(--gap); overflow: hidden;
}

/* ===================================================
   LEFT COLUMN
=================================================== */
.left-column { width: 100%; height: 100%; overflow-y: scroll; }

/* Spectacle view: photos grid */
.projects-grid { width: 100%; gap: var(--gap); }

/* Page view: text content */
.page-content {
    width: 100%; padding: 3rem 4rem;
    font-family: var(--font-body); font-size: 0.95rem; line-height: 170%;
}
.page-content h2 {
    font-family: var(--font-primary); font-size: 2rem; text-transform: uppercase;
    margin-bottom: 2rem; letter-spacing: 0.02em;
}
.page-content p { margin-bottom: 1rem; }
.page-content .prestation-item { border-bottom: 1px solid rgba(0,0,0,0.1); padding: 1.2rem 0; }
.page-content .prestation-item:last-of-type { border-bottom: none; }
.page-content .prestation-item h3 { font-weight: 700; margin-bottom: 0.3rem; }
.page-content .prestation-item p { margin-bottom: 0; opacity: 0.7; }

/* ===================================================
   RIGHT PANEL
=================================================== */
.right-panel {
    background-color: var(--color-bg); border-left: 1px solid var(--color-border);
    overflow-y: scroll; height: 100%; position: relative; z-index: 1;
}

/* ===================================================
   PROJECT CARDS
=================================================== */
@keyframes figureAppear { from { opacity: 0; } to { opacity: 1; } }
.project-card { position: relative; cursor: pointer; }
.project-card figure { display: flex; flex-direction: column; margin: 0; }
.project-card figure picture { display: flex; }
.project-card figure img { width: 100%; height: 100%; object-fit: cover; display: block; animation: figureAppear 0.6s forwards; opacity: 0; }
.project-card a { display: block; width: 100%; }
.project-card:nth-child(1) img { animation-delay: 0.1s; }
.project-card:nth-child(2) img { animation-delay: 0.2s; }
.project-card:nth-child(3) img { animation-delay: 0.3s; }
.project-card:nth-child(4) img { animation-delay: 0.4s; }
.project-card:nth-child(5) img { animation-delay: 0.5s; }
.project-card:nth-child(6) img { animation-delay: 0.6s; }
.project-card:nth-child(7) img { animation-delay: 0.7s; }
.project-card:nth-child(8) img { animation-delay: 0.8s; }
.project-card:nth-child(9) img { animation-delay: 0.9s; }
.project-card:nth-child(10) img { animation-delay: 1.0s; }

.photo-credit {
    position: absolute; left: 8px; bottom: 8px;
    background: rgba(0,0,0,0.55); color: #fff; font-size: 0.75rem;
    padding: 4px 8px; border-radius: 8px; font-family: var(--font-body);
}

/* ===================================================
   PROJECT INFO PANEL (title bar)
=================================================== */
.project-title-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.8rem 2rem; border-bottom: 1px solid var(--color-border);
    font-family: var(--font-primary); font-size: 1rem;
    position: sticky; top: 0; background-color: var(--color-bg); z-index: 10;
}

/* ===================================================
   ACCORDION (right panel)
=================================================== */
.accordion { border-bottom: 1px solid var(--color-border); }
.accordion:last-child { border-bottom: none; }
.accordion > summary {
    padding: 1rem 2rem; font-size: 1rem; text-transform: uppercase; cursor: pointer;
    font-family: var(--font-primary); list-style: none;
    display: flex; justify-content: space-between; align-items: center;
}
.accordion > summary::marker,
.accordion > summary::-webkit-details-marker { display: none; }
.accordion-icon { height: 1rem; width: 1rem; transform: rotate(180deg); transition: transform 0.2s ease; }
.accordion[open] .accordion-icon { transform: rotate(0deg); }
.accordion > .accordion-content { padding: 0 2rem 1rem; font-family: var(--font-body); font-size: 0.9rem; line-height: 160%; }
.accordion > .accordion-content p { margin-bottom: 0.8rem; }

/* ===================================================
   PRESSE
=================================================== */
.press-grid { display: flex; flex-direction: column; gap: 0.8rem; }
.press-item { display: flex; gap: 0.8rem; padding: 0.6rem 0; border-bottom: 1px solid rgba(0,0,0,0.08); text-decoration: none; color: inherit; transition: opacity 0.2s; }
.press-item:last-child { border-bottom: none; }
.press-item:hover { opacity: 0.7; }
.press-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.press-item-text { display: flex; flex-direction: column; gap: 2px; }
.press-source { font-size: 0.75rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.05em; }
.press-title { font-weight: 700; font-size: 0.85rem; }

/* ===================================================
   QUOTES
=================================================== */
.quotes-list { display: flex; flex-direction: column; gap: 0.6rem; }
.quote-item { padding: 0.8rem; background: var(--color-white); border-radius: 8px; border: 1px solid rgba(0,0,0,0.06); }
.quote-item p { font-style: italic; font-size: 0.85rem; line-height: 150%; margin-bottom: 0.3rem; }
.quote-item .who { font-size: 0.75rem; opacity: 0.6; }

/* ===================================================
   RESERVATION
=================================================== */
.reservation-wrap { width: 100%; overflow: hidden; margin-top: 0.5rem; }
.reservation-wrap iframe { width: 100%; height: 600px; border: 0; }

/* ===================================================
   LEGAL
=================================================== */
.legal-content { font-family: var(--font-body); font-size: 0.85rem; line-height: 160%; }
.legal-content p { margin-bottom: 0.8rem; }

/* ===================================================
   NAV PANEL (right side navigation for pages)
=================================================== */
.nav-panel-title {
    padding: 0.8rem 2rem; border-bottom: 1px solid var(--color-border);
    font-family: var(--font-primary); font-size: 1rem;
    position: sticky; top: 0; background-color: var(--color-bg); z-index: 10;
}
.nav-panel-item {
    display: block; padding: 1rem 2rem; font-size: 1.1rem; text-transform: uppercase;
    border-bottom: 1px solid var(--color-border); font-family: var(--font-primary);
    cursor: pointer; transition: opacity 0.2s;
}
.nav-panel-item:hover { opacity: 0.6; }
.nav-panel-item.current { background-color: rgba(0,0,0,0.03); }

/* ===================================================
   HOME GRID (page d'accueil: 1 photo par spectacle)
=================================================== */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--gap);
    padding: 0;
}
.home-card { position: relative; overflow: hidden; }
.home-card figure { position: relative; margin: 0; }
.home-card img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 3/4; }
.home-card-title {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 1.5rem 1.2rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.65));
    color: #fff; font-family: var(--font-primary); font-size: 1.3rem;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.home-card a { display: block; width: 100%; }
.home-card:hover img { transform: scale(1.03); transition: transform 0.4s ease; }
.home-card img { transition: transform 0.4s ease; }

/* Home right panel with logo */
.home-panel { display: flex; align-items: center; justify-content: center; }
.home-logo-wrap { padding: 3rem; text-align: center; }
.home-logo { max-width: 180px; height: auto; opacity: 0.9; }

/* ===================================================
   NAV INLINE CONTENT (Carré Rond & Prestations in hamburger)
=================================================== */
.nav-inline-content {
    display: flex; gap: 2rem; padding: 1.5rem 2rem;
    font-family: var(--font-body); font-size: 0.9rem; line-height: 160%;
}
.nav-inline-logo {
    flex-shrink: 0; width: 80px;
    display: flex; align-items: flex-start; justify-content: center;
}
.nav-inline-logo img { width: 80px; height: auto; }
.nav-inline-text { flex: 1; }
.nav-inline-text p { margin-bottom: 0.8rem; }
.nav-inline-text h3 { font-weight: 700; margin-bottom: 0.3rem; }

/* ===================================================
   AGENDA PAST DATES
=================================================== */
.agenda-past { opacity: 0.45; }
.agenda-past .past-label {
    font-style: italic; font-size: 0.8rem;
    color: var(--color-rose); margin-left: 0.3rem;
}

/* ===================================================
   RESPONSIVE
=================================================== */
@media (max-width: 768px) {
    :root { 
        --header-height: 3.5rem; 
        --nav-width: 100vw;
    }
    
    html, body { overflow-x: hidden; height: auto; overflow-y: auto; }
    .container { height: auto; min-height: 100vh; overflow-y: auto; display: block; }
    
    header { padding: 0 1rem; position: sticky; top: 0; width: 100%; }
    .site-logo { left: 1rem; }
    .site-logo img { height: 2rem; }
    
    #nav + label { padding: 0 1rem; }
    
    nav[aria-label="nav-main"] { 
        width: 100vw; 
        height: calc(100vh - var(--header-height)); 
        border-left: none;
        position: fixed;
        left: 0;
        right: 0;
        z-index: 99999;
    }
    
    main { 
        display: block;
        height: auto; 
        overflow: visible;
    }
    
    .left-column { height: auto; overflow: visible; }
    .right-panel { 
        display: block; 
        width: 100%; 
        height: auto; 
        overflow: visible; 
        border-left: none; 
        border-top: 1px solid var(--color-border);
    }
    
    .home-grid { grid-template-columns: 1fr; }
    .home-card img { aspect-ratio: 1/1; }
    .home-card-title { font-size: 1.1rem; padding: 1rem; }
    
    .page-content { padding: 2rem 1.2rem; }
    .page-content h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
    
    .nav-inline-content { flex-direction: column; gap: 1rem; padding: 1.2rem; }
    .nav-inline-logo { width: 50px; }
    .nav-inline-logo img { width: 50px; }
    
    .soutenir-grid { grid-template-columns: 1fr; }
    
    /* Fix for mobile scrolling when menu is open */
    body.nav-open { overflow: hidden; height: 100vh; }
}

/* Specific fix for landscape on small screens */
@media (max-height: 500px) and (max-width: 900px) {
    :root { --header-height: 3rem; }
    nav[aria-label="nav-main"] { height: calc(100vh - var(--header-height)); }
    .nav-inline-content { flex-direction: row; }
}
@media (orientation: landscape) {
    #nav:checked ~ nav[aria-label="nav-main"] { top: var(--header-height); }
    nav[aria-label="nav-main"] { border-bottom: 1px solid var(--color-border); }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===================================================
   CUSTOM CURSOR (carré → rond sur les liens)
=================================================== */
#cursor {
    position: fixed; left: 0; top: 0;
    width: 20px; height: 20px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 0%;
    pointer-events: none;
    z-index: 100001;
    transform: translate(-50%, -50%);
    transition: width .15s ease, height .15s ease, border-radius .15s ease, background-color .15s ease, border-color .15s ease;
    mix-blend-mode: difference;
}
@media (hover: hover) {
    *, a, button, summary, label, input { cursor: none !important; }
}
@media (hover: none) {
    #cursor { display: none; }
}


/* ===================================================
   CARRÉ ROND NAV CONTENT FIX
=================================================== */
.nav-inline-text {
    flex: 1;
    min-width: 0;
}
.nav-inline-text p {
    margin-bottom: 0.9rem;
}
.nav-inline-text strong {
    font-weight: 700;
}
.nav-inline-text a {
    text-decoration: underline;
}

/* ===================================================
   DISTRIBUTION STYLING
=================================================== */
.distribution-content {
    display: grid;
    gap: 0.9rem;
}
.distribution-content p,
.distribution-content ul,
.distribution-content ol {
    margin-bottom: 0;
}
.distribution-content ul,
.distribution-content ol {
    list-style: none;
    display: grid;
    gap: 0.65rem;
}
.distribution-content li {
    padding: 0.8rem 0.95rem;
    background: var(--color-gris);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    line-height: 155%;
}
.distribution-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.14em;
    font-weight: 700;
}
.distribution-content strong {
    font-weight: 700;
}
.distribution-content > p {
    padding: 0.8rem 0.95rem;
    background: var(--color-gris);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
}

/* ===================================================
   MOBILE ORDER - SINGLE SPECTACLE
=================================================== */
@media (max-width: 768px) {
    body.single-spectacle main,
    body.single-spectacle.single-spectacle main,
    body.single main {
        display: flex;
        flex-direction: column;
    }

    body.single-spectacle .spectacle-panel,
    body.single .spectacle-panel {
        order: 1;
    }

    body.single-spectacle .projects-grid,
    body.single .projects-grid {
        order: 2;
    }

    body.single-spectacle .project-title-bar,
    body.single .project-title-bar {
        position: static;
    }
}
