@import url('https://fonts.googleapis.com/css2?family=VT323&family=Libre+Baskerville:wght@400;700&display=swap');

:root {
    --bg-pattern: repeating-linear-gradient(45deg,
            #aaa 0,
            #aaa 1px,
            #fff 0,
            #fff 50%);
    --card-bg: #ffffff;
    --ink: #000000;
    --border-width: 2px;
    --shadow-offset: 4px;
    --font-main: 'Geneva', 'Verdana', sans-serif;
    --font-mono: 'VT323', monospace;
}

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

body {
    font-family: var(--font-main);
    background-color: #bbbbbb;
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* The "Mac" Screen / Stack Container */
#stack-container {
    width: 100%;
    max-width: 760px;
    height: 85vh;
    max-height: 720px;
    min-height: 540px;
    background: var(--card-bg);
    border: var(--border-width) solid var(--ink);
    border-radius: 8px;
    /* Slightly rounded like original Mac window */
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Title Bar */
.title-bar {
    height: 30px;
    border-bottom: var(--border-width) solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(to bottom,
            #fff,
            #fff 2px,
            #000 2px,
            #000 4px);
}

.title-text {
    background: #fff;
    padding: 2px 12px;
    font-family: 'Libre Baskerville', serif;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: -0.5px;
    border: var(--border-width) solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    text-transform: lowercase;
}

/* Card Content Area */
main {
    flex: 1;
    position: relative;
    padding: 20px;
    overflow-y: auto;
}

.card {
    display: none;
    height: 100%;
    flex-direction: column;
    animation: none;
    /* No smooth fade, instant switch is more retro */
}

.card.active {
    display: flex;
}

/* Typography & Elements */

h2 {
    font-family: var(--font-main);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

/* Buttons */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: center;
    gap: 2.5rem;
    max-width: 540px;
    margin: auto auto;
}

button,
.retro-btn {
    background: #fff;
    border: var(--border-width) solid var(--ink);
    padding: 10px 20px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--ink);
    transition: transform 0.1s;
    text-decoration: none;
    color: var(--ink);
    display: inline-block;
    text-align: center;
    border-radius: 6px;
}

button:active,
.retro-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--ink);
    background: #000;
    color: #fff;
}

.back-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    margin-bottom: 20px;
    padding: 6px 12px;
    font-size: 0.9rem;
    z-index: 10;
}

/* Social Icon Boxes (for Home Card) */
.icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    height: 200px;
    width: 200px;
    margin: 0 auto;
}

.pixel-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    image-rendering: pixelated;
    border: 2px solid black;
    /* Placeholder for icon */
    background: #eee;
}

/* Adjust embeds */
iframe {
    border: 2px solid var(--ink);
    box-shadow: 4px 4px 0 #aaa;
    background: #fff;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 16px;
}

::-webkit-scrollbar-track {
    background: #fff;
    border-left: 2px solid #000;
    background-image: radial-gradient(#000 15%, transparent 16%);
    background-size: 4px 4px;
}

::-webkit-scrollbar-thumb {
    background: #fff;
    border: 2px solid #000;
    box-shadow: inset -2px -2px 0 #aaa;
}

/* Discord Section */
.discord-section {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    width: 100%;
}

.discord-btn {
    background: #5865F2;
    /* Discord Blurple */
    border: var(--border-width) solid var(--ink);
    padding: 6px 12px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform 0.1s;
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px;
    width: auto;
    min-width: 140px;
    justify-content: center;
}

.discord-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--ink);
    background: #4752C4;
}

/* Substack Features */
.span-2 {
    grid-column: 1 / -1;
}

.icon-btn.span-2 {
    width: 100%;
    max-width: 100%;
    height: 80px; 
    flex-direction: row; 
    gap: 10px;
}
.icon-btn.span-2 span {
    font-size: 1.2rem;
}

.substack-post {
    border: 2px solid var(--ink);
    background: #fff;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 4px 4px 0 #aaa;
    text-align: left;
    border-radius: 6px;
}
.substack-post h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}
.substack-post h3 a {
    color: var(--ink);
    text-decoration: none;
}
.substack-post h3 a:hover {
    text-decoration: underline;
}
.substack-post .post-date {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
    font-family: var(--font-mono);
}
.substack-post .post-desc {
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.4;
}
.substack-post .read-more {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 2px solid var(--ink);
    text-decoration: none;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform 0.1s;
    border-radius: 4px;
}
.substack-post .read-more:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--ink);
}

/* Responsive Adjustments */
@media (max-width: 600px) {
    main {
        padding: 5px;
    }

    .nav-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        max-width: 100%;
        margin: auto;
    }

    .icon-btn {
        width: 100%;
        max-width: 240px;
        height: 60px !important;
        padding: 5px;
    }

    .discord-section {
        margin-top: 0.5rem;
    }

    #stack-container {
        height: 95vh;
        min-height: auto;
    }
}