/* ============================================================================
   CSS for Dudley Community Climate Justice Archive
   ============================================================================
   
   This stylesheet contains all the styles for the archive website.
   
   STRUCTURE:
   1. Global Reset & Variables
   2. Typography & Links
   3. Layout (Header, Footer, Main Content)
   4. Story Grid & Popups
   5. Filter System
   6. Responsive Design (Mobile/Tablet/Desktop)
   
   For learning about CSS properties, visit:
   https://developer.mozilla.org/en-US/docs/Web/CSS
   
   For learning about responsive design:
   https://web.dev/responsive-web-design-basics/
*/

/* ============================================================================
   GLOBAL RESET
   ============================================================================
   
   Sets box-sizing to border-box for all elements. This means padding and
   border are included in width/height calculations instead of being added.
*/
* {
    box-sizing: border-box;
}

html {
    /* 
       Base font size - all rem units calculate from this
       1rem = 18px
    */
    font-size: 18px;
}

/* ============================================================================
   CSS VARIABLES (Custom Properties)
   ============================================================================
   
   These variables store reusable values. Reference them throughout the
   stylesheet with var(--variable-name). Change the value here to update
   it everywhere it's used.
*/
:root {
    /* Background Colours */
    --background: #FFFAF3;          /* Cream background */
    --white: #ffffff;
    --highlight-yellow: #FFFF99;    /* Used for hovers */
    --light-gray: var(--light-gray);
    --light-blue: var(--light-blue);
    --border-gray: var(--border-gray);
    
    /* Text Colours */
    --black: #000;
    --white-text: #FFF;
    --gray-text: #666;
    --black-alt: #000000;
    
    /* Shadow Colours - RGBA values for transparency */
    --shadow-light: rgba(0, 0, 0, 0.1);      /* 10% opacity */
    --shadow-medium: rgba(0, 0, 0, 0.15);    /* 15% opacity */
    --shadow-dark: rgba(0, 0, 0, 0.2);       /* 20% opacity */
    --shadow-darker: rgba(0, 0, 0, 0.25);    /* 25% opacity */
    --shadow-darkest: rgba(0, 0, 0, 0.3);    /* 30% opacity */
    --shadow-scroll-track: rgba(0, 0, 0, 0.1);
    --shadow-scroll-thumb: rgba(0, 0, 0, 0.3);
    --shadow-scroll-thumb-hover: rgba(0, 0, 0, 0.5);
    --shadow-text: rgba(0, 0, 0, 0.50);
    --shadow-heavy: #00000040;
}

/* ============================================================================
   BODY
   ============================================================================
   
   Base styles for the <body> element.
*/
body {
    background-color: var(--background);    /* #FFFAF3 cream colour */
    font-family: 'Times New Roman', serif;  /* Serif font */
    max-width: 100vw;                       /* 100% of viewport width */
    overflow-x: hidden;                     /* Hides horizontal scrollbar */
}

/* ============================================================================
   LINKS & HOVER EFFECTS
   ============================================================================ */

/* a - Base link style */
a {
    color: var(--black);
}

/*
   Content Link Hover Effect
   
   Uses a ::before pseudo-element positioned absolutely behind the link
   to create a yellow highlight box on hover.
   
   Applied to links in: .story-finding, .story-metadata, .footer-content,
   and header h1. Excludes .tag elements.
*/

/* Sets positioning context for the ::before pseudo-element */
.story-finding a,
.story-metadata a:not(.tag),
.footer-content a,
header h1 a {
    position: relative;              /* Creates positioning context */
}

/* Creates the highlight box */
.story-finding a::before,
.story-metadata a:not(.tag)::before,
.footer-content a::before,
header h1 a::before {
    content: '';                     /* Required for pseudo-element */
    position: absolute;              /* Positions relative to the link */
    inset: -5px;                     /* Shorthand for top/right/bottom/left: -5px */
    background: transparent;         /* Invisible by default */
    z-index: -1;                     /* Behind the link text */
}

/* Shows the yellow background on hover */
.story-finding a:hover::before,
.story-metadata a:not(.tag):hover::before,
.footer-content a:hover::before,
header h1 a:hover::before {
    background: var(--highlight-yellow);  /* Makes the box visible */
}

/* These links don't get the hover effect */
.related-story a:hover,
.story a:hover,
.story-nav-arrow a:hover {
    background: none;
}

/* ============================================================================
   LAYOUT & SPACING
   ============================================================================
   
   Page-specific margin overrides.
*/

/* header.homepage
   Narrower margins for homepage header */
header.homepage {
    margin-left: 1.11111rem;    /* 20px */
    margin-right: 1.11111rem;
}

/* .homepage-content
   Side margins for homepage content area */
.homepage-content {
    margin-left: 2.22222rem;    /* 40px */
    margin-right: 2.22222rem;
}

/* .main-content.wander
   Side margins for wander page */
