* {margin: 0; padding: 0; box-sizing: border-box;}

:root {
    --bg: #0b0c1a;
    --max-width: 80rem;
    --container-padding: 1.5rem;
    --gap: 1.5rem;
    --radius: 0.5rem;
    --base-font-size: clamp(14px, 1.6vw, 18px);
}

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    color: #e6e9f0;
    font-family:  "Noto Sans TC", sans-serif;
    font-weight: 350;
    letter-spacing: 0.05em;
    line-height: 1.6;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    overflow-x: auto;
}

main {
    padding-top: 2rem;
    flex: 1;
}

@media (max-width: 639px) {
    main {
        padding-top: 6rem;
        flex: 1;
    }
}

/* Utilities and responsive defaults */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

img, picture, video, iframe, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1.0rem;
}


/* small devices tweak */
@media (max-width: 639px) {
    :root {
        --gap: 1rem;
        --container-padding: 1rem;
    }
    h1 { font-size: clamp(1.25rem, 6vw, 2rem); }
    h2 { font-size: clamp(1rem, 5vw, 1.5rem); }
}

/* ===== Header & Nav ===== */
header {
    position: fixed; 
    top: 0;
    left: 0; 
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(96px);
    background-color: #0c234099;
    padding: 0.2rem 1rem;
    transition: background-color 0.3s;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-title {
    font-family: "Chiron GoRound TC", "Noto Serif TC", "Noto Sans TC", sans-serif;
    margin: 0.5rem 0rem 0.2rem 1rem;
}

.site-title a {
    color: #ffffff;
    text-decoration: none;
    font-size: clamp(1rem, 4vw, 1.5rem);
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
/* small devices (phones) */
@media (max-width: 639px) {
    header { padding: 0.4rem 0.75rem; }
    .nav-menu {
        gap: 0.25rem;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }
    .nav-menu a {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
    }
    nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }
    .site-title {
        margin: 0.5rem 0;
        text-align: center;
    }
}

.nav-menu a {
    color: #e6e9f0;
    font-size: 0.9rem;
    transition: color 0.3s;
    padding: 0.7rem 0.5rem; 
    display: inline-block; 
    text-align: center; 
    text-decoration:none;
}

.nav-menu a:hover {
    background-color: #5c61ac3e; 
    color: #8ab4f8;
    text-decoration:underline;
}

/* ===== Footer ===== */
footer {
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: #aaaaaa;
    background-color: #0c2340;
}

.contact-icons {
    display:flex;
    justify-content:center;
    gap:2rem; 
    margin:1rem; 
    flex-wrap:wrap;
}

.contact-icons a {
    display: inline-block; 
    transition: all 0.3s ease; 
    text-decoration: none;
    color: #ffffff; 
}

.contact-icons a:hover {
    transform: translateY(-8px); 
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3)); 
    color: #bdb6d5;
}
/* Hero */
#hero {
    min-height: 50vh;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.carousel-container {
    height: 100%;
    width: 100%;
    position: relative;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

/* slides info */
.slide {
    position: relative;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
}

.slide img {
    width: 100%;
    height: 100%;
    object-position: center center;
    flex-shrink: 0;
    flex-grow: 0;
    object-fit: cover;
    display: block;
}

.slide iframe {
    width: 100%;
    height: 100%;
    object-position: center center;
    flex-shrink: 0;
    flex-grow: 0;
    object-fit: cover;
    display: block;
}

.slide-info {
    position: absolute;
    bottom: 3rem;
    right: 2rem;
    color: #ffffff;
    text-shadow: 1px 1px 5px rgba(249, 242, 242, 0.7);
    background-color: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
    font-size: clamp(0.9rem, 2.2vw, 1.05rem);
    max-width: 40ch;
    line-height: 1.3;
}

/* button */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0,0,0,0.3);
    border: none;
    color: white;
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    padding: clamp(0.5rem, 1.2vw, 1rem) clamp(0.75rem, 1.8vw, 1.5rem);
    cursor: pointer;
    border-radius: 50%;
}


.carousel-btn:hover {
    background: rgba(255,255,255,0.2);
}

.carousel-btn.prev {
    left: 1rem;
}

.carousel-btn.next {
    right: 1rem;
}


@media (max-width: 639px) {
    #hero {
        height: auto;
    }
    .slide-info {
        position: static;
        bottom: auto;
        right: auto;
        left: 0;
        width: calc(100% - 2rem);
        margin: 1rem;
        text-align: left;
        border-radius: 0.25rem;
    }
    .carousel-btn {
        padding: 0.6rem;
        font-size: 1.1rem;
    }
    .carousel-btn.prev {
        left: 0.5rem;
    }
    .carousel-btn.next {
        right: 0.5rem;
    }
}

