/* ===========================================================
   Cadence — Dotclear theme
   A masonry photo-grid theme, CSS-columns based (no JS needed
   for layout; js/cadence.js only toggles the mobile menu).
   =========================================================== */

:root {
    --gs-bg: #ffffff;
    --gs-text: #2b2f36;
    --gs-muted: #7a828e;
    --gs-accent: #2b2f36;
    --gs-border: #e9e9ec;
    --gs-gap: 0px;
    --gs-radius: 2px;
    --gs-font-title: "Josefin Sans", "Helvetica Neue", Arial, sans-serif;
    --gs-font-body: "Lato", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--gs-bg);
    color: var(--gs-text);
    font-family: var(--gs-font-body);
    font-weight: 300;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Masthead ---------- */
.masthead {
    padding: 40px 30px 10px;
}
.masthead .site-title {
    font-family: var(--gs-font-title);
    font-weight: 300;
    font-size: 3rem;
    color: var(--gs-text);
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 30px;
    border-top: 1px solid var(--gs-border);
    border-bottom: 1px solid var(--gs-border);
    flex-wrap: wrap;
}

.menu-toggle {
    background: #1b1d21;
    color: #fff;
    border: none;
    padding: 8px 14px;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: var(--gs-radius);
}
.menu-icon { margin-right: 4px; }

.topbar-center { text-align: center; flex: 1; }
.site-title-small {
    display: none; /* shown only if masthead hidden via theme option */
    font-family: var(--gs-font-title);
    font-size: 1.6rem;
}
.site-tagline {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gs-muted);
}

.social-icons {
    list-style: none;
    display: flex;
    gap: 14px;
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
}
.social-icons a { color: var(--gs-text); }
.social-icons a:hover { color: var(--gs-muted); }

/* ---------- Nav ---------- */
.site-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    background: #fafafa;
    border-bottom: 1px solid var(--gs-border);
}
.site-nav.open { max-height: 400px; }
.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 8px 30px 14px;
}
.site-nav li {
    border-bottom: 1px solid var(--gs-border);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.site-nav.open li {
    opacity: 1;
    transform: translateY(0);
}
.site-nav.open li:nth-child(1) { transition-delay: 0.03s; }
.site-nav.open li:nth-child(2) { transition-delay: 0.07s; }
.site-nav.open li:nth-child(3) { transition-delay: 0.11s; }
.site-nav.open li:nth-child(4) { transition-delay: 0.15s; }
.site-nav.open li:nth-child(5) { transition-delay: 0.19s; }
.site-nav li:last-child { border-bottom: none; }
.site-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    font-family: var(--gs-font-title);
    font-size: 1.05rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gs-text);
    transition: color 0.25s ease, padding-left 0.25s ease;
}
.site-nav a::before {
    content: "";
    width: 0;
    height: 1px;
    background: var(--gs-accent);
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.site-nav a:hover,
.site-nav a:focus {
    color: var(--gs-accent);
    padding-left: 10px;
}
.site-nav a:hover::before,
.site-nav a:focus::before {
    width: 20px;
}

/* ---------- Simple grid (cases carrées uniformes, sans masonry) ---------- */
.grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-auto-rows: 260px !important;
    gap: 6px !important;
    padding: 6px !important;
}

.grid-item {
    margin: 0 !important;
    position: relative;
    overflow: hidden;
    background: #eee;
    height: 100% !important;
    width: auto !important;
}

/* La photo en vedette (bloc 2x2) revient tous les 9 elements, en
   alternant gauche puis droite. Ligne ET colonne sont fixees explicitement
   pour eviter que CSS Grid ne les regroupe avant les photos normales. */