.main-content.wander {
    margin-left: 2.22222rem;
    margin-right: 2.22222rem;
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */

/* header
   Main site header (sticks to top when scrolling) */
header {
    font-family: Arial, sans-serif;
    margin-left: 2.222222rem;
    margin-right: 2.222222rem;
    position: sticky;               /* Remains visible during scroll */
    top: 0;
    z-index: 101;                   /* Above popups (z-index: 100) */
    padding: 1.11111rem 0;          /* 20px top and bottom */
}

/* .main-header
   Layout for header - site title on left, navigation on right */
.main-header {
    display: flex;
    justify-content: space-between;  /* Pushes children apart */
    align-items: center;             /* Vertically centers */
}

/* header h1
   Site title "Dudley Time Portal" */
header h1 {
    color: var(--black);
    font-family: Arial;
    font-size: 22px;
    font-style: normal;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.22px;
}

/* header h1 a
   Site title link (no underline by default) */
header h1 a {
    text-decoration: none;
}

/* header h1 a:hover
   Site title link hover (adds underline) */
header h1 a:hover {
    text-decoration: underline;
}

/* header p
   Paragraphs in header area */
header p {
    text-transform: lowercase;
    color: var(--black);
    font-family: Arial;
    font-size: 1.22222rem;           /* 22px */
    font-style: normal;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.01222rem;
}

/* .header-nav
   Holds the Wander/Archive/Random/Add navigation buttons */
.header-nav {
    display: flex;
    gap: 20px;                       /* Space between buttons */
}

/* .header-nav .dashed-button
   Navigation buttons (Wander, Archive, Random, Add) */
.header-nav .dashed-button {
    height: 41px;
    padding: 5px 10px;
    text-transform: lowercase;
}

/* .header-nav .dashed-button:hover
   Navigation button hover state (repeats padding to prevent movement) */
.header-nav .dashed-button:hover {
    padding: 5px 10px;
}

/* ============================================================================
   PAGE HEADINGS
   ============================================================================
   
   Headers for different sections and index pages.
*/

/* .tag-list-header, .wander-through-archive-header, .theme-index-header, .type-index-header
   Standard headers for tag/category pages
   - Serif font (Times New Roman) matches the body text
   - Larger size (32px) makes them prominent
   - Negative letter spacing tightens large text */
.tag-list-header,
.wander-through-archive-header,
.theme-index-header,
.type-index-header {
    color: var(--black);
    font-family: "Times New Roman";
    font-size: 1.77778rem;           /* 32px */
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: -0.03556rem;     /* Tighten large text */
}

/* .wander-through-archive-header (specific override)
   Extra large size for the main "Wander through archive" heading */
.wander-through-archive-header {
    margin-top: 40px;
    color: var(--black);
    font-family: "Times New Roman";
    font-size: 52px;                 /* Much larger than other headers */
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: -1.04px !important;  /* Proportionally tighter */
    margin-bottom: 1.66667rem;       /* 30px spacing below */
}

/* ============================================================================
   FILTER SYSTEM
   ============================================================================
   
   The filtering interface on the Archive page. Uses custom dropdown menus
   (not native <select> elements) for better styling control.
*/

/* .archive-filters
   Container for all filter dropdowns (Themes, Types, Weather)
   - Flexbox with wrap allows dropdowns to stack on small screens
   - Gap creates consistent spacing between dropdowns */
.archive-filters {
    display: flex;
    flex-wrap: wrap;                 /* Stack on small screens */
    gap: 1.11111rem;                 /* 20px between dropdowns */
    margin-bottom: 2.22222rem;       /* 40px below filters */
    align-items: flex-start;
}

/* .filter-dropdown
   Individual dropdown container (one for each filter type)
   - Relative positioning for absolutely positioned dropdown content */
.filter-dropdown {
    position: relative;              /* For absolute dropdown content */
    min-width: 200px;                /* Dropdowns don't get too narrow */
}

/* .filter-dropdown-button
   The button that opens/closes a filter dropdown
   - Dashed border changes to solid on hover/focus for feedback
   - Full width fills the dropdown container
   - Flexbox spreads text left, arrow right */
.filter-dropdown-button {
    background: var(--Background);
    border: 2px dashed var(--black); /* Dashed = not active */
    font-family: Arial, sans-serif;
    font-size: 1.22222rem;           /* 22px */
    font-weight: 400;
    color: var(--black);
    padding: 0.27778rem 0.55556rem;  /* 5px 10px */
    width: 100%;                     /* Fill container */
    display: flex;
    justify-content: space-between;  /* Text left, arrow right */
    align-items: center;
    cursor: pointer;                 /* Shows it's clickable */
    letter-spacing: -0.01222rem;
    line-height: 1.4;
}

/* .filter-dropdown-button:hover
   Hover state - border becomes solid for feedback */
.filter-dropdown-button:hover {
    border-style: solid;             /* Dashed → solid */
}

/* .filter-dropdown-button:focus
   Focus state (keyboard navigation) - same as hover */
.filter-dropdown-button:focus {
    outline: none;                   /* Remove default browser outline */
    border-style: solid;             /* Our custom focus indicator */
}

/* .dropdown-arrow
   The down arrow (▼) in the dropdown button
   - Could rotate when dropdown opens (handled by JavaScript) */
.dropdown-arrow {
    font-size: 1rem;
    transition: transform 0.2s ease; /* Smooth rotation animation */
}

.filter-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.filter-dropdown.open .filter-dropdown-button {
    border-style: solid;
    border-bottom: none;
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--Background);
    border: 2px solid var(--black);
    border-top: none;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.55556rem;
}

