/*
Theme Name: 桃園幼教輔導團
Theme URI: https://5fc7745a564f7.site123.me/
Author: 桃園市桃園區桃園國民小學
Description: 為桃園市幼兒教育輔導團設計的專屬佈景主題，溫暖童趣又不失機關的正式感。
Version: 1.0
Requires at least: 5.9
Requires PHP: 7.4
Text Domain: taoyuan-kids
*/

/* ==========================================================================
   Design tokens
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
    --teal-900: #204b47;
    --teal-700: #307672;   /* SITE123 原站主色 */
    --teal-500: #4d938e;
    --mint-100: #e3f1ee;
    --mint-50: #f5faf9;
    --peach-500: #f0a868;
    --peach-100: #fdecd9;
    --yellow-400: #fbd86d;
    --yellow-100: #fdf3d9;
    --teal-100: #e6f0ef;
    --ink-900: #1f2a28;
    --ink-600: #4d5c59;
    --white: #ffffff;
    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow-soft: 0 10px 30px rgba(32, 75, 71, 0.08);
    --max-width: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--mint-50);
    color: var(--ink-900);
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4,
.site-title,
.hero-title {
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    color: var(--teal-900);
    line-height: 1.35;
    margin: 0 0 0.5em;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.4rem; }

p { margin: 0 0 1.1em; max-width: 68ch; }

a { color: var(--teal-700); text-decoration: none; }
a:hover { color: var(--peach-500); }

img { max-width: 100%; height: auto; border-radius: var(--radius-md); display: block; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border-bottom: 3px solid var(--peach-500);
}

.site-header .container {
    max-width: 1440px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
    flex-wrap: nowrap;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-branding img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.site-title {
    font-size: clamp(1.1rem, 0.6rem + 1.5vw, 2.1rem);
    margin: 0;
    white-space: nowrap;
}

.site-title a { color: var(--teal-900); }

.site-description {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-600);
}

/* Primary nav */
.primary-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    margin: 0;
    padding: 0;
}

.primary-nav a {
    display: inline-block;
    padding: 6px 8px;
    border-radius: 999px;
    color: var(--teal-900);
    font-weight: 700;
    font-size: clamp(0.8rem, 0.5rem + 0.9vw, 1.3rem);
    white-space: nowrap;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a {
    background: var(--mint-100);
    color: var(--teal-700);
}

.primary-nav .nav-login a {
    border: 2px solid var(--peach-500);
    color: var(--peach-500);
}
.primary-nav .nav-login a:hover {
    background: var(--peach-500);
    color: var(--white);
}

/* ==========================================================================
   Hero (front page)
   ========================================================================== */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--teal-700), var(--teal-900));
    background-size: cover;
    background-position: center;
    color: var(--ink-900);
    padding: 72px 0 96px;
    scroll-margin-top: 90px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 0;
}

.hero-card {
    max-width: 720px;
}
.hero-card .hero-title,
.hero-card .hero-subtitle,
.hero-card .hero-meta { color: var(--ink-900); }
.hero-card .hero-meta strong { color: var(--ink-900); }

.hero-blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.35;
}
.hero-blob.one { width: 260px; height: 260px; background: var(--peach-500); top: -80px; right: -60px; }
.hero-blob.two { width: 180px; height: 180px; background: var(--yellow-400); bottom: -60px; left: 8%; opacity: 0.25; }

.hero .container { position: relative; z-index: 1; }

.hero-title {
    color: var(--white);
    font-size: 3rem;
    max-width: 22ch;
    font-weight: 900;
}

.hero-subtitle {
    color: rgba(255, 255, 255, 0.9);
    max-width: 56ch;
    font-size: 1.25rem;
}

.hero-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 28px;
    font-size: 16pt;
    color: rgba(255, 255, 255, 0.85);
}

.hero-meta strong { color: var(--white); }

/* ==========================================================================
   Content sections & cards
   ========================================================================== */
.section {
    padding: 64px 0;
    scroll-margin-top: 90px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 3px;
    background: var(--peach-100);
    border-radius: 3px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-soft);
}

.card h3 { margin-bottom: 6px; }

.card .card-meta {
    display: inline-block;
    background: var(--mint-100);
    color: var(--teal-700);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.announcement-card {
    display: block;
}

.announcement-thumb {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 14px;
}

.announcement-thumb img {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 0;
}

.announcement-card h3 { margin-bottom: 6px; overflow-wrap: break-word; }

.btn {
    display: inline-block;
    background: var(--peach-500);
    color: var(--white);
    padding: 11px 24px;
    border-radius: 999px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--teal-700); color: var(--white); }

/* Page / single content */
.entry-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-soft);
}

.info-content {
    text-align: center;
}

.info-image {
    max-width: 640px;
    width: 100%;
    margin: 0 auto 24px;
}

.org-chart-image {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}

.info-body {
    font-size: 1.2rem;
    max-width: 68ch;
    margin: 0 auto;
}

.entry-header { margin-bottom: 18px; }

.entry-meta {
    color: var(--ink-600);
    font-size: 0.85rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: var(--teal-900);
    color: rgba(255, 255, 255, 0.85);
    padding: 48px 0 24px;
    margin-top: 40px;
}

.site-footer a { color: var(--yellow-400); }

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 28px;
    margin-bottom: 28px;
}

.footer-grid h4 {
    color: var(--white);
    font-size: 1rem;
}

.site-footer .copyright {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 18px;
    font-size: 0.85rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 720px) {
    .hero-title { font-size: 2rem; }
    .section { padding: 44px 0; }
    .entry-content { padding: 24px; }
    .site-header .container { flex-wrap: wrap; }
    .primary-nav ul { flex-wrap: wrap; }
}

/* ==========================================================================
   回到頂端按鈕
   ========================================================================== */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--peach-500);
    color: var(--white);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 90;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: var(--teal-700);
}

@media (max-width: 720px) {
    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top { transition: none; }
}

/* Accessibility: visible focus */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--yellow-400);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* ==========================================================================
   輔導團成員、相簿封面
   ========================================================================== */
.team-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.team-card {
    text-align: center;
    padding: 20px 14px;
}

.team-card.tint-mint { background: var(--mint-100); }
.team-card.tint-peach { background: var(--peach-100); }
.team-card.tint-yellow { background: var(--yellow-100); }
.team-card.tint-teal { background: var(--teal-100); }
.team-card .card-meta { background: var(--white); font-size: inherit; }

.team-name {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: calc(1.1rem + 5pt);
    padding-bottom: 8px;
    border-bottom: 3px solid var(--peach-100);
    margin-bottom: 8px;
}

.team-school {
    color: var(--ink-600);
    margin-bottom: 6px;
}

a.card, a.card:hover { color: var(--ink-900); }
a.card h3 { color: var(--teal-900); }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.photo-grid img { width: 100%; height: 200px; object-fit: cover; }

.sortable-photos .photo-item {
    cursor: grab;
    user-select: none;
}
.sortable-photos .photo-item:active { cursor: grabbing; }
.sortable-photos .photo-item.dragging {
    opacity: 0.4;
}
.photo-grid a.photo-thumb {
    display: block;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}
.photo-grid a.photo-thumb:hover { transform: translateY(-3px); }
.photo-grid a.photo-thumb img { margin: 0; }

/* ==========================================================================
   照片放大檢視（Lightbox）
   ========================================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 28, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 60px 20px 40px;
    z-index: 200;
}

.lightbox[hidden] { display: none; }

.lightbox-img {
    max-width: min(92vw, 1100px);
    max-height: 74vh;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox-close:hover,
.lightbox-close:focus-visible { background: rgba(255, 255, 255, 0.3); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox-nav:hover,
.lightbox-nav:focus-visible { background: rgba(255, 255, 255, 0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

@media (max-width: 640px) {
    .lightbox-nav { width: 40px; height: 40px; font-size: 1.4rem; }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }
}

.link-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.link-list li {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 16px 22px;
}
.link-list a { font-weight: 700; font-size: 1.15rem; }

/* ==========================================================================
   後台管理介面
   ========================================================================== */
body.admin { background: var(--mint-50); }

.admin-topbar {
    background: var(--teal-900);
    color: var(--white);
    padding: 14px 0;
}
.admin-topbar .container { display: flex; justify-content: space-between; align-items: center; }
.admin-topbar a { color: var(--white); font-weight: 700; }
.admin-topbar .admin-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-topbar .admin-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.9rem;
}
.admin-topbar .admin-nav a:hover,
.admin-topbar .admin-nav a.active { background: rgba(255,255,255,0.15); }

.admin-wrap { max-width: 920px; margin: 0 auto; padding: 40px 24px; }

.login-wrap {
    max-width: 380px;
    margin: 80px auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 40px;
}
.login-wrap h1 { text-align: center; font-size: 1.6rem; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 6px; }
.form-group .hint { color: var(--ink-600); font-size: 0.85rem; margin-top: 4px; }
input[type=text],
input[type=password],
input[type=url],
input[type=email],
input[type=file],
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d7e4e1;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
}
textarea { min-height: 160px; resize: vertical; }

.btn-block { display: block; width: 100%; text-align: center; }
.btn-secondary { background: var(--mint-100); color: var(--teal-900); }
.btn-secondary:hover { background: #d7e9e5; color: var(--teal-900); }
.btn-danger { background: #d9534f; }
.btn-danger:hover { background: #b5322e; }

.alert {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}
.alert-success { background: #e2f3ea; color: #1c6a41; }
.alert-error { background: #fdecec; color: #a4302a; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-soft); }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--mint-100); }
.admin-table th { background: var(--mint-100); }
.admin-table img.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }

.color-swatch-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    font-weight: 700;
    color: var(--ink-900);
}

.color-swatch input { margin: 0; }

.color-dot {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.color-swatch:has(input:checked) {
    border-color: var(--teal-700);
}

.admin-table .drag-handle {
    width: 32px;
    text-align: center;
    color: var(--ink-600);
    font-size: 1.2rem;
    cursor: grab;
    user-select: none;
}
.admin-table .drag-handle:active { cursor: grabbing; }
.admin-table tbody tr.dragging { opacity: 0.4; }
.admin-actions { margin-bottom: 20px; }
.row-actions a { margin-right: 10px; font-size: 0.9rem; }
