/* --- 1. Global Reset & Core System Standardisation --- */
* {
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
}

/* --- 2. Centralised Light/Dark Color Systems --- */
:root {
    --bg-color: #e9e7e0;           /* Soft, warm off-white */
    --lightbox-content-bg: #faf9f5; /* Matches the popup background */
    --footer-bg: #dcdad2;    /* Updated to match */
    --lightbox-bg: rgba(250, 249, 245, 0.98); /* Updated to match */
    
    /* Keep all your other text and link colors exactly the same */
    --text-color: #333333;
    --heading-color: #000000;
    --link-color: #0066cc;
    --link-hover: #004499;
    --border-color: #eeeeee;
    --shadow-color: rgba(0, 0, 0, 0.06);
    --shadow-hover: rgba(0, 0, 0, 0.14);
    --switch-bg: #f0f0f0;
    --switch-border: #cccccc;
    --switch-knob: #ffffff;
}

[data-theme="dark"] {
    --bg-color: #121212; 
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --link-color: #4da6ff; 
    --link-hover: #80bfff;
    --border-color: #2c2c2c;
    --footer-bg: rgba(18, 18, 18, 0.9);
    --lightbox-bg: rgba(18, 18, 18, 0.98);
    --lightbox-content-bg: #1e1e1e;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --shadow-hover: rgba(0, 0, 0, 0.6);
    
    --switch-bg: #2a2a2a;
    --switch-border: #444444;
    --switch-knob: #e0e0e0;
}

