/* CSS Variables */
:root {
  /* Typography - Title Font Options */
  --title-font: "Noto Sans", sans-serif;
  
  /* Typography - Body Font Options */
  --body-font: "Noto Sans", sans-serif;
  
  /* UI Font */
  --ui-font: "Noto Sans", sans-serif;
  
  /* Author Font */
  --author-font: "Lato", sans-serif;
  
  /* Font sizes */
  --base-font-size: 16px;
  --h1-size: 2.5rem;
  --h2-size: 1.6rem;
  --h3-size: 1.3rem;
  --h4-size: 1.1rem;
  --body-size: 1rem;
  --small-text: 0.9rem;
  --author-size: 1rem;
  
  /* Colors */
  --text-color: #333;
  --background-color: #efefef;
  --content-bg: #efefef;
  --footer-bg: #f5f5f5;
  --author-text: #6c757d;
  --footer-text: #adb5bd;
  --sim-bg: #f8f9fa;
  --card-bg: white;
  --card-shadow: rgba(0, 0, 0, 0.1);
  
  /* UI Colors */
  --primary-btn: #3a86ff;
  --primary-btn-hover: #2a75ee;
  --danger-btn: #ef476f;
  --danger-btn-hover: #e02f5a;
  --control-bg: #f8f9fa;
  --border-color: #e5e5e5;
  
  /* Layout */
  --content-width: 800px;
  --content-padding: 2rem 1rem;
  --section-spacing: 2.5rem;
  --simulation-width: 95vw;
  --simulation-max-width: 1400px;
}

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

body {
  background-color: var(--background-color);
  font-family: var(--ui-font);
  font-size: var(--base-font-size);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 120vh;
  margin: 0;
  padding: 0;
  color: var(--text-color);
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--title-font);
  line-height: 1.2;
  font-weight: 600;
}

h1 {
  font-size: var(--h1-size);
  margin-bottom: 1.2rem;
  margin-top: 2.5rem;
}

h2 {
  font-size: var(--h2-size);
  margin-top: var(--section-spacing);
  margin-bottom: 1.2rem;
}

h3 {
  font-size: var(--h3-size);
  margin-bottom: 1rem;
}

h4 {
  font-size: var(--h4-size);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

p {
  font-family: var(--body-font);
  font-size: var(--body-size);
  line-height: 1.5;
  margin-bottom: 1rem;
  color: var(--text-color);
}

/* Styling for links within content paragraphs */
.content p a {
  color: #118ab2; /* Default link color */
  text-decoration: none; /* Remove underline */
  transition: color 0.2s ease-in-out; /* Smooth color transition */
}

.content p a:hover {
  color: #f28482; /* Hover link color */
  text-decoration: none; /* Ensure no underline on hover either */
}

ul, ol {
  font-family: var(--body-font);
  font-size: var(--body-size);
  line-height: 1.5;
  color: var(--text-color);
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Author styling */
.author {
  margin: 0.8rem 0 1.5rem 0;
  font-family: var(--author-font);
  font-style: normal;
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.author p {
  margin: 0;
  font-family: var(--author-font);
  color: var(--author-text);
  font-size: var(--author-size);
  margin-bottom: 4rem;
}

/* Content */
.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--content-padding);
  background-color: var(--content-bg);
  position: relative;
  overflow: visible;
}

.text-block {
  margin-bottom: 2rem;
}

/* Visualization section (renamed from simulation-container) */
.viz-container {
    background-color: var(--sim-bg);
    margin: 1rem 0rem;
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    
}

/* Map Container Styling */
#tariff-map-container {
    flex: 1;
    width: 100%;
    max-width: 600px;
    height: 400px;
    position: relative;
}

/* Scatterplot Container Styling */
#tariff-scatterplot-container {
    flex: 2;
    width: 100%;
    max-width: 1000px;
    position: relative;
}

