/*
 * Paper Theme — Continuous-Form Receipt / Paper-Strip Style (纸带 · 票据风格)
 *
 * Design Language:
 *  - Sawtooth perforated top & bottom ticket edges with colored zigzag accent strips
 *  - Continuous-form tractor-feed sprocket-hole side strips on article lists
 *  - Pinking-shear zigzag cut marks separating entries on one printed sheet
 *  - Warm archival paper & ink palette (light: cream cotton paper + vermilion;
 *    dark: warm drafting slate + terracotta ink)
 *  - Crisp straight corners, dashed perforation dividers, tactile stamp aesthetic
 */

html[data-theme="paper"] {
    --wb-radius-card: 0px;
    --wb-radius-control: 2px;
    --wb-radius-pill: 2px;
    --wb-radius-modal: 0px;
    --radius-sm: 2px;
    --radius-md: 2px;
    --radius-lg: 0px;
    --radius-xl: 0px;
}

.dark {
    --bg: #151311;
    --bg-rgb: 21, 19, 17;
    --bg-channels: 21 19 17;
    --card-bg: #1e1b17;
    --card-bg-channels: 30 27 23;
    --panel-bg: var(--card-bg);
    --input-bg: #27231e;
    --input-bg-channels: 39 35 30;
    --border: rgba(235, 224, 206, 0.14);
    --border-channels: 235 224 206;
    --border-alpha: 0.14;
    --border-hover: rgba(235, 224, 206, 0.28);
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 10px 24px -8px rgba(0, 0, 0, 0.5);
    --card-hover-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.62);
    --text-main: #f3ede2;
    --text-main-channels: 243 237 226;
    --fg: var(--text-main);
    --text-body: #c4baaa;
    --text-body-channels: 196 186 170;
    --text-meta: #8f8474;
    --text-meta-channels: 143 132 116;
    --text-muted: #8f8474;
    --accent: #ea580c;
    --accent-rgb: 234, 88, 12;
    --accent-channels: 234 88 12;
    --accent-dim: rgba(234, 88, 12, 0.16);
    --accent-foreground: #fff9f2;
    --accent-line: rgba(234, 88, 12, 0.32);
    --focus-shadow-color: rgba(234, 88, 12, 0.35);
    --card-hover: rgba(243, 237, 226, 0.03);
    --placeholder: rgba(243, 237, 226, 0.32);
    --glass-bg: rgba(30, 27, 23, 0.88);
    --glass-border: rgba(235, 224, 206, 0.14);
    --overlay-bg: rgba(16, 14, 12, 0.78);
    --inset-bg: #27231e;
    --inset-border: rgba(235, 224, 206, 0.16);
    --tag-bg: rgba(234, 88, 12, 0.12);
    --tag-bg-hover: rgba(234, 88, 12, 0.22);
    --tag-text: #fdba74;
    --tag-border: rgba(251, 146, 60, 0.28);
    --image-placeholder-base: #231f1b;
    --image-placeholder-sheen: rgba(234, 88, 12, 0.36);
    --image-placeholder-border: rgba(234, 88, 12, 0.72);
    --image-placeholder-stripe: rgba(234, 88, 12, 0.12);
    --hover-surface: rgba(243, 237, 226, 0.07);
    --wb-auth-error-text: #f87171;
    --wb-auth-success-text: #34d399;
}