.filter-dropdown.open .filter-dropdown-content {
    display: block;
}

.filter-tag-option {
    display: inline-block;
    width: fit-content;
    padding: 0.27778rem 0.55556rem;
    margin-bottom: 0.27778rem;
    border: none;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 1.22222rem;
    font-weight: 400;
    letter-spacing: -0.01222rem;
    text-transform: lowercase;
    text-align: center;
    transition: opacity 0.2s ease;
}

.filter-tag-option:hover {
    opacity: 0.8;
}

.filter-tag-option.selected {
    position: relative;
}

.filter-tag-option.selected::after {
    content: '✓';
    position: absolute;
    right: -1.11111rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: var(--black);
}

.filter-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55556rem;
    min-width: 120px;
    margin-top: 0.27778rem;
}

.clear-filters-btn {
    font-size: 1rem;
    padding: 0.33333rem 0.66667rem;
    white-space: nowrap;
}

.filter-count {
    font-family: Arial, sans-serif;
    font-size: 0.88889rem;
    color: var(--gray-text);
    text-align: center;
    line-height: 1.2;
}

/* Active Filters Display

Shows currently applied filters as removable tags below the filter controls.
*/
.active-filters {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55556rem;
}

.active-filters-label {
    font-family: Arial, sans-serif;
    font-size: 1rem;
    color: var(--black);
    font-weight: 400;
    margin-right: 0.55556rem;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.33333rem;
}

/* .active-filter-tag
   Individual tag showing an active filter (e.g., "Climate Change × ")
   - Displayed above the story grid to show what filters are applied
   - Background color matches the tag's theme color (set by JavaScript)
   - Includes an × button to remove the filter */
.active-filter-tag {
    display: inline-flex;
    align-items: center;
    font-family: Arial, sans-serif;
    font-size: 0.88889rem;          /* 16px - slightly smaller than body */
    padding: 0.22222rem 0.44444rem; /* 4px 8px */
    gap: 0.33333rem;                /* Space between text and × */
    border: none;
    cursor: pointer;                /* Whole tag is clickable to remove */
    /* Background and text color set by JavaScript based on tag color */
}

/* .active-filter-tag:hover
   Hover state - slight transparency shows it's interactive */
.active-filter-tag:hover {
    opacity: 0.8;                   /* Slight fade on hover */
}

/* .active-filter-remove
   The × button within an active filter tag
   - Inherits color from parent for good contrast
   - No background or border - just the × character */
.active-filter-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.11111rem;          /* Slightly larger than tag text */
    line-height: 1;                 /* Tight line height for × */
    padding: 0;
    margin: 0;
    /* Color inherited from parent .active-filter-tag */
}

/* .active-filter-remove:hover
   Hover state for the × - extra transparency */
.active-filter-remove:hover {
    opacity: 0.7;                   /* More faded than tag hover */
}

/* ============================================================================
   FILTER UI STATES
   ============================================================================
   
   Visual feedback for filtering operations and results.
*/

/* .stories-list.filtering
   Loading state when filters are being applied
   - Faded out and non-interactive while JavaScript updates the grid */
.stories-list.filtering {
    opacity: 0.6;                    /* Fade to show it's updating */
    pointer-events: none;            /* Disable clicks during update */
}

/* .filter-loading
   Loading message (hidden by default, shown by JavaScript if needed) */
.filter-loading {
    display: none;                   /* Hidden by default */
    font-family: Arial, sans-serif;
    font-size: 0.88889rem;
    color: var(--gray-text);
    text-align: center;
    padding: 1.11111rem;
}

/* .filter-loading.visible
   Loading message when visible */
.filter-loading.visible {
    display: block;
}

/* ============================================================================
   NO RESULTS MESSAGE
   ============================================================================
   
   Friendly message shown when filters match no stories.
*/

/* .no-results
   Container for "no results" message
   - Takes full width of the grid
   - Dashed border matches the filter aesthetic
   - Centered content with generous padding */
.no-results {
    grid-column: 1 / -1;             /* Span all grid columns */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 20rem;               /* Tall enough to be noticeable */
    padding: 2.22222rem;
    background: var(--Background);
    border: 2px dashed var(--black); /* Matches filter dropdowns */
    text-align: center;
}

/* .no-results-content h3
   "No stories found" heading */
.no-results-content h3 {
    font-family: Arial, sans-serif;
    font-size: 1.66667rem;           /* 30px - prominent */
    font-weight: 400;                /* Regular weight */
    margin-bottom: 1.11111rem;
    color: var(--black);
}

/* .no-results-content p
   Explanation text
   - Grey color makes it secondary to the heading
   - Max width keeps lines readable */