/* SVG containers */
#tariff-scatterplot-container svg, 
#tariff-map-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Tooltip Style */
.tooltip {
    background-color: white;
    border: solid;
    border-width: 1px;
    border-radius: 5px;
    padding: 10px;
    position: absolute;
    pointer-events: none;
    min-width: 150px;
    font-size: 12px;
    z-index: 10;
}

/* Strategy selection */
.strategy-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.strategy-group {
  margin-bottom: 12px;
}

.strategy-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
}

.strategy-description {
  font-size: 0.85rem;
  color: #666;
  margin-top: 4px;
  margin-bottom: 0;
  min-height: 2em;
}

/* Color indicator styling */
.color-indicator {
  display: none;
}

/* Proportion control styling */
.proportion-control-container {
  background-color: var(--control-bg);
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.proportion-control-container h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.proportion-slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.proportion-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  background: #ddd;
}

.proportion-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.proportion-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.proportion-label {
  font-size: 12px;
  font-weight: bold;
  width: 40px;
  text-align: center;
}

/* Tournament parameters */
.tournament-params {
  background-color: var(--control-bg);
  padding: 12px 15px;
  border-radius: 4px;
  border: none;
}

.param-group {
  margin-bottom: 20px;
}

.param-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 0.9rem;
}

.param-description {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 10px;
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-container input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  outline: none;
  margin: 5px 0;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.slider-container input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 2px solid #577590;
  cursor: pointer;
}

.slider-minmax {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

/* Only hide min values for sliders other than proportion */
.param-group:not(:first-child) .slider-min {
  display: none;
  text-align: left;
  font-size: 12px;
}

/* For proportion slider specifically */
.param-group:first-child .slider-min {
  display: block;
  text-align: left;
  font-size: 12px;
}

.slider-max {
  text-align: right;
  font-size: 12px;
}

/* Button styling */
.button-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

.button-group button {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

#start-tournament {
  background-color: var(--primary-btn);
  color: white;
}

#start-tournament:hover:not(:disabled) {
  background-color: var(--primary-btn-hover);
}

#stop-tournament {
  background-color: var(--danger-btn);
  color: white;
}

#stop-tournament:hover:not(:disabled) {
  background-color: var(--danger-btn-hover);
}

#reset-visualization {
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  color: #333;
}

#reset-visualization:hover {
  background-color: #e9ecef;
}

/* Button disabled state */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ddd;
}

/* Form controls styling */
select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  color: var(--text-color);
  width: 100%;
  max-width: 100%;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  height: 62px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' fill='none' stroke='%23666' stroke-width='1.5'><path d='M1,1 L7,7 L13,1' /></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  white-space: normal;
}

select:focus {
  border-color: var(--primary-btn);
}

select option {
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 62px;
  white-space: normal;
  text-align: left;
}

select option::before {
  content: attr(value);
  display: inline;
  font-weight: 600;
}

/* Style for strategy name and description in dropdowns */
.strategy-name {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.strategy-desc {
  display: block;
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
}

/* Running indicator */
#running-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #adb6c4;
  font-weight: bold;
  font-size: 13px;
  font-family: var(--ui-font);
  position: absolute;
  bottom: 15px;
  right: 15px;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 6px 12px;
  border-radius: 4px;
  z-index: 100;
}

#running-indicator.hidden {
  display: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(173, 182, 196, 0.3);
  border-top-color: #adb6c4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Strategy node styling */
.strategy circle {
  cursor: pointer;
  transition: r 0.3s ease-out, stroke-width 0.3s ease-out;
}

.strategy circle:hover {
  stroke-width: 3px;
  stroke: #fff;
}

.strategy text {
  pointer-events: none;
  font-family: var(--ui-font);
}

.matchup-line {
  pointer-events: none;
}

/* Agent pool styling */
.agent {
  transition: r 0.3s ease-out;
  cursor: pointer;
}

.agent:hover {
  opacity: 0.9;
}

/* Histogram styling */
.histogram-area {
  transition: d 0.3s ease-out;
}

