/* Petrarchan - Catppuccin Latte Theme */
@import "catpuccin.css";

/* Base styles */
body {
    font-family: "Noto Serif", "Palatino Linotype", "serif";
    background-color: var(--ctp-latte-base);
    margin: 0;
    padding: 20px;
    color: var(--ctp-latte-text);
    line-height: 1.6;
}

.header {
    max-width: 1200px;
    margin: 0 auto;
    text-align: left;
    margin-bottom: 20px;
}

.header h1 {
    color: var(--ctp-latte-text);
    margin: 0;
}

.header p {
    color: var(--ctp-latte-subtext0);
    margin: 10px 0 0 0;
}

/* Catalog styles */
.catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.thread-card {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    background: var(--ctp-latte-crust);
    border: 1px solid var(--ctp-latte-overlay0);
    padding: 15px;
    height: 350px;
    gap: 10px;
}

.thread-card:hover {
    background: var(--ctp-latte-mantle);
}

.thread-header {
    display: flex;
    align-items: center;
}

.thread-id {
    font-weight: bold;
    color: var(--ctp-latte-sapphire);
    margin-right: 10px;
}

.thread-date {
    color: var(--ctp-latte-subtext0);
    font-size: 12px;
    margin-left: auto;
}

.thread-title {
    font-weight: bold;
    color: var(--ctp-latte-text);
}

.thread-title.no-title {
    color: var(--ctp-latte-overlay0);
    font-style: italic;
}

.thread-main-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.thread-image {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    display: block;
    align-self: flex-start;
}

.thread-content {
    color: var(--ctp-latte-subtext1);
    line-height: 1.4;
    overflow: hidden;
    position: relative;
    flex: 1;
}

.thread-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ctp-latte-subtext0);
    font-size: 12px;
    border-top: 1px solid var(--ctp-latte-overlay0);
    padding-top: 10px;
    margin-top: auto;
}

.thread-poster {
    font-weight: bold;
}

.thread-replies {
    background: var(--ctp-latte-rosewater);
    color: var(--ctp-latte-crust);
    padding: 2px 6px;
    font-size: 11px;
}

.thread-link {
    text-decoration: none;
    color: inherit;
}

.no-threads {
    text-align: center;
    color: var(--ctp-latte-subtext0);
    font-style: italic;
    grid-column: 1 / -1;
    padding: 40px;
}

/* Thread view styles */
.thread-container {
    max-width: 1200px;
    margin: 0 auto;
}
.header a {
    color: var(--ctp-latte-pink);
    text-decoration: none;
}

.header a:hover {
    color: var(--ctp-latte-sapphire);
    text-decoration: underline;
}

.post {
    background: var(--ctp-latte-crust);
    border: 1px solid var(--ctp-latte-overlay0);
    margin-bottom: 15px;
    overflow: hidden;
}

.post.op {
    border-left: 4px solid var(--ctp-latte-rosewater);
}

.post-header {
    background-color: var(--ctp-latte-mantle);
    padding: 10px 15px;
    border-bottom: 1px solid var(--ctp-latte-overlay0);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.post-id {
    font-weight: bold;
    color: var(--ctp-latte-sapphire);
    margin-right: 15px;
}

.post-poster {
    font-weight: bold;
    color: var(--ctp-latte-rosewater);
    margin-right: 15px;
}

.post-date {
    color: var(--ctp-latte-subtext0);
    font-size: 12px;
    margin-left: auto;
}

.post-title {
    font-weight: bold;
    color: var(--ctp-latte-text);
    margin-top: 5px;
    width: 100%;
}

.post-content {
    padding: 15px;
}

.post-image {
    float: left;
    margin: 0 15px 10px 0;
    max-width: 250px;
    max-height: 250px;
    object-fit: contain;
    border: 1px solid var(--ctp-latte-overlay0);
}

.post-image:hover {
    cursor: pointer;
    opacity: 0.9;
}
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.back-to-catalog {
    display: inline-block;
    background-color: var(--ctp-latte-sapphire);
    color: var(--ctp-latte-crust);
    padding: 10px 20px;
    text-decoration: none;
    margin-bottom: 20px;
    transition: background-color 0.2s;
}

.back-to-catalog:hover {
    background-color: var(--ctp-latte-sapphire);
}

.no-posts {
    text-align: center;
    color: var(--ctp-latte-subtext0);
    font-style: italic;
    padding: 40px;
    background: var(--ctp-latte-crust);
}

.thread-stats {
    background: var(--ctp-latte-crust);
    padding: 10px 15px;
    margin-bottom: 20px;
    color: var(--ctp-latte-subtext0);
    font-size: 14px;
}

/* Post references and backlinks */
.post-ref {
    color: var(--ctp-latte-pink);
    text-decoration: none;
    font-weight: 500;
}

.post-ref.same-thread {
    color: var(--ctp-latte-pink);
}

.post-ref.cross-thread {
    color: var(--ctp-latte-red);
}

.post-ref.dead-link {
    color: var(--ctp-latte-overlay1);
    cursor: not-allowed;
}

.post-ref:hover {
    text-decoration: underline;
    color: var(--ctp-latte-sapphire);
}

.backlinks {
    font-size: 12px;
}

.backlink {
    color: var(--ctp-latte-pink);
    text-decoration: none;
    margin-inline: 1px;
    font-weight: 500;
}

.backlink:hover {
    text-decoration: underline;
    color: var(--ctp-latte-sapphire);
}

/* Post anchors for smooth scrolling */
.post {
    scroll-margin-top: 20px;
}

.post:target {
    background-color: var(--ctp-latte-surface0);
    border-left: 3px solid var(--ctp-latte-rosewater);
    transition: background-color 0.3s ease;
}

/* Responsive styles */
@media (max-width: 768px) {
    .post-image {
        float: none;
        display: block;
        margin: 0 0 15px 0;
        max-width: 100%;
    }
    .post-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .post-date {
        margin-left: 0;
        margin-top: 5px;
    }
}