.no-results-content p {
    font-family: Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.55556rem;
    color: var(--gray-text);         /* Lighter than main text */
    max-width: 28rem;                /* ~500px - comfortable reading width */
}

/* .no-results-content .clear-link
   "Clear all filters" link within the no results message
   - Styled as an underlined link (not a button) */
.no-results-content .clear-link {
    background: none;
    border: none;
    color: var(--black);
    text-decoration: underline;      /* Looks like a link */
    font-family: Arial, sans-serif;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
}

/* .no-results-content .clear-link:hover
   Hover removes underline (opposite of normal links) */
.no-results-content .clear-link:hover {
    text-decoration: none;
}

/* Stories Container Spacing */
.archive .stories-list {
    margin-top: 2.22222rem;
    padding: 0 2.22222rem;
}

/* Responsive Filter Layout */
@media (max-width: 768px) {
    .archive-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 0 1.11111rem;
    }
    
    .archive-filters-container {
        padding: 1rem 1.11111rem;
    }
    
    .archive .stories-list {
        padding: 0 1.11111rem;
    }
    
    .archive-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-dropdown {
        min-width: auto;
        width: 100%;
    }
    
    .filter-dropdown-content {
        max-height: 300px;
    }
    
    .filter-tag-option {
        font-size: 1.11111rem;
        padding: 0.33333rem 0.55556rem;
    }
    
    .filter-actions {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.55556rem;
        width: 100%;
    }
    
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .active-filters-label {
        margin-right: 0;
        margin-bottom: 0.33333rem;
    }
    
    .no-results {
        min-height: 15rem;
        padding: 1.11111rem;
    }
    
    .no-results-content h3 {
        font-size: 1.33333rem;
    }
}

/* ============================================================================
   TAGS
   ============================================================================
   
   Tags are used throughout the archive to show themes, types, weather, and
   other categories. Each tag has a colour (set inline by Go templates) that
   represents its category.
*/

/* .tag-list
   Displays tags in a wrapping row (used on index pages and story pages) */
.tag-list {
    display: flex;
    flex-wrap: wrap;                 /* Tags wrap to new lines */
    gap: 10px;                       /* 10px between each tag */
    list-style-type: none;           /* No bullets */
}

/* .tag-list-container
   Adds large bottom margin to sections containing tag lists */
.tag-list-container {
    margin-bottom: 6.66667rem;       /* 120px */
}

/* ul.tag-list
   Removes default left padding when tag list is a <ul> element */
ul.tag-list {
    padding-inline-start: 0;
}

/* .tag
   Small pill-shaped tags for themes, types, weather (background color set inline) */
.tag {
    align-items: center;
    background-color: var(--black);  /* Default background */
    color: var(--white-text);
    display: flex;
    font-family: Arial;
    font-size: 0.77778rem;           /* 14px */
    font-style: normal;
    font-weight: 400;
    gap: 0.55556rem;
    justify-content: center;
    letter-spacing: -0.00778rem;
    line-height: 140%;
    padding: 0.11111rem 0.27778rem 0.16667rem 0.27778rem;  /* 2px 5px 3px 5px */
    text-decoration: none;
    text-transform: lowercase;
    width: fit-content;
}

/* .tag:hover
   All tags turn black on hover (!important overrides inline styles) */
.tag:hover {
    background: #000 !important;
}

/* a.tag
   Maintains tag padding when tag is a link */
a.tag {
    margin: 0;
    padding: 0.11111rem 0.27778rem 0.16667rem 0.27778rem;
}

/* .tag.large
   Larger tag size used in headers */
.tag.large {
    font-size: 1.22222rem;           /* 22px */
    justify-content: center;
    letter-spacing: -0.01222rem;
    padding: 0.27778rem 0.55556rem;  /* 5px 10px */
}

/* .tag.medium
   Medium-sized tags (between default and large) */
.tag.medium {
    font-family: Arial;
    gap: 10px;
    height: 41;
    padding-bottom: 5px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 5px;
    width: 82;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -1%;
    line-height: 140%;
    text-transform: lowercase;
}

/* Story Images

Images within story content, limiting width while maintaining aspect ratio.
*/
.story img {
    max-width: 300px;
    height: auto;
}

/* Stories Grid

A responsive 3-column layout for stories.
*/
.stories-list {
    display: grid;
    /* 
    Creates a responsive 3-column layout:
    - auto-fill: Creates as many columns as will fit
    - minmax: Sets minimum and maximum column widths
    - calc: Calculates column width accounting for gaps
    */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, calc((100% - 11.11112rem) / 3)), 1fr));
    gap: 5.55556rem;
}

/* Homepage Stories

Stories hidden by default until JavaScript randomizes them.
*/
.stories-list.homepage, .stories-list.wander {
    visibility: hidden;
}

/* Visible Homepage Stories

Stories after JavaScript randomization completes.
*/
.stories-list.homepage.visible, .stories-list.wander.visible {
    visibility: visible;
}