.histogram-area:hover {
  opacity: 0.8;
}

.histogram-line {
  transition: d 0.3s ease-out;
  pointer-events: none;
}

/* Axis styling */
.x-axis path,
.x-axis line,
.y-axis path,
.y-axis line {
  stroke: #ccc;
  stroke-width: 1px;
}

.x-axis text,
.y-axis text {
  font-size: 11px;
  fill: #666;
  font-family: var(--ui-font);
}

.x-axis-label,
.y-axis-label {
  font-size: 12px;
  fill: #333;
  font-family: var(--ui-font);
}

/* Legend styling */
.legend-item text {
  fill: #333;
  font-family: var(--ui-font);
  font-size: 12px;
}

/* Grid lines */
.grid-line {
  stroke: #eee;
  stroke-width: 1;
}

/* Y-axis labels */
.left-y-label, .right-y-label {
  font-size: 10px;
  fill: #777;
  font-family: var(--ui-font);
}

/* Winner styles */
.winner-label {
  font-size: 13px;
  text-align: center;
  color: var(--primary-btn);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--ui-font);
  font-weight: bold;
}

/* Strategy name and total score text */
.strategy-name-label, .strategy-label {
  font-family: var(--ui-font);
  font-size: 15px !important;
}

.total-score, .avg-score {
  font-family: var(--ui-font);
  font-size: 12px !important;
}
.section-divider {
    border: 0;
    height: 1px;
    background-color: var(--footer-text);
    opacity: 0.3;
    margin: 4rem auto;
    width: 100%;
    max-width: var(--content-width);
}

/* More Stories section */
.more-stories {
    background: var(--background-color);
    padding: var(--section-spacing) 0;
    margin-top: 4rem;
    width: 100%;
}

.more-stories .content {
    max-width: 100%;
    padding: 0 2rem;
    background-color: transparent;
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    align-items: start;
}

.story-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.story-card {
    background: var(--card-bg);
    overflow: hidden;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    height: auto;
}

.story-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    background-color: #000;
}

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

.story-card h4 {
    font-size: var(--h4-size);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.story-card p {
    margin: 0;
    font-size: var(--small-text);
    color: var(--footer-text);
}

/* Center the "More Stories" heading */
.more-stories h3 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  min-height: 20vh;
  background-color: var(--footer-bg);
  margin-top: 3rem;
  padding: 2rem 0;
}

.footer .container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1rem;
  color: var(--footer-text);
}

.footer p {
  margin-bottom: 1rem;
  color: var(--footer-text);
  font-family: var(--ui-font);
  font-size: 0.9rem;
}

.footer a {
  color: var(--footer-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease-in-out;
}

.footer a:hover {
  border-bottom-color: var(--footer-text);
}

/* Media queries for responsive layout */
@media (max-width: 1024px) {
    /* Tablet layout - stack in 2 rows */
    .simulation-grid {
        grid-template-columns: minmax(auto, 400px) 1fr;
        grid-template-areas:
            "controls simulation"
            "histogram histogram";
        gap: 20px;
    }
    
    .controls-column {
        grid-area: controls;
    }
    
    .agent-pool-column {
        grid-area: simulation;
        width: 100%;
        max-width: 600px;
        height: 600px;
    }
    
    .histogram-column {
        grid-area: histogram;
        width: 100%;
        height: 400px;
    }
}

@media (max-width: 768px) {
    /* Mobile layout - stack vertically */
    .simulation-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "controls"
            "simulation"
            "histogram";
    }
    
    .simulation-inner {
        min-width: auto;
        width: 95%;
    }
    
    .agent-pool-column {
        width: 100%;
        height: 500px;
    }
    
    .histogram-column {
        width: 100%;
        height: 400px;
    }
}

@media (max-width: 480px) {
    /* Small mobile adjustments */
    .simulation-container {
        padding: 1rem;
    }
    
    .simulation-inner {
        padding: 5px;
    }
    
    .simulation-grid {
        gap: 15px;
    }
}

