:root {
    --top-row-width: 500px;
    --top-row-height: 250px;
    --top-pic-width: calc(200px / 1.618);
    --page-start-y: var(--top-pic-width);
    --latest-width: 50px;
    /* whitespace / ((1.618)^3 * 2 + 1) */
    --topws-narrow: 14px;
    --ws: calc(var(--top-row-width) - var(--top-pic-width) - var(--latest-width) - var(--topws-narrow));
    --topws-wide: calc(var(--ws) / 2);

    /* plus 1 for rounding / calc reasons */
    --top-row-true-width: calc(var(--top-row-width) + 1px);
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --color-text: #2D3436;
    --color-link: #2D3436;
    --color-link-hover: #0984E3;
}
#container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px 20px;
    padding: 20px;
    width: 100%;
}

#top-row {
    width: var(--top-row-true-width); 
    height: var(--top-row-height);
    /* https: //stackoverflow.com/questions/14241696/how-to-get-rid-of-space-between-divs-when-display-inline-block-and-stacked-horiz */
    font-size: 0;
    padding-top: var(--page-start-y);
}

#latest {
    font-size: 14px;
}

#top-row div {
    display: inline-block;
    vertical-align: top;
}

.top-space {
    height: 100%;
}

/* #top-row p {
    margin: 0 0 0 var(--white-space-col-width);
}

#top-row img {
    margin: 0 var(--white-space-col-width) 0 var(--white-space-col-width);
} */

#link-grid {
    width: var(--top-row-true-width);
}

.link-row {
    /* I really want this height to be equal to 3 lines of text, plus some padding */
    height: 200px;
}

/* odd rows long, short (g ratio)*/
/* even rows, short long */
.link-row-cell {
    display: inline-block;
    height: 100%;
    /* I want the width to be the parent width / 2 */
    width: calc(50% - 10px - 3px);
    /* What would truly aesthetic margins be? */
    /* padding: 0 0 0 10px; */
}

.link-row.bp > :first-child {
    border-right: 1px solid black;
}

/* .link-row-cell:first-child {
    border-right: 1px solid black;
    padding-right: 2px;
}

.link-row-cell:nth-child(2) {
    border-left: 1px solid black;
}

#link-grid > :nth-child(even) > :first-child {
    width: calc(51.414% - 14px);
}

#link-grid > :nth-child(even) > :nth-child(2) {
    width: calc(48.616% - 14px);
}

#link-grid > :nth-child(odd) > :first-child {
    width: calc(48.616% - 14px);
}

#link-grid > :nth-child(odd) > :nth-child(2) {
    width: calc(51.414% - 14px);
} */
/* .link-row-cell:first-child { */
    /* 61.803, 38.197 */
    /* width: 51.414%; */
/* } */

/* blueprint style for border */
.bp {
    border: 1px solid black;
}

.column {
    flex: 1;
    padding: 0 15px;
    min-width: 0;  /* Allows columns to shrink below their content size */
    white-space: normal;  /* Allow text wrapping */
}

.column h2 {
    margin-bottom: 15px;
    font-weight: 500;  /* Medium weight for headers */
    font-size: 1.125rem;  /* 18px */
    letter-spacing: -0.01em;
}

.column a {
    display: flex;
    justify-content: space-between;
    text-decoration: none;
    margin-bottom: 8px;
    color: var(--color-link);
    font-size: 0.9375rem;
    transition: color 0.2s ease;
    width: 100%;
}

.post-date {
    color: #8895a7;
    font-size: 0.8125rem;  /* 13px */
    margin-left: 12px;
    flex-shrink: 0;
}

.latest-post {
    margin-bottom: 40px;
    padding: 20px;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    grid-column: 1 / -1;  /* Makes latest post span full width */
}

.latest-post h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8895a7;
    margin-bottom: 12px;
}

.latest-post a {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.column a:hover {
    color: var(--color-link-hover);
}

body {
    line-height: 1.7;
    max-width: 650px;
    margin: 3rem auto;
    padding: 0 1rem;
    color: #2c3e50;
    font-size: 1.125rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 2rem;
}

p {
    margin-bottom: 1.5rem;
}

a {
    color: #2c3e50;
    text-decoration: none;
    border-bottom: 1px solid #2c3e50;
}

a:hover {
    border-bottom: 2px solid #2c3e50;
}

.section {
    margin-bottom: 2.5rem;
}

.fiction-section {
    font-family: inherit;
}

.subscribe {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

#layout {
    display: flex;
    gap: 20px;
    padding: 40px 20px 20px;
    max-width: 100%;
}

.side-nav {
    padding-top: 3px;
    margin-top: 35px;  /* Increased to account for container's padding (20px) + h2's margin (15px) */
    min-width: 100px;
}

.side-nav a {
    display: block;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.875rem;  /* 14px - slightly smaller than main content */
    margin-bottom: 12px;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.side-nav a:hover {
    opacity: 1;
}

/* Add responsive text wrapping */
.column a {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Optional: Add media query for very small screens */
@media (max-width: 600px) {
    #container {
        grid-template-columns: 1fr;  /* Single column on mobile */
    }
    
    .side-nav {
        min-width: 80px;  /* Smaller nav on mobile */
    }
}

#story-container {
    flex: 1;
    padding: 20px;
    max-width: 680px;  /* Nice readable width for story pages */
}

#story-container h1 {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.story-description {
    font-size: 1.125rem;
    color: #4a5568;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.story-image {
    margin-bottom: 2rem;
}

.story-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.story-parts a,
.story-list a {
    display: flex;
    justify-content: space-between;
    text-decoration: none;
    color: var(--color-link);
    font-size: 1.125rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eaeaea;
    transition: color 0.2s ease;
}

.story-parts a:hover,
.story-list a:hover {
    color: var(--color-link-hover);
}

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 0;
    background-color: #2D3436;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: normal;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

[data-tooltip]:after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-top-color: #2D3436;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}