/* Story Image Container

The story image and navigation arrows.
*/
/* Story Attachment Navigation Container
Navigation wrapper that contains arrows and attachment content.
*/
.story-attachment-navigation {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    margin: 0;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 0;
    width: 100%;
}

.story-image-container {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    margin: 0;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 0;
    width: 100%;
    flex: 1;
}

/* Story Image

The main image for individual stories.
*/
.story-image {
    width: 100%;
    height: auto;
    max-height: 30.22222rem;
    object-fit: contain;
}

/* Story Audio

Audio player display for main story attachments, centered between navigation arrows.
*/
.story-audio {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 200px;
}

.story-audio audio {
    max-width: 100%;
}

/* Story Document

Document download display for main story attachments, centered between navigation arrows.
*/
.story-document {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 200px;
    text-align: center;
}

.story-document .document-icon {
    margin-bottom: 1rem;
}

.story-document .download-link {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    border: 2px solid #000;
    text-decoration: none;
    color: #000;
    transition: background-color 0.3s ease;
}

.story-document .download-link:hover {
    background-color: #000;
    color: #fff;
}

/* Story No Attachments

Discrete display when story has no attached media, centered and subtle.
*/
.story-no-attachments {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 150px;
    text-align: center;
    color: #999;
}

.no-attachment-placeholder {
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.no-attachment-placeholder svg {
    width: 32px;
    height: 32px;
    stroke: #ccc;
}

.story-no-attachments p {
    font-family: 'Times New Roman', serif;
    font-size: 1.22222rem;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.02rem;
    color: #aaa;
    margin: 0;
}

/* Story Details

The main content and metadata for a story.
*/
.story-details {
    border-top: 1px solid #000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 60px;
    margin-left: 2.22222rem;
    margin-right: 2.22222rem;
    margin-top: 60px;
    padding-bottom: 60px;
    padding-top: 60px;
}

/* Story Finding

The main text content of a story.
*/
.story-finding {
    font-family: 'Times New Roman', serif;
    font-size: 1.22222rem;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.02rem;
    width: 32.22222rem;
    margin-bottom: 60px;
}

/* Story Metadata

All metadata items for a story.
*/
.story-metadata {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.11111rem;
    width: 100%;
}


.story-metadata-item-group {
    display: flex;
    flex-direction: column;
    gap: 1.11111rem;
}

/* Story Metadata Item

A single metadata item with label and value.
*/
.story-metadata-item {
    display: flex;
    flex-direction: column;
    font-family: Arial;
    font-size: 1.22222rem;
    font-style: normal;
    font-weight: 400;
    gap: 0.27778rem;
    letter-spacing: -0.00778rem;
    line-height: 140%;
    width: 100%;
}

/* Story Metadata Label

Labels for metadata fields (e.g., "Date", "Location").
*/
.story-metadata-item-label {
    font-size: 0.88889rem;
    color: var(--shadow-text);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Story Metadata Value

Values for metadata fields.
*/
.story-metadata-item-value {
    color: var(--black);
}

/* Tag-based Metadata

Tag-based metadata like themes and types.
*/
.story-metadata-item-value.tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.55556rem;
}

.story-metadata-item-value.tags .tag {
    font-size: 1.22222rem;
}

/* Related Stories Container

The related stories section.
*/
.related-stories-container {
    display: flex;
    flex-direction: column;
    gap: 6.66667rem;
    padding-left: 2.22222rem;
    padding-right: 2.22222rem;
    margin-bottom: 6.66667rem;
}

/* Related Story Image

Thumbnail images for related stories.
*/
.related-story-image {
    height: auto;
    max-width: 8.33333rem;
    object-fit: cover;
}

/* Related Stories Grid

A grid of related stories.
*/
.related-stories {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5.56rem;
}

/* Related Story Item

A single related story in the grid.
*/
.related-story {
    grid-column: auto;
}

/* Related Story Title

The title of a related story.
*/
.related-stories-item-title {
    color: var(--black);
    font-family: Arial;
    font-size: 1.22222rem;
    font-style: normal;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.01222rem;
    text-transform: lowercase;
    margin-bottom: 1.11111rem;
}

/* Related Story Title Tag

Tags within related story titles.
*/
.related-stories-item-title .tag {
    display: inline-block;
}

/* Story Navigation Arrow

Navigation arrows between stories.
*/
.story-nav-arrow {
    padding: 0 1.82rem;
    flex-shrink: 0;
}

.standard-margins {
    margin-left: 40px;
    margin-right: 40px;
}

/* Theme and Type Index Headers

Headers for theme and type index pages.
*/
.theme-index-header,
.type-index-header,
.weather-index-header
{
    margin-bottom: 4rem;
    font-family: Arial;
    font-weight: 400;
    font-size: 22px;
    line-height: 140%;
    letter-spacing: -1%;
    text-transform: lowercase;
    margin-left: 40px;
    margin-right: 40px;
    margin-top: 20px;
}

/* Theme and Type Index Tags

Tags within theme and type index headers.
*/
.theme-index-header .tag,
.type-index-header .tag,
.weather-index-header .tag {
    display: inline-block;
    margin-right: 1rem;
}

/* Main Footer

The site footer with contact information and additional content.
*/
footer {
    padding: 5.55556rem 2.22222rem;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

/* Footer Address

Contact information in the footer.
*/
footer address {
    color: var(--black);
    font-family: Arial;
    font-size: 1.22222rem;
    font-style: normal;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.00778rem;
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-skip-ink: auto;
    text-decoration-thickness: auto;
    text-underline-offset: auto;
    text-underline-position: from-font;
}

/* Footer Content

The main content area in the footer.
*/
.footer-content {
    color: var(--black);
    font-family: "Times New Roman";
    font-size: 1.77778rem;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: -0.03556rem;
    width: 43.72222rem;
}

/* Footer Content Paragraphs

Paragraphs within the footer content.
*/
.footer-content div {
    margin-bottom: 1.11111rem;
}

/* Compilation Information

Copyright and compilation information in the footer.
*/
.compilation-information {
    color: var(--black);
    font-family: Arial;
    font-size: 0.77778rem;
    font-style: normal;
    font-weight: 400;
    line-height: 140%;
    letter-spacing: -0.00778rem;
    margin-top: 2.22222rem;
}

.homepage-collage {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-bottom: 2rem;
    text-align: center;
}

.homepage-collage img {
    width: 100%;
    height: auto;
    max-height: none;
    display: block;
}

.what-if-rotation {
    margin-top: 80px;
    position: relative;
    min-height: 200px;
    max-width: 900px;
}

.what-if-rotation-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    visibility: visible;
}

.what-if-rotation-item.hide {
    visibility: hidden;
    pointer-events: none;
}

.what-if-rotation-item-text {
    opacity: 1;
    transition: opacity 2.5s cubic-bezier(0.4, 0, 0.6, 1);
    position: absolute;
    width: 100%;
}

.what-if-rotation-item.hide .what-if-rotation-item-text {
    opacity: 0;
}

.what-if-rotation-item.fade-out .what-if-rotation-item-text {
    opacity: 0;
}

.what-if-rotation-item-title {
    width: fit-content;
    height: 47px;
    gap: 10px;
    padding: 5px;
    background: var(--highlight-yellow);
    font-family: Times New Roman;
    font-weight: 400;
    font-style: italic;
    font-size: 32px;
    line-height: 100%;
    letter-spacing: -2%;
    margin-bottom: 5px;
}

.what-if-rotation-item-text {
    font-family: Times New Roman;
    font-weight: 400;
    font-size: 32px;
    line-height: 100%;
    letter-spacing: -2%;
}

/* Dashed Button

A button with a dashed border for navigation and actions.
*/
.dashed-button {
    align-items: center;
    background: var(--Background);
    border: 2px dashed var(--black);
    color: var(--black);
    display: flex;
    font-family: Arial;
    font-size: 1.22222rem;
    font-style: normal;
    font-weight: 400;
    gap: 0.55556rem;
    justify-content: center;
    letter-spacing: -0.01222rem;
    line-height: 140%;
    padding: 0.27778rem 0.55556rem;
    text-decoration: none;
    width: max-content;
}

.dashed-button:hover {
    border: 2px solid var(--black);
    background: none;
    padding: 0.27778rem 0.55556rem;
}

.story-popup {
    bottom: 0;
    display: none;
    left: 0;
    position: fixed;
    width: 100%;
    z-index: 1000;
    pointer-events: none;
    height: 80%;
}

.story-popup-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-popup img {
    background-color: white;
    box-shadow: 0px 10px 10px 0px var(--shadow-heavy);
    max-width: 40%;
}

.story-popup-text {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    padding: 10px;
    height: 185px;
    border-top: 1px solid var(--black-alt);
    padding-left: 40px;
    padding-right: 40px;
    padding-top: 20px;
    padding-bottom: 20px;
    pointer-events: auto;
}

.story-popup-text-finding {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.story-popup-text-finding-content {
    font-family: Times New Roman;
    font-weight: 400;
    font-size: 22px;
    line-height: 140%;
    letter-spacing: -2%;
    color: var(--black);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    /* or as many as fit */
    flex: 1 1 0%;
    min-height: 0;
    max-height: 100%;
}

.story-popup-view-link {
    flex-shrink: 0;
    margin-top: auto;
}

.story-popup-text-tags .tag {
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
    vertical-align: top;
}

.story-popup-text-tags {
    text-align: right;
}

/* Archive Header with Count and Clear Filters */
.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 2.22222rem;
    padding-top: 40px;
}

.archive-header-title {
    color: var(--black);
    font-family: "Times New Roman", serif;
    font-size: 2.88889rem;
    font-weight: 400;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.05778rem;
}

.clear-filters-button-top {
    background: var(--Background);
    border: none;
    color: var(--black);
    cursor: pointer;
    /* Hidden by default, shown when filters are active */
    display: none;
    align-items: center;
    gap: 0.27778rem;
    font-family: Arial, sans-serif;
    font-size: 1.22222rem;
    text-decoration: underline;
    padding: 0.27778rem 0.55556rem;
    letter-spacing: -0.01222rem;
}

.clear-filters-button-top.visible {
    display: flex;
}

.clear-filters-button-top:hover {
    opacity: 0.7;
}

.clear-filters-icon {
    font-size: 1.33333rem;
    font-weight: bold;
}

/* Sticky Filter Container */
.archive-filters-container {
    position: sticky;
    top: 5.88889rem;
    z-index: 100;
    padding: 1.66667rem 2.22222rem;
    padding-top: 0;
}

/* Archive Filters */
.archive-filters {
    display: flex;
    gap: 2.22222rem; /* 40px from Figma spacing */
    align-items: center;
    margin: 0 0 1.11111rem 0;
    flex-wrap: wrap;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.clear-filters-button {
    align-items: center;
    background: var(--Background);
    border: 2px dashed var(--black);
    color: var(--black);
    display: flex;
    font-family: Arial;
    font-size: 1.22222rem;
    font-style: normal;
    font-weight: 400;
    gap: 0.55556rem;
    justify-content: center;
    letter-spacing: -0.01222rem;
    line-height: 140%;
    padding: 0.27778rem 0.55556rem;
    text-decoration: none;
    width: max-content;
    cursor: pointer;
}

.clear-filters-button:hover {
    border: 2px solid var(--black);
    background: none;
    padding: 0.27778rem 0.55556rem;
}

.filter-count {
    font-family: Arial;
    font-size: 1rem;
    color: var(--gray-text);
}

.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-dropdown-button {
    align-items: center;
    background: var(--Background);
    border: 2px dashed var(--black);
    color: var(--black);
    display: flex;
    font-family: Arial;
    font-size: 1.22222rem;
    font-style: normal;
    font-weight: 400;
    gap: 0.55556rem;
    justify-content: center;
    letter-spacing: -0.01222rem;
    line-height: 140%;
    padding: 0.27778rem 0.55556rem;
    text-decoration: none;
    width: max-content;
    cursor: pointer;
    min-width: 120px;
}

.filter-dropdown-button:hover {
    border: 2px solid var(--black);
    background: none;
}

.filter-dropdown.open .filter-dropdown-button {
    border: 2px solid var(--black);
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--Background);
    border: 2px solid var(--black);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    top: 100%;
    left: 0;
}

.filter-dropdown.open .filter-dropdown-content {
    display: block;
}

.filter-tag-option {
    display: flex;
    align-items: center;
    padding: 0.55556rem;
    cursor: pointer;
    font-family: Arial;
    font-size: 1rem;
    border-bottom: 1px solid var(--border-gray);
}

.filter-tag-option:hover {
    background-color: var(--light-gray);
}

.filter-tag-option.selected {
    background-color: var(--light-blue);
}

/* Inspired By and Contributed To Sections
 *
 * New sections that appear at the bottom of story pages showing related content.
 */
.story-connections {
    border-bottom: 1px solid #000;
    display: flex;
    flex-direction: column;
    gap: 4.44444rem;
    margin-bottom: 6.66667rem;
    padding-bottom: 60px;
    margin-left: 2.22222rem;
    margin-right: 2.22222rem;
}

.story-connections-section {
    display: flex;
    flex-direction: column;
    gap: 2.22222rem;
}

.story-connections-title {
    color: var(--black);
    font-family: Arial, sans-serif;
    font-size: 1.22222rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.01222rem;
    margin: 0;
}

.story-connections-grid {
    display: flex;
    gap: 2.22222rem;
    flex-wrap: wrap;
}

/* Big Button Component
 *
 * Large button-like cards used for "Inspired by" and "Contributed to" sections.
 */
.big-button {
    border: 2px dashed var(--black);
    display: flex;
    gap: 1.11111rem;
    height: 6.66667rem;
    padding: 0.55556rem;
    align-items: center;
    width: 20.72222rem;
    text-decoration: none;
    color: var(--black);
    position: relative;
    flex-shrink: 0;
}

.big-button:hover {
    border-style: solid;
}

.big-button-image {
    width: 5.55556rem;
    height: 5.55556rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.big-button-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
    height: 100%;
}

.big-button-title {
    font-family: Arial, sans-serif;
    font-size: 1.22222rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.01222rem;
    color: var(--black);
    margin: 0 0 0.33333rem 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
}

.big-button-description {
    font-family: 'Times New Roman', serif;
    font-size: 0.88889rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.01778rem;
    color: var(--black);
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    text-overflow: ellipsis;
}

/* Responsive Layout for Big Buttons */
@media (max-width: 768px) {
    .story-connections {
        padding-left: 1.11111rem;
        padding-right: 1.11111rem;
        gap: 3.33333rem;
    }
    
    .story-connections-grid {
        flex-direction: column;
        gap: 1.11111rem;
    }
    
    .big-button {
        width: 100%;
        max-width: none;
    }
}

/* Connections View
 *
 * Interactive scattered layout for showing story connections on homepage
 * Creates an "infinite canvas" effect with a fixed viewport height
 */
.connections-view {
    position: relative;
    width: 100%;
    height: 843px;
    overflow: auto;
    scroll-behavior: smooth;
    margin-bottom: 6.66667rem;
    box-shadow: 0 0 5px 0 var(--shadow-darker) inset;
}

.connections-view::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.connections-view::-webkit-scrollbar-track {
    background: var(--shadow-light);
}

.connections-view::-webkit-scrollbar-thumb {
    background: var(--shadow-darkest);
    border-radius: 4px;
}

.connections-view::-webkit-scrollbar-thumb:hover {
    background: var(--shadow-scroll-thumb-hover);
}

.connections-canvas {
    position: relative;
    width: 5000px; /* Large internal canvas width */
    height: 3500px; /* Large internal canvas height */
    background-color: var(--white); /* White background */
    box-shadow: 0 0 5px 0 var(--shadow-darker) inset; /* Inset shadow for depth */
}

.connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 5000px; /* Match canvas width */
    height: 3500px; /* Match canvas height */
    pointer-events: none;
    z-index: 5;
}