/* Position the running indicator inside the agent-pool-column */
.agent-pool-column {
    position: relative;
}

/* Add styles for disabled sliders and buttons */
input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
}

/* Style for the disabled slider labels */
.param-group:has(input:disabled) .param-description,
.param-group:has(input:disabled) label,
.param-group:has(input:disabled) .slider-minmax {
    opacity: 0.5;
}

/* Citation styling */
.citation {
    font-size: 0.9rem;
    color: #666;
    margin: 2rem 0;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.citation a {
    color: #3a86ff;
    text-decoration: none;
    font-weight: 500;
}

.citation a:hover {
    text-decoration: underline;
}

/* More Stories Section */
.more-stories {
    background: var(--background-color);
    padding: var(--section-spacing) 0;
    margin-top: 4rem;
    width: 100%;
}

.section-divider {
    border: 0;
    height: 1px;
    background-color: var(--footer-text);
    opacity: 0.3;
    margin: 4rem auto;
    width: 100%;
    max-width: var(--content-width);
}

.more-stories .content {
    max-width: 100%;
    padding: 0 2rem;
    background-color: transparent;
}

.more-stories h3 {
    font-family: var(--title-font);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    align-items: start;
}

/* Story Cards */
.stories-track .story-card {
    flex: 0 0 auto;
    width: calc(33.333% - 20px);
    margin: 0 10px;
    background: var(--card-bg);
    border-radius: 8px !important;
    overflow: visible;
    box-shadow: none;
    border: none !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-origin: center center;
    position: relative;
    z-index: 1;
}

.stories-track .story-card:hover,
.stories-track .story-card:focus,
.stories-track .story-card:active {
    border: none !important;
    border-bottom: none !important;
    text-decoration: none;
    outline: none;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 2;
    border-radius: 8px !important;
}

/* Override any default link styles for story cards */
a.story-card,
a.story-card:hover,
a.story-card:active,
a.story-card:visited,
a.story-card:focus {
    border: none !important;
    border-bottom: none !important;
    text-decoration: none !important;
}

/* Story card content styling */
.story-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

.story-card h4 {
    font-family: var(--title-font);
    font-size: var(--h4-size);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--text-color);
}

.story-card p {
    margin: 0;
    font-size: var(--small-text);
    color: var(--footer-text);
}

.story-card:hover h4 {
    color: #0077b6;
}

/* Story card media container with aspect ratio */
.story-card-media {
    position: relative;
    width: 100%;
    padding-top: 107.5%;
    overflow: hidden;
    background-color: #fff;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
    border: none !important;
    border-bottom: none !important;
    transition: none !important;
}

.story-card-media img,
.story-card-media video {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 100%;
    object-fit: cover;
    border: 0 !important;
    border-bottom: 0 !important;
    outline: 0 !important;
    transition: none !important;
    box-shadow: none !important;
}

/* Additional specific rule to override any hover borders on media elements */
.stories-track .story-card:hover .story-card-media,
.stories-track .story-card:focus .story-card-media,
.stories-track .story-card:active .story-card-media {
    border: none !important;
    border-bottom: none !important;
    outline: none !important;
    transition: none !important;
}

.stories-track .story-card:hover .story-card-media img,
.stories-track .story-card:hover .story-card-media video,
.stories-track .story-card:focus .story-card-media img,
.stories-track .story-card:focus .story-card-media video,
.stories-track .story-card:active .story-card-media img,
.stories-track .story-card:active .story-card-media video {
    border: 0 !important;
    border-bottom: 0 !important;
    outline: 0 !important;
    transition: none !important;
    box-shadow: none !important;
}

/* Responsive adjustments */
@media (min-width: 1100px) {
    .story-card {
        width: calc(25% - 20px);
        border-radius: 8px !important;
    }
}

@media (max-width: 900px) {
    .story-card {
        width: calc(50% - 20px);
        border-radius: 8px !important;
    }
}

