/* ====================================================================
   SIQI WEBSITE  —  STYLES
   ====================================================================
   This stylesheet is loaded by siqi-website.html.

   For local preview (double-clicking the .html), keep this file in the
   SAME folder as siqi-website.html — the <link> uses a relative path.

   For Cargo: upload this file to Cargo Files too, copy its URL, and put
   that URL into the <link rel="stylesheet"> tag in siqi-website.html.
   See CARGO-GUIDE.md.
   ==================================================================== */

/* ── base ─────────────────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    background-color: #FFFAF1;
    font-family: sans-serif;
}

/* ── shared header ────────────────────────────────────────── */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    box-sizing: border-box;
    background-color: #FFFAF1;
    z-index: 100;
}

header h1 {
    color: #E5231E;
    margin: 0;
    font-size: 1.5rem;
    flex: 1;
    cursor: pointer;
}

header h1:nth-child(1) { text-align: left; }
header h1:nth-child(2) { text-align: center; }
header h1:nth-child(3) { text-align: right; }

/* ── view switching (gallery view  /  journal view) ───────── */
.view { display: none; }
.view.active { display: block; }

/* ── first screen ─────────────────────────────────────────── */
.hero {
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.hero-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 40px;
    box-sizing: border-box;
}

.hero-footer p {
    color: #E5231E;
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1.4;
    text-align: left;
}

/* ── flying 3D journal ────────────────────────────────────── */
.journal {
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    height: 420px;
    pointer-events: auto;
    will-change: transform;
    transform: translate3d(-300px, -300px, 0);
    user-select: none;
    cursor: pointer;
    z-index: 200;
}

.journal canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ── gallery section ──────────────────────────────────────── */
.gallery-section {
    padding: 60px 13px 80px;
}

.gallery-label {
    color: #E5231E;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 0 24px 2px;
}

.gallery-grid {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.gallery-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.g-card {
    position: relative;
    overflow: visible;
    cursor: zoom-in;
}

.g-card-image {
    width: 100%;
    display: block;
}

.g-card-image img {
    width: 100%;
    display: block;
    height: auto;
}

.g-card-image iframe {
    width: 100%;
    height: 320px;
    display: block;
    border: 0;
    background: #fff;
    pointer-events: none; /* preview only — click opens the lightbox */
}

/* keep the pixel-art gif crisp when scaled up — no anti-aliasing */
.g-card-image img[src$=".gif"],
.lightbox-inner img[src$=".gif"] {
    image-rendering: pixelated;
}

.g-card-gradient {
    height: 160px;
}

.g-card-body {
    padding: 7px 2px 4px;
}

.g-card-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 3px;
}

.g-card-date {
    font-size: 0.68rem;
    color: #E5231E;
    margin: 0 0 5px;
    letter-spacing: 0.02em;
}

.g-card-desc {
    font-size: 0.75rem;
    color: #555;
    margin: 0;
    line-height: 1.5;
}

/* ── gallery lightbox ─────────────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.lightbox.open { display: flex; }

.lightbox-inner {
    background: #FFFAF1;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.lightbox-inner img,
.lightbox-inner video {
    width: 100%;
    display: block;
}

.lightbox-inner iframe {
    width: 100%;
    height: 80vh;
    display: block;
    border: 0;
    background: #fff;
}

.lightbox-body p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    margin: 12px 0 0;
}

.lightbox-body {
    padding: 18px 22px 22px;
}

.lightbox-body h2 {
    margin: 0 0 5px;
    font-size: 1.2rem;
    color: #1a1a1a;
}

.lightbox-body .lb-date {
    font-size: 0.75rem;
    color: #E5231E;
    margin: 0;
    display: block;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 1.8rem;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    user-select: none;
}

/* ── about section ─────────────────────────────────────────── */
.about-section {
    padding: 80px 40px 60px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 60px;
    box-sizing: border-box;
}

.about-section .bio {
    max-width: 520px;
    flex: 1;
}

.about-section .bio p {
    color: #E5231E;
    margin: 0 0 1em;
    font-size: 1.05rem;
    font-weight: bold;
    line-height: 1.55;
}

.about-section .bio p:last-child { margin-bottom: 0; }

.about-section .contact {
    text-align: right;
    flex-shrink: 0;
}

