/* ============================================================
   layout.css — 容器、标题区、主布局网格、边栏
   梦初雪 (Yume Hatsuyuki) 角色档案卷轴
   ============================================================ */

/* ── 魔典主容器 ──────────────────────────────────────────── */
.grimoire-container {
    max-width: 1200px;
    margin: 0 auto;
    background:
        linear-gradient(135deg,
            var(--parchment-old) 0%,
            var(--parchment-stained) 25%,
            var(--parchment-dark) 50%,
            var(--parchment-stained) 75%,
            var(--parchment-old) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 23px,
            rgba(92, 64, 51, 0.1) 23px,
            rgba(92, 64, 51, 0.1) 24px
        );

    border: 8px double var(--ink-iron);
    border-radius: 2px;
    position: relative;
    padding: clamp(1rem, 3vw, 3rem);
    box-shadow:
        0 4px 20px var(--shadow-heavy),
        0 8px 40px var(--shadow-heavy),
        inset 0 0 50px rgba(212, 196, 160, 0.3);

    clip-path: polygon(
        0 20px, 20px 0,
        calc(100% - 20px) 0, 100% 20px,
        100% calc(100% - 20px), calc(100% - 20px) 100%,
        20px 100%, 0 calc(100% - 20px)
    );
}

/* 卷轴钉装饰 */
.grimoire-container::before,
.grimoire-container::after {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--ink-iron) 30%, var(--parchment-burnt) 100%);
    border: 3px solid var(--ink-gold);
    border-radius: 50%;
    z-index: 2;
}

.grimoire-container::before {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.grimoire-container::after {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

/* ── 标题区域 ─────────────────────────────────────────────── */
.tome-header {
    text-align: center;
    margin-bottom: clamp(2rem, 5vw, 4rem);
    padding: clamp(1rem, 3vw, 2rem);
    position: relative;
    border-bottom: 3px double var(--ink-iron);
}

.tome-header::before,
.tome-header::after {
    content: "❖";
    position: absolute;
    bottom: -15px;
    font-size: 1.5rem;
    color: var(--ink-gold);
    background: var(--parchment-old);
    padding: 0 10px;
}

.tome-header::before { left: 20%; }
.tome-header::after  { right: 20%; }

.main-title {
    font-family: var(--font-illuminated);
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: var(--ink-iron);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    text-shadow:
        2px 2px 0 var(--parchment-dark),
        4px 4px 0 var(--shadow-light);
    line-height: 1.2;
    font-weight: 900;
}

.character-tagline {
    font-family: 'New Tegomin', 'STZhongsong', '华文中宋', var(--font-header);
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--ink-blood);
    font-style: italic;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    display: inline-block;
    padding: 0.3rem 1rem;
    background: rgba(139, 0, 0, 0.1);
    border-left: 3px solid var(--ink-blood);
    border-right: 3px solid var(--ink-blood);
    font-weight: 700;
}

/* ── 角色诗区域 ───────────────────────────────────────────── */
.persona-poem {
    max-width: 800px;
    margin: 2rem auto 3rem;
    padding: clamp(1.5rem, 4vw, 3rem);
    background:
        linear-gradient(135deg,
            rgba(240, 230, 210, 0.9) 0%,
            rgba(232, 216, 182, 0.9) 100%),
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,50 Q25,40 50,50 T100,50' stroke='rgba(92,64,51,0.1)' fill='none' stroke-width='1'/%3E%3C/svg%3E");
    border: 2px solid var(--ink-sepia);
    border-radius: 1px;
    position: relative;
    transform: rotate(-0.3deg);
    box-shadow:
        0 4px 15px var(--shadow-light),
        inset 0 0 20px rgba(212, 196, 160, 0.4);
}

.persona-poem::before {
    content: "角色诗";
    position: absolute;
    top: -12px;
    left: 20px;
    font-family: 'New Tegomin', 'STKaiti', 'KaiTi', var(--font-illuminated);
    font-size: 1.2rem;
    color: var(--ink-gold);
    background: var(--parchment-old);
    padding: 0 10px;
    letter-spacing: 1px;
    font-weight: 700;
}

.persona-poem::after {
    content: "✒";
    position: absolute;
    bottom: -15px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--ink-sepia);
    transform: rotate(15deg);
}

.poem-verse {
    font-family: var(--font-script);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--ink-sepia);
    margin: 1rem 0;
    line-height: 1.8;
    text-align: center;
    padding: 0.5rem;
    border-bottom: 1px dashed rgba(92, 64, 51, 0.2);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.poem-verse:last-child { border-bottom: none; }

/* ── 主内容网格 ───────────────────────────────────────────── */
.grimoire-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 3rem;
}

@media (min-width: 1024px) {
    .grimoire-layout {
        grid-template-columns: 1fr 2fr;
    }
}

/* ── 边栏 ─────────────────────────────────────────────────── */
.profile-sidebar {
    position: relative;
    padding: 1.5rem;
    background:
        linear-gradient(135deg,
            var(--parchment-old) 0%,
            var(--parchment-stained) 100%);
    border: 3px solid var(--ink-iron);
    border-radius: 2px;
    box-shadow:
        inset 0 0 20px rgba(212, 196, 160, 0.5),
        0 4px 12px var(--shadow-light);
}

.profile-sidebar::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 1px solid rgba(92, 64, 51, 0.2);
    pointer-events: none;
}

/* ── 主要内容区域 ─────────────────────────────────────────── */
.profile-content {
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

/* ── 区块标题 ─────────────────────────────────────────────── */
.section-title {
    font-family: var(--font-header);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--ink-iron);
    position: relative;
    letter-spacing: 1px;
    font-weight: 700;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, var(--ink-iron), transparent);
}

/* 各区块标题颜色 */
#morphology-title   { color: var(--ink-iron); }
#appearance-title   { color: var(--ink-iron); }
#basic-info-title   { color: var(--ink-iron); }

#root-definition-title {
    color: var(--ink-blood);
    border-bottom-color: var(--ink-blood);
}
#root-definition-title::after {
    background: linear-gradient(90deg, var(--ink-blood), transparent);
}

#core-power-title {
    color: var(--ink-gold);
    border-bottom-color: var(--ink-gold);
}
#core-power-title::after {
    background: linear-gradient(90deg, var(--ink-gold), transparent);
}

#base-ability-title {
    color: var(--ink-royal-purple);
    border-bottom-color: var(--ink-royal-purple);
}
#base-ability-title::after {
    background: linear-gradient(90deg, var(--ink-royal-purple), transparent);
}

/* ── 边界装饰符文 ─────────────────────────────────────────── */
.marginalia {
    position: absolute;
    font-family: var(--font-illuminated);
    color: var(--ink-gold);
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

.marginalia.top-left     { top: 10px;    left: 10px;    transform: rotate(-15deg); }
.marginalia.top-right    { top: 10px;    right: 10px;   transform: rotate(15deg); }
.marginalia.bottom-left  { bottom: 10px; left: 10px;    transform: rotate(15deg); }
.marginalia.bottom-right { bottom: 10px; right: 10px;   transform: rotate(-15deg); }
