/* fonts */

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Mono';
    font-style: normal;
    font-weight: bold;
    src: url('../font/lmmono-bold.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Mono';
    font-style: italic;
    font-weight: bold;
    src: url('../font/lmmono-bolditalic.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Mono';
    font-style: italic;
    font-weight: normal;
    src: url('../font/lmmono-italic.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Mono';
    font-style: normal;
    font-weight: normal;
    src: url('../font/lmmono-normal.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Roman';
    font-style: normal;
    font-weight: bold;
    src: url('../font/lmroman-bold.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Roman';
    font-style: italic;
    font-weight: bold;
    src: url('../font/lmroman-bolditalic.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Roman';
    font-style: italic;
    font-weight: normal;
    src: url('../font/lmroman-italic.woff');
}

@font-face {
    font-display: swap;
    font-family: 'Latin Modern Roman';
    font-style: normal;
    font-weight: normal;
    src: url('../font/lmroman-normal.woff');
}

/* global */

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

a {
    color: inherit;
    text-decoration: none;
}


.post-footer {
    margin-top: 5rem;
    border-top: 1px solid #ababab;
    padding-top: 1rem;
    font-style: italic;
    color: #bcbcbc;
    font-size: 0.9rem;
    text-align: center;
}
img {
    border: 1px dotted #ababab;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

time {
    color: gray;
    margin-left: 1rem;
    min-width: 5rem;
}

#wrapper {
    background-color: #FAFAFA;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    min-height: 100vh;
    overflow-wrap: break-word;
    padding: 1rem;
    justify-content: space-between; /* Ensure footer stays at the bottom */
}

main.index, main.archive, main.post {
    flex-grow: 1;
}

.link {
    color: rgb(50, 50, 200);
    text-decoration: none;
}

.archive .link {
    font-size: 1rem;
}

/* Add underscore before links (except special cases) */
a:not(.prev):not(.next):not(.default-link):not(.lang-btn):not(.image-link):not(.link):not(:has(img))::before {
    content: '_';
    text-align: center;
    font-size: 0.8rem;
}

/* Remove underscore for image links */
a.image-link::before {
    content: '';
}

/* Remove underscore before links that contain images */
a:has(img)::before {
    content: '' !important;
}

a#site-title::before {
    content: '';
}

a#site-title:hover {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.link.prev:hover, .link.next:hover {
    text-decoration: none;
    color: red;
}
.link.prev, .link.next {
    font-weight: bold;
    color: black;

}

.post-date {
    text-align: center;
    font-style: italic;
    color: gray;
    font-size: 0.8rem;
}
.paginator {
    align-items: flex-end;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin-top: 2rem;
}

::-webkit-scrollbar {
    background-color: #FAFAFA;
    height: 8px;
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background-color: #AAAAAA;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #888888;
}

/* header */

#header {
    align-items: left;
    display: flex;
    flex-direction: column;
    padding-bottom: 1rem;
    border-bottom: 1px solid #000;
    font-family: 'Courier New', monospace;
}

#header div.footnote {
    max-width: 90%;
    margin: 0 auto;
    text-align: center;
}

#header > span {
    text-align: left;
    margin: 1rem 0 1rem;
    font-size: 1em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

#header div.footnote {
    font-size: 0.7em;
}

.navigation {
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.navigation > div {
    display: flex;
}

.navigation .prev,
.navigation .next {
    flex-shrink: 0;
    padding-top: 0.5rem;
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important;
}

.post-header {
    margin: 1rem 0;
    width: 100%;
    overflow: visible;
}

h1 {
    padding: 0 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.9em;
}

@media screen and (min-width: 768px) {
    #header > span {
        font-size: 2em;
    }
    
    #header div.footnote {
        font-size: 1em;
    }
    
    h1 {
        font-size: 2em;
    }
}

#header > nav {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    flex-wrap: wrap;
    max-width: 768px;
    width: 100%;
}

#header > nav > span > a {
    font-size: 1.2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}
.header-content p {
    margin: 0;
}
.header-content .left {
    text-align: left;
    flex: 1;
}
.header-content .center {
    text-align: center;
    flex: 1;
}
.header-content .right {
    text-align: right;
    flex: 1;
}

.post-date-left {
    width: 150px;
    display: inline-block;
}

.post-title-right {
    overflow: hidden; text-overflow: ellipsis; max-width: 95%;

}

@media (max-width: 600px) {

.post-title-right:before {
    content: '- ';
}    
.post-title-right {
    white-space: normal;
    max-width: 100%;
}
.post-title-right {
    max-width: 100%;
    white-space: normal;
    
}

#wrapper  {
    padding: 0.5rem;
}

main.index, main.archive { 
    width: 100% !important;
}

.post-date-left,
    .post time  {
        display: none !important;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
    }
    .header-content .left,
    .header-content .center,
    .header-content .right {
        text-align: center;
        flex: none;
        width: 100%;
    }
}

/* main */

main.index, main.archive {
    align-self: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 2rem 0;
    width: calc(100% - 2rem);
    max-width: 1024px;
}

main.archive {
    font-family: inherit;
}

main.post {
    align-self: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    max-width: 768px;
    padding: 2rem 0;
    width: calc(100% - 2rem);
    font-size: 1.2rem;
}

.post {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    overflow: hidden; 
}

.post time {
    width: 150px;
    display: inline-block;
}

.post .content a {
    color: rgb(50, 50, 200);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0; /* Ensure the link can shrink */
    max-width: 100%;
    font-size: 1em;
    display: inline-block; /* Ensure ellipsis is applied */
    vertical-align: bottom; /* Align text properly */
}

.post .content img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* footer */

#footer {
    border-top: 1px solid #000;
    padding-top: 1rem;
    align-items: center;
    display: flex;
    font-size: .9rem;
    flex-direction: column;
    margin-top: auto;
    width: 100%;
    background-color: #FAFAFA; /* Match the background color */
}

@media screen and (max-width: 768px) {
    #footer {
        font-size: 0.5rem;
        padding-top: 0.3rem;
        padding-bottom: 0.3rem;
        position: relative;
        line-height: 1.2;
    }
}

