/* Fixed Navigation Toolbar */
.period-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 15px 0;
}

.period-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

/* Connecting dotted line - centered on dots */
.period-nav-container::before {
    content: '';
    position: absolute;
    top: 9px;
    left: calc(40px + 9px);
    right: calc(40px + 9px);
    height: 2px;
    background-image: linear-gradient(to right, rgba(200, 200, 200, 0.4) 40%, transparent 40%);
    background-size: 8px 2px;
    background-repeat: repeat-x;
    z-index: 0;
}

.period-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    padding: 0 8px;
    border-radius: 8px;
}

.period-nav-item:hover {
    color: #333;
}

.period-nav-item:hover .period-nav-dot {
    transform: scale(1.3);
}

.period-nav-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: white;
    flex-shrink: 0;
}

/* Period-specific dot colors */
.period-nav-item[data-period="1"] .period-nav-dot {
    background: #4285f4;
    box-shadow: 0 0 12px rgba(66, 133, 244, 0.3);
}
.period-nav-item[data-period="2"] .period-nav-dot {
    background: #34a853;
    box-shadow: 0 0 12px rgba(52, 168, 83, 0.3);
}
.period-nav-item[data-period="3"] .period-nav-dot {
    background: #fbbc04;
    box-shadow: 0 0 12px rgba(251, 188, 4, 0.3);
}
.period-nav-item[data-period="4"] .period-nav-dot {
    background: #ea4335;
    box-shadow: 0 0 12px rgba(234, 67, 53, 0.3);
}
.period-nav-item[data-period="5"] .period-nav-dot {
    background: #9c27b0;
    box-shadow: 0 0 12px rgba(156, 39, 176, 0.3);
}
.period-nav-item[data-period="6"] .period-nav-dot {
    background: #00bcd4;
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.3);
}
.period-nav-item[data-period="7"] .period-nav-dot {
    background: #ff9800;
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.3);
}
.period-nav-item[data-period="8"] .period-nav-dot {
    background: #e91e63;
    box-shadow: 0 0 12px rgba(233, 30, 99, 0.3);
}

/* Active state - enhanced glow */
.period-nav-item.active .period-nav-dot {
    transform: scale(1.4);
}

.period-nav-item[data-period="1"].active .period-nav-dot {
    box-shadow: 0 0 20px #4285f4, 0 0 40px rgba(66, 133, 244, 0.5);
}
.period-nav-item[data-period="2"].active .period-nav-dot {
    box-shadow: 0 0 20px #34a853, 0 0 40px rgba(52, 168, 83, 0.5);
}
.period-nav-item[data-period="3"].active .period-nav-dot {
    box-shadow: 0 0 20px #fbbc04, 0 0 40px rgba(251, 188, 4, 0.5);
}
.period-nav-item[data-period="4"].active .period-nav-dot {
    box-shadow: 0 0 20px #ea4335, 0 0 40px rgba(234, 67, 53, 0.5);
}
.period-nav-item[data-period="5"].active .period-nav-dot {
    box-shadow: 0 0 20px #9c27b0, 0 0 40px rgba(156, 39, 176, 0.5);
}
.period-nav-item[data-period="6"].active .period-nav-dot {
    box-shadow: 0 0 20px #00bcd4, 0 0 40px rgba(0, 188, 212, 0.5);
}
.period-nav-item[data-period="7"].active .period-nav-dot {
    box-shadow: 0 0 20px #ff9800, 0 0 40px rgba(255, 152, 0, 0.5);
}
.period-nav-item[data-period="8"].active .period-nav-dot {
    box-shadow: 0 0 20px #e91e63, 0 0 40px rgba(233, 30, 99, 0.5);
}

.period-nav-item.active {
    color: #1a1a1a;
    font-weight: 700;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px 8px;
    margin: -12px 0;
    border-radius: 12px;
}

/* Active state with period-specific colors - much more prominent */
.period-nav-item[data-period="1"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.3), 0 4px 12px rgba(66, 133, 244, 0.2);
}
.period-nav-item[data-period="2"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.3), 0 4px 12px rgba(52, 168, 83, 0.2);
}
.period-nav-item[data-period="3"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(251, 188, 4, 0.3), 0 4px 12px rgba(251, 188, 4, 0.2);
}
.period-nav-item[data-period="4"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(234, 67, 53, 0.3), 0 4px 12px rgba(234, 67, 53, 0.2);
}
.period-nav-item[data-period="5"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.3), 0 4px 12px rgba(156, 39, 176, 0.2);
}
.period-nav-item[data-period="6"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.3), 0 4px 12px rgba(0, 188, 212, 0.2);
}
.period-nav-item[data-period="7"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.3), 0 4px 12px rgba(255, 152, 0, 0.2);
}
.period-nav-item[data-period="8"].active {
    background: white;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.3), 0 4px 12px rgba(233, 30, 99, 0.2);
}

.period-nav-label {
    text-align: center;
    line-height: 1.3;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    padding: 18px 20px;
    background: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-weight: 600;
    color: #4285f4;
}

/* Period Header */
.period-header {
    margin-top: 80px;
    position: relative;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.9), rgba(52, 100, 200, 0.85));
    color: white;
    padding: 60px 80px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.period-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('assets/images/ankgor-wat.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: 0;
}

.period-header-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.period-header h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 3.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.15;
}

.period-dates {
    font-size: 1.3rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    opacity: 0.95;
}

/* Featured Image - Floated Right (C1 Layout) */
.period-featured-image {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  max-width: 400px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.period-featured-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  object-fit: cover;
  max-height: 320px;
}

