/* ===========================================================
   悦悦官网 · 前台三板块
   背景 / 字体 / 文字颜色 / 公告栏 全部沿用原站 index.php 的风格
   背景模板由后台写入 body 的 class="bg-template-N"
   =========================================================== */

:root {
    /* 原站标题渐变（与老 index.php 一致） */
    --gradient-title: linear-gradient(135deg, #4e9f3d 0%, #3b82f6 50%, #ef4444 100%);
    --gradient-size: 200%;

    /* 面板透明度：原站 panel_opacity 0.11 → 内层 0.11 + 0.10 = 0.21 */
    --card-opacity: 0.21;
    --card-border-opacity: 0.25;

    --radius: 12px;
    --stage-h: 145%;   /* 大图高宽比：145% = 长方形竖图（100% 是正方形） */
    --ease: cubic-bezier(.22, .61, .36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg-body);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    font-family: 'Roboto Condensed', "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", system-ui, sans-serif;
    padding: 20px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

@keyframes gradientMove {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---------- 布局 ---------- */
.wrap {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    gap: 0;                            /* 间距改用 --sp-* 变量控制 */
    padding-top: var(--sp-top, 0px);   /* 整页顶部留白（后台可调） */
}

.wrap > * {
    animation: rise .55s var(--ease) both;
}
.wrap > *:nth-child(1) { animation-delay: .02s; }
.wrap > *:nth-child(2) { animation-delay: .08s; }
.wrap > *:nth-child(3) { animation-delay: .14s; }
.wrap > *:nth-child(4) { animation-delay: .20s; }

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- 板块一：标题（原站 h1 样式） ---------- */
.brand {
    text-align: center;
    margin-bottom: var(--sp-brand, 16px);   /* 标题 → 公告 */
}

.brand-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: var(--gradient-title);
    background-size: var(--gradient-size) var(--gradient-size);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: gradientMove 8s ease infinite;
    text-shadow: 0 0 3px rgba(78, 159, 61, .4);
    word-break: break-word;
    margin-bottom: var(--sp-notice, 16px);  /* 公告 → 大图 */
}

.title-line {
    width: 70px;
    height: 2px;
    margin: 8px auto 0;
    border-radius: 1px;
    background: var(--gradient-title);
    background-size: var(--gradient-size) var(--gradient-size);
    animation: gradientMove 8s ease infinite;
}

.brand-sub {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: .85;
}

/* ---------- 板块二：公告栏（原站 .desc 样式） ---------- */
.notice {
    background: rgba(255, 255, 255, var(--card-opacity));
    border: 1px solid rgba(255, 255, 255, var(--card-border-opacity));
    border-radius: var(--radius);
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: .5px;
    text-align: center;
    color: var(--text-primary);
    word-break: break-word;
}

/* ---------- 板块三：图片画布（正方形） ---------- */
.stage {
    display: block;
    width: var(--stage-w, 100%);   /* 大图宽度占比（后台可调） */
    margin: 0 auto;
}

.canvas {
    position: relative;
    display: block;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    background: rgba(255, 255, 255, var(--card-opacity));
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-card);
    container-type: inline-size;   /* 图层字号用 cqw，跟着画布宽度缩放 */
    transition: box-shadow .25s var(--ease), border-color .25s var(--ease);
    -webkit-user-drag: none;
}

/* 长方形画布：高度 = 宽度 × 145%（原来是 1:1 正方形） */
.canvas::before {
    content: "";
    display: block;
    padding-top: var(--stage-h, 145%);
}

.canvas-base {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    -webkit-user-drag: none;
    user-select: none;
}

/* 画布里的叠加图层 */
.layer {
    position: absolute;
    pointer-events: none;
    transform-origin: center center;
    -webkit-user-drag: none;
    user-select: none;
}

.layer-img img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: inherit;
    pointer-events: none;
    -webkit-user-drag: none;
}

.layer-text {
    text-align: center;
    line-height: 1.35;
    letter-spacing: .02em;
    white-space: pre-wrap;
    word-break: break-word;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

/* 有跳转时，鼠标反馈只改边框和阴影，不做缩放 */
a.canvas:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--text-arrow);
}

/* ---------- 页脚（原站 .footer 样式） ---------- */
.foot {
    text-align: center;
    margin-top: var(--sp-notice, 16px);
    font-size: 12px;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: .8;
}

@media (max-width: 420px) {
    .brand-title { font-size: 27px; letter-spacing: 1.2px; }
    .notice { padding: 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ---------------- 自定义背景图（后台上传） ---------------- */
body.has-bg-photo {
    background-image: var(--bg-photo);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.has-bg-photo::before {
    content: "";
    position: fixed;
    inset: 0;
    background: #101014;
    opacity: var(--bg-dim, 0);
    pointer-events: none;
    z-index: 0;
}

body.has-bg-photo .wrap {
    position: relative;
    z-index: 1;
}

/* 手机端 fixed 背景会卡，改成随页面滚 */
@media (max-width: 640px) {
    body.has-bg-photo {
        background-attachment: scroll;
    }

    /* 手机端：标题 + 公告一直顶到上面，图片占满屏宽 */
    body {
        padding: 0 8px 22px;       /* 原来是 20px 10px：顶部清零、左右各让 8px */
        align-items: flex-start;
    }

    .wrap {
        max-width: 100%;
        /* 后台的顶部留白照样生效，负数就是继续往上顶 */
        padding-top: var(--sp-top, 0px);
    }

    .brand {
        padding-top: 6px;          /* 只留一点点呼吸 */
        margin-bottom: calc(var(--sp-brand, 16px) * .6);
    }

    .notice {
        margin-bottom: calc(var(--sp-notice, 16px) * .55);
        padding: 13px 12px;
        font-size: 14px;
    }
}
