/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

nav {
    margin-bottom: 2rem;
}

.back-button {
    text-decoration: none;
    color: #666;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.back-button:hover {
    color: #333;
}

.site-title {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.section-title {
    text-align: center;
    margin: 3rem 0 2rem;
    color: #2c3e50;
}

.stories-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.story-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

/* Card hover effect */
.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.story-card.missing-gems {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid #e0e0e0;
}

/* Title text fixes */
.story-card h2 {
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}
.story-card a {
    text-decoration: none;
    color: #2c3e50;
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Style the link itself */
.story-card h2 a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word; /* Add this for better breaking */
    hyphens: auto;
    line-height: 1.2;
    display: block;
    width: 100%;
    text-decoration: none;
    color: #2c3e50;
    font-size: 1rem; /* Standardize font size */
}
.story-card .date {
    color: #666;
    font-size: 0.9rem;
    margin-top:auto;
}
.story-card.missing-gems {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid #e0e0e0;
}
.story {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.story h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    /* Add these new properties */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    font-size: 2rem;
    /* Base font size */
}

.story .date {
    color: #666;
    margin-bottom: 2rem;
}

.story-content {
    max-width: 800px;
    margin: 0 auto;
}

.image-container {
    margin: 2rem 0;
}

.image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}
.video-container {
    position: relative;
    width: 100%;
    margin: 1em auto;
    max-width: 100%;
}

/* Landscape video styles */
.video-container.landscape-video {
    max-width: 100%;
    aspect-ratio: 16/9;
}

/* Portrait video styles */
.video-container.portrait-video {
    max-width: 400px; /* Or any suitable max-width for portrait videos */
    aspect-ratio: 9/16;
    margin: 1em auto;
}

.video-container .plyr {
    width: 100%;
    height: 100%;
}

.video-player {
    width: 100%;
    height: 100%;
    display: block;
}

/* Make sure portrait videos don't overflow in fullscreen */
.plyr--fullscreen-enabled.portrait-video .plyr__video-wrapper {
    height: 100%;
    width: auto;
    margin: auto;
}

/* Ensure controls are visible */
.plyr--video .plyr__controls {
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.75));
    padding: 20px 10px 10px;
}

/* Better control visibility */
.plyr--video .plyr__control svg {
    filter: drop-shadow(0px 1px 1px rgba(0,0,0,.25));
}

/* Add responsive styles for different screen sizes */
@media (max-width: 768px) {
    .video-container.portrait-video {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .video-container.portrait-video {
        max-width: 240px;
    }
}

.secrets-intro {
    text-align: center;
    font-style: italic;
    color: #666;
    margin-bottom: 2rem;
}

.secrets-link {
    text-decoration: none;
    color: #2c3e50;
    transition: color 0.3s;
}

.secrets-link:hover {
    color: #34495e;
}

.video-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    padding: 5px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-icon svg {
    width: 14px;
    height: 14px;
    fill: white;
}
.story-card {
    position: relative;
}


.story-card {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 300px;
    }

    .feature-image-container {
        width: 100%;
        height: 200px;
        overflow: hidden;
        border-radius: 8px 8px 0 0;
        margin: -1.5rem -1.5rem 1rem -1.5rem;
        position: relative;
    }

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

    .story-card:hover .feature-image {
        transform: scale(1.05);
    }

    .story-content {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }

    .story-card h2 {
        margin-top: 0;
    }

    .story-card .date {
        margin-top: auto;
    }




.lazy-image {
        opacity: 0;
        transition: opacity 0.3s ease-in;
    }
    
.lazy-image.loaded {
    opacity: 1;
}

.image-placeholder {
    background: #f0f0f0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-out;
}

.image-placeholder.hidden {
    opacity: 0;
}


.chinese-title {
        font-size: 0.9em;
        color: #666;
        margin: 0.5em 0;
    }
.chinese-content {
  background: #f9f9f9;
  border-left: 10px solid #ccc;
  margin: 1.5em 10px;
  padding: 0.5em 10px;
  quotes: "\201C""\201D""\2018""\2019";
}
.chinese-content:before {
  color: #ccc;
  font-size: 4em;
  line-height: 0.1em;
  margin-right: 0.25em;
  vertical-align: -0.4em;
}
.chinese-content p {
  display: inline;
}

.nav-title {
    display: block;
    font-size: 0.9em;
    margin: 2px 0;
}

.nav-title.chinese {
    color: #666;
    font-size: 0.85em;
}

.story-navigation a {
    display: block;
    text-align: center;
}

.prev-link {
    text-align: left;
}

.next-link {
    text-align: right;
}
@media (max-width: 768px) {
    .chinese-title {
        font-size: 0.85em;
    }
}
@media (max-width: 768px) {
    .story-card {
        min-height: 250px;
    }

    .feature-image-container {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .story-card {
        min-height: 200px;
    }

    .feature-image-container {
        height: 120px;
    }
}
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .story {
        padding: 1.5rem;
    }

    /* Grid container fixes */
    .stories-grid {
        display: grid;
        gap: 1rem;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        width: 100%;
        max-width: 100%;
    }


    .story-card h2 {
        font-size: 0.8rem;
        /* Smaller font size on mobile */
    }

    .story h1 {
        font-size: 1rem;
        /* Smaller font size on mobile */
    }

    /* Card container fixes */
    .story-card {
        background: white;
        padding: 1.5rem;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s, box-shadow 0.3s;
        max-width: 87%;
        box-sizing: border-box;
        overflow: hidden;
    display:flex;
    flex-direction: column;
    min-width:0;
    }
}

@media (max-width: 480px) {
    .story-card h2 {
        font-size: 0.8rem;
        /* Even smaller font size */
    }

    .story h1 {
        font-size: 0.9rem;
        /* Even smaller font size */
    }
}

.auth-forms {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
}
.auth-forms input {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.auth-forms button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: none;
    border-radius: 4px;
    background: #007bff;
    color: white;
    cursor: pointer;
}
.auth-forms button:hover {
    background: #0056b3;
}
.content {
    display: none;
}
.loading {
    text-align: center;
    padding: 20px;
    display: none;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff; /* Changed to white background */
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    max-width: 1200px; /* Increased max-width */
    min-height: 100vh;
    box-sizing: border-box;
}

.close-modal {
    position: fixed; /* Changed to fixed */
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001; /* Ensure it's above other content */
    background: rgba(255, 255, 255, 0.8); /* Semi-transparent background */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.modal-body {
    margin-top: 0;
    padding: 20px 0;
}

.modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
}

.modal-body video {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
}

.story-title {
    margin: 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 2em;
}

.story-date {
    color: #666;
    margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-content {
        padding: 15px;
    }
    
    .story-title {
        font-size: 1.5em;
        margin: 15px 0;
    }
    
    .close-modal {
        right: 10px;
        top: 10px;
    }
}
/* Add these styles to your CSS */
.video-container {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Plyr custom styles */
.plyr {
    --plyr-color-main: #007bff;
    margin: 0 !important;
}

.plyr--video {
    border-radius: 8px;
}
.modal-navigation {
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    z-index: 1002;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background: white;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .modal-navigation {
        padding: 0 10px;
    }
    
    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}
.note {
    font-size:0.9em;
}