/* Main Content */
.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 40px 100px;
    position: relative;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 60px;
}

.action-btn {
    padding: 16px 36px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 2px solid #4285f4;
    font-family: inherit;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-btn-primary {
    background: #4285f4;
    color: white;
}

.action-btn-primary:hover {
    background: #3367d6;
    border-color: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.action-btn-secondary {
    background: white;
    color: #4285f4;
}

.action-btn-secondary:hover {
    background: rgba(66, 133, 244, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

/* Content Area */
.content-area p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #333;
}

.content-area img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 8px;
}

/* Sources link at bottom of extended history pages */
.sources-link-wrapper {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

/* Intro page specific: larger first paragraph */
body:has(.action-buttons) .content-area > p:first-of-type {
    font-size: 1.2rem;
    font-weight: 400;
    color: #1a1a1a;
}

/* Sources Page Specific Styling */
.content-area h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 2rem;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

.content-area h2:first-of-type {
    margin-top: 1.5rem;
}

/* Extended history pages: make H2s larger */
body:has(.sources-link-wrapper) .content-area h2 {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
}

body:has(.sources-link-wrapper) .content-area h2:first-of-type {
    margin-top: 2rem;
}

.content-area h3 {
    font-family: 'Lato', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
    line-height: 1.3;
}

/* Source button styling */
.source-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: flex-start;
}

/* Remove any extra spacing from buttons in groups */
.source-buttons-group > .source-btn {
    margin: 0 !important;
}

.source-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #4285f4;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
}

.source-btn:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.source-btn .external-icon {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Previous/Next Navigation - Desktop */
.period-nav-arrows {
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 100;
}

.period-nav-arrows-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.nav-arrow {
    position: absolute;
    top: 0;
    pointer-events: auto;
    text-decoration: none;
    color: #666;
    background: white;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-arrow:hover {
    background: #4285f4;
    color: white;
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.3);
}

.nav-arrow-prev {
    left: 0;
    padding: 12px 20px 12px 16px;
}

.nav-arrow-prev:hover {
    transform: translateX(-5px);
}

.nav-arrow-next {
    right: 0;
    padding: 12px 16px 12px 20px;
}

.nav-arrow-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.nav-arrow-label {
    white-space: nowrap;
}

/* Previous/Next Navigation - Mobile */
.period-nav-mobile {
    display: none;
    gap: 1rem;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e0e0e0;
}

.nav-btn-mobile {
    flex: 1;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    font-family: inherit;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-btn-mobile:hover {
    border-color: #4285f4;
    color: #4285f4;
    background: rgba(66, 133, 244, 0.05);
}

@media (max-width: 1024px) {
    .period-nav-arrows {
        display: none;
    }

    .period-nav-mobile {
        display: flex;
    }

    .period-featured-image {
        max-width: 300px;
        right: 40px;
    }
}

/* Medium screens - reduce font size to help titles stay on one line */
@media (max-width: 1200px) {
    .period-header h1 {
        font-size: 3rem;
        line-height: 1.1;
    }
}

@media (max-width: 900px) {
    .period-nav-container {
        flex-direction: column;
        display: none;
        padding: 0;
    }

    .period-nav-container::before {
        display: none;
    }

    .period-nav-container.active {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .period-nav-item {
        flex-direction: row;
        gap: 15px;
        padding: 15px 20px;
        border-bottom: 1px solid #e0e0e0;
        border-left: 4px solid transparent;
        justify-content: flex-start;
        margin: 0;
    }

    .period-nav-label {
        text-align: left;
        font-size: 0.9rem;
        flex: 1;
    }

    .period-nav-item.active {
        border-bottom: 1px solid #e0e0e0;
        font-weight: 700;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
        border-top: none;
        padding: 15px 20px;
    }

    .period-nav-item[data-period="1"].active {
        border-left-color: #4285f4;
        background: rgba(66, 133, 244, 0.12);
    }
    .period-nav-item[data-period="2"].active {
        border-left-color: #34a853;
        background: rgba(52, 168, 83, 0.12);
    }
    .period-nav-item[data-period="3"].active {
        border-left-color: #fbbc04;
        background: rgba(251, 188, 4, 0.12);
    }
    .period-nav-item[data-period="4"].active {
        border-left-color: #ea4335;
        background: rgba(234, 67, 53, 0.12);
    }
    .period-nav-item[data-period="5"].active {
        border-left-color: #9c27b0;
        background: rgba(156, 39, 176, 0.12);
    }
    .period-nav-item[data-period="6"].active {
        border-left-color: #00bcd4;
        background: rgba(0, 188, 212, 0.12);
    }
    .period-nav-item[data-period="7"].active {
        border-left-color: #ff9800;
        background: rgba(255, 152, 0, 0.12);
    }
    .period-nav-item[data-period="8"].active {
        border-left-color: #e91e63;
        background: rgba(233, 30, 99, 0.12);
    }

    .period-header {
        padding: 60px 30px;
        margin-top: 56px;
        flex-direction: column;
    }

    .period-featured-image {
        position: static;
        transform: none;
        max-width: 90%;
        margin: 20px auto 0;
        right: auto;
    }

    .period-header h1 {
        font-size: 2.5rem;
        line-height: 1.15;
    }

    .period-dates {
        font-size: 1.1rem;
    }

    .main-content {
        padding: 40px 24px 80px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-btn {
        justify-content: center;
    }

    .period-nav-mobile {
        flex-direction: column;
    }
}