@media (max-width: 600px) {
    .story-card {
        width: calc(100% - 20px);
        border-radius: 8px !important;
    }

    .stories-carousel-container {
        padding: 0 30px;
    }
}

/* Stories Carousel */
.stories-carousel-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

.stories-carousel {
    width: 100%;
    overflow: visible;
    position: relative;
    padding: 10px 0 20px 0;
}

.stories-track {
    display: flex;
    transition: transform 0.4s ease-in-out;
    padding: 10px 0;
}

.story-card:hover h4 {
    color: #0070f3;
}

/* Navigation buttons */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: white;
    border: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: #666;
}

.carousel-nav:hover {
    background-color: #f5f5f5;
}

.carousel-nav.prev {
    left: 0;
}

.carousel-nav.next {
    right: 0;
}

/* Fix story card styling to remove hover border and ensure consistent rounded corners */
a.story-card {
    border-bottom: none;
    border: none !important;
}

.stories-track a.story-card:hover {
    border-bottom: none !important;
    border-bottom-color: transparent;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Completely remove any border from story card links */
.stories-track a.story-card,
.stories-track a.story-card:hover,
.stories-track a.story-card:focus,
.stories-track a.story-card:active {
    border: none;
    border-bottom: none;
    text-decoration: none;
    outline: none;
}

/* Ensure consistent rounded corners on all story cards, including when hovered */
.stories-track .story-card {
    border-radius: 8px !important;
    overflow: hidden;
}

.stories-track .story-card:hover {
    border-radius: 8px !important;
}

/* Prevent any hover border on story card media */
.story-card-media,
.story-card-media img,
.story-card-media video {
    border: none !important;
    outline: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    :root {
        --base-font-size: 16px;
        --h1-size: 2rem;
    }
}

/* Override the default a:hover behavior specifically for story cards */
.more-stories a:hover,
.more-stories a:hover *,
.more-stories a:hover *:before,
.more-stories a:hover *:after {
    border: none !important;
    border-bottom: none !important;
    border-color: transparent !important;
    border-bottom-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* Ultimate override for story card borders - added at the end to have maximum specificity */
.story-card,
.story-card *,
.story-card:hover,
.story-card:hover *,
.stories-track .story-card,
.stories-track .story-card *,
.stories-track .story-card:hover,
.stories-track .story-card:hover *,
.story-card-media,
.story-card-media *,
.story-card-media img,
.story-card-media video,
.story-card:hover .story-card-media,
.story-card:hover .story-card-media img,
.story-card:hover .story-card-media video,
.story-card::before,
.story-card::after,
.story-card *::before,
.story-card *::after,
.story-card:hover::before,
.story-card:hover::after,
.story-card:hover *::before,
.story-card:hover *::after {
    border: 0 none !important;
    border-bottom: 0 none !important;
    border-top: 0 none !important;
    border-left: 0 none !important;
    border-right: 0 none !important;
    border-color: transparent !important;
    border-style: none !important;
    border-width: 0 !important;
    outline: 0 none !important;
}

/* Prevent hover events on media elements */
.story-card-media,
.story-card-media img,
.story-card-media video {
    pointer-events: none !important;
}

/* Apply border radius only where needed */
.story-card,
.story-card:hover {
    border-radius: 8px !important;
}

.story-card-media {
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
}

.story-card-content {
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

/* Ultimate video element reset - this overrides ALL browser styling for videos */
video {
    all: initial !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: 100% !important;
    object-fit: cover !important;
    background-clip: padding-box !important;
    -webkit-background-clip: padding-box !important;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* Video wrapper to isolate media elements */
.video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    outline: 0 !important;
}

.video-wrapper * {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    outline: 0 !important;
}

/* Second Visualization Container */
#employment-viz-container {
    display: flex; /* Make it a flex container too */
    align-items: flex-start; /* Align items to top */
    gap: 20px; /* Space between filters and chart */
}

/* Filters Container Styling */
#employment-filters {
    flex: 1; /* Takes 1/4 width approx */
    max-width: 600px; /* Set specific max-width */
    padding: 15px;
    border: none; /* Remove border */
    border-radius: 4px;
    background-color: transparent; /* Remove background */
    align-self: center; /* Explicitly center vertically */
}

/* Container for filter buttons */
#employment-filters .button-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

/* General Filter Button Style */
#employment-filters .filter-button {
     display: block; 
     flex: 1; /* Make buttons share space */
     padding: 10px 15px; /* Increase padding */
    /* margin-bottom: 15px; */ /* Now handled by button container */
     border: none; /* Remove border */
     border-radius: 6px; /* Slightly more rounded */
     background-color: #6c757d; /* Default gray */
     color: white;
     font-weight: 600;
     font-size: 13px; /* Slightly smaller button text */
     cursor: pointer;
     text-align: center;
     transition: background-color 0.2s, transform 0.1s;
 }
 
 #employment-filters .filter-button:hover {
    background-color: #5a6268; /* Darker gray on hover */
    transform: translateY(-1px); /* Subtle lift effect */
 }
 
 #employment-filters .filter-button:active {
     transform: translateY(0px); /* Press effect */
 }
 