.light {
    --bg: #f3ede1;
    --bg-rgb: 243, 237, 225;
    --bg-channels: 243 237 225;
    --card-bg: #fffdf7;
    --card-bg-channels: 255 253 247;
    --panel-bg: var(--card-bg);
    --input-bg: #f6f1e6;
    --input-bg-channels: 246 241 230;
    --border: rgba(54, 42, 28, 0.14);
    --border-channels: 54 42 28;
    --border-alpha: 0.14;
    --border-hover: rgba(54, 42, 28, 0.28);
    --card-shadow: 0 2px 6px rgba(54, 42, 28, 0.06), 0 8px 20px -6px rgba(54, 42, 28, 0.08);
    --card-hover-shadow: 0 12px 28px -6px rgba(54, 42, 28, 0.14);
    --text-main: #221c16;
    --text-main-channels: 34 28 22;
    --fg: var(--text-main);
    --text-body: #473e34;
    --text-body-channels: 71 62 52;
    --text-meta: #7b6f60;
    --text-meta-channels: 123 111 96;
    --text-muted: #7b6f60;
    --accent: #c2410c;
    --accent-rgb: 194, 65, 12;
    --accent-channels: 194 65 12;
    --accent-dim: rgba(194, 65, 12, 0.1);
    --accent-foreground: #fffdf7;
    --accent-line: rgba(194, 65, 12, 0.25);
    --focus-shadow-color: rgba(194, 65, 12, 0.28);
    --card-hover: rgba(54, 42, 28, 0.025);
    --hover-surface: rgba(54, 42, 28, 0.06);
    --placeholder: rgba(54, 42, 28, 0.38);
    --glass-bg: rgba(255, 253, 247, 0.9);
    --glass-border: rgba(54, 42, 28, 0.14);
    --overlay-bg: rgba(34, 28, 22, 0.52);
    --inset-bg: #f6f1e6;
    --inset-border: rgba(54, 42, 28, 0.16);
    --tag-bg: rgba(194, 65, 12, 0.08);
    --tag-bg-hover: rgba(194, 65, 12, 0.15);
    --tag-text: #9a3412;
    --tag-border: rgba(194, 65, 12, 0.24);
    --image-placeholder-base: #efe8da;
    --image-placeholder-sheen: rgba(194, 65, 12, 0.28);
    --image-placeholder-border: rgba(194, 65, 12, 0.65);
    --image-placeholder-stripe: rgba(194, 65, 12, 0.1);
    --wb-auth-error-text: #b91c1c;
    --wb-auth-success-text: #047857;
}

/* Subtle dot-grid paper sheet backdrop */
html[data-theme="paper"] body {
    background-image: radial-gradient(color-mix(in srgb, var(--text-meta) 20%, transparent) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ==========================================================================
   Receipt Sawtooth Perforation Edges (Paper-Strip Signature)
   ========================================================================== */
html[data-theme="paper"] .card,
html[data-theme="paper"] .zibll-sidebar-widget,
html[data-theme="paper"] .md-region-premium-card,
html[data-theme="paper"] .zibll-paid-card,
html[data-theme="paper"] .zibll-video-container,
html[data-theme="paper"] .wb-paper-feed,
html[data-theme="paper"] .wb-auth-modal-card {
    --wb-teeth-size: 24px;
    --wb-teeth-height: 12px;
    --wb-tooth-top: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 0 H24 L12 12 Z' fill='%23000'/%3E%3C/svg%3E");
    --wb-tooth-bottom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 12 H24 L12 0 Z' fill='%23000'/%3E%3C/svg%3E");
    --wb-zig-ribbon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 10 L6 2 L12 10 L18 2 L24 10' fill='none' stroke='%23000' stroke-width='3.5'/%3E%3C/svg%3E");
    border-radius: 0;
    -webkit-mask:
        var(--wb-tooth-top)
            top / var(--wb-teeth-size) var(--wb-teeth-height) repeat-x,
        var(--wb-tooth-bottom)
            bottom / var(--wb-teeth-size) var(--wb-teeth-height) repeat-x,
        linear-gradient(#000 0 0) padding-box;
    -webkit-mask-composite: destination-out;
    mask:
        var(--wb-tooth-top)
            top / var(--wb-teeth-size) var(--wb-teeth-height) repeat-x,
        var(--wb-tooth-bottom)
            bottom / var(--wb-teeth-size) var(--wb-teeth-height) repeat-x,
        linear-gradient(#000 0 0) padding-box;
    mask-composite: exclude;
}

/* Colored zigzag ticket stub along top & bottom edges */
html[data-theme="paper"] .card::before,
html[data-theme="paper"] .zibll-sidebar-widget::before,
html[data-theme="paper"] .wb-auth-modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--wb-teeth-height, 12px);
    background: var(--accent);
    opacity: 0.85;
    -webkit-mask: var(--wb-zig-ribbon)
        top / var(--wb-teeth-size, 24px) var(--wb-teeth-height, 12px) repeat-x;
    mask: var(--wb-zig-ribbon)
        top / var(--wb-teeth-size, 24px) var(--wb-teeth-height, 12px) repeat-x;
    pointer-events: none;
    z-index: 3;
}

html[data-theme="paper"] .card::after,
html[data-theme="paper"] .zibll-sidebar-widget::after,
html[data-theme="paper"] .wb-auth-modal-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--wb-teeth-height, 12px);
    background: var(--accent);
    opacity: 0.85;
    -webkit-mask: var(--wb-zig-ribbon)
        bottom / var(--wb-teeth-size, 24px) var(--wb-teeth-height, 12px) repeat-x;
    mask: var(--wb-zig-ribbon)
        bottom / var(--wb-teeth-size, 24px) var(--wb-teeth-height, 12px) repeat-x;
    pointer-events: none;
    z-index: 3;
}

