/* ========================================
   StemiTV Homepage Layout C
   區塊式佈局 - Section-based Layout
   ======================================== */

/* ===== CSS Custom Properties ===== */
:root {
    --layout-max-width: 1600px;
    --section-padding: 2rem;
    --card-radius: 12px;
    --card-shadow: 0 4px 16px rgba(30, 41, 59, 0.10);
    --card-shadow-hover: 0 8px 32px rgba(30, 41, 59, 0.18);
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Colors */
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-secondary: #14b8a6;
    --color-accent: #8b5cf6;
    --color-bg: #f8fafc;
    --color-bg-alt: #f1f5f9;
    --color-card: #ffffff;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
}

/* Dark mode variables */
[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-bg-alt: #1e293b;
    --color-card: #1e293b;
    --color-text: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-border: #334155;
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* 深色模式背景圖 */
[data-theme="dark"] body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: url('/Image/Katedral_Mesias_Sunset.jpg') no-repeat center center;
    background-size: cover;
    animation: backgroundZoomPan 60s ease-in-out infinite alternate;
    z-index: -1;
}

/* 確保容器透明以顯示背景 */
[data-theme="dark"] .homepage-container,
[data-theme="dark"] .body-content,
[data-theme="dark"] .container {
    background-color: transparent !important;
}

/* 淺色模式背景圖 */
body::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: url('/Image/Katedral_Mesias_Sunset.jpg') no-repeat center center;
    background-size: cover;
    animation: backgroundZoomPan 60s ease-in-out infinite alternate;
    z-index: -1;
}

/* 背景動畫 - 緩慢縮放平移效果 */
@keyframes backgroundZoomPan {
    0% {
        transform: scale(1) translate(0, 0);
    }

    50% {
        transform: scale(1.1) translate(-3%, -3%);
    }

    100% {
        transform: scale(1) translate(3%, 3%);
    }
}

/* 淺色模式容器透明 */
.homepage-container {
    background-color: transparent !important;
}

/* ===== Homepage Container ===== */
.homepage-container {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Hero Section (Video Player) ===== */
.hero-section {
    padding: var(--section-padding) 0;
    margin-bottom: 1rem;
}

.hero-section .section-inner {
    max-width: 1200px;
    margin: 0 auto;
}


.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #1e293b;
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.video-wrapper #StemiVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===== Notice Section ===== */
.notice-section {
    padding: 0 0 1.5rem 0;
}

.notice-card {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #fff7e6, #ffe9c2);
    border: 1px solid #f3c67a;
    border-left: 6px solid #f08b17;
    border-right: 6px solid #f08b17;
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(240, 139, 23, 0.12);
    padding: 14px 18px;
    text-align: center;
}

.notice-title {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #6b2f00;
}

.notice-body {
    margin: 0 0 6px 0;
    color: #5a3a1b;
    line-height: 1.6;
}

.notice-image {
    margin: 0 auto 10px auto;
    max-width: 100%;
}

.notice-image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.notice-link {
    color: #9b3e00;
    font-weight: 600;
    text-decoration: underline;
}

.notice-link:hover {
    color: #6b2f00;
}

.notice-card--debug {
    background: #eef6ff;
    border-color: #8fb6ff;
    border-left-color: #2f6fdd;
}

.notice-card--debug .notice-title,
.notice-card--debug .notice-body {
    color: #153a73;
}

/* ===== Category Section ===== */
.category-section {
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.category-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: var(--color-card);
    border-radius: var(--card-radius);
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--card-shadow);
    transition: var(--transition-base);
    border: 1px solid var(--color-border);
}

.category-block:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--color-primary);
}

.category-block i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
    transition: var(--transition-base);
}

.category-block:hover i {
    color: var(--color-primary-dark);
    transform: scale(1.1);
}

.category-block span {
    font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem);
    font-weight: 600;
    text-align: center;
}

/* ===== Videos Section ===== */
.videos-section {
    padding: var(--section-padding) 0;
}