/* Specific style for the toggle button when active (multi-select) */
#toggle-select-mode.mode-active {
    background-color: var(--primary-btn); /* Blue when multi-select is active */
}

#toggle-select-mode.mode-active:hover {
    background-color: var(--primary-btn-hover); /* Darker blue on hover */
}

.naics-checkbox-container { /* Rename this class if desired */
    /* Remove previous styling like border/height/overflow */
    /* Default block layout will stack divs vertically */
    display: flex; /* Use flexbox for layout */
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 8px; /* Space between filter options */
}

.filter-option {
    padding: 6px 12px;
    /* border: 1px solid #ddd; */
    border-radius: 4px; /* Slightly rounded rectangle */
    cursor: pointer;
    font-size: 14px; /* Even Larger font */
    transition: all 0.2s ease-in-out;
    background-color: #F2F4F8; /* Default light background */
    color: #c7ccdb; /* Default lighter text */
    display: inline-block; /* Fit width to content */
    /* margin-bottom: 5px; */ /* Gap handles spacing now */
    /* text-align: center; */ /* Remove text centering */
}

.filter-option.active {
    background-color: #e1e5ee; /* Light blue background for active */
    color: #767B91; /* Darker blue text for active */
    /* border-color: none;  */
    font-weight: 500;
}

.filter-option:hover {
    background-color: #e9ecef; /* Subtle hover */
    color: #767B91;
}

.filter-option.active:hover {
     background-color: #edf2f4; /* Slightly darker blue on hover when active */
}

/* Barchart Container Styling */
#employment-barchart {
    flex: 3; /* Takes 3/4 width approx */
    max-width: 1000px; /* Set specific max-width */
    position: relative; /* For potential internal elements */
    min-width: 0; /* Prevent flex item from overflowing */
}

/* Y-Axis Label Toggle */
.toggle-option {
    cursor: pointer;
    fill: #c7ccdb; /* Blue link color */
    text-decoration: none;
    font-size: 0.95em; /* Slightly smaller */
    pointer-events: auto; /* Re-enable pointer events specifically for the toggle options */
}

.toggle-option.active {
    font-weight: normal;
    text-decoration: none;
    fill: #2ab7ca; /* Use the default text fill color */
    cursor: default;
}

/* Ensure axis labels don't prevent clicks on tspans */
.y-axis-label {
    pointer-events: none; /* Disable pointer events on the main label text group */
}
.y-axis-label .toggle-option {
    pointer-events: auto; /* Re-enable pointer events specifically for the toggle options */
}

/* Caption Styling */
.caption {
  font-size: 0.9rem;
  color: #999;
  /* margin-top: 0.20rem; */
  text-align: left;
  /* font-style: italic; */
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;

  padding-left: 0rem;
  padding-right: 1rem;
  box-sizing: border-box;
}

