body {
    font-family: 'Avenir Next', Avenir, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #fff;
    color: #222;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6,
.article-title {
    font-family: 'EB Garamond', Georgia, serif;
}

#author-name {
    background-color: #404040;
    color: white;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 3.125em;
    letter-spacing: 2.8px;
    font-weight: normal;
    text-align: center;
    margin: 0;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.5em;
    margin: 0;
    color: #333;
}

#essays-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 4px 0 rgba(0,0,0,.2);
}

#essays-container ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#essays-container li {
    border-bottom: 1px solid #ddd;
    padding: 16px 0;
}

#essays-container li a {
    color: #000;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
    display: block;
}

#essays-container li .subtitle {
    color: #555;
    font-size: 18px;
    margin: 10px 0;
    font-weight: normal;
}

#essays-container li .metadata {
    color: #888;
    font-size: 16px;
    margin-bottom: 5px;
    font-style: normal;
}

#essays-container li.has-thumbnail {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

#essays-container li.has-thumbnail .essay-details {
    flex: 1;
    min-width: 0;
}

.essay-thumbnail {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.site-headshot {
    display: block;
    margin: 20px auto 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
}

#social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.site-tagline {
    text-align: center;
    font-size: 14px;
    color: #555;
    margin: 8px 0;
}

.site-tagline a {
    color: #2573da;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 10px;
    box-sizing: border-box;
}

.essay-search {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    padding: 8px 12px;
    font-family: 'Avenir Next', Avenir, Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: #222;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    -webkit-appearance: none;
    appearance: none;
}

.essay-search::placeholder {
    color: #777;
}

.essay-search:focus {
    outline: 2px solid #2573da;
    outline-offset: 1px;
    border-color: #2573da;
}

.search-status {
    max-width: 800px;
    margin: 0 auto 10px;
    padding: 0 20px;
    box-sizing: border-box;
    color: #222;
    font-size: 16px;
    text-align: left;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #404040;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.social-icon:hover {
    background-color: #606060;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#site-footer {
    background-color: #9f9f9f;
    color: white;
    text-align: center;
    padding: 12px 16px 13px;
    margin-top: 40px;
    font-family: 'Avenir Next', Avenir, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#article-count {
    font-size: 16px;
    font-weight: normal;
    margin: 0 0 11px;
    text-align: center;
}

#last-updated {
    font-size: 14px;
    opacity: 0.8;
}

.copyright {
    font-size: 14px;
    margin: 0 0 11px;
}

.footer-social {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.footer-social a {
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.footer-social svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.social-icon svg {
    width: 24px;
    height: 24px;
}

#home-icon:hover {
    background-color: #2573da;
}

#medium-icon:hover {
    background-color: #00ab6c;
}

#substack-icon:hover {
    background-color: #ff6719;
}

#linkedin-icon:hover {
    background-color: #0077b5;
}

