* {
    box-sizing: border-box;
}

body {
    font-family: "Comic Neue";
    background-image: url("background_dithered.png");
    margin: 0;
}

.layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header header"
        "sidebar main"
}

.header {
    grid-area: header;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.logo {
    width: 300px;
    margin-left: 8px;
}

.vertical-line {
    width: 1px;
    height: 60px;
    /* controls line length */
    background-color: black;
    margin-left: 25px;
    margin-right: 15px;
}

.quote {
    font-size: 32px;
    font-weight: lighter;
}

.walk-cycle {
    height: 100px;
    margin-left: auto;
    padding-bottom: 10px;
}

@media screen and (max-width: 900px) {
    .walk-cycle {
        display: none
    }
}

.double-line {
    width: 100%;
    border-top: 3px solid #6b4fa3;
    border-bottom: 3px solid #6b4fa3;
    height: 6px;
    margin-top: 0px;
}

.sidebar {
    grid-area: sidebar;
    margin: 0;
    padding: 0;
    background-image: url("sidebar background dithered.png");
    height: 100%;
}

.sidebar a {
    font-size: 32px;
    font-style: italic;
    text-decoration-style: wavy;
    display: block;
    color: black;
    padding: 16px;
    text-align: right;
}

.sidebar a:hover {
    font-weight: bold;
}

.summary {
    align-self: stretch;
    font-size: 20px;
    padding: 5px;
}

div.content {
    padding: 1px 16px;
    height: 100%;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 12px;
    height: auto;
}

.column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
    gap: 15px;
    height: 100%;
    width: 100%;
}
.row {
    display: grid;
    grid-column: 1;
    grid-row: 1 / span 4;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-auto-columns: max-content;
    gap: 15px;
    height: 100%;
    width: 100%;
}

.recent-work {
    grid-column: 1 / span 3;
    grid-row: 2;
}
.recent-work img {
    width: 100%;
    height: 100%;
    margin: auto; 
}

.cool-stuff {
    grid-column: 3;
    grid-row: 4;
}

.current-thoughts {
    grid-column: 1;
    grid-row: 4;
}
.current-thoughts .wide-thought img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}
.column-wide {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    gap: 15px;
    height: 100%;
    width: 100%;
}

.long-vertical-line {
    grid-row: 3 / span 4;
    grid-column: 2;
    display: block;
    width: 1px;
    background-color: black;
    height: 100%;
    justify-self: center;
}

.grid-title {
    font-size: 32px;
    font-weight: bold;
    margin-top: 0px;
    margin-bottom: 0px;
}

.recent-title {
    grid-column: 1;
}

.cool-title {
    grid-column: 3;
    grid-row: 3;
}

.current-title {
    grid-column: 1;
    grid-row: 3;
}

.box {
    display: box;
    padding: 5px;
    border-radius: 10px;
    text-align: center;
    overflow: hidden;
}

.long-box {
    grid-column: span 2;
}

figure {
    margin: 0;
    width: 100%;
}

figure figcaption {
    display: box;
    background-color: #6b4fa3;
    color: white;
    font-style: bold;
    border-radius: 5px;
    padding: 5px;
}

figure img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

@media screen and (min-width: 769px) {
    .recent-work img,
    .current-thoughts img,
    .cool-stuff img {
        max-height: 270px;
        width: 100%;
        height: auto;
        object-fit: contain;
    }
}

/* stuff for the pages */

/* stuff for articles */
.article-layout {
    background-image: url("sidebar\ background\ dithered.png");
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 10fr 1fr;
    grid-template-areas:
        "space text space"
}

.article-content {
    display: grid;
    background-image: url("background_dithered.png");
    grid-column: 2;
}

.article-image {
    padding: 15px;
    display: flex;
    justify-content: center;
    margin: 0 auto;
    max-height: 600px;
}

.article-paragraph {
    font-size: 20px;
    margin: 15px;
}

.article-header {
    display: flex;
    align-items: center;
    margin-bottom: 0px;
}

.article-header a {
    font-size: 32px;
    color: black;
    margin-top: 10px;
    display: inline-block;
    text-decoration: none;
}

.article-header a:hover {
    font-weight: bold;
}

.article-logo {
    height: 60px;
    margin-right: 0px;
    margin-left: 8px;
}

.article-date {
    margin-top: 0px;
    margin-left: 8px;
}