.about-section .contact p {
    color: #E5231E;
    margin: 0 0 0.4em;
    font-size: 1.05rem;
    font-weight: bold;
    line-height: 1.55;
}

.about-section .contact a {
    color: #E5231E;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.about-section .contact p:last-child { margin-bottom: 0; }

@media (max-width: 700px) {
    .about-section { flex-direction: column; gap: 40px; padding: 60px 20px; }
    .about-section .contact { text-align: left; }
}

/* ── journal grid ─────────────────────────────────────────── */
.grid-container {
    padding: 100px 24px 80px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
}

.journal-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    width: 220px;
    height: 320px;
    position: relative;
    overflow: visible;
    cursor: zoom-in;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 6px;
}

.slot {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.slot.top   { align-self: flex-start; }
.slot.bottom{ align-self: flex-end; }

.slot img {
    width: 100%;
    display: block;
    max-height: 130px;
    object-fit: cover;
}

/* PDFs and 3D models occupy the same slot footprint as an image */
.slot iframe,
.slot model-viewer {
    width: 100%;
    height: 130px;
    display: block;
    border: 0;
    background: transparent;
    pointer-events: none; /* let the click reach the slot → lightbox */
}

.slot iframe { background: #fff; }

/* a single-item card grows to fit its image at the full card width */
.card.solo { height: auto; align-self: start; }

.card.solo .slot.bottom img {
    max-height: none;
    height: auto;          /* natural height — no cropping */
}

/* PDFs / 3D models have no natural height — give them a tall fixed box */
.card.solo .slot.bottom iframe,
.card.solo .slot.bottom model-viewer {
    height: 360px;
}

.slot .title {
    color: #E5231E;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 6px 2px 0;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

/* in the top slot, title appears BELOW the image */
.slot.top  .title { margin: 6px 2px 0; }
/* in the bottom slot, title appears ABOVE the image */
.slot.bottom .title { margin: 0 2px 6px; order: -1; }

/* ── journal lightbox ─────────────────────────────────────── */
.j-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 300;
    align-items: center;
    justify-content: center;
}

.j-lightbox.open { display: flex; }

.j-lightbox-inner {
    background: #FFFAF1;
    max-width: 600px;
    width: 92%;
    max-height: 92vh;
    overflow-y: auto;
}

.j-lightbox-inner .jlb-image img { width: 100%; display: block; }
.j-lightbox-inner .jlb-image iframe { width: 100%; height: 80vh; display: block; border: 0; background: #fff; pointer-events: none; }
.j-lightbox-inner .jlb-image model-viewer { width: 100%; height: 70vh; display: block; background: transparent; }
.j-lightbox-body { padding: 18px 22px 22px; }
.j-lightbox-body h2 { margin: 0; font-size: 1.1rem; color: #E5231E; }
.j-lightbox-body p { margin: 10px 0 0; font-size: 0.9rem; color: #555; line-height: 1.6; }

.j-lightbox-close {
    position: absolute;
    top: 18px; right: 22px;
    font-size: 1.8rem;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    user-select: none;
}

/* ── gallery video: poster + play badge ───────────────────── */
.g-card-video { position: relative; }

.g-play-badge {
    position: absolute;
    top: 50%; left: 50%;
    width: 56px; height: 56px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(229, 35, 30, 0.9);
    pointer-events: none;
    z-index: 6;
    transition: transform 0.15s ease;
}

.g-card:hover .g-play-badge { transform: translate(-50%, -50%) scale(1.08); }

/* the white play triangle */
.g-play-badge::after {
    content: "";
    position: absolute;
    top: 50%; left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #FFFAF1;
}

/* ── lightbox video + "loading" overlay ───────────────────── */
.lb-video { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.lb-video video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }

.lb-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 250, 241, 0.82);  /* cream veil — poster shows faintly behind */
    color: #E5231E;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    z-index: 3;
}

.lb-loading.done { display: none; }   /* hidden once the video can play */

.lb-spinner {
    width: 34px; height: 34px;
    border: 3px solid rgba(229, 35, 30, 0.25);
    border-top-color: #E5231E;
    border-radius: 50%;
    animation: lb-spin 0.8s linear infinite;
}

@keyframes lb-spin { to { transform: rotate(360deg); } }
