/* ═══════════════════════════════════════════════
   Article Editor — style.css
   BRIX Templates · Update Workflow
   ═══════════════════════════════════════════════ */

/* ── Design Tokens ── */

:root {
    /* Neutrals */
    --color-bg: #f7f7fc;
    --color-primary: #1a1a1a;
    --color-white: #ffffff;
    --color-gray-50: #fafbfc;
    --color-gray-100: #f8f9fa;
    --color-gray-200: #e8eaed;
    --color-gray-300: #d0d0d0;
    --color-gray-500: #999999;
    --color-gray-600: #666666;
    --color-gray-700: #333333;

    /* Accent */
    --color-accent: #7d5dff;
    --color-accent-dark: #6342ea;
    --color-accent-50: #faf9ff;
    --color-accent-100: #f5f3ff;
    --color-accent-200: #ede9fe;
    --color-accent-300: #f0eaff;
    --color-accent-text: #5b3cc4;
    --color-accent-underline: rgba(99, 66, 234, 0.3);
    --gradient-accent: linear-gradient(90deg, var(--color-accent), var(--color-accent-dark));

    /* Status — Danger */
    --color-danger: #c0392b;
    --color-danger-bg: #fce4e4;

    /* Status — Success */
    --color-success: #1e8449;
    --color-success-bg: #d5f5e3;
    --color-success-border: #a3e4bc;

    /* Code block (dark) */
    --color-code-bg: #1e1e2e;
    --color-code-border: #313244;
    --color-code-text: #cdd6f4;

    /* Typography */
    --font-primary: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Spacing */
    --padding-page: 40px;
    --padding-card: 28px;

    /* Borders & Shadows */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-pill: 20px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-top: 0 -2px 12px rgba(0, 0, 0, 0.04);

    /* Animation */
    --transition: all 0.15s ease;
}


/* ── Reset ── */

html { overflow-x: hidden; }
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-primary);
    background: var(--color-bg);
    color: var(--color-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


/* ── Layout: Header ── */

.top-bar {
    background: var(--color-white);
    padding: 20px 0;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 100;
}

.top-bar-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--padding-page);
    display: flex;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon { height: 40px; width: auto; }

.logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-divider {
    width: 1px;
    height: 32px;
    background: var(--color-gray-200);
}

.logo-subtext {
    font-size: 12px;
    color: var(--color-gray-600);
    font-weight: 500;
}


/* ── Layout: Content ── */

.content-area {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: var(--padding-page) var(--padding-page) 60px;
    width: 100%;
}


/* ── Layout: Footer ── */

footer {
    background: linear-gradient(135deg, var(--color-gray-100) 0%, var(--color-white) 100%);
    border-top: 1px solid var(--color-gray-200);
    padding: 24px var(--padding-page);
    text-align: center;
    color: var(--color-gray-600);
    font-size: 13px;
    box-shadow: var(--shadow-top);
}

footer a {
    text-decoration: none;
    font-weight: 600;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

footer a:hover {
    background: linear-gradient(90deg, var(--color-accent-dark), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-divider {
    opacity: 0.3;
    margin: 0 8px;
}

.footer-meta {
    opacity: 0.6;
}


/* ── Shared: Card Base ── */

.about-card,
.change-block,
.seo-diff,
.changelog {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}


/* ── Component: About Card ── */

.about-card {
    padding: 32px;
    margin-bottom: 40px;
}

.about-card h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    overflow-wrap: break-word;
}

.about-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.about-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-gray-600);
}

.about-meta-item i {
    color: var(--color-accent);
    font-size: 16px;
}

.about-summary {
    font-size: 14px;
    color: var(--color-gray-600);
    line-height: 1.7;
}


/* ── Component: Section Label ── */

.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--color-gray-500), var(--color-gray-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ── Component: Change Block ── */

.change-block {
    margin-bottom: 24px;
    overflow: hidden;
}

.change-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px var(--padding-card);
    border-bottom: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
}

.change-number,
.change-tag-new {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.change-number {
    background: var(--gradient-accent);
    color: var(--color-white);
}

.change-tag-new {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    color: var(--color-white);
}

.change-location {
    font-size: 15px;
    font-weight: 600;
    min-width: 0;
    overflow-wrap: break-word;
    flex: 1;
    order: -1;
}

.change-body {
    padding: 24px var(--padding-card);
}


/* ── Component: Change Checkbox (inside .change-header) ── */

.change-check {
    order: -2;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
}

.change-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.change-check-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-gray-300);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: transparent;
    font-size: 13px;
    background: var(--color-white);
}

.change-check:hover .change-check-box {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(125, 93, 255, 0.1);
}

.change-checkbox:checked + .change-check-box {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-white);
}

.change-block:has(.change-checkbox:checked) {
    border-color: rgba(125, 93, 255, 0.3);
    box-shadow: 0 0 0 1px rgba(125, 93, 255, 0.15), var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}


/* ── Component: Text Card ── */

.text-card {
    position: relative;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-sm);
    padding: 28px 24px 20px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-gray-700);
    overflow-wrap: break-word;
}

.text-card:has(.badge-old)::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-sm);
    z-index: 1;
    pointer-events: none;
}

.text-card:has(.badge-old) .card-top-bar { z-index: 2; }
.text-card:last-of-type { margin-bottom: 0; }


/* ── Component: Badge ── */

.card-top-bar {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.badge-old { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-new { background: var(--color-success-bg); color: var(--color-success); }


/* ── Component: Copy Button ── */

.btn-copy-md {
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--color-gray-200);
    background: var(--color-white);
    color: var(--color-gray-600);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    line-height: 1;
}

.btn-copy-md:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-300);
    color: var(--color-primary);
}

.btn-copy-md:active { transform: scale(0.96); }

.btn-copy-md.copied {
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
    color: var(--color-success);
}

.btn-copy-md i { font-size: 11px; }


/* ── Component: Copy Updates Button (top bar) ── */

.btn-copy-updates {
    margin-left: auto;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    border: none;
    background: var(--gradient-accent);
    color: var(--color-white);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(-4px) scale(0.95);
    pointer-events: none;
    white-space: nowrap;
}

.btn-copy-updates.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.btn-copy-updates:hover {
    box-shadow: 0 4px 16px rgba(125, 93, 255, 0.35);
    transform: translateY(-1px) scale(1);
}

.btn-copy-updates:active {
    transform: scale(0.97);
}

.btn-copy-updates.copied {
    background: linear-gradient(90deg, var(--color-success), #27ae60);
}

.btn-copy-updates i {
    font-size: 15px;
}

.copy-updates-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}


/* ── Rich Content (inside .text-card) ── */

.text-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 16px 0 10px;
    letter-spacing: -0.01em;
}

.text-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 14px 0 8px;
}

.text-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 12px 0 6px;
}

.text-card h2:first-child,
.text-card h3:first-child,
.text-card h4:first-child { margin-top: 0; }

.text-card p { margin-bottom: 12px; }
.text-card p:last-child { margin-bottom: 0; }

.text-card strong { font-weight: 600; color: var(--color-primary); }

.text-card a {
    color: var(--color-accent-dark);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--color-accent-underline);
    transition: var(--transition);
}

.text-card a:hover {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.text-card del,
.text-card s {
    text-decoration: line-through;
    color: var(--color-gray-500);
}

.text-card code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: var(--color-accent-100);
    color: var(--color-accent-text);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--color-accent-200);
}

.text-card pre {
    background: var(--color-code-bg);
    padding: 18px 22px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 14px 0;
    border: 1px solid var(--color-code-border);
}

.text-card pre code {
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--color-code-text);
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

.text-card ul {
    margin: 10px 0;
    padding-left: 22px;
    list-style-type: disc;
}

.text-card ul ul {
    margin: 4px 0;
    list-style-type: circle;
}

.text-card ol {
    margin: 10px 0;
    padding-left: 22px;
}

.text-card li { margin-bottom: 6px; }
.text-card li:last-child { margin-bottom: 0; }

.text-card blockquote {
    border: 1px solid var(--color-accent-200);
    background: var(--color-accent-50);
    padding: 16px 20px;
    margin: 14px 0;
    border-radius: var(--radius-sm);
    color: var(--color-gray-600);
}