/* --- 3. Body Layout Base Setup --- */
body {
    font-family: Georgia, Cambria, "Times New Roman", Times, serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    font-size: 1.15rem; 
    -webkit-font-smoothing: antialiased;
    padding-bottom: 110px; 
    margin-bottom: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 720px;
    margin: 18vh auto 5vh auto;
    padding: 0 2rem;
    opacity: 0;
    animation: initialLoadFade 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes initialLoadFade {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 4. Custom Mode Selection Slider Track --- */
.theme-switch-container {
    position: absolute;
    top: 2.5rem;
    right: 2.5rem;
    z-index: 100;
}

.theme-switch {
    display: inline-block;
    position: relative;
    width: 64px;
    height: 34px;
    cursor: pointer;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--switch-bg);
    border: 1px solid var(--switch-border);
    border-radius: 34px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.slider .icon {
    font-size: 1rem;
    user-select: none;
    z-index: 1;
}

.slider .knob {
    position: absolute;
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 3px;
    background-color: var(--switch-knob);
    border-radius: 50px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.theme-switch input:checked + .slider .knob {
    transform: translateX(30px);
}

.theme-switch input:focus-visible + .slider {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
}

/* --- 5. Editorial Typography & Layout Actions --- */
.intro {
    font-size: 2.2rem;
    font-weight: 400; 
    line-height: 1.4;
    color: var(--heading-color);
    margin-bottom: 3rem;
    letter-spacing: -0.02em;
    transition: color 0.3s ease;
}

a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid var(--link-color);
    transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover, a.active {
    color: var(--link-hover);
    border-bottom: 2px solid var(--link-hover);
}

.content-section {
    display: none;
    margin-top: 2.5rem;
    animation: sectionFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.content-section.active {
    display: block;
}

.content-section p {
    margin-bottom: 1rem;
}

@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 6. Media Asset Layout Grids & Brand Overlays --- */
.thumbnail, .game-cover {
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 0 4px 20px var(--shadow-color);
    transform-style: preserve-3d; /* Allows layered brand emblems to hover outward on Z-axis */
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.thumbnail:hover, .game-cover:hover {
    box-shadow: 0 20px 40px var(--shadow-hover);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
}

.thumbnail-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Interactive Brand Overlays on Ad Hover */
.thumbnail-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.72); 
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 4px;
    z-index: 2;
}

.brand-logo {
    max-width: 55%;
    max-height: 55%;
    object-fit: contain;
    opacity: 0;
    transform: translateZ(30px) scale(0.9); 
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.thumbnail:hover .thumbnail-overlay { opacity: 1; }
.thumbnail:hover .brand-logo {
    opacity: 1;
    transform: translateZ(30px) scale(1);
}

/* Games Gallery Grid */
.games-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    margin-top: 2.5rem;
}

.game-cover {
    height: auto;
    display: block;
    border-radius: 4px;
}

/* --- 7. Minimalist Fiction Tables --- */
.fiction-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2.5rem;
}

.fiction-table td {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    transition: border-color 0.3s ease;
}

.story-info {
    display: flex;
    flex-direction: column;
}

.story-title {
    font-weight: 200;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--heading-color);
    transition: color 0.3s ease;
}

.story-publisher {
    font-size: 0.95rem;
    color: #666666;
    margin-top: 0.2rem;
}

[data-theme="dark"] .story-publisher { color: #aaaaaa; }
.story-action { text-align: right; }

.btn {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background-color: transparent;
    color: var(--text-color) !important;
    border: 1px solid var(--text-color);
    border-radius: 3px;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color) !important;
}

/* --- 8. Blurred Persistent Sticky Footer --- */
.footer {
    position: fixed;
    bottom: 0; left: 0; right: 0; 
    padding: 1.5rem 0;
    text-align: center;
    background-color: var(--footer-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.95rem;
    z-index: 10;
    border-top: 1px solid var(--border-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer a {
    margin: 0 0.4rem;
    color: var(--text-color);
    border-bottom: none;
}

.footer a:hover {
    color: var(--link-color);
    border-bottom: 1px solid var(--link-color);
}

.footer .divider { color: #dddddd; user-select: none; }
[data-theme="dark"] .footer .divider { color: #333333; }

/* --- 9. Lightbox Scroll-Snap Slider System --- */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--lightbox-bg);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 850px;
    background: var(--lightbox-content-bg);
    border-radius: 4px;
    padding: 2.5rem 2rem 1.5rem 2rem;
    color: var(--text-color);
    box-shadow: 0 10px 50px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Horizontal Slider Matrix Viewport */
.lightbox-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: 4px;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.lightbox-slider::-webkit-scrollbar { display: none; }

.slider-item {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-item img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.slider-item .video-container {
    width: 100%;
    padding-bottom: 56.25%;
    position: relative;
    background: #000;
    border-radius: 4px;
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

/* Lightbox Navigation Control Elements */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.3rem;
    z-index: 1010;
    display: none; 
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav-btn:hover { background: rgba(0, 0, 0, 0.8); }
.nav-btn:active { transform: translateY(-50%) scale(0.92); }
.prev-btn { left: -60px; }
.next-btn { right: -60px; }

.close-btn {
    position: absolute;
    top: -45px; right: 0;
    background: none; border: none;
    color: var(--text-color);
    font-size: 2.5rem; cursor: pointer;
    line-height: 1;
}

.lightbox-meta { text-align: center; margin-top: 1rem; }

.lightbox-counter {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    opacity: 0.6;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
}

.lightbox-desc { font-size: 1.05rem; font-style: italic; }

/* --- 10. Responsive Breakpoint Customisation --- */
@media (max-width: 1024px) {
    .prev-btn { left: 10px; }
    .next-btn { right: 10px; }
    .lightbox-content { padding: 2.5rem 1rem 1rem 1rem; }
}

@media (max-width: 600px) {
    body { font-size: 1.05rem; }
    .theme-switch-container { top: 1.5rem; right: 1.5rem; }
    .container { margin: 14vh auto 5vh auto; padding: 0 1.5rem; }
    .intro { font-size: 1.75rem; margin-bottom: 2rem; }
    .games-gallery { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1.2rem; }
    .story-title { font-size: 1.1rem; }
    .close-btn { top: -40px; }
}

/* Unified container for both YouTube/Vimeo and raw MP4s */
.slider-item .video-container {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9; /* Forces pristine landscape dimensions */
    position: relative;
    background: #000000;
    border-radius: 4px;
    overflow: hidden;
}

/* Forces both media formats to sit perfectly inside the box without breaking out */
.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures nothing gets cropped or stretched */
    border: none;
    background: #000000;
}

/* --- 11. Large Screen Gallery Breakout --- */
@media (min-width: 1024px) {
    .gallery {
        /* Makes the grid 135% wider than the 720px text container (~970px wide) */
        width: 135%; 
        max-width: 1000px;
        
        /* Forces the over-extended grid to center itself perfectly */
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        
        /* Upgrades the grid layout to support 3 columns nicely on wide viewports */
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2.5rem;
    }
}

/* --- 12. Personalized Letter Pitch Styling Customizations --- */
.pitch-container {
    margin-top: 14vh;
}

.pitch-header h1 {
    margin-bottom: 1.5rem;
}

.lead-text {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 3rem;
    color: var(--heading-color);
}

.pitch-section {
    margin-bottom: 3.5rem;
}

.pitch-section h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--heading-color);
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

/* Minimalist Document & Media Attachment Layout Grid */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0 2rem 0;
}

.attachment-grid.single-item {
    grid-template-columns: minmax(260px, 340px);
}

.attachment-card {
    display: flex;
    align-items: center;
    background-color: transparent;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    padding: 0.8rem 1rem;
    text-decoration: none !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.attachment-card:hover {
    background-color: var(--border-color);
    border-color: var(--text-color) !important;
    transform: translateY(-2px);
}

/* Document Format Type Designations */
.file-icon {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    user-select: none;
}

.docx-type { background-color: #2b579a; color: #ffffff; }
.excel-type { background-color: #217346; color: #ffffff; }
.video-type { background-color: #ff0000; color: #ffffff; }

.file-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.file-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--heading-color);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.file-details {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    margin-top: 0.15rem;
}

/* Pitch Letter Closing Footer Sign-Off */
.pitch-closing {
    margin-top: 4rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 2rem;
}

.signature {
    font-size: 1.4rem;
    font-style: italic;
    margin-top: 0.5rem;
    color: var(--heading-color);
}

.pitch-contact-nav {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 4rem;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
}

.pitch-contact-nav a {
    border-bottom: none;
    color: var(--text-color);
}

.pitch-contact-nav a:hover {
    color: var(--link-color);
    border-bottom: 1px solid var(--link-color);
}

.pitch-contact-nav .slash {
    color: var(--border-color);
    user-select: none;
}

@media (max-width: 600px) {
    .pitch-container { margin-top: 10vh; }
    .lead-text { font-size: 1.15rem; margin-bottom: 2rem; }
    .attachment-grid { grid-template-columns: 1fr; }
    .attachment-grid.single-item { grid-template-columns: 1fr; }
}

footer a, 
footer a:hover, 
.main-footer a, 
.main-footer a:hover {
    border-bottom: none !important;      /* Stops global link underlines from adding height */
    transform: none !important;          /* Stops animations from breaking mouse tracking */
    box-shadow: none !important;         /* Stops glow shadows from altering dimensions */
}