/*
 * Pebblous Blog - Common Styles
 * Shared CSS for all blog pages
 */

/* ========================================
   Theme System - CSS Variables
   ======================================== */
:root {
    /* Dark Theme (default) */
    --bg-primary: #111827;
    --bg-secondary: #1F2937;
    --bg-card: rgba(31, 41, 55, 0.95);
    --text-primary: #F9FAFB;
    --text-secondary: #E5E7EB;
    --text-muted: #9CA3AF;
    --heading-color: #FFFFFF;
    --accent-color: #F86825;
    --teal-color: #14b8a6;
    --border-color: #374151;
    --logo-placeholder-bg: #1e293b;
    --logo-placeholder-border: transparent;
}

[data-theme="light"] {
    --bg-primary: #F9FAFB;
    --bg-secondary: #F3F4F6;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --heading-color: #111827;
    --accent-color: #F86825;
    --teal-color: #0d9488;
    --border-color: #E5E7EB;
    --logo-placeholder-bg: #f5f5f5;
    --logo-placeholder-border: #E5E7EB;
}

[data-theme="beige"] {
    --bg-primary: #F5EED9;
    --bg-secondary: #FFF3D9;
    --bg-card: rgba(255, 252, 245, 0.6);
    --text-primary: #3A2E1C;
    --text-secondary: #574523;
    --text-muted: #78716c;
    --heading-color: #3A2E1C;
    --accent-color: #F86825;
    --teal-color: #0d9488;
    --border-color: #E8D9B8;
    --logo-placeholder-bg: #FFF8E1;
    --logo-placeholder-border: #E8D9B8;
}

/* ========================================
   Base Styles
   ======================================== */
body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    scroll-behavior: smooth;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
}

/* Hero/Main Title - 섹션 제목(h2)보다 확실히 크게 */
main h1,
.hero-title {
    font-size: 2.25rem;      /* text-4xl */
    line-height: 1.3;
    font-weight: 800;        /* extrabold */
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    main h1,
    .hero-title {
        font-size: 3rem;     /* text-5xl */
    }
}

a {
    transition: color 0.2s ease-in-out;
}

/* ========================================
   Themeable Utility Classes
   ======================================== */
.themeable-card {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.themeable-heading {
    color: var(--heading-color);
}

.themeable-accent,
.accent-text {
    color: var(--accent-color);
}

.teal-text {
    color: var(--teal-color);
}

.themeable-accent-border {
    border-color: var(--accent-color);
}

.themeable-accent-bg {
    background-color: var(--accent-color);
}

/* ========================================
   Related Posts - Logo Placeholder
   ======================================== */
.default-logo {
    width: 37.5%;
    height: auto;
    object-fit: contain !important;
    max-width: 100%;
}

.logo-placeholder {
    background-color: var(--logo-placeholder-bg);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.card:hover .logo-placeholder {
    transform: scale(1.02);
}

.themeable-text {
    color: var(--text-primary);
}

.themeable-text-secondary {
    color: var(--text-secondary);
}

.themeable-text-muted {
    color: var(--text-muted);
}

.themeable-subtitle {
    color: var(--text-muted);
}

.themeable-border {
    border-color: var(--border-color);
}

.themeable-toc-border {
    border-color: var(--border-color);
}

.themeable-toc-link {
    color: var(--text-muted);
    border-color: transparent;
}

.themeable-toc-link:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.themeable-toc-link-active {
    color: var(--accent-color);
    border-color: var(--accent-color) !important;
    font-weight: 500;
}

/* ========================================
   Animation - Fade In Card
   ======================================== */
.fade-in-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   Footer Styles
   ======================================== */
.pebblous-footer {
    background-color: #0f172a;
    color: #94a3b8;
    position: relative;
    padding-top: 2rem;
}

/* Short horizontal bar at the top */
.pebblous-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #F86825 20%, #F86825 80%, transparent);
    opacity: 0.4;
    z-index: 1;
}

.footer-border {
    border-top: none;
}

.footer-heading {
    color: var(--heading-color);
}

.footer-text {
    color: var(--text-muted);
}

.footer-link {
    color: var(--text-muted);
    transition: all 0.3s ease;
    text-decoration: none !important;
    border-bottom: none !important;
    position: relative;
    display: inline-block;
    padding-bottom: 3px;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: var(--accent-color) !important;
}

.footer-link:hover::after {
    width: 100%;
}

.footer-divider {
    border-top: 1px solid var(--border-color);
}

.footer-social-icon {
    color: var(--text-muted);
    transition: color 0.2s;
}

.footer-social-icon:hover {
    color: var(--accent-color);
}

/* ========================================
   Buttons
   ======================================== */
.link-item {
    transition: color 0.2s ease-in-out;
}

.hover-accent:hover {
    color: var(--accent-color) !important;
}

/* Scroll to Top Button */
#scrollTopBtn {
    background-color: var(--accent-color);
    color: var(--bg-card);
    transition: opacity 0.3s;
}