.text-card blockquote p { margin-bottom: 0; }

.text-card img {
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--color-gray-200);
    margin: 14px 0;
    display: block;
}


/* ── Component: Image Placeholder ── */

.image-placeholder {
    position: relative;
    background: var(--color-accent-50);
    border: 1px solid var(--color-accent-200);
    border-radius: var(--radius-sm);
    padding: 28px 24px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--color-accent-dark);
    margin: 14px 0;
}

.ph-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    background: var(--gradient-accent);
    color: var(--color-white);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.ph-badge i { font-size: 11px; }

.ph-desc {
    max-width: min(360px, 100%);
    margin: 0 auto;
}

.ph-circle {
    width: 36px;
    height: 36px;
    background: var(--color-accent-200);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--color-accent);
    font-size: 16px;
}


/* ── Component: Reasoning ── */

.reasoning {
    background: var(--color-gray-50);
    border-top: 1px solid var(--color-gray-200);
    padding: 16px var(--padding-card);
    font-size: 13px;
    color: var(--color-gray-600);
    line-height: 1.7;
    overflow-wrap: break-word;
}

.reasoning strong {
    color: var(--color-primary);
    font-weight: 600;
}

.reasoning-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.reasoning-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-accent-dark);
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 5px;
    transition: var(--transition);
}

.reasoning-source:hover {
    background: var(--color-accent-300);
    color: var(--color-accent);
}

.reasoning-source i { font-size: 13px; }


/* ── Component: SEO Diff (inline diff style) ── */

.seo-diff {
    padding: var(--padding-card);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 24px;
}

.seo-diff-row {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--color-gray-200);
}

.seo-diff-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.seo-diff-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-accent);
    margin-bottom: 6px;
}

.seo-diff-del {
    text-decoration: line-through;
    color: var(--color-danger);
    background: var(--color-danger-bg);
    padding: 1px 4px;
    border-radius: 3px;
}

.seo-diff-ins {
    color: var(--color-success);
    background: var(--color-success-bg);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}


/* ── Component: Changelog (minimal rule + tag) ── */

.changelog {
    padding: var(--padding-card);
    margin-bottom: 24px;
}

.changelog-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.changelog-date {
    font-size: 13px;
    font-weight: 700;
}

.changelog-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--color-success-bg);
    color: var(--color-success);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.changelog-text {
    font-size: 13px;
    color: var(--color-gray-600);
    line-height: 1.7;
}


/* ── Responsive: Tablet (≤1024px) ── */

@media (max-width: 1024px) {
    :root {
        --padding-page: 24px;
        --padding-card: 24px;
    }
    .about-card { padding: 28px; }
    .logo-subtext,
    .logo-divider { display: none; }
    .btn-copy-updates { font-size: 12px; padding: 7px 14px; }
}


/* ── Responsive: Mobile (≤480px) ── */

@media (max-width: 480px) {
    :root {
        --padding-page: 16px;
        --padding-card: 16px;
    }

    .top-bar { padding: 14px 0; }
    .logo-icon { height: 32px; }
    .logo { font-size: 18px; }
    .logo-section { gap: 12px; }

    .content-area { padding: 20px var(--padding-page) 32px; }

    .about-card { padding: 20px; }
    .about-card h1 { font-size: 22px; }
    .about-meta { flex-direction: column; gap: 8px; }

    .change-header { gap: 10px; }
    .change-location { font-size: 14px; }

    .text-card { padding: 24px 16px 16px; font-size: 13px; }
    .text-card pre { padding: 14px 16px; }
    .text-card code { font-size: 12px; }
    .text-card pre code { font-size: 12px; }

    .image-placeholder { padding: 24px 16px 16px; }

    .reasoning-source { padding: 4px 10px; }

    .change-check-box { width: 18px; height: 18px; font-size: 11px; border-width: 1.5px; }
    .btn-copy-updates { font-size: 11px; padding: 6px 12px; gap: 6px; }
    .copy-updates-count { font-size: 10px; padding: 1px 6px; }

    footer { font-size: 12px; }
}