/* Header Styles */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes logo left, text right */
    padding: 1rem 0 2rem; /* Increased bottom padding to add space above the line */
    margin-bottom: 5rem; /* Space below header */
    /* border-bottom: 1px solid var(--border-color); */ /* Optional separator */
    /* border-bottom: 1px dotted #778da9; */ /* Replaced with pseudo-element */
    position: relative; /* Needed for absolute positioning of ::after */
}

/* Add pseudo-element for custom dotted line */
.site-header::after {
    content: '';
    position: absolute;
    bottom: 0; /* Position at the bottom of the header */
    left: 0;
    width: 100%;
    height: 1px; /* Thickness of the line */
    /* Create a repeating pattern: 1px color (#778da9), 5px transparent */
    background-image: linear-gradient(to right, #778da9 2px, transparent 2px);
    background-size: 7px 2px; /* 1px dot + 5px space = 6px total width for repeat */
    background-repeat: repeat-x;
    background-position: left bottom;

}

.header-logo {
    height: 90px; /* Adjust height as needed */
    width: auto;
}

.header-nav-text {
    font-family: 'JetBrains Mono', monospace; /* Use a monospace font like in the image */
    font-size: 1rem; /* Adjust size as needed */
    /* color: var(--text-color); */ /* Removed direct color setting */
    color: #778da9; /* Set default color for non-link text (slashes) */
}

/* Style the link within the nav text */
.header-nav-text a {
    color: #778da9; /* Default link color */
    text-decoration: none; /* Remove underline */
    transition: color 0.2s ease-in-out; /* Smooth transition */
}

.header-nav-text a:hover {
    color: #415a78; /* Hover color */
}

/* --- START RESPONSIVE CHANGES --- */
@media (max-width: 1024px) { /* INCREASED threshold */
    /* Hide the map container */
    #tariff-map-container {
        display: none;
    }

    /* Allow scatterplot container to take full width */
    #tariff-scatterplot-container {
        flex-basis: 100%;
        max-width: 100%;
    }

    /* Stack employment viz items vertically */
    #employment-viz-container {
        flex-direction: column;
        align-items: center; /* Center items horizontally when stacked */
    }

    /* Ensure filters and bar chart take full width */
    #employment-filters,
    #employment-barchart {
        flex-basis: 100%; /* Take full width */
        max-width: 95%; /* Add slight padding */
        width: 95%;
        align-self: center; /* Ensure centering */
    }

    /* Adjust filter options for wrapping/layout */
    #employment-filters .naics-checkbox-container {
        justify-content: flex-start; /* Align items to the start (left) */
    }
}
/* --- END RESPONSIVE CHANGES --- */

/* --- START SCROLLYTELLING STRUCTURE --- */
#scrolly-wrapper {
    position: relative;
    /* Height determines scroll duration. Adjust as needed */
    height: 400vh; /* INCREASED height significantly */
    /* Add full-width breakout styles */
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f0f0f0;
}

#scrollytelling-container {
    /* This container becomes sticky within the wrapper */
    position: sticky;
    top: 0;
    height: 100vh; /* Fill viewport height when sticky */
    width: 100%; /* Fill width of the wrapper */
    overflow: hidden; 
    /* Reset inherited conflicting styles from .viz-container if class was used */
    left: auto; 
    transform: none;
    /* Ensure it inherits background if needed, or set explicitly */
    /* background-color: var(--sim-bg);  */
    background-color: #f0f0f0;
    padding: 1rem; /* Re-apply padding if needed */
    display: block; /* Override potential flex from .viz-container */
}

#scrolly-graphic {
    /* Graphic fills the sticky container */
    width: 100%; 
    height: 100%; 
    /* Remove positioning related to old layout */
    /* position: sticky; */
    /* top: 20px;  */
    /* float: left; */
    /* z-index: 1; */ 
    display: flex;
    flex-direction: row; /* side-by-side */
    gap: 10px;
    align-items: stretch; /* Make children fill height */
    opacity: 1;
}

