/* ============================================================
   PRELOADER
   ============================================================ */
#preloader {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #cccccc;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    border: 12px solid #cccccc;
    border-radius: 50%;
    border-top: 12px solid #000000;
    width: 80px;
    height: 80px;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ============================================================
   PLAYGROUND.CSS — aligned with svenronceray.fr visual system
   ============================================================ */

/* ---- Fonts (same as style.css) ---- */
@import url('https://fonts.googleapis.com/css2?family=PT+Mono&display=swap');

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #e3e3e3;
    font-family: 'Overpass Mono Light', 'PT Mono', monospace;
    width: 100vw;
    min-height: 100vh;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    overflow-x: hidden;
}

/* Grid overlay — visible only when creator is open */
body.grid-active {
    background-image:
        linear-gradient(rgba(150, 150, 150, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(150, 150, 150, 0.2) 1px, transparent 1px);
    background-size: 16px 16px;
}

::-webkit-scrollbar {
    display: none;
}

/* ============================================================
   HEADER — mirror of .project-header-container / .project-cols
   ============================================================ */
.pg-header {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    background-color: #e3e3e3;
    border-bottom: 1px solid #999;
}

.pg-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 95%;
    margin: 0 auto;
    padding: 30px 0;
    gap: 24px;
}

/* Back link */
.pg-back {
    font-family: 'PT Mono', monospace;
    font-size: 0.8em;
    color: #3b3b3b;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.pg-back:hover {
    color: #111;
}

/* Name + label */
.pg-title-block {
    border-left: 1px solid #999;
    padding-left: 24px;
    flex-shrink: 0;
}

.pg-name {
    font-family: 'PT Mono', monospace;
    font-size: 1em;
    font-weight: bold;
    color: #202020;
    margin: 0;
    line-height: 1.2;
}

