/* Custom styles for mkaz.blog with Pico CSS */
/* Custom font faces */
@font-face {
    font-family: 'Hyperlegible';
    src: url('/font/AtkinsonHyperlegible-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Hyperlegible';
    src: url('/font/AtkinsonHyperlegible-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Hyperlegible';
    src: url('/font/AtkinsonHyperlegible-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Hyperlegible';
    src: url('/font/AtkinsonHyperlegible-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* Override Pico CSS variables - placed after Pico CSS loads */
:root {
    --pico-border-radius: 0.25rem;
    --pico-card-background-color: #f5f5f5;
    --pico-card-border-color: #ddd;
    --pico-color-azure-950: rgb(252, 46, 115);
    --pico-color-zinc-500: #6b7280;
    --pico-font-family-sans-serif: 'Hyperlegible', system-ui, -apple-system,
        BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --pico-font-size: 16px;
    --pico-spacing: 1rem;
}

/* Fixed font sizing */
html {
    font-size: 16px;
}

body {
    border-top: 8px solid var(--pico-color-azure-950);
    font-size: var(--pico-font-size);
    font-family: var(--pico-font-family-sans-serif);
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

a,
a:visited {
    color: #0120ad;
    text-decoration: none;
}

/* Header styling */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 960px;
    margin: 0 auto 1rem auto;
    padding: 0.5rem 1rem;
}

header hgroup {
    margin: 0;
}

header hgroup h1 {
    font-size: 1.2rem;
    margin: 0;
}

header hgroup p {
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

header hgroup a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
}

header nav {
    margin: 0;
}

header nav ul {
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

header nav ul li {
    margin: 0;
}

/* Flexbox layout instead of grid */
.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 960px;
    margin: 0 auto;
}

.grid {
    display: flex;
    gap: 2rem;
}

aside {
    flex: 0 0 200px;
    min-width: 200px;
}

main {
    flex: 1;
    min-width: 0;
}

/* Sidebar navigation */
aside nav {
    margin-bottom: 1.5rem;
}

aside nav h3 {
    font-size: 1rem;
    margin-left: 0;
    margin-bottom: 0.5rem;
    color: var(--pico-color-zinc-500);
}

aside nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

aside nav ul li {
    margin-left: 0;
    margin-bottom: 0.25rem;
}

aside nav ul li a {
    display: block;
    font-size: 0.9rem;
    margin-left: 0;
    padding: 0.125rem 0;
    text-decoration: none;
}

aside nav hr {
    margin: 1rem 0;
}

/* Book list styling */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.book {
    padding: 1rem;
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
    text-align: center;
}

.book img {
    max-width: 120px;
    height: auto;
    margin: 0 auto 1rem;
}

.book .content h3 {
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.book .content .rating {
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

/* Callout styling */
.callout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--pico-border-radius);
    background-color: var(--pico-card-background-color);
    border: 1px solid var(--pico-card-border-color);
}

.callout.info {
    background-color: var(--pico-color-amber-50);
    border-color: var(--pico-color-amber-200);
}

.callout .label {
    flex-shrink: 0;
}

.callout p {
    margin: 0;
}

/* Code styling adjustments */
pre {
    background-color: var(--pico-color-zinc-900);
    color: var(--pico-color-zinc-100);
}

code {
    color: #9a039a;
    background-color: #ffffff;
}

/* Code inside blocks */
pre code {
    color: var(--pico-color-zinc-100);
}

/* Media embeds */
.youtube-embed .codepen-embed,
figure,
iframe,
video {
    max-width: 100%;
    width: 100%;
    margin: 1.5rem 0;
}

.youtube-embed iframe,
.codepen-embed iframe {
    min-height: 420px;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

/* Post list styling - more compact for desktop */
.postlist ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.postlist ul li {
    padding: 0.25rem 1rem;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.postlist ul li:nth-child(odd) {
    background-color: #f5f5f5;
}

.post-date {
    color: var(--pico-color-zinc-500);
    font-size: 0.9rem;
}

/* Reduce excessive spacing in main content */
main > * {
    margin-bottom: 1rem;
}

main > h1 {
    margin-bottom: 1rem;
    margin-top: 0;
}

main > h2 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* Tighten up general spacing for desktop */
p + p {
    margin-top: 1rem;
}

article {
    line-height: 1.5;
}

/* Hamburger menu button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--pico-border-radius);
    transition: background-color 0.2s ease;
}

.menu-toggle:hover {
    background-color: var(--pico-card-background-color);
}

/* Sidebar close button */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--pico-color-zinc-500);
    border-radius: var(--pico-border-radius);
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background-color: var(--pico-card-background-color);
    color: var(--pico-color-azure-950);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* Show hamburger menu */
    .menu-toggle {
        display: block;
    }

    /* Hide header nav items */
    header nav ul {
        display: none;
    }

    .grid {
        flex-direction: column;
        gap: 0;
    }

    /* Show close button on mobile */
    .sidebar-close {
        display: block;
    }

    /* Hide aside by default on mobile */
    aside {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        z-index: 1000;
        padding: 2rem 1rem;
        overflow-y: auto;
        transition: left 0.3s ease;
        border-right: 1px solid var(--pico-card-border-color);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    /* Show sidebar when toggled */
    aside.show {
        left: 0;
    }

    /* Adjust main content */
    main {
        flex: none;
        width: 100%;
    }

    .book-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    /* Add overlay when sidebar is open */
    aside.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
    }
}