/* ========================================
   Table Styles
   ======================================== */
.themeable-table-header-row {
    background-color: var(--bg-secondary);
}

main table th,
main table td {
    border-color: var(--border-color);
    padding: 1rem;
}

main table thead,
main table tbody tr {
    border-color: var(--border-color);
}

main table tbody tr {
    transition: background-color 0.2s ease;
}

main table tbody tr:hover {
    background-color: rgba(248, 104, 37, 0.05);
}

/* ========================================
   TOC Styles
   ======================================== */
/* Mobile TOC */
#mobile-toc-toggle {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 40;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#mobile-toc-menu {
    position: fixed;
    bottom: 140px;
    right: 20px;
    max-width: 280px;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 40;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: none;
}

#mobile-toc-menu.show {
    display: block;
}

/* TOC Number Hover Effect */
.themeable-toc-link:hover .toc-number {
    color: var(--accent-color);
}

/* ========================================
   Section Spacing
   ======================================== */
main section {
    margin-bottom: 4rem;
}

main h2 {
    font-size: 1.75rem;
    line-height: 2.25rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 2rem;
    padding-top: 1rem;
    padding-bottom: 0.75rem;
    border-bottom-width: 2px;
    border-color: var(--border-color);
}

main h3 {
    font-size: 1.35rem;
    line-height: 1.875rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: var(--heading-color);
}

main p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 1rem;
}

main ul {
    list-style-type: disc;
    list-style-position: outside;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

main ol {
    list-style-type: decimal;
    list-style-position: outside;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

main li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    padding-left: 0.5rem;
}

main li ul,
main li ol {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

main strong {
    font-weight: 700;
    color: var(--heading-color);
}

/* ========================================
   Header Placeholder - CLS Prevention
   ======================================== */
#header-placeholder {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 64px; /* Prevent layout shift when header loads */
}

@media (min-width: 768px) {
    #header-placeholder {
        min-height: 72px;
    }
}

/* ========================================
   Sticky Header
   ======================================== */
#sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background-color: var(--bg-primary);
    border-color: var(--border-color);
    transition: all 0.3s ease;
}

/* ========================================
   Theme Switcher
   ======================================== */
#theme-switcher {
    border-color: var(--border-color);
}

#theme-switcher button {
    color: var(--text-muted);
    background-color: transparent;
    transition: all 0.2s ease;
}

#theme-switcher button.active {
    color: var(--bg-primary);
    background-color: var(--text-muted);
}

/* ========================================
   Card Decoration Styles
   ======================================== */
/* PDF Download Card with Animated Gradient */
.pdf-download-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border: 2px solid var(--border-color);
    position: relative;
    overflow: visible;
}

.pdf-download-card::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(248, 104, 37, 0.08) 0%, transparent 60%);
    animation: pulse 3s ease-in-out infinite;
    z-index: 0;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(50%, -50%) scale(1.1);
        opacity: 0.3;
    }
}

/* Statistics Card with Gradient Border */
.stat-card {
    position: relative;
    overflow: visible;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-color), var(--teal-color));
    border-radius: 2px 0 0 2px;
}

/* Number Badge - Square Bold Design for Section Numbers */
.number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    background: linear-gradient(135deg, #F86825, #FF8C42);
    color: white;
    font-weight: 900;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(248, 104, 37, 0.3), 0 2px 4px -1px rgba(248, 104, 37, 0.2);
    transition: all 0.3s ease;
    margin-top: 0.75rem;
}

.number-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 15px -3px rgba(248, 104, 37, 0.4), 0 4px 6px -2px rgba(248, 104, 37, 0.3);
}