/* Socials page stuff */
.social-button {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.socials-caption {
    display: inline-flex;
    background-color: #6b4fa3;
    color: white;
    font-style: bold;
    border-radius: 5px;
    padding: 5px;
}

/* ALL THE ARCHIVE THINGS */
.archive-grid {
    display: grid;
    grid-template-columns: auto auto auto;
}

/* --- ARCHIVE MOBILE RESPONSIVE FIXES --- */
@media screen and (max-width: 768px) {

    /* Reuse the stacking logic from the index */
    .layout {
        display: flex;
        flex-direction: column;
    }

    .header-top {
        flex-direction: column;
        text-align: center;
    }

    .logo {
        width: 70%;
        margin: 0 auto;
    }

    /* Adjust the /writing archive breadcrumb text */
    .article-header {
        justify-content: center;
        padding: 10px 0;
    }

    /* Transform sidebar to a top-menu */
    .sidebar {
        width: 100%;
        text-align: center;
    }

    .sidebar a {
        display: inline-block;
        padding: 10px;
        font-size: 20px;
    }

    .summary {
        display: none;
        /* Keep the archive focused on the list */
    }

    /* The Grid Fix: Switch 3 columns to 1 */
    .archive-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    /* Ensure images fill the width of the phone */
    .archive-grid img {
        width: 100% !important;
        max-height: none !important;
        /* Remove the 400px cap on mobile for better aspect ratio */
        height: auto !important;
        object-fit: cover;
    }

    .box {
        margin-bottom: 20px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding-bottom: 20px;
    }
}

/* --- MOBILE RESPONSIVE FIXES --- */

@media screen and (max-width: 768px) {

    /* Stack the main layout */
    .layout {
        display: flex;
        flex-direction: column;
    }

    /* Header adjustments */
    .header-top {
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }

    .logo {
        width: 80%;
        margin: 0 auto 10px auto;
    }

    .vertical-line {
        display: none;
    }

    .quote {
        font-size: 20px;
        margin-bottom: 10px;
    }

    /* Sidebar to Top Nav */
    .sidebar {
        width: 100%;
        text-align: center;
        padding: 10px 0;
    }

    .sidebar a {
        display: inline-block;
        font-size: 22px;
        padding: 8px 12px;
    }

    .summary {
        display: none;
    }

    /* Main Content Grid Fix */
    .main-grid {
        display: flex;
        flex-direction: column;
        /* Stacks everything vertically */
        gap: 10px;
    }

    /* Re-ordering the elements so titles stay with their content */
    .recent-title {
        order: 1;
        /* First */
    }

    .recent-work {
        order: 2;
        /* Second */
        grid-template-columns: 1fr;
        /* Single column for images */
    }

    .cool-title {
        order: 3;
        /* Third */
    }

    .cool-stuff {
        order: 4;
        /* Fourth */
        grid-template-columns: 1fr;
        /* Single column for boxes */
    }

    .long-vertical-line {
        display: none;
        /* Hide the divider */
    }

    .grid-title {
        text-align: center;
        font-size: 28px;
        margin-top: 20px;
        padding: 5px;
        border-bottom: 2px solid #6b4fa3;
        /* Visual separation */
    }

    .column {
        padding: 0 10px;
    }

    figure img {
        width: 100% !important;
    }

}

/* --- MOBILE ARTICLE RESPONSIVE FIXES WITH GREEN BORDER --- */

@media screen and (max-width: 768px) {

    /* The outer container shows the green dithered background */
    .article-layout {
        display: block;
        background-image: url("sidebar background dithered.png");
        /* Your green texture */
        padding: 10px;
        /* This creates the 'green border' effect around the content */
        min-height: 100vh;
    }

    /* The inner content looks like the main page body */
    .article-content {
        background-image: url("background_dithered.png");
        /* Your tan texture */
        width: 100%;
        margin: 0 auto;
        border: 1px solid rgba(0, 0, 0, 0.2);
        /* Optional: thin border to define the edge */
        border-radius: 4px;
        padding: 15px;
        box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
        /* Subtle retro shadow */
    }

    /* Header adjustments to fit the tighter space */
    .article-header {
        flex-wrap: wrap;
        gap: 5px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .article-header a {
        font-size: 16px;
        word-break: break-all;
        /* Prevents long titles from breaking the layout */
    }

    .article-logo {
        height: 35px;
    }

    /* Ensure images don't overflow the new padded container */
    .article-image {
        width: 100% !important;
        height: auto;
        margin: 15px 0;
    }

    .article-paragraph {
        font-size: 18px;
        margin: 0;
        line-height: 1.6;
    }
}

/* NOTES ARCHIVE */
.notes-list {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 18px auto;
}

.note-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 18px;
    min-height: 140px;
    padding: 12px 5px;
    color: black;
    text-decoration: none;
}

.note-card:hover .note-title,
.note-card:focus-visible .note-title {
    font-weight: bold;
    text-decoration: underline;
}

.note-cover {
    width: 180px;
    height: 140px;
    object-fit: cover;
}

.note-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 140px;
    padding: 12px;
    border: 1px dashed black;
    font-style: italic;
    text-align: center;
}

.note-details {
    align-self: center;
    min-width: 0;
}

.note-title {
    display: inline-block;
    margin: 0 0 6px;
    padding: 4px 7px;
    background-color: #6b4fa3;
    color: white;
    border-radius: 5px;
    font-size: 30px;
    line-height: 1.1;
}

.note-date {
    margin: 0 0 10px;
    font-size: 16px;
    font-style: italic;
}

.note-description {
    margin: 0;
    font-size: 19px;
    line-height: 1.4;
}

@media screen and (max-width: 768px) {
    .notes-list {
        margin: 10px 0;
        padding: 0 4px;
    }

    .note-card {
        grid-template-columns: 100px 1fr;
        gap: 12px;
        min-height: 100px;
        padding: 10px 0;
    }

    .note-cover,
    .note-cover-placeholder {
        width: 100px;
        height: 100px;
    }

    .note-title {
        font-size: 23px;
    }

    .note-date {
        margin-bottom: 6px;
        font-size: 14px;
    }

    .note-description {
        font-size: 16px;
    }
}

@media screen and (max-width: 480px) {
    .note-card {
        grid-template-columns: 1fr;
    }

    .note-cover,
    .note-cover-placeholder {
        width: 100%;
        height: auto;
        max-height: 220px;
    }

    .note-cover-placeholder {
        min-height: 120px;
    }
}