.videos-section .section-title {
    font-size: clamp(1.4rem, 1.15rem + 1.1vw, 2rem);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.videos-section .section-title i {
    color: var(--color-primary);
}

/* Video Grid - CSS Grid with auto-fill */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Video Card */
.video-card {
    background: var(--color-card);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition-base);
    border: 1px solid var(--color-border);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.video-card .card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.video-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .card-image img {
    transform: scale(1.05);
}

/* Play icon overlay */
.video-card .card-image::after {
    content: '\f04b';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.video-card:hover .card-image::after {
    opacity: 0.9;
}

.video-card .card-content {
    padding: 1rem;
}

.video-card .card-title {
    font-size: clamp(1.15rem, 1.05rem + 0.45vw, 1.35rem);
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    display: block;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.video-card .card-title:hover {
    color: var(--color-primary);
}

/* No image fallback */
.video-card.no-image .card-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-card.no-image .card-image .fallback-title {
    color: white;
    font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
    font-weight: 700;
    text-align: center;
    padding: 1rem;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

/* ===== Quick Links Section ===== */
.quicklinks-section {
    padding: var(--section-padding) 0;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.quicklinks-section .section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    text-align: center;
}

.quicklinks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

.quicklink-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: var(--color-card);
    border-radius: var(--card-radius);
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--card-shadow);
    transition: var(--transition-base);
    border: 1px solid var(--color-border);
}

.quicklink-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--color-secondary);
}

.quicklink-card .icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: var(--transition-base);
}

.quicklink-card .icon-wrapper.feedback {
    background: linear-gradient(135deg, #f97316, #fb923c);
}

.quicklink-card .icon-wrapper.qanda {
    background: linear-gradient(135deg, #14b8a6, #2dd4bf);
}

.quicklink-card .icon-wrapper.line {
    background: linear-gradient(135deg, #06c755, #00b900);
}

.quicklink-card .icon-wrapper i {
    font-size: 1.5rem;
    color: white;
}

.quicklink-card span {
    font-weight: 600;
    font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
}

/* ===== Responsive Breakpoints ===== */

/* Large Desktop (≥1400px) */
@media (min-width: 1400px) {
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small Desktop / Tablet Landscape (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet Portrait (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .homepage-container {
        padding: 0 1rem;
    }

    .hero-section .section-inner {
        max-width: 100%;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
    }

    .category-block {
        padding: 1.25rem 0.75rem;
    }

    .category-block i {
        font-size: 1.75rem;
    }

    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .quicklinks-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* Mobile Landscape (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .homepage-container {
        padding: 0 0.75rem;
    }

    .hero-section {
        padding: 1rem 0;
    }

    .category-section {
        padding: 1rem 0;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .category-block {
        padding: 1rem 0.5rem;
    }

    .category-block i {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .category-block span {
        font-size: 1.25rem;
    }

    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .quicklinks-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .quicklink-card {
        padding: 1rem;
    }

    .quicklink-card .icon-wrapper {
        width: 50px;
        height: 50px;
    }

    .quicklink-card .icon-wrapper i {
        font-size: clamp(1.3rem, 1.1rem + 0.2vw, 1.4rem);
    }
}

/* Mobile Portrait (<576px) */
@media (max-width: 575px) {
    :root {
        --section-padding: 1rem;
    }

    .homepage-container {
        padding: 0 0.5rem;
    }

    .hero-section {
        padding: 0.75rem 0;
    }

    .category-section {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0 0.5rem;
    }

    .category-block {
        padding: 0.875rem 0.5rem;
    }

    .category-block i {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .category-block span {
        font-size: 1.25rem;
    }

    .videos-section {
        padding: 1rem 0;
    }

    .videos-section .section-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .video-card .card-content {
        padding: 0.875rem;
    }

    .video-card .card-title {
        font-size: 1.25rem;
    }

    .quicklinks-section {
        padding: 1rem 0;
    }

    .quicklinks-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: 100%;
    }

    .quicklink-card {
        flex-direction: row;
        justify-content: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .quicklink-card span {
        font-size: 1.25rem;
    }

    .quicklink-card .icon-wrapper {
        margin-bottom: 0;
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }
}

/* Extra small devices (≤360px) */
@media (max-width: 360px) {
    .category-block span {
        font-size: 1.25rem;
    }

    .video-card .card-title {
        font-size: 1.25rem;
    }
}

/* ===== Print Styles ===== */
@media print {

    .hero-section,
    .category-section {
        display: none;
    }

    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