/* ==========================================================================
   Continuous-Form Tractor-Feed Paper Sheet (.wb-paper-feed)
   ========================================================================== */
html[data-theme="paper"] .wb-paper-feed {
    --wb-feed-strip: 34px;
    --wb-feed-hole: 5px;
    --wb-feed-pitch: 28px;
    display: block;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    padding: 0.85rem 0;
}

html[data-theme="paper"] .wb-paper-feed::before,
html[data-theme="paper"] .wb-paper-feed::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--wb-feed-strip);
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle at 50% 50%,
            var(--bg) var(--wb-feed-hole),
            color-mix(in srgb, var(--text-meta) 38%, transparent) calc(var(--wb-feed-hole) + 1px),
            transparent calc(var(--wb-feed-hole) + 2px))
        center / var(--wb-feed-strip) var(--wb-feed-pitch) repeat-y;
}

html[data-theme="paper"] .wb-paper-feed::before {
    left: 0;
    border-right: 1px dashed var(--border-hover);
}

html[data-theme="paper"] .wb-paper-feed::after {
    right: 0;
    border-left: 1px dashed var(--border-hover);
}

html[data-theme="paper"] .wb-paper-feed .wb-paper-item {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    padding: 1.75rem calc(var(--wb-feed-strip) + 1.5rem);
    transition: background-color 0.2s ease;
}

html[data-theme="paper"] .wb-paper-feed .wb-paper-item:hover {
    background: var(--card-hover);
    box-shadow: none;
    transform: none;
}

/* Zigzag pinking-shear cut mark between items on the continuous sheet */
html[data-theme="paper"] .wb-paper-feed .wb-paper-item + .wb-paper-item::before {
    content: '';
    position: absolute;
    top: -5px;
    left: var(--wb-feed-strip);
    right: var(--wb-feed-strip);
    height: 10px;
    background: var(--text-meta);
    opacity: 0.5;
    pointer-events: none;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='10' viewBox='0 0 24 10'%3E%3Cpath d='M0 8 L6 2 L12 8 L18 2 L24 8' fill='none' stroke='%23000' stroke-width='2.5'/%3E%3C/svg%3E")
        0 50% / 24px 10px repeat-x;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='10' viewBox='0 0 24 10'%3E%3Cpath d='M0 8 L6 2 L12 8 L18 2 L24 8' fill='none' stroke='%23000' stroke-width='2.5'/%3E%3C/svg%3E")
        0 50% / 24px 10px repeat-x;
}

/* Dashed receipt dividers & stamp controls */
html[data-theme="paper"] header {
    border-bottom-style: dashed;
}

html[data-theme="paper"] footer {
    border-top-style: dashed;
}

html[data-theme="paper"] .zibll-widget-header {
    border-bottom-style: dashed;
}

html[data-theme="paper"] .post-list-cover {
    border-radius: 2px;
    border-style: dashed;
}

html[data-theme="paper"] .wb-auth-body {
    padding-top: 2.1rem;
    padding-bottom: 2rem;
}

@media (max-width: 640px) {
    html[data-theme="paper"] .wb-paper-feed {
        --wb-feed-strip: 24px;
        --wb-feed-hole: 4px;
        --wb-feed-pitch: 24px;
    }

    html[data-theme="paper"] .wb-paper-feed .wb-paper-item {
        padding: 1.25rem calc(var(--wb-feed-strip) + 0.875rem);
    }
}

.light .code-block-wrapper {
    background: #f6f1e6;
    border-color: rgba(54, 42, 28, 0.16);
}
.light .code-block-header {
    background: rgba(54, 42, 28, 0.05);
    border-bottom-color: rgba(54, 42, 28, 0.12);
}
.light .prose pre {
    color: #2b231b;
}