.story-link-scattered {
    position: absolute;
    display: block;
    text-decoration: none;
    z-index: 2;
    width: auto;
    height: auto;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.3s ease;
}

.story-link-scattered:hover {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 8px 25px var(--shadow-dark);
}

.story-image-scattered {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
    display: block;
}

.story-link-scattered.connected {
    box-shadow: 0 4px 15px var(--shadow-medium);
    z-index: 10;
}

.story-link-scattered.highlighted {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 12px 35px var(--shadow-darkest);
}

.connections-view {
    margin-bottom: 6.66667rem;
}

/* Debug Console (Quake-style HUD)

A translucent heads-up display that slides in from the top when 'D' key is pressed.
Inspired by Quake console, using existing design elements.
*/
.debug-console {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 0.88889rem;
    border-bottom: 2px solid #333;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    backdrop-filter: blur(2px);
}

.debug-console-visible {
    transform: translateY(0);
}

.debug-console-content {
    display: flex;
    align-items: center;
    padding: 0.55556rem 1.11111rem;
    gap: 0.55556rem;
    max-width: 100vw;
    overflow: hidden;
}

.debug-item {
    color: #ccc;
    white-space: nowrap;
}

.debug-item strong {
    color: #fff;
    margin-left: 0.27778rem;
}

.debug-separator {
    color: #666;
}

