:root {
    --primary-color: #22223B;
    --secondary-color: #4A4E69;
    --accent-color: #9A8C98;
    --highlight-color: #C9ADA7;
    --contrast-color: #F2E9E4;
    --background-color: #F2E9E4;
    --text-color: #22223B;
    --border-color: #9A8C98;
    --box-shadow: 0 2px 4px rgba(34, 34, 59, 0.1);
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background-color: var(--background-color);
}

h1, h2, h3 {
    font-family: 'Inter', sans-serif;
    color: #000000;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 5rem;
    font-weight: 700;
    text-align: left;
    margin-top: 0;
    font-family: Helvetica, Arial, sans-serif;
    /* background: linear-gradient(180deg, transparent 65%, var(--accent-color) 65%); */
    display: inline;
    line-height: 1.3;
    padding: 0 0.1em;
}

h2 {
    font-size: 1.8rem;
    font-weight: 600;
    display: inline;
    line-height: 1.3;
    padding: 0 0.1em;
}

h3 {
    font-size: 1.4rem;
    font-weight: 500;
    display: inline;
    line-height: 1.3;
    padding: 0 0.1em;
}

.controls-and-matrix {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    margin: 2rem 0;
}

.combined-container {
    padding: 0;
    width: 100%;
    display: flex;
    gap: 2rem;
}

.controls-section {
    flex: 0 0 300px;
    padding-right: 1.5rem;
}

.matrix-section {
    flex: 1;
}

/* Remove the individual box styling since they're now in a shared container */
.controls, .matrix-container {
    background-color: transparent;
    box-shadow: none;
    padding: 0;
}

table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    background-color: transparent;
}

th, td {
    width: calc(100% / 7);
    height: 60px;
    text-align: center;
    vertical-align: middle;
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    hyphens: auto;
    border: 1px solid var(--border-color);
    position: relative;
    background-color: transparent;
}

/* Remove or comment out the square aspect ratio forcing */
/* td::before {
    content: '';
    display: block;
    padding-top: 100%;
} */

td > * {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

.time-saved {
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: auto;
    min-height: auto;
    padding: 12px;
    text-align: center;
    text-justify: inter-word;
    word-wrap: break-word;
    font-family: 'JetBrains Mono', monospace;
    position: relative;
}

.time-saved::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 10;
}

.time-saved:hover::before {
    opacity: 1;
    visibility: visible;
}

.time-saved:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    padding: 8px;
}

.time-saved.selected {
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 0 0 0 2px var(--secondary-color);
    transform: scale(1.02);
}

.inefficient {
    background-color: grey;
    color: var(--text-color);
}

/* Form controls */
form {
    max-width: none;
    margin: 0;
    text-align: left;
}

input[type="range"] {
    width: 100%;
    max-width: 400px;
    margin: 1rem 0;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.efficiency-slider {
    margin: 2rem 0;
    position: relative;
}

#efficiency_display {
    display: block;
    margin-top: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

/* Narrative section */
.narrative {
    margin: 1rem 0 2rem 0;
    text-align: justify;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
}

/* Variables display */
#variables_display {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

#variables_display h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#variables_display p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

#narrative_main {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

#narrative_details {
    font-size: 1.2rem;
    color: var(--text-color);
    font-weight: 400;
}

.controls-section h2,
.matrix-section h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: white;
    margin: 4px 0;
    width: 140px;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.2);
}

/* Style the date input labels */
.date-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 1rem 0;
}

.date-input-group label {
    font-weight: 500;
    min-width: 50px;
}

.time-period-display {
    margin-top: 0.5rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

/* Add container for matrix with relative positioning */
.matrix-container {
    position: relative;
    padding-left: 40px;  /* Space for y-axis label */
    padding-top: 40px;   /* Space for x-axis label */
}

/* X-axis label (top) */
.matrix-x-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-weight: 500;
    color: var(--text-color);
}

/* Y-axis label (left side) */
.matrix-y-label {
    position: absolute;
    left: 0;
    top: 50%;
    transform: rotate(-90deg) translateX(-50%);
    transform-origin: 0 0;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-color);
}

/* Adjust table position to account for labels */
.matrix-container table {
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    padding: 1rem 1rem 1rem 0;
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

label[for="time_period"],
label[for="efficiency_improvement"] {
    font-weight: bold;
}

@media (max-width: 768px) {
    .combined-container {
        flex-direction: column;
    }
    
    .controls-section {
        flex: 1;
        padding-right: 0;
        margin-bottom: 2rem;
    }
    
    h1 {
        font-size: 3rem;
    }
    
    .matrix-container {
        overflow-x: auto;
    }
}

.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--secondary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Make first column (y-axis) bold */
td:first-child {
    font-weight: bold;
}

/* Make header row (x-axis) bold */
th {
    font-weight: bold;
}

.nav {
    position: absolute;
    top: 2rem;
    right: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--secondary-color);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.about-content section {
    margin-bottom: 3rem;
}

.about-content h2 {
    margin-bottom: 1rem;
    display: block;
}

.about-content h3 {
    margin: 1.5rem 0 1rem;
    display: block;
}

.about-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

.about-content pre {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', monospace;
}

.equation {
    padding: 1.5rem;
    margin: 1rem 0;
    background-color: var(--contrast-color);
    border-radius: 4px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.mjx-chtml {
    margin: 0 !important;
}

.about-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.linkedin-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.linkedin-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.about-content h3 {
    color: var(--secondary-color);
    margin-top: 2rem;
}

.about-me-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.about-me-content {
    flex: 2;
}

.headshot-container {
    flex: 1;
    max-width: 300px;
}

.headshot {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .about-me-container {
        flex-direction: column-reverse;
    }
    
    .headshot-container {
        max-width: 200px;
        margin: 0 auto;
    }
}

.external-link, .linkedin-link {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
}

.external-link:hover, .linkedin-link:hover {
    color: #003d99;
    text-decoration: underline;
}

.external-link:visited, .linkedin-link:visited {
    color: #551a8b;
}

