/* SEDG Main Styles */
/* Core tokens for the light editorial portfolio theme. */

:root {
    /*
     * Editorial light theme.
     * `--color-black` is kept as a compatibility alias because the legacy
     * component styles use it as their page background token.
     */
    --color-bg: #f2f1ec;
    --color-surface: #ffffff;
    --color-surface-muted: #e7e8e4;
    --color-ink: #1c2225;
    --color-muted: #626b6f;
    --color-border: rgba(28, 34, 37, 0.16);
    --color-black: var(--color-bg);
    --color-white: #ffffff;
    --color-signature: #e94a29;
    --color-accent: #e94a29;
    --color-gray: #4d565a;
    --color-gray-light: #747d81;
    /* 스크롤 막대 - 배경에 묻히지 않을 만큼만 옅은 회색 */
    --color-scrollbar: #9aa09d;
    
    /* Typography */
    --font-primary: Pretendard, 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', Arial, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 4rem;
    
    /* Breakpoints */
    --mobile: 768px;
    --tablet: 1024px;
    --desktop: 1440px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-smooth: 0.35s cubic-bezier(0.22, 1, 0.36, 1);

    /* Shape and elevation */
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --shadow-soft: 0 18px 55px rgba(28, 34, 37, 0.09);
    --shadow-lifted: 0 28px 80px rgba(28, 34, 37, 0.14);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    scroll-padding-top: 92px;
}

body {
    font-family: var(--font-primary);
    font-weight: var(--font-weight-normal);
    line-height: 1.6;
    color: var(--color-ink);
    background-color: var(--color-bg);
    overflow-x: hidden;
    position: relative;
}

/* Modal/Popup Background Blur Effect */
body.modal-open {
    overflow: hidden !important;
    /* Remove position fixed to prevent scroll jumping */
}

/* 모달이 열려 있을 때 배경만 흐리게 한다.
   body 직속으로 동적으로 붙는 오버레이/토스트는 흐림 대상에서 제외해야 한다.
   (제외 목록이 빠져 있어서 JS가 인라인 filter:none을 덕지덕지 주입하던 문제를 CSS로 정리) */
body.modal-open > *:not(.popup-overlay):not(.project-creation-modal):not(.ai-loading-animation):not(.lightbox-save-notification):not(.admin-message):not(.category-selection-popup):not(.loading-animation-container):not(#sedg-init-error) {
    filter: blur(5px);
    transition: filter var(--transition-normal);
}

/* Ensure save notification is never blurred */
.lightbox-save-notification {
    filter: none !important;
}

/* Footer Styles */
#main-footer {
    background: var(--color-black);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-xl) 0 var(--spacing-lg);
    margin-top: var(--spacing-xxl);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.footer-section h3 {
    color: var(--color-signature);
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-sm);
}

.footer-section h4 {
    color: var(--color-white);
    font-size: 1.125rem;
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: var(--spacing-xs);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-lg);
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    margin: 0;
}

/* Footer Mobile Styles */
@media (max-width: 768px) {
    #main-footer {
        padding: var(--spacing-lg) 0;
        margin-top: var(--spacing-xl);
    }
    
    .footer-container {
        padding: 0 var(--spacing-md);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }
    
    .footer-section h3 {
        font-size: 1.25rem;
    }
    
    .footer-section h4 {
        font-size: 1rem;
    }
    
    .footer-section p {
        font-size: 0.85rem;
    }
    
    .footer-bottom {
        padding-top: var(--spacing-md);
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: clamp(2rem, 5vw, 4rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

p {
    margin-bottom: var(--spacing-sm);
    font-size: clamp(0.875rem, 2vw, 1rem);
}

/* Layout Containers */
#header-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* background-color: rgba(0, 0, 0, 0.95); */
    /* backdrop-filter: blur(10px); */
    transition: var(--transition-normal);
}

#gallery-group-container {
    position: relative;
    min-height: 100vh;
    z-index: 2;
}

#main-container {
    position: relative;
    background-color: var(--color-black);
    z-index: 3;
    padding-top: var(--spacing-xl);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.fade-out {
    opacity: 1;
    animation: fadeOut 0.3s ease forwards;
}

/* Buttons */
button {
    background: none;
    border: none;
    color: var(--color-white);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-fast);
}

button:hover {
    color: var(--color-signature);
}

button:focus {
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-signature) 76%, white);
    outline-offset: 3px;
}

::selection {
    color: #ffffff;
    background: var(--color-signature);
}

/* Input Fields */
input[type="text"],
input[type="password"],
textarea {
    border: 1px solid var(--color-white);
    color: var(--color-white);
    font-family: inherit;
    font-size: 1rem;
    border-radius: 4px;
    transition: var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-signature);
    box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.2);
}

/* Editable Elements */
[contenteditable="true"] {
    outline: 2px dashed var(--color-signature);
    outline-offset: 4px;
    padding: var(--spacing-xs);
    transition: var(--transition-fast);
}

[contenteditable="true"]:hover {
    background-color: rgba(255, 69, 0, 0.1);
}

.editable-active {
    background-color: rgba(255, 69, 0, 0.05);
}

/* Save Indicator */
.save-indicator {
    position: absolute;
    top: -30px;
    right: 0;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    z-index: 1000;
}

.save-indicator.success {
    background-color: var(--color-signature);
    color: var(--color-white);
}

.save-indicator.error {
    background-color: #ff0000;
    color: var(--color-white);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* 위/아래 화살표 버튼 숨김 */
::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-signature);
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-gray);
    border-top: 2px solid var(--color-signature);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --spacing-xs: 0.25rem;
        --spacing-sm: 0.5rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-xxl: 2.5rem;
    }
    
    body {
        font-size: 14px;
    }
}

/* Animations */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