.pg-label {
    font-family: 'PT Mono', monospace;
    font-size: 0.7em;
    color: #888;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pg-hint {
    font-family: 'PT Mono', monospace;
    font-size: 0.7em;
    color: #888;
    margin: 0;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

/* Controls area */
.pg-controls {
    display: flex;
    gap: 10px;
    margin-left: auto;
    align-items: center;
}

/* ---- Buttons — minimal, monospace, site-coherent ---- */
.pg-btn {
    font-family: 'PT Mono', monospace;
    font-size: 0.72em;
    color: #3b3b3b;
    background: transparent;
    border: 1px solid #999;
    padding: 7px 18px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 0;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.pg-btn:hover {
    background: #202020;
    color: #e3e3e3;
    border-color: #202020;
}

.pg-btn:active {
    background: #111;
    color: #fff;
}

.pg-btn--creator.active {
    background: #202020;
    color: #e3e3e3;
    border-color: #202020;
}

/* ============================================================
   GALLERY CANVAS
   ============================================================ */
.gallery {
    width: 100%;
    height: 600vh;
    position: relative;
    overflow: visible;
    /* Push below fixed header */
    padding-top: 70px;
}

/* ============================================================
   GALLERY ITEMS + FLIP CARDS
   ============================================================ */
.gallery-item {
    position: absolute;
    cursor: grab;
    perspective: 1000px;
    transition:
        transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.3s ease,
        left 0s, top 0s;
}

.gallery-item:active,
.gallery-item.dragging {
    cursor: grabbing;
    transition: none;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
}

.flip-front,
.flip-back {
    position: absolute;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flip-front {
    width: 100%;
    height: 100%;
    background-color: transparent;
    transform: rotateY(0deg);
}

/* Back face rendered at 300% for sharpness at high zoom */
.flip-back {
    width: 300%;
    height: 300%;
    left: -100%;
    top: -100%;
    background-color: #e3e3e3;
    color: #333;
    transform: scale(0.3333333) rotateY(-180deg);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 60px;
    box-sizing: border-box;
    font-size: 42px;
    font-family: 'PT Mono', monospace;
}

.flip-back p {
    margin: 0;
    line-height: 1.5;
    text-align: left;
    font-size: 0.85em;
    color: #3b3b3b;
}

.flip-back strong {
    font-size: 1.1em;
    margin-bottom: 20px;
    display: block;
    color: #111;
    text-align: left;
    font-weight: bold;
}

/* Flip state */
.gallery-item.flipped .flip-front {
    transform: rotateY(180deg);
}

.gallery-item.flipped .flip-back {
    transform: scale(0.3333333) rotateY(0deg);
}

/* ============================================================
   SELECTION BOX
   ============================================================ */
.selection-box {
    position: absolute;
    border: 1px dashed #202020;
    background-color: rgba(50, 50, 50, 0.06);
    z-index: 5000;
    pointer-events: none;
    display: none;
}

/* Selected state */
.gallery-item.selected {
    box-shadow: 0 0 0 1px #202020;
}

/* ============================================================
   CREATOR PANEL — minimal glass panel with site typography
   ============================================================ */
.magazine-creator {
    display: none;
    position: fixed;
    top: 80px;
    right: 30px;
    width: 300px;
    background: rgba(227, 227, 227, 0.95);
    backdrop-filter: blur(8px);
    padding: 20px;
    border: 1px solid #999;
    z-index: 1500;
    font-family: 'PT Mono', monospace;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    animation: slideIn 0.25s ease;
}

.magazine-creator.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.magazine-creator h3 {
    margin-bottom: 18px;
    color: #202020;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid #999;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #bbb;
    border-radius: 0;
    font-family: 'PT Mono', monospace;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    color: #202020;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #202020;
    outline: none;
    background: white;
}

.format-options {
    display: flex;
    gap: 14px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #444;
}

/* Colour palette grid */
.color-options-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.15s ease;
}

.color-option:hover {
    transform: scale(1.08);
    border-color: #202020;
}

.color-option.selected {
    transform: scale(1.08);
    border-color: #202020;
    box-shadow: 0 0 0 1px #202020;
}

/* Create button */
.create-btn {
    width: 100%;
    padding: 10px;
    background: #202020;
    color: #e3e3e3;
    border: 1px solid #202020;
    border-radius: 0;
    font-family: 'PT Mono', monospace;
    font-size: 0.72rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.create-btn:hover {
    background: #111;
    border-color: #111;
}

/* ============================================================
   MAGAZINE COVER ELEMENTS
   ============================================================ */
.magazine-cover {
    position: absolute;
    width: 300px;
    cursor: grab;
    pointer-events: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    user-select: none;
    transform-origin: center center;
    transition:
        transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
        box-shadow 0.3s ease,
        left 0s, top 0s;
}

.magazine-cover:active,
.magazine-cover.dragging {
    cursor: grabbing;
    transition: none;
}

.magazine-cover.selected {
    box-shadow: 0 0 0 1px #202020;
}

/* Typography */
.mag-title {
    font-family: 'Times New Roman', serif;
    font-weight: 900;
    line-height: 0.85;
    text-transform: uppercase;
    text-align: center;
    pointer-events: none;
    letter-spacing: -1px;
}

.mag-subtitle {
    font-family: 'Overpass Mono', monospace;
    font-weight: 400;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 10px;
    pointer-events: none;
}

.mag-article {
    font-family: 'Times New Roman', serif;
    font-weight: 400;
    pointer-events: none;
}

/* Layouts */
.layout-1 {
    justify-content: space-between;
    text-align: center;
}

.layout-1 .mag-title {
    font-family: Impact, 'Arial Narrow', sans-serif;
    font-size: 4rem;
    order: -1;
    margin-bottom: auto;
}

.layout-1 .mag-subtitle {
    font-size: 0.9rem;
    order: 0;
    margin-top: 15px;
    display: inline-block;
}

.layout-1 .mag-article {
    font-family: 'Overpass Mono', monospace;
    font-size: 1.3rem;
    font-style: normal;
    order: 1;
    margin-top: 20px;
    line-height: 22px;
}

.layout-2 {
    justify-content: flex-start;
}

.layout-2 .mag-title {
    font-family: 'Overpass Mono', monospace;
    font-size: 3.5rem;
    text-align: center;
    margin-bottom: 5px;
}

.layout-2 .mag-subtitle {
    font-size: 0.8rem;
    text-align: center;
    border-bottom: 1px solid currentColor;
    padding-bottom: 5px;
    margin-bottom: 100px;
}

.layout-2 .mag-article {
    font-family: PT Mono, monospace;
    font-size: 2rem;
    font-weight: bold;
    text-align: left;
    max-width: 90%;
    line-height: 1.1;
}

.layout-3 {
    justify-content: flex-end;
    align-items: flex-start;
}

.layout-3 .mag-title {
    font-size: 5rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: absolute;
    right: 15px;
    top: 20px;
    height: 90%;
    text-align: center;
}

.layout-3 .mag-subtitle {
    font-size: 1rem;
    text-align: left;
    margin-bottom: 20px;
    font-weight: normal;
}

.layout-3 .mag-article {
    font-size: 1.4rem;
    text-align: left;
    max-width: 65%;
    border-left: 4px solid currentColor;
    padding-left: 15px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.pg-footer {
    font-family: 'PT Mono', monospace;
    font-size: 0.75em;
    text-align: center;
    color: #888;
    padding: 20px 0;
    position: relative;
    z-index: 10;
}