/* == news == */
#news h2 {
    text-align:center;
    padding-top: 2rem;
    padding-bottom: 1rem;
}
/* 瀑布流式佈局 */
/*
.news-grid{
    columns: 3;
    column-gap: 1rem;
    padding: 1rem 1rem;
}*/

.news-grid{
    display: grid;
    grid-auto-rows: auto;
    grid-template-columns: repeat(3, 1fr);
    padding: 1rem 1rem;
    grid-gap: 1.5rem;
}

/* 平板 */
@media (min-width: 640px) and (max-width: 1023px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手機 */
@media (max-width: 639px) {
    #news h2 {
        text-align: center;
        padding: 0.2rem;
    }
    .news-grid {
        grid-template-columns: 1fr;
    }
    .news-card h3 { font-size: 1rem; }
    .news-info { font-size: 0.95rem; padding: 0.5rem 0.9rem 1rem 0.9rem; }
    .news-date { font-size: 0.7rem; }
}

.news-card {
    background-color: rgba(20, 20, 35, 0.5);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
    height: auto;
    width: 100%;
    padding: 0;
    transition: transform 0.3s, box-shadow 0.3s;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.news-card iframe {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.news-card img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.news-card h3 {
    margin-top: 1.0rem;
    margin-left: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: #ffffff;
}

.news-date {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #aaaaaa;
}

.news-info {
    padding: 0.5rem 1rem 1rem 1rem;
    font-size: 1.0rem;
    max-height: 30vh;
    overflow-y: auto;
}

.news-info p {
    color: #dcdcdc;
}

.news-info ul {
    padding-left: 1rem;
}

.news-info a {
    color: #8aebf8;
}

.news-info a:hover {
    color: #cef9ff;
    text-decoration: underline;
}

/* about */
.about-us {
    display: flex;
    gap: 3rem;
    max-width: 80rem;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.about-content {
    flex: 1;
}
/* history */
.history {
    display: flex;
    gap: 3rem;
    max-width: 80rem;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.history-content {
    flex: 1;
}

/* side bar */
.sidebar {
    position: sticky;
    align-self: flex-start;
    top: 5rem;
    flex: 0 0 16rem;
    border-right: 0.0625rem solid rgba(255,255,255,0.1);
    background-color: var(--bg);
    padding: 2rem 1rem;
}

.sidebar-title {
    font-size: 1.5rem;
    margin-top: 0rem;
    margin-bottom: 1.5rem;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 1023px) {
    .about-us, .history {
        display: flex;
        flex-direction: column;
        gap: 0rem;
        width: 100%;
        padding: 2rem 1.5rem;
    }
    .sidebar-section {
        position: sticky; 
        top: 5rem;
        width: 100%;
        z-index: 999;
        padding: 0.2rem 1rem;
        background-color: var(--bg);
    }
    .sidebar {
        display: block;
        width: 100%;
        border-right: none;
        border-bottom: 0.0625rem solid rgba(255,255,255,0.1);
        padding-bottom: 0rem;
        margin-bottom: 0rem; 
    }
    .sidebar-title {
        margin: 0 0 0.5rem 0;
        text-align: center;
    }
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding: 0.25rem 0;
        width: 100%;
    }
    .sidebar-nav a {
        white-space: nowrap;
        flex: 0 0 auto;
    }
}

.sidebar-nav a {
    color: #dcdcdc;
    font-size: 1.0rem;
    transition: color 0.3s;
    padding: 0.7rem 0.5rem; 
    display: inline-block; 
    text-align: center; 
    text-decoration:none;
    border-radius: 0.4rem;
}

.sidebar-nav a:hover {
    background-color: #5c61ac3e; 
    color: #8ab4f8;
    text-decoration:underline;
}

/* bylaws */
.pdf-wrapper {
  margin-top: 2rem;
}

.pdf-embed {
  width: 100%;
  height: 50rem;
  border: none;
  background-color: var(--bg);
}


/* responsive iframe helper */
.embed-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}
.embed-responsive iframe,
.embed-responsive object,
.embed-responsive embed {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
/* night-stories*/
.night-stories {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
    width: 100%;
    padding: 2rem 1.5rem;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.night-stories-hero {
    text-align: center;
    padding: 0.2rem 1.5rem 2rem 1.5rem;
}

.night-stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 2rem;
    max-width: 75rem;
    margin: 0 auto;
}

@media (max-width: 64rem) {
    .night-stories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 40rem) {
    .night-stories-grid {
        grid-template-columns: 1fr;
    }
}

.night-stories-card {
    background-color: rgba(20, 20, 35, 0.5);
    border-radius: 0.5rem;
    overflow: hidden;
    height: auto;
    width: 100%;
    padding: 0;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
}

@media (hover: hover) {
    .night-stories-card:hover {
        transform: translateY(-0.3rem);
        box-shadow: 0 0.5rem 1.25rem rgba(0,0,0,0.5);
    }

    .night-stories-card:hover img {
        transform: scale(1.05);
    }
}

.night-stories-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.night-stories-card h2 {
    font-size: 1.2rem;
    margin: 0.75rem 0;
    color: #ffffff;
    letter-spacing: 0.1em;
    text-align: center;
}

@media (max-width: 1023px) {
    .night-stories-card h2 {
        font-size: clamp(1rem, 5vw, 1.2rem);
        margin: 0.75rem 0;
        color: #ffffff;
        letter-spacing: 0.1em;
        text-align: center;
    }
}

/* content*/
.stories-list {
    min-height: 100vh;
    max-width: 64rem;
    margin: 3rem auto;
    padding: 2.5rem 1.5rem;
}

.night-stories-header {
    text-align: center;
    margin-bottom: 3rem;
}

.night-stories-header p {
    margin-top: 0.5rem;
    opacity: 0.85;
    font-size: 0.95rem;
}
.stories-items {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stories-item {
    display: flex;
    gap: 1.5rem;
    background-color: rgba(20, 20, 35, 0.5);
    border-radius: 0.75rem;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    align-items: stretch;
}

@media (hover: hover) {
    .stories-item:hover {
        transform: translateY(-0.3rem);
        box-shadow: 0 0.75rem 1.5rem rgba(0,0,0,0.5);
    }
}

.stories-thumb {
    flex: 0 0 10rem;
    overflow: hidden; 
}

.stories-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stories-thumb iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stories-meta {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stories-meta h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.stories-meta time {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.stories-meta p {
    font-size: 0.9rem;
    opacity: 0.9;
}

@media (max-width: 48rem) {
    .stories-item {
        flex-direction: column;
    }

    .stories-thumb {
        width: 100%;
    }
}

/* content per page*/
.night-stories-page {
    display: flex;
    gap: 3rem;
    max-width: 80rem;
    min-height: 100vh;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.night-stories-page-content {
    flex: 1;
}

/* gallery */ /* article */
.gallery, .article {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.gallery-header, .article-header {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
    width: 100%;
    margin-bottom: 2rem;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.gallery-title, .article-title {
    margin: 0 auto;
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    margin-bottom: 1.5rem;
    letter-spacing: clamp(0.5rem, 2vw, 1.5rem);
}

.gallery-intro, .article-intro {
    margin: 0 auto;
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    line-height: 1.8;
    opacity: 0.9;
    max-width: 65ch;
}

@media (max-width: 639px) {
    .gallery-header, .article-header {
        margin-bottom: 1.5rem;
        min-height: auto;
    }
    
    .gallery-title, .article-title {
        letter-spacing: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .gallery-intro, .article-intro {
        line-height: 1.6;
        font-size: 0.95rem;
    }
}

/* gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) and (max-width: 1023px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


@media (max-width: 639px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}


.gallery-item {
    cursor: pointer;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-hidden-content {
    display: none;
}

/* lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 990;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.lightbox-content {
    position: relative;
    width: min(90vw, 72rem);
    max-height: 90vh;

    background: #0b0c1a;
    color: #fff;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;

    padding: 2rem;
    border-radius: 0.75rem;

    z-index: 900;
    overflow: hidden; 
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.lightbox-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
}

.lightbox-info {
    padding-right: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.7;
}

.lb-meta {
    opacity: 0.8;
    margin-bottom: 1rem;
}

.lightbox-description {
    max-height: 30vh;
    overflow-y: auto;
}

/* RWD */
@media (max-width: 48rem) {

    .lightbox {
        align-items: flex-start;
    }

    .lightbox-content {
        width: 100%;
        height: auto;
        margin: 8rem 1rem;
        max-height: 80vh;

        border-radius: 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;

        padding: 1rem;
    }

    .lightbox-image {
        max-height: 45vh;
    }

    .lightbox-image img {
        max-height: 45vh;
    }

    .lightbox-info {
        overflow-y: auto;
        padding-bottom: 1rem;
    }
}


/* contact us */
.contact {
    padding: 0.5rem 3rem; 
    max-width: 1200px;  
    margin: 0 auto;     
}

.contact h1{
    text-align:center;
    padding:2rem 1rem;
    margin: 0 auto;
}

.contact-container {
    display: flex;
    gap: 5rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.left-container {
    flex: 1 1 20rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-align: left;
}

.right-container {
    flex: 2 1 30rem;
    max-width: 50rem; 
}

.right-container iframe {
    width: 100%;
    height: 100%;
    min-height: 30em; 
    border: 0;
}

.contact-forms {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    width: auto;
}

.btn-form {
    padding: 0.8rem 1.5rem;
    background-color: #0c2340cc;
    color: #e6e6e6;
    border: none;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
    flex: 1;
}

.btn-form:hover {
    background-color: #8ab4f8;
    color: #ffffff;
}