/* ==========================================================================
   PROJET DETAIL — Brutalist field-manual spread
   ========================================================================== */

.content {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--s-7) var(--s-6);
}

.project-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    position: relative;
}

/* ----- Header row: logo + nom + membres ----- */
.project-header,
#firstrow {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--s-5);
    align-items: start;
    padding-bottom: var(--s-5);
    border-bottom: var(--rule-w-bold) solid var(--rule-bright);
    margin-bottom: var(--s-6);
    position: relative;
}

#firstrow::before {
    content: "FICHE PROJET";
    position: absolute;
    top: 0; left: 0;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-3);
}

/* When a projet has no logo, the <div id="logo"> isn't emitted; reflow
   the grid so the title takes the full row instead of squeezing into the
   120px logo column. */
.project-header.no-logo,
#firstrow.no-logo {
    grid-template-columns: 1fr;
}

/* When a projet has no affiche, the <div id="affiche"> isn't emitted;
   reflow #thirdrow from 1fr 1fr to 1fr so description spans full width
   instead of stretching across half the page next to an empty box. */
#thirdrow.no-affiche {
    grid-template-columns: 1fr;
}

.project-container #logo {
    background: var(--paper-alt);
    border: var(--rule-w) solid var(--rule);
    border-radius: var(--radius);
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-2);
    margin-top: var(--s-5);
    overflow: hidden;
}
.project-container #logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.project-container #entete {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding-top: var(--s-5);
}

.project-container #entete h1,
.project-container > h1 {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
    text-transform: none;
    color: var(--ink);
    margin: 0;
}

.project-container #entete h2 {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: none;
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
}

/* ----- Slogan ----- */
.project-container #slogan {
    background: var(--paper-alt);
    border-left: 0;
    padding: var(--s-4) var(--s-5);
    margin-bottom: var(--s-6);
}
.project-container #slogan p {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--ink);
    margin: 0;
}
.project-container #slogan b {
    display: block;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-2);
}

/* ----- Third row: affiche + description side by side ----- */
#thirdrow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-6);
    align-items: start;
    margin-bottom: var(--s-6);
}

.project-container #affiche {
    border: var(--rule-w) solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper);
    overflow: hidden;
    position: relative;
}

.project-container #affiche::before {
    content: "AFFICHE";
    position: absolute;
    top: var(--s-2); left: var(--s-3);
    z-index: 5;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--ink);
    background: var(--accent);
    padding: 2px var(--s-2);
}

.project-header img,
.project-container #affiche img {
    max-width: 100%;
    height: auto;
    display: block;
}

.project-container #affiche iframe,
.project-container #affiche object,
.project-container #affiche embed {
    width: 100%;
    min-height: 560px;
    border: none;
    background: var(--paper);
}

.project-container #affiche .pdf-image-render {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: var(--paper);
}

.project-container #affiche .pdf-image-canvas {
    width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

.project-container #affiche .pdf-image-fallback {
    width: 100%;
    min-height: 640px;
    border: none;
    /* Hidden by default — canvas (.pdf-image-canvas) is the primary renderer.
       The iframe was flashing browser/ad-blocker UI for the R2 URL during the
       pre-canvas-render window. Revealed only on explicit render failure. */
    display: none;
}
.project-container #affiche .pdf-render-failed .pdf-image-fallback {
    display: block;
}

#description {
    padding: var(--s-5);
    background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
    border: var(--rule-w) solid var(--rule);
    border-radius: var(--radius);
    position: relative;
}

#description::before {
    content: "§ DESCRIPTION";
    display: block;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-4);
    padding-bottom: var(--s-3);
    border-bottom: var(--rule-w) solid var(--rule);
}

#description p,
#mon-texte,
#mon-texte .txt {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--ink);
}
#description p { margin: 0 0 var(--s-3) 0; }
#description p:last-child { margin-bottom: 0; }
/* WYSIWYG formatting in the rendered description (lists + inline marks). */
#description ul,
#description ol {
    margin: 0 0 var(--s-3) 0;
    padding-left: 1.5rem;
}
#description ul:last-child,
#description ol:last-child { margin-bottom: 0; }
#description li {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--ink);
    margin-bottom: var(--s-1);
}
#description strong, #description b { font-weight: 700; }
#description em, #description i { font-style: italic; }
#description u { text-decoration: underline; }
/* Long unbroken strings (a URL/hash/path in student content) must wrap instead
   of overflowing the container's right edge — WCAG 1.4.10 Reflow. Applied to the
   container AND p/li so it holds whether the content is wrapped in <p>/<li> or
   rendered bare. */
#description,
#description p,
#description li {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ----- Video ----- */
#video {
    margin-top: var(--s-6);
}

.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
    border: 1px solid var(--rule-bright);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--ink);
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#video::before {
    content: "§ DÉMONSTRATION VIDÉO";
    display: block;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-3);
}

/* ----- Notation / favori row ----- */
#notation {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-5);
    padding: var(--s-4);
    background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
    border: var(--rule-w) solid var(--rule);
    border-radius: var(--radius);
}

#notation form { margin: 0; }

#notation a {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-5);
    background: transparent;
    color: var(--accent);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 999px;
    transition:
        background var(--t-fast) var(--ease),
        color var(--t-fast) var(--ease),
        border-color var(--t-fast) var(--ease);
}
#notation a:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}
#notation a .fa {
    font-size: 0.95rem;
}

/* ----- Edit projet link ----- */
#edit-projet {
    margin: var(--s-3) 0;
}
.edit-projet-link {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-4);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 999px;
    transition:
        background var(--t-fast) var(--ease),
        color var(--t-fast) var(--ease),
        border-color var(--t-fast) var(--ease);
}
.edit-projet-link::before {
    content: "✎";
    font-size: 1rem;
    margin-right: var(--s-1);
}
.edit-projet-link:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

/* ----- Edit form refinements (used by edit_projet.html) ----- */
.project-container form label {
    display: block;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--s-2);
}

.project-container form textarea,
.project-container form input[type="text"] {
    width: 100%;
    padding: var(--s-3) var(--s-3);
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.55;
    background: var(--paper);
    color: var(--ink);
    border: var(--rule-w) solid var(--ink);
    border-radius: var(--radius-sm);
    outline: none;
    transition: outline var(--t-fast) var(--ease);
}

.project-container form textarea:focus,
.project-container form input[type="text"]:focus {
    outline: var(--rule-w-bold) solid var(--accent);
    outline-offset: -3px;
}

.project-container form input[type="file"] {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.85rem;
    padding: var(--s-2);
    border: var(--rule-w) dashed var(--ink);
    background: var(--paper-alt);
    width: 100%;
}

.project-container form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-4) var(--s-6);
    background: var(--ink);
    color: var(--paper);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    border: var(--rule-w) solid var(--ink);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.project-container form button[type="submit"]:hover {
    background: var(--accent);
    color: var(--ink);
}

/* ----- Responsive ----- */
@media (max-width: 800px) {
    .project-header,
    #firstrow {
        grid-template-columns: 1fr;
    }
    .project-container #logo {
        margin-top: 0;
    }
    #thirdrow {
        grid-template-columns: 1fr;
        gap: var(--s-4);
    }
}
