/* =========================
   Base + Layout
   ========================= */
:root {
    --page-radius: 14px;
    --gap: 16px;
    --max-width: 1600px;

    --crease-w: clamp(44px, 2.6vw, 76px);

    --op-multiply: .85;
    --op-burn: .15;
    --op-hi-a: .22;
    --op-hi-b: .18;

    --crease-top-offset: 0px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: #000;
    color: #fff;
    font-family: "Avenir Next", "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* 布局：上方编辑器，下方 Preview 条，Gallery 另有全屏页面 */
.frame {
    grid-template-rows: 56px minmax(0, 1fr) auto 44px;
    min-height: 100dvh;
    max-width: var(--max-width);
    margin-inline: auto;
    display: grid;
    grid-template-columns: 220px 1fr 320px;
    grid-template-rows: 56px minmax(0, 1fr) auto 44px;
    grid-template-areas:
        "nav nav nav"
        "left spread info"
        "bottom bottom bottom"
        "footer footer footer";
    gap: var(--gap);
    padding: 8px var(--gap);
}

/* =========================
   Navbar
   ========================= */
.navbar {
    grid-area: nav;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.brand {
    justify-self: start;
    font-weight: 600;
    letter-spacing: .02em;
}

.center-nav {
    justify-self: center;
    display: flex;
    gap: 24px;
}

.center-nav a {
    color: #cfcfcf;
    text-decoration: none;
    font-size: 13px;
}

.center-nav a:hover {
    color: #fff;
}

.publish {
    justify-self: end;
    color: #cfcfcf;
    text-decoration: none;
    font-size: 13px;
}

.publish:hover {
    color: #fff;
}

/* =========================
   Left controls
   ========================= */
.left {
    grid-area: left;
    display: grid;
    align-content: start;
    gap: 10px;
}

.control-label {
    font-size: 12px;
    color: #cfcfcf;
}

.slider {
    width: 100%;
    appearance: none;
    background: #222;
    height: 2px;
    border-radius: 2px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #000;
}

/* Layout buttons */
.layout-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.layout-btn {
    flex: 1;
    height: 26px;
    border-radius: 999px;
    border: 1px solid #333;
    background: #111;
    color: #f2f2f2;
    font-size: 11px;
    cursor: pointer;
    padding-inline: 8px;
}

.layout-btn:hover {
    background: #1b1b1b;
}

.layout-btn.active {
    background: #f2f2f2;
    color: #000;
    border-color: #f2f2f2;
}

.actions {
    display: grid;
    gap: 8px;
    margin-top: 4px;
}

.actions button {
    height: 32px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #121212;
    color: #f2f2f2;
    cursor: pointer;
}

.actions button:hover {
    background: #1a1a1a;
}

/* =========================
   Spread
   ========================= */
/* /* Book spread （白色跨页） */
.spread {
    grid-area: spread;
    position: relative;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    isolation: isolate;

    padding: 0;
    /* 关键 */
}

/* 画布容器：必须完全盖住 spread */
#canvasHost {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    /* 关键：让它盖住整个 grid 区域 */
    grid-column: 1 / -1 !important;
    grid-row: 1 / -1 !important;

    margin: 0;
    padding: 0;
}


/* 画布本身填满容器 */
#canvasHost>canvas,
.canvas-host>canvas {
    width: 100%;
    height: 100%;
    display: block;
}


/* 折痕层 */
.crease {
    position: absolute;
    inset: 0;
    pointer-events: none;
    margin: 0 auto;
    width: var(--crease-w);
    background-repeat: no-repeat;
    background-position: center top;
    background-size: var(--crease-w) 100%;
    filter: blur(0.25px);
}

.crease.layer-one {
    z-index: 105;
    mix-blend-mode: multiply;
    opacity: var(--op-multiply);
    background-color: #fff;
}

.crease.layer-two {
    z-index: 100;
    mix-blend-mode: color-burn;
    opacity: var(--op-burn);
    background-color: #fff;
}

.crease.layer-three {
    z-index: 103;
    opacity: var(--op-hi-a);
    background-color: #000;
    mix-blend-mode: screen;
}

@supports (mix-blend-mode: plus-lighter) {
    .crease.layer-three {
        mix-blend-mode: plus-lighter;
    }
}

.crease.layer-four {
    z-index: 102;
    opacity: var(--op-hi-b);
    background-color: #000;
    mix-blend-mode: screen;
}

@supports (mix-blend-mode: color-dodge) {
    .crease.layer-four {
        mix-blend-mode: color-dodge;
    }
}

.crease-preload {
    position: absolute;
    visibility: hidden !important;
    z-index: -99;
}

/* =========================
   Info panel
   ========================= */
.info {
    grid-area: info;
    color: #e6e6e6;
    align-self: start;
}

/* Title / Date 输入样式 */
.title-input {
    width: 100%;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    padding: 0;
    outline: none;
}

.date-input {
    width: 100%;
    border: none;
    background: transparent;
    color: #aaaaaa;
    font-size: 12px;
    margin-bottom: 10px;
    padding: 0;
    outline: none;
}

/* 文本输入框：驱动画布上的文字 */
.desc-input {
    width: 100%;
    min-height: 160px;
    margin-top: 4px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #333;
    background: #050505;
    color: #f5f5f5;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.desc-input:focus {
    border-color: #888;
}

/* =========================
   Bottom strip: Preview
   ========================= */
.bottom-strip {
    grid-area: bottom;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-top: 4px;
    border-top: 1px solid #1e1e1e;
}

.preview-block {
    flex: 1;
    min-width: 0;
}

.panel-title {
    margin: 0 0 4px 0;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #bbbbbb;
}

/* 一排相册式缩略图，横向滚动 */
.thumb-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.thumb {
    flex: 0 0 72px;
    height: 96px;
    object-fit: cover;
    border-radius: 6px;
    background: #222;
    box-shadow: 0 0 0 1px #222;
}

/* =========================
   Footer
   ========================= */
.footer {
    grid-area: footer;
    align-self: end;
    color: #a8a8a8;
    font-size: 12px;
}

/* =========================
   Gallery full-page view
   ========================= */
.gallery-page {
    position: fixed;
    inset: 0;
    background: #000;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    z-index: 999;
}

.gallery-page.hidden {
    display: none;
}

.gallery-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gallery-brand {
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-size: 13px;
}

.back-btn {
    border-radius: 999px;
    border: 1px solid #444;
    background: #111;
    color: #f2f2f2;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
}

.back-btn:hover {
    background: #1a1a1a;
}

.gallery-page-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    overflow: auto;
}

