/*
Theme Name: APYDA Theme
Description: 亞太青年發展協會主題
Author: ycfeller
Version: 1.0
Text Domain: apyda-theme
Domain Path: /languages
*/

/* 基本樣式 */
:root {
    --primary: #0A3D62;
    --secondary: #F9CA24;
    --accent: #3C6382;
    --light: #F8FAFC;
    --dark: #1E293B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 工具類 */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.text-shadow-lg {
    text-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.transition-navbar {
    transition: background-color 0.3s, box-shadow 0.3s, padding 0.3s;
}

.hero-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 導航樣式 */
#navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 50;
    transition: background-color 0.3s, box-shadow 0.3s, padding 0.3s;
}

#navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.navbar-brand .logo {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
}

.navbar-brand h1 {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.125rem;
    margin: 0;
}

.navbar-brand p {
    color: var(--accent);
    font-size: 0.75rem;
    margin: 0;
}

/* 桌面端導航 */
.desktop-nav {
    display: none;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
}

.nav-link {
    color: var(--dark);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--primary);
}

/* 下拉菜單 */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-toggle i {
    transition: transform 0.3s;
}

.dropdown:hover .dropdown-toggle i {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 12rem;
    background: white;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transform-origin: top;
    transition: all 0.3s;
    z-index: 50;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* 二級/三級子菜單（桌面） */
.dropdown-menu .dropdown {
    position: relative;
}

.dropdown-menu .dropdown > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: 0;
    margin-left: 0.25rem;
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.3s;
}

.dropdown-item:hover {
    background-color: var(--primary);
    color: white;
}

/* 移動端菜單 */
.mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 50;
}

.mobile-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-dropdown-toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.5rem 0;
    color: var(--dark);
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s;
}

.mobile-dropdown-toggle:hover {
    color: var(--primary);
}

.mobile-dropdown-toggle i {
    transition: transform 0.3s;
}

.mobile-dropdown-toggle.active i {
    transform: rotate(180deg);
}

/* 默认展开时根据 aria-expanded 同步图标旋转状态 */
.mobile-dropdown-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.mobile-dropdown-menu {
    padding-left: 1rem;
    display: none;
    gap: 0.5rem;
    flex-direction: column;
}

.mobile-dropdown-menu.active {
    display: flex;
}

.mobile-dropdown-menu a {
    padding: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--dark);
    text-decoration: none;
    transition: color 0.3s;
}

.mobile-dropdown-menu a:hover {
    color: var(--primary);
}

/* CTA按鈕 */
.cta-button {
    background: linear-gradient(135deg, var(--secondary), #f39c12);
    color: var(--dark);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Hero區域 */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 8rem 0 6rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.1;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .hero {
        padding: 6rem 0 4rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
}

/* 按鈕樣式 */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--secondary);
    color: var(--dark);
}

.btn-primary:hover {
    background: #f1c40f;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: var(--primary);
}

/* 内容区块样式 */
.content-section {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #1f2937;
}

.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* 卡片樣式 */
.card {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.card-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
}

.card p {
    color: #6b7280;
    line-height: 1.6;
}

/* 頁腳樣式 */
footer {
    background: #1f2937;
    color: white;
    padding: 4rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--secondary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--secondary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero {
        text-align: center;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 640px) {
    .navbar-brand h1 {
        font-size: 1rem;
    }
    
    .navbar-brand p {
        font-size: 0.625rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 0.875rem;
    }
    
    .card {
        padding: 1rem;
    }
}

/* 返回頂部按鈕 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 40;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* 統計數字動畫 */
.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary);
    display: block;
}

.stat-label {
    font-size: 1rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* 图片样式 */
img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 6rem;
}

/* 載入動畫 */
.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #f3f4f6;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: var(--dark);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 無障礙設計 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦點樣式 */
*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 打印樣式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}

/* 文章與頁面排版樣式（entry-content）
   說明：補齊 h1–h6、段落、列表、引用、程式碼、表格、分隔線等常用段落元素樣式，
   保持與現有配色與字體風格一致，不改變任何既有功能。 */
.entry-content {
    color: #1f2937; /* 灰900 */
    line-height: 1.8;
    word-wrap: break-word;
}
.entry-content p {
    margin: 1rem 0;
}
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary);
    margin: 1.5rem 0 0.75rem;
}
.entry-content h1 { font-size: 2rem; }
.entry-content h2 { font-size: 1.75rem; }
.entry-content h3 { font-size: 1.5rem; }
.entry-content h4 { font-size: 1.25rem; }
.entry-content h5 { font-size: 1.125rem; }
.entry-content h6 { font-size: 1rem; }

.entry-content a {
    color: #2563eb; /* blue-600 */
    text-decoration: underline;
}
.entry-content a:hover {
    color: #1d4ed8; /* blue-700 */
}

.entry-content ul,
.entry-content ol {
    margin: 1rem 0;
    padding-left: 1.25rem;
}
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin: 0.5rem 0; }

.entry-content blockquote {
    margin: 1.25rem 0;
    padding-left: 1rem;
    border-left: 4px solid var(--accent);
    color: #374151; /* 灰700 */
    font-style: italic;
}

.entry-content code {
    background: #f3f4f6; /* 灰100 */
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
}
.entry-content pre {
    background: #111827; /* 灰900 */
    color: #e5e7eb; /* 灰200 */
    padding: 1rem;
    border-radius: 0.5rem;
    overflow: auto;
    margin: 1rem 0;
}
.entry-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.entry-content hr {
    border: 0;
    border-top: 1px solid #e5e7eb; /* 灰200 */
    margin: 2rem 0;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}
.entry-content th,
.entry-content td {
    border: 1px solid #e5e7eb; /* 灰200 */
    padding: 0.75rem;
    text-align: left;
}
.entry-content thead th {
    background: #f9fafb; /* 灰50 */
}

.entry-content figure { margin: 1rem 0; }
.entry-content figcaption {
    color: #6b7280; /* 灰500 */
    font-size: 0.875rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Gutenberg 對齊兼容 */
.entry-content .alignleft { float: left; margin-right: 1rem; }
.entry-content .alignright { float: right; margin-left: 1rem; }
.entry-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry-content .wp-block-image img { max-width: 100%; height: auto; }
.entry-content .alignwide { margin-left: calc(-5vw); margin-right: calc(-5vw); }
.entry-content .alignfull { width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }

@media (max-width: 768px) {
    .entry-content h1 { font-size: 1.75rem; }
    .entry-content h2 { font-size: 1.5rem; }
    .entry-content h3 { font-size: 1.25rem; }
}