.debug-link {
    color: #fff;
    text-decoration: none;
    padding: 0.11111rem 0.27778rem;
    border: 1px solid #555;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.debug-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #888;
}

.debug-close {
    color: #888;
    font-size: 0.77778rem;
    margin-left: auto;
}

/* Mobile responsiveness for debug console */
@media (max-width: 768px) {
    .debug-console-content {
        padding: 0.33333rem 0.55556rem;
        font-size: 0.77778rem;
        gap: 0.33333rem;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .debug-close {
        display: none;
    }
    
    .debug-item {
        flex-shrink: 0;
    }
}

/* Handle very long content gracefully */
@media (max-width: 480px) {
    .debug-console-content {
        font-size: 0.66667rem;
        gap: 0.22222rem;
    }
    
    .debug-item {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Story Navigation Buttons

Next and Previous navigation buttons for story pages, based on Figma design.
Uses cream background with dashed border and flexible layout.
*/
.story-navigation {
    display: flex;
    gap: 1.11111rem;
    margin-top: 3.33333rem;
    margin-bottom: 2.22222rem;
}

.story-nav-button {
    border: 2px dashed #000;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0.55556rem;
    text-decoration: none;
    color: #000;
    flex: 1;
    min-height: 6.66667rem;
    gap: 1.11111rem;
    transition: border-style 0.2s ease;
}

.story-nav-button:hover {
    border-style: solid;
}

.story-nav-button.previous {
    justify-content: flex-start;
}

.story-nav-button.next {
    justify-content: flex-end;
}

.story-nav-image {
    width: 5.55556rem;
    height: 5.55556rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.story-nav-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.story-nav-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.story-nav-button.previous .story-nav-text {
    align-items: flex-start;
    text-align: left;
}

.story-nav-button.next .story-nav-text {
    align-items: flex-end;
    text-align: right;
}

.story-nav-label {
    font-family: Arial, sans-serif;
    font-size: 1.22222rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.01222rem;
    margin: 0;
}

.story-nav-title {
    font-family: Arial, sans-serif;
    font-size: 0.88889rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -0.00889rem;
    margin: 0.22222rem 0 0 0;
    opacity: 0.7;
}

/* Mobile responsiveness for navigation */
@media (max-width: 768px) {
    .story-navigation {
        flex-direction: column;
        gap: 0.55556rem;
    }
    
    .story-nav-button {
        min-height: 5rem;
        gap: 0.77778rem;
    }
    
    .story-nav-image {
        width: 4rem;
        height: 4rem;
    }
    
    .story-nav-label {
        font-size: 1rem;
    }
    
    .story-nav-title {
        font-size: 0.77778rem;
    }
}