.grid-item:nth-child(1) { grid-row: 1 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(10) { grid-row: 5 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(19) { grid-row: 9 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(28) { grid-row: 13 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(37) { grid-row: 17 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(46) { grid-row: 21 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(55) { grid-row: 25 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(64) { grid-row: 29 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(73) { grid-row: 33 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(82) { grid-row: 37 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(91) { grid-row: 41 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(100) { grid-row: 45 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(109) { grid-row: 49 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(118) { grid-row: 53 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(127) { grid-row: 57 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(136) { grid-row: 61 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(145) { grid-row: 65 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(154) { grid-row: 69 / span 2 !important; grid-column: 2 / span 2 !important; }
.grid-item:nth-child(163) { grid-row: 73 / span 2 !important; grid-column: 1 / span 2 !important; }
.grid-item:nth-child(172) { grid-row: 77 / span 2 !important; grid-column: 2 / span 2 !important; }

.grid-photo,
.grid-photo--placeholder {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.grid-photo--placeholder {
    background: linear-gradient(135deg, #dcdfe3, #eef0f2);
}

.grid-item a {
    display: block;
    position: relative;
    height: 100%;
}

/* Voile sombre au repos très léger, qui s'intensifie au survol */
.grid-item a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.05) 45%, rgba(0,0,0,0) 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 1;
}
.grid-item a:hover::before,
.grid-item a:focus::before {
    opacity: 1;
}

.grid-photo {
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease;
    filter: saturate(0.94);
}
.grid-item a:hover .grid-photo,
.grid-item a:focus .grid-photo {
    transform: scale(1.08);
    filter: saturate(1.08);
}

.grid-item figcaption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 18px 18px 16px;
    color: #fff;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 2;
}
.grid-item figcaption::before {
    content: "";
    display: block;
    width: 26px;
    height: 2px;
    background: #fff;
    margin-bottom: 8px;
    opacity: 0.85;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.05s;
}
.grid-item a:hover figcaption,
.grid-item a:focus figcaption {
    opacity: 1;
    transform: translateY(0);
}
.grid-item a:hover figcaption::before,
.grid-item a:focus figcaption::before {
    transform: scaleX(1);
}

.grid-title {
    display: block;
    font-family: var(--gs-font-title);
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}
.grid-date {
    display: block;
    margin-top: 3px;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

/* ---------- Mise en page à deux colonnes pour le gabarit natif ---------- */
/* Utilisé uniquement par la page d'un billet (post.html natif, non
   surchargé par ce thème) : place la sidebar à droite du contenu au
   lieu de la laisser s'empiler en dessous. */
#wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 0;
}
#main {
    flex: 1 1 0%;
    min-width: 0;
}
#sidebar {
    flex: 0 0 280px;
    width: 280px;
}
#sidebar .widget {
    margin-bottom: 28px;
    font-size: 0.9rem;
}
#sidebar .widget h2 {
    font-family: var(--gs-font-title);
    font-weight: 400;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
    color: var(--gs-muted);
}
#sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#sidebar li { margin-bottom: 6px; }

@media (max-width: 900px) {
    #wrapper { flex-direction: column; }
    #sidebar { width: 100%; }
}

#navlinks {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0 0 30px;
    padding: 16px 20px;
    background: #fafafa;
    border: 1px solid var(--gs-border);
    border-radius: var(--gs-radius);
    font-family: var(--gs-font-title);
}
#navlinks span { display: none; }
#navlinks a {
    flex: 1 1 0%;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--gs-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color 0.2s ease, opacity 0.2s ease;
    opacity: 0.75;
}
#navlinks a:hover,
#navlinks a:focus {
    color: var(--gs-accent);
    opacity: 1;
}
#navlinks a.prev { text-align: left; }
#navlinks a.next { text-align: right; }

/* ---------- Fallback styling for the native post template ---------- */
/* post.html is not overridden by this theme (see README) — Dotclear uses
   its built-in "mustek" template for reliability. These rules restyle
   its standard classes to stay visually consistent with Cadence. */
.post {
    max-width: 760px;
    margin: 0 auto;
    padding: 30px;
}
.post .day-date {
    color: var(--gs-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 6px;
}
.post .post-title {
    font-family: var(--gs-font-title);
    font-weight: 300;
    font-size: 2.2rem;
    margin: 0 0 8px;
}
.post .post-title a { color: var(--gs-text); }
.post .post-info {
    color: var(--gs-muted);
    font-size: 0.85rem;
    margin: 0 0 20px;
}
.post .post-content { line-height: 1.7; }
.post .post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--gs-radius);
    margin: 16px 0;
}
.post .post-info-co {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gs-border);
    font-size: 0.8rem;
}
.post .post-info-co a { color: var(--gs-muted); margin-right: 16px; }
.post .post-info-co a:hover { color: var(--gs-text); }


.single-entry { padding: 30px; max-width: 900px; margin: 0 auto; }
.entry-title {
    font-family: var(--gs-font-title);
    font-weight: 300;
    font-size: 2.2rem;
}
.entry-meta { color: var(--gs-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.entry-photo { margin: 20px 0; }
.entry-photo-img { width: 100%; border-radius: var(--gs-radius); }
.entry-content { line-height: 1.7; }
.entry-tags { list-style: none; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.entry-tags a {
    padding: 4px 10px;
    background: #f2f2f3;
    border-radius: 20px;
    font-size: 0.75rem;
}

.post-nav { display: flex; justify-content: space-between; margin: 30px 0; font-size: 0.9rem; }

/* ---------- Comments ---------- */
.entry-comments { margin-top: 40px; border-top: 1px solid var(--gs-border); padding-top: 20px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--gs-border); }
.comment-author { font-weight: 700; margin: 0 0 4px; font-size: 0.85rem; }
#comment-form input[type="text"],
#comment-form input[type="email"],
#comment-form input[type="url"],
#comment-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gs-border);
    border-radius: var(--gs-radius);
    font-family: inherit;
}
#comment-form label { display: block; font-size: 0.75rem; text-transform: uppercase; margin-bottom: 4px; color: var(--gs-muted); }
#comment-form input[type="submit"] {
    background: var(--gs-accent);
    color: #fff;
    border: none;
    padding: 10px 22px;
    cursor: pointer;
    border-radius: var(--gs-radius);
}

/* ---------- Archive / category / search headers ---------- */
.archive-header { padding: 30px; text-align: center; }
.archive-header h1 { font-family: var(--gs-font-title); font-weight: 300; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    justify-content: space-between;
    padding: 10px 30px 40px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---------- 404 ---------- */
.not-found { text-align: center; padding: 100px 20px; }
.not-found h1 { font-size: 5rem; font-family: var(--gs-font-title); margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.75rem;
    color: var(--gs-muted);
    border-top: 1px solid var(--gs-border);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .grid { grid-template-columns: repeat(2, 1fr) !important; grid-auto-rows: 200px !important; }
    .masthead .site-title { font-size: 2.2rem; }
}
@media (max-width: 400px) {
    .grid { grid-template-columns: 1fr !important; grid-auto-rows: 240px !important; padding: 6px !important; }
    .grid-item:nth-child(1),
    .grid-item:nth-child(10),
    .grid-item:nth-child(19),
    .grid-item:nth-child(28),
    .grid-item:nth-child(37),
    .grid-item:nth-child(46),
    .grid-item:nth-child(55),
    .grid-item:nth-child(64),
    .grid-item:nth-child(73),
    .grid-item:nth-child(82),
    .grid-item:nth-child(91),
    .grid-item:nth-child(100),
    .grid-item:nth-child(109),
    .grid-item:nth-child(118),
    .grid-item:nth-child(127),
    .grid-item:nth-child(136),
    .grid-item:nth-child(145),
    .grid-item:nth-child(154),
    .grid-item:nth-child(163),
    .grid-item:nth-child(172) { grid-column: span 1 !important; grid-row: span 1 !important; }
    .topbar { padding: 12px 16px; }
    .masthead { padding: 24px 16px 6px; }
}