/* 每一个“folder”卡片 */
.gallery-item {
    background: #080808;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid #202020;
}

.gallery-item-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    object-fit: cover;
    background: #222;
}

.gallery-item-meta {
    font-size: 11px;
    color: #bbbbbb;
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1200px) {
    .frame {
        grid-template-columns: 200px 1fr;
        grid-template-rows: 56px auto auto auto 44px;
        grid-template-areas:
            "nav nav"
            "left spread"
            "info info"
            "bottom bottom"
            "footer footer";
    }

    .center-nav {
        gap: 16px;
    }
}

@media (max-width: 980px) {
    .frame {
        grid-template-columns: 1fr;
        grid-template-rows: 56px auto auto auto auto 44px;
        grid-template-areas:
            "nav"
            "spread"
            "info"
            "bottom"
            "left"
            "footer";
    }

    .center-nav {
        display: none;
    }

    .left {
        margin-top: var(--gap);
        grid-template-columns: 1fr 1fr;
    }

    .left .actions {
        grid-column: 1 / -1;
    }
}

/* crease */
/*
.crease{
  position:absolute; inset:0; pointer-events:none; margin:0 auto;
  width:75px;
  background-repeat:repeat-y;
  background-position:center;
  background-size:75px 1000px;
  filter:none;
}
.crease.layer-one{ z-index:105; mix-blend-mode:multiply; opacity:.85; background-color:#fff; }
.crease.layer-two{ z-index:100; mix-blend-mode:color-burn; opacity:.185; background-color:#fff; }
.crease.layer-three{ z-index:103; mix-blend-mode:plus-lighter; opacity:.25; background-color:#000; }
.crease.layer-four{ z-index:102; mix-blend-mode:color-dodge; opacity:.2; background-color:#000; }
*/