/* Map and Text Block Container (share the left side space) */
#scrolly-map-container,
#scrolly-text-block {
    flex: 1; /* Let flexbox handle width */
    /* width: 49%; */ /* REMOVED explicit width */
    height: 100%; 
    min-width: 0; /* Prevent flex overflow */
    position: relative; /* Changed from absolute for text block */
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out; 
    /* border: 1px solid #eee; */ /* Removed temporary border */
    padding: 10px;
    /* background-color: #f0f0f0;  */
}

/* Text block specific styling - NO LONGER USED for sliding effect */
#scrolly-text-block {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%; /* Take full width of its container space */
    height: 100%; /* Take full height */
    transform: translateY(100%); /* Start below the view */
    opacity: 1;
}

/* NEW Styles for Text Above/Below Map */
.scrolly-map-text {
    position: absolute; /* Position relative to map container */
    left: 10px; /* Padding from left */
    right: 10px; /* Padding from right */
    background-color: rgba(248, 249, 250, 0.85); /* Use var(--sim-bg) with alpha */
    padding: 10px;
    border-radius: 4px;
    z-index: 10; /* Ensure text is above map paths */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
    font-size: 0.9rem;
    color: var(--text-color);
}

#scrolly-map-text-above {
    top: 10px; /* Position near top */
}

#scrolly-map-text-below {
    bottom: 10px; /* Position near bottom */
}

/* Class to show the text */
.scrolly-map-text.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0s;
}

/* Scatterplot container (takes the other half) */
#scrolly-scatterplot-container {
    flex: 1; 
    height: 100%; 
    min-width: 0; 
    position: relative;
    /* background-color: #f0f0f0;  */
    /* Ensure previous flex properties are removed */
}

/* State transitions driven by JS adding/removing classes */
#scrolly-map-container.is-hidden {
    transform: translateY(-100%); /* Slide map up */
    opacity: 0;
}

#scrolly-text-block.is-visible {
    transform: translateY(0); /* Slide text in */
    opacity: 1;
}

/* Scrollytelling Responsive adjustments */
@media (max-width: 768px) { 
    #scrolly-wrapper {
        height: auto; /* Disable fixed scroll height */
    }
    #scrollytelling-container {
        position: relative; /* Unstick */
        height: auto;
        top: auto;
    }
    #scrolly-graphic {
        width: 100%;
        /* float: none; */
        position: relative; 
        height: auto; 
        margin-bottom: 10px; /* Add margin when visible */
    }

    /* Ensure map/scatter take full width on mobile */
    #scrolly-map-container,
    #scrolly-scatterplot-container {
        width: 100%;
        flex-basis: auto; /* Reset flex basis */
        height: 50vh; /* Give them a fixed height */
        margin-bottom: 10px;
    }

    /* Handle text block differently on mobile - maybe overlay? */
    #scrolly-text-block {
         /* Revisit mobile positioning - for now, keep absolute over map area */
         /* It might need to become static or overlay differently */
         transform: translateY(100%); /* Keep hidden initially */
    }
    #scrolly-map-container.is-hidden { 
        /* On mobile, maybe just hide map instead of sliding? */
        display: none; 
    } 
     #scrolly-text-block.is-visible {
        /* On mobile, ensure it takes space when visible */
        position: relative; 
        transform: translateY(0);
        opacity: 1;
        height: auto; /* Adjust height */
        margin-bottom: 10px; /* Add margin when visible */
    }
}
/* --- END SCROLLYTELLING STRUCTURE --- */

/* NEW: County Highlight Border Style */
.county-highlight-border {
    fill: none;
    stroke: black;
    stroke-width: 1.5px;
    pointer-events: none;
}

/* NEW: Annotation Line Style */
.annotation-line {
    stroke: #555;
    stroke-width: 1px;
    stroke-dasharray: 3,3;
}

#scrolly-steps {
    // ... existing code ...
}