button {
    background-color: #2573da;
    border: none;
    color: white;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

button:hover {
    background-color: #1c5bb0;
}

/* Article View Styles */
.article-view {
    max-width: 900px;
    margin: 0 auto;
}

.article-header {
    border-bottom: 2px solid #ddd;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.back-button {
    background-color: #6c757d;
    margin-bottom: 20px;
}

.back-button:hover {
    background-color: #5a6268;
}

.article-title {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    color: #333;
    text-align: left;
    padding: 0;
}

.article-subtitle {
    color: #555;
    font-size: 1.3em;
    margin: 10px 0;
    font-weight: normal;
    font-style: italic;
}

.article-metadata {
    color: #888;
    font-size: 1.1em;
    margin: 10px 0;
    font-style: normal;
}

/* Article Actions */
.article-actions {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.share-button, .copy-url-button {
    background-color: #2573da;
    border: none;
    color: white;
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    min-height: 36px;
}

.share-button:hover, .copy-url-button:hover {
    background-color: #1c5bb0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-url-button {
    background-color: #6c757d;
}

.copy-url-button:hover {
    background-color: #545b62;
}

.article-content {
    line-height: 1.6;
    font-size: 1.1em;
}

.article-content h1 {
    font-size: 2em;
    margin: 30px 0 15px 0;
    color: #333;
    text-align: left;
    padding: 0;
}

.article-content h2 {
    font-size: 1.6em;
    margin: 25px 0 12px 0;
    color: #444;
}

.article-content h3 {
    font-size: 1.3em;
    margin: 20px 0 10px 0;
    color: #555;
}

.article-content p {
    margin: 15px 0;
    text-align: justify;
}

.article-content strong {
    font-weight: bold;
}

.article-content em {
    font-style: italic;
}

.article-content a {
    color: #2573da;
    text-decoration: underline;
}

.article-content a:hover {
    color: #1c5bb0;
}

/* Footnote markers stay small and raised above the surrounding text (#36). */
.article-content sup.footnote-ref,
.article-content sup.footnote-number {
    font-size: 0.75em;
    line-height: 0;
    vertical-align: super;
}

/* Briefly mark where a footnote link landed (#6). */
.article-content .footnote-highlight {
    background-color: #fff3cd;
    transition: background-color 0.3s ease;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Loading and Error States */
#loading {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    padding: 40px;
}

.error {
    text-align: center;
    color: #dc3545;
    padding: 40px;
    font-size: 1.1em;
}

/* Essay Link Styles */
.essay-link {
    color: #000;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
    display: block;
    transition: color 0.2s ease;
}

.essay-link:hover {
    color: #2573da;
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 24px 0 4px;
    color: #222;
    font-family: 'Avenir Next', Avenir, Helvetica, Arial, sans-serif;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
    box-sizing: border-box;
    color: #2573da;
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination-link:hover {
    color: #1c5bb0;
    background-color: #eef4fc;
}

.pagination-prev,
.pagination-next {
    padding: 0 12px;
}

.pagination-link.is-current {
    color: #222;
    font-weight: bold;
    background-color: #e6eef9;
    cursor: default;
}

.pagination-link.is-disabled {
    color: #aaa;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 40px;
    color: #222;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        overflow-x: hidden;
        word-wrap: break-word;
    }
    
    h1 {
        font-size: 2em;
        padding: 15px 10px;
    }
    
    #author-name {
        font-size: 2.5em;
    }
    
    #essays-container {
        margin: 10px;
        padding: 15px;
        max-width: none;
    }
    
    .search-container {
        padding: 0 10px 10px;
    }
    
    .search-status {
        margin: 0 0 10px;
        padding: 0 10px;
    }
    
    #essays-container li a {
        font-size: 20px;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    #essays-container li .subtitle {
        font-size: 16px;
        margin: 8px 0;
    }
    
    #essays-container li .metadata {
        font-size: 14px;
    }
    
    #essays-container li.has-thumbnail {
        gap: 12px;
    }
    
    .essay-thumbnail {
        width: 56px;
        height: 56px;
    }
    
    #sort-buttons {
        flex-direction: column;
        align-items: center;
        margin-bottom: 15px;
    }
    
    button {
        width: 100%;
        max-width: 300px;
        margin: 2px 0;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .article-view {
        margin: 0 10px;
    }
    
    .article-title {
        font-size: 1.8em;
        line-height: 1.3;
    }
    
    .article-subtitle {
        font-size: 1.1em;
    }
    
    .article-metadata {
        font-size: 1em;
    }
    
    .article-content {
        font-size: 1em;
    }
    
    .article-content h1 {
        font-size: 1.6em;
        margin: 25px 0 12px 0;
    }
    
    .article-content h2 {
        font-size: 1.4em;
        margin: 20px 0 10px 0;
    }
    
    .article-content h3 {
        font-size: 1.2em;
        margin: 18px 0 8px 0;
    }
    
    .article-content p {
        margin: 12px 0;
        text-align: left;
    }
    
    .essay-link {
        font-size: 20px;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .article-actions {
        flex-direction: column;
        gap: 8px;
        margin: 15px 0;
    }
    
    .share-button, .copy-url-button {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    body {
        overflow-x: hidden;
        word-wrap: break-word;
    }
    
    h1 {
        font-size: 1.8em;
        padding: 12px 8px;
    }
    
    #author-name {
        font-size: 2.25em;
    }
    
    #essays-container {
        margin: 5px;
        padding: 10px;
    }
    
    #essays-container li {
        padding: 12px 0;
    }
    
    #essays-container li a {
        font-size: 18px;
        line-height: 1.3;
    }
    
    #essays-container li .subtitle {
        font-size: 15px;
        margin: 6px 0;
    }
    
    #essays-container li .metadata {
        font-size: 13px;
    }
    
    button {
        padding: 10px 16px;
        font-size: 15px;
    }
    
    .article-title {
        font-size: 1.6em;
        line-height: 1.2;
    }
    
    .article-subtitle {
        font-size: 1em;
    }
    
    .article-metadata {
        font-size: 0.9em;
    }
    
    .article-content {
        font-size: 0.95em;
    }
    
    .article-content h1 {
        font-size: 1.4em;
        margin: 20px 0 10px 0;
    }
    
    .article-content h2 {
        font-size: 1.2em;
        margin: 18px 0 8px 0;
    }
    
    .article-content h3 {
        font-size: 1.1em;
        margin: 15px 0 6px 0;
    }
    
    .article-content p {
        margin: 10px 0;
    }
    
    .essay-link {
        font-size: 18px;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .article-actions {
        margin: 12px 0;
    }
    
    .share-button, .copy-url-button {
        padding: 10px 14px;
        font-size: 15px;
        min-height: 42px;
    }
    
    #loading, .error {
        padding: 30px 20px;
        font-size: 1em;
    }
}

/* Tablet Styles */
@media (min-width: 769px) and (max-width: 1024px) {
    #essays-container {
        max-width: 90%;
        margin: 15px auto;
        padding: 18px;
    }
    
    .article-view {
        max-width: 95%;
    }
    
    .article-title {
        font-size: 2.2em;
    }
    
    #essays-container li a {
        font-size: 22px;
    }
}

/* Large Screen Optimizations */
@media (min-width: 1200px) {
    #essays-container {
        max-width: 900px;
    }
    
    .article-view {
        max-width: 1000px;
    }
    
    .article-content {
        font-size: 1.15em;
    }
}

/* Touch-friendly improvements for mobile */
@media (max-width: 768px) {
    button {
        min-height: 44px; /* Minimum touch target size */
    }
    
    .essay-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    #essays-container li {
        padding: 12px 0;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    h1 {
        font-size: 1.8em;
        padding: 10px;
    }
    
    #author-name {
        font-size: 2.25em;
    }
    
    #essays-container {
        margin: 5px;
        padding: 10px;
    }
    
    .article-title {
        font-size: 1.6em;
    }
}
