/* Import Base Styles */
/* ==========================================================================
   Media Query Mixins
   ========================================================================== */
/* Usage example:
@media (min-width: var(--breakpoint-xl)) { ... } */
/* Mobile-first breakpoints */
/* Small phones and up (300px) */
/* Medium phones and up (400px) */
/* Tablets and up (600px) */
/* Desktop and up (800px) */
/* Large Desktop (1400px) */
/* Or Desktop-first breakpoints */
/* Large Desktop and down */
/* Desktop and down */
/* Tablets and down */
/* Medium phones and down */
/* Small phones and down */
/**
* @license
*
* Font Family: Sentient
* Designed by: Noopur Choksi
* URL: https://www.fontshare.com/fonts/sentient
* © 2025 Indian Type Foundry
*
* Using variable fonts to support all weights (200-700) with just two files
* instead of loading 10 separate static font files.
*
*/
/**
* Variable font — normal style
* font-variation-settings: 'wght' 400;
* available axes: 'wght' (200–700)
*/
@font-face {
  font-family: Sentient-Variable;
  src: url('../fonts/sentient/Sentient-Variable.woff2') format('woff2'),
       url('../fonts/sentient/Sentient-Variable.woff') format('woff'),
       url('../fonts/sentient/Sentient-Variable.ttf') format('truetype');
  font-weight: 200 700;
  font-display: swap;
  font-style: normal;
}
/**
* Variable font — italic style
* font-variation-settings: 'wght' 400;
* available axes: 'wght' (200–700)
*/
@font-face {
  font-family: Sentient-VariableItalic;
  src: url('../fonts/sentient/Sentient-VariableItalic.woff2') format('woff2'),
       url('../fonts/sentient/Sentient-VariableItalic.woff') format('woff'),
       url('../fonts/sentient/Sentient-VariableItalic.ttf') format('truetype');
  font-weight: 200 700;
  font-display: swap;
  font-style: italic;
}
/* Import Components */
/* ==========================================================================
   Navigation
   ========================================================================== */
/* Primary Navigation */
nav {
    margin-bottom: var(--spacing-md);
}
nav a {
    color: inherit;
    text-decoration: none;
}
nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: var(--spacing-xs);
}
nav li.nav-link:not(:first-child)::before {
    content: "/";
    margin-right: var(--spacing-xs);
    color: var(--color-text-muted);
}
nav a[aria-current="page"] {
    font-weight: bold;
}
nav a:hover {
    text-decoration: underline;
}
/* Mobile Navigation: horizontal scroll (same breakpoint as profile photo) */
@media (width <= 500px) {
    nav {
        /* horizontal scroll behavior */
        --nav-fade: 16px; /* edge fade width */

        width: 100%;
        max-width: 100vw; /* constrain nav width to viewport */
        overflow: auto hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain; /* avoid scroll chaining to body */
        touch-action: pan-x;
        scrollbar-gutter: stable;
        padding: 0 var(--spacing-xs);
        position: relative;

        /* subtle edge fades using masks; keeps scrollbar visible */
        -webkit-mask-image: linear-gradient(
          to right,
          transparent 0,
          black var(--nav-fade),
          black calc(100% - var(--nav-fade)),
          transparent 100%
        );
    }

    /* Make the list size to its content so the container can scroll */
    nav ul {
        display: inline-flex;
        gap: var(--spacing-xs);
        white-space: nowrap;
        min-width: max-content;
        padding-bottom: 0.25rem; /* avoid scrollbar overlaying text on some browsers */
    }

    /* Prevent items from shrinking so separators stay consistent */
    nav li {
        flex: 0 0 auto;
    }
}
/* ==========================================================================
   Book Grid Layout
   ========================================================================== */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--book-width));
    gap: var(--spacing-sm);
    margin: var(--spacing-md) auto;
    justify-content: left;
}
.book-grid figure {
    margin: 0;
    width: var(--book-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease;
}
.book-grid figure:hover {
    transform: translateY(-2px);
}
.book-grid img {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}
.book-grid figcaption {
    margin-top: var(--spacing-sm);
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    width: 100%;
    color: var(--color-text);
}
/* Browse link — appears at bottom of book and writing article pages */
.shelf-browse-link {
    display: inline-block;
    margin-top: var(--spacing-md);
    color: var(--color-primary);
    font-size: var(--font-size-small);
    text-decoration: none;
}
.shelf-browse-link:hover {
    text-decoration: underline;
    text-decoration-thickness: 0.1em;
}
/* Theater Components */
.theater-wrapper {
    max-width: 200px;

    /* updated cap moved from inline style */
    margin: var(--spacing-sm) 0;
}
.theater-wrapper img {
    width: 100%;

    /* Make image fill wrapper */
    max-width: 100%;

    /* ensures the image fills wrapper up to 200px */
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    display: block;
    transition: transform 0.2s ease;
}
.theater-wrapper img:hover {
    transform: translateY(-2px);
}
/* ==========================================================================
   Newsletter Section
   ========================================================================== */
.newsletter-section {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.newsletter-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xs) var(--spacing-sm);
    align-items: start;
}
.newsletter-title {
    grid-column: 1 / -1;
    margin: 0; /* rely on grid gap for spacing */
    color: var(--color-primary);
    font-size: 1.5rem;
}
.newsletter-description {
    grid-column: 1;
    margin-top: 0;
    margin-bottom: 0;
    color: var(--color-text);
    line-height: var(--line-height-base);
}
.newsletter-form {
    grid-column: 2;
}
.embeddable-buttondown-form {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "email submit";
    gap: 0 var(--spacing-md);
    align-items: center;
}
.embeddable-buttondown-form label {
    font-weight: 700;
    color: var(--color-text);
}
.embeddable-buttondown-form input[type="email"] {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family-base);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}
.embeddable-buttondown-form input[type="email"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 1px var(--color-primary),
        0 0 20px -5px color-mix(in oklch, var(--color-primary) 40%, transparent);
}
.embeddable-buttondown-form input[type="submit"] {
    grid-area: submit;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--color-primary);
    color: var(--color-bg);
    font-family: var(--font-family-base);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    width: auto;
    white-space: nowrap;
    justify-self: end;
}
.embeddable-buttondown-form input[type="submit"]:hover {
    opacity: 0.9;
}
.embeddable-buttondown-form input[type="submit"]:active {
    transform: translateY(1px);
}
.newsletter-powered {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
}
.newsletter-powered a {
    color: var(--color-text-muted);
    text-decoration: underline;
    text-decoration-thickness: 0.05em;
}
.newsletter-powered a:hover {
    color: var(--color-primary);
}
/* Newsletter message (success/error) */
.newsletter-message {
    display: none;
    grid-column: 1 / -1;
    margin-top: var(--spacing-sm);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    line-height: var(--line-height-base);
}
.newsletter-message.is-visible {
    display: block;
}
.newsletter-message-success {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-success-text);
}
.newsletter-message-error {
    background-color: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    color: var(--color-error-text);
}
/* Disabled state for submit button */
.embeddable-buttondown-form input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
@media (width <= 500px) {
    .newsletter-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm) 0;
    }

    .newsletter-description,
    .newsletter-form {
        grid-column: 1;
        width: 100%;
    }

    .embeddable-buttondown-form {
        grid-template-columns: 1fr;
        grid-template-areas:
            "email"
            "submit";
        gap: var(--spacing-sm) 0;
        align-items: stretch;
        width: 100%;
    }

    .embeddable-buttondown-form input[type="submit"] {
        width: 100%;
        justify-self: stretch;
    }
}
/* ==========================================================================
   Social Links Component
   ========================================================================== */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin: var(--spacing-sm) 0;
}
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    background-color: transparent;
    color: var(--color-text-muted);
    text-decoration: none !important;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.1s ease;
}
.social-link svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentcolor;
}
.social-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}
.social-link:active {
    transform: translateY(1px);
}
.social-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
/* ==========================================================================
   Writing Posts / Article Listings
   ========================================================================== */
.writing-list {
    margin: var(--spacing-md) 0;
}
.writing-item {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}
.writing-item:last-child {
    border-bottom: none;
}
.writing-item-title {
    margin: 0 0 var(--spacing-xs) 0;
    font-family: Sentient-Variable, serif;
    font-weight: 700;
    font-size: var(--font-size-title);
    line-height: 1.3;
}
.writing-item-title a {
    color: var(--color-primary);
    text-decoration: none;
}
.writing-item-date {
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
    margin: 0 0 var(--spacing-sm) 0;
}
.writing-item-excerpt {
    color: var(--color-text);
    line-height: var(--line-height-base);
    margin: 0;
}
/* Shelf page writing section - compact list style */
.writing-recent-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-xs) 0;
}
.writing-recent-list li {
    margin-bottom: 0.35rem;
}
.writing-recent-list a {
    color: var(--color-primary);
}
.writing-recent-list .date {
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
}
.writing-item-title a:hover {
    text-decoration: underline;
    text-decoration-thickness: 0.1em;
}
/* Mobile adjustments */
@media (width <= 500px) {
    .writing-item-title {
        font-size: 1.5rem;
    }
    
    .writing-item {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }
}
/* ==========================================================================
   RSS Icon and Page Header
   ========================================================================== */
/* Page header with title and optional RSS icon */
.page-header {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
    margin-top: 0.67em; /* matches browser default h1 top margin */
    margin-bottom: var(--spacing-sm);
}
.page-header h1 {
    margin: 0;
}
/* RSS link and icon styling */
.rss-link {
    display: inline-flex;
    align-items: center;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.rss-link:hover {
    color: var(--color-primary);
}
.rss-icon {
    width: 20px;
    height: 20px;
    fill: currentcolor;
}
/* Mobile adjustments */
@media (width <= 500px) {
    .page-header {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .rss-icon {
        width: 18px;
        height: 18px;
    }
}
/* ==========================================================================
   Utility Classes
   ========================================================================== */
/* Visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
/* ==========================================================================
   CSS Custom Properties (Variables)
   ========================================================================== */
:root {
    /* Layout */
    --max-content-width: 80ch;
    --container-padding: var(--spacing-md);

    /* Typography */
    --font-family-base: 'Nunito Sans', system-ui, -apple-system, sans-serif;
    --line-height-base: 1.5;
    --font-size-small: 0.9rem;

    /* Spacing Scale */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;

    /* Component Specific */
    --book-width: 180px;
    --border-radius: 4px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgb(0 0 0 / 10%);
    --shadow-md: 0 2px 8px rgb(0 0 0 / 15%);

    /* Breakpoints */
    --breakpoint-xl: 1400px;
    --breakpoint-lg: 800px;
    --breakpoint-md: 600px;
    --breakpoint-sm: 500px;
    --breakpoint-xs: 400px;

    /* Typography Scale */
    --font-size-title: 1.75rem;
    --font-size-display: 2rem;

    /* Light Theme Colors */
    --color-bg: oklch(100% 0 0deg);
    --color-text: oklch(22% 0 0deg);
    --color-text-muted: oklch(51% 0 0deg);
    --color-primary: oklch(50% 0.111 242deg);
    --color-heading: oklch(18% 0 0deg);
    --color-border: oklch(92% 0 0deg);
    --color-success-bg: oklch(92% 0.037 153deg);
    --color-success-border: oklch(89% 0.052 152deg);
    --color-success-text: oklch(40% 0.105 147deg);
    --color-error-bg: oklch(91% 0.037 11deg);
    --color-error-border: oklch(87% 0.054 11deg);
    --color-error-text: oklch(37% 0.119 20deg);
}
/* Dark theme colors */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --color-bg: oklch(22% 0 0deg);
        --color-text: oklch(98% 0.009 286deg);
        --color-text-muted: oklch(71% 0 0deg);
        --color-primary: oklch(70% 0.113 236deg);
        --color-heading: oklch(96% 0 0deg);
        --color-border: oklch(32% 0 0deg);
        --color-success-bg: oklch(35% 0.078 145deg);
        --color-success-border: oklch(42% 0.087 144deg);
        --color-success-text: oklch(83% 0.078 145deg);
        --color-error-bg: oklch(30% 0.066 22deg);
        --color-error-border: oklch(36% 0.076 22deg);
        --color-error-text: oklch(83% 0.075 19deg);
    }
}
[data-theme='dark'] {
    --color-bg: oklch(22% 0 0deg);
    --color-text: oklch(98% 0.009 286deg);
    --color-text-muted: oklch(71% 0 0deg);
    --color-primary: oklch(70% 0.113 236deg);
    --color-heading: oklch(96% 0 0deg);
    --color-border: oklch(32% 0 0deg);
    --color-success-bg: oklch(35% 0.078 145deg);
    --color-success-border: oklch(42% 0.087 144deg);
    --color-success-text: oklch(83% 0.078 145deg);
    --color-error-bg: oklch(30% 0.066 22deg);
    --color-error-border: oklch(36% 0.076 22deg);
    --color-error-text: oklch(83% 0.075 19deg);
}
/* ==========================================================================
   Base Styles
   ========================================================================== */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    line-height: 1.5;
    background-color: var(--color-bg);
    color: var(--color-text);
}
body,
.site-wrapper {
    font-family: var(--font-family-base);
}
.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: var(--spacing-sm);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}
main {
    flex: 1;
}
h1 {
    font-family: Sentient-Variable, serif;
    color: var(--color-heading);
    font-weight: 700;
}
h2 {
    font-family: Sentient-VariableItalic, serif;
    font-weight: 300;
    font-style: italic;
    margin-top: var(--spacing-lg);
}
h2:first-child {
    margin-top: 0;
}
/* Subtitle under the H1 on the homepage — distinct from section H2s */
.page-subtitle {
    font-family: Sentient-Variable, serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin: 0 0 var(--spacing-sm) 0;
}
/* Pull quote — editorial excerpt displayed on the homepage */
.pull-quote {
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-left: 3px solid var(--color-primary);
    font-family: Sentient-Variable, serif;
    font-size: 1.1rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text-muted);
}
/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}
article img,
main img {
    max-width: 100%;
    height: auto;
    margin: var(--spacing-md) auto;
    border-radius: var(--border-radius);
}
/* Ensure images in writing posts match text width */
main article img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
/* Base link styles */
a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 0.05em;
    text-underline-offset: 0.2em;
}
/* Override link color for nav */
nav a {
    color: inherit;
    text-decoration: none;
}
a:focus,
button:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
a:hover {
    text-decoration-thickness: 0.2em;
}
nav a:hover {
    text-decoration: underline;
}
/* ==========================================================================
   Navigation
   ========================================================================== */
/* Primary Navigation */
nav {
    margin-bottom: 0;
}
nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: var(--spacing-xs);
}
nav a[aria-current="page"] {
    font-weight: bold;
}
/* Mobile Navigation: horizontal scroll  */
@media (width <= 500px) {
    /* Keep the page fixed to the viewport width; only the nav can scroll */
    * {
        box-sizing: border-box;
    }
    
    html, body {
        max-width: 100vw;
        overflow-x: hidden; /* prevent any accidental page-level x scroll */
        margin: 0;
        padding: 0;
    }

    .site-wrapper {
        max-width: 100vw;
        width: 100vw;
        padding: var(--spacing-sm) var(--spacing-md);
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    main {
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow-wrap: break-word;
    }
    
    /* Better typography for mobile */
    h1, h2, h3, h4, h5, h6 {
        max-width: 100%;
        overflow-wrap: break-word;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        hyphens: auto;
    }
    
    p {
        max-width: 100%;
        overflow-wrap: break-word;
    }

    nav {
        /* horizontal scroll behavior */
        --nav-fade: 16px; /* edge fade width */

        width: 100%;
        max-width: 100vw; /* constrain nav width to viewport */
        overflow: auto hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain; /* avoid scroll chaining to body */
        touch-action: pan-x;
        scrollbar-gutter: stable;
        padding: 0 var(--spacing-xs);
        position: relative;

        /* subtle edge fades using masks; keeps scrollbar visible */
        -webkit-mask-image: linear-gradient(
          to right,
          transparent 0,
          black var(--nav-fade),
          black calc(100% - var(--nav-fade)),
          transparent 100%
        );
    }

    /* Make the list size to its content so the container can scroll */
    nav ul {
        display: inline-flex;
        gap: var(--spacing-xs);
        white-space: nowrap;
        min-width: max-content;
        padding-bottom: 0.25rem; /* avoid scrollbar overlaying text on some browsers */
    }

    /* Prevent items from shrinking so separators stay consistent */
    nav li {
        flex: 0 0 auto;
    }
}
/* ==========================================================================
   Homepage Avatar
   ========================================================================== */
.homepage-avatar {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    object-position: center top;
    margin: var(--spacing-md) 0 var(--spacing-xs) 0;
    display: block;
}
/* ==========================================================================
   About Section
   ========================================================================== */
.about-intro {
    overflow: hidden;
    margin: .5rem 0;
}
.profile-photo {
    float: left;
    max-width: 300px;
    height: auto;
    border-radius: var(--border-radius);
    margin: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 0;
    background-color: var(--color-border);
    aspect-ratio: 1/1;
}
@media (width <= 600px) {
    .about-intro {
        display: block;
        overflow: visible;
    }
    
    .profile-photo {
        float: none !important;
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0 0 var(--spacing-md) 0;
        position: static;
    }
}
/* ==========================================================================
   Book Grid Layout
   ========================================================================== */
.book-grid {
    /* Use CSS Grid instead of flex so we can let the browser decide
       how many 180 px columns fit inside the content width */
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--book-width));
    gap: var(--spacing-sm);
    margin: var(--spacing-md) auto;

    /* keep the grid flush with the header text */
    justify-content: left;

    /* centres the grid so leftover space is split */
}
.book-grid figure {
    margin: 0;
    width: var(--book-width);

    /* lock each card to 180 px */
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease;
}
.book-grid figure:hover {
    transform: translateY(-2px);
}
.book-grid img {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background-color: var(--color-border);
}
.book-grid figcaption {
    margin-top: var(--spacing-sm);
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    width: 100%;
    color: var(--color-text);
}
/* ==========================================================================
   Individual Book Page
   ========================================================================== */
.book-header {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--spacing-md);
    margin: 2rem 0;
}
.book-cover {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    background-color: var(--color-border);
    aspect-ratio: 2/3;
}
.book-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
@media (width <= 500px) {
    .book-header {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .book-cover {
        max-width: 200px;
        margin: 0 auto;
    }
}
/* ==========================================================================
   Media Queries (Desktop First)
   ========================================================================== */
/* Four-column shelf (1400px and up) */
@media (min-width: var(--breakpoint-xl)) {
    .book-grid {
        grid-template-columns: repeat(4, var(--book-width));
        justify-content: space-between;
    }
}
/* Three-column shelf (800px - 1399px) */
@media (max-width: var(--breakpoint-xl)) {
    .book-grid {
        grid-template-columns: repeat(3, var(--book-width));
        justify-content: space-between;
    }
}
/* === Fine-grained mobile breakpoints === */
/* Medium tablets (600px - 799px) */
@media (max-width: var(--breakpoint-lg)) {
    :root {
        --book-width: min(calc((100vw - var(--spacing-md) * 2 - var(--spacing-sm)) / 2), 180px);
    }

    .book-grid {
        grid-template-columns: repeat(2, var(--book-width));
        justify-content: space-between;
        gap: var(--spacing-sm);
    }
}
/* Small tablets (500px - 599px) */
@media (width >= 500px) and (width <= 599px) {
    :root {
        --book-width: min(calc((100vw - var(--spacing-md) * 2 - var(--spacing-sm) * 2) / 3), 180px);
    }

    .book-grid {
        grid-template-columns: repeat(3, var(--book-width));
    }
}
/* Large phones (400px - 499px) */
@media (width >= 400px) and (width <= 499px) {
    :root {
        --book-width: min(calc((100vw - var(--spacing-md) * 2 - var(--spacing-sm)) / 2), 180px);
    }

    .book-grid {
        grid-template-columns: repeat(2, var(--book-width));
        gap: var(--spacing-sm);
        margin: var(--spacing-md) 0;
        width: 100%;
        max-width: 100%;
    }
}
/* Small phones (300px - 399px) */
@media (width >= 300px) and (width <= 399px) {
    :root {
        --book-width: calc((100vw - var(--spacing-md) * 2 - var(--spacing-sm)) / 2);
    }

    .book-grid {
        grid-template-columns: repeat(2, var(--book-width));
        gap: var(--spacing-sm);
        margin: var(--spacing-md) 0;
        width: 100%;
        max-width: 100%;
    }
}
/* Extra small phones (under 300px) */
@media (width <= 299px) {
    :root {
        --book-width: calc(100vw - var(--spacing-sm) * 2);
    }

    .book-grid {
        grid-template-columns: var(--book-width);
        justify-content: center;
        gap: var(--spacing-md);
    }

    body {
        padding: var(--spacing-sm);
    }
}
.theme-toggle-group {
    display: flex;
    align-items: center;
    margin-left: auto;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
/* Pill — sky blue in light mode */
.toggle-slider {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #87ceeb 0%, #b8d9f0 100%);
    border-radius: 28px;
    transition: background 0.4s ease;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / 15%);
}
/* Sun emoji knob */
.toggle-slider::before {
    content: "☀️";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    font-size: 15px;
    line-height: 22px;
    text-align: center;
    transition: all 0.4s ease;
}
/* Pill — deep navy in dark mode */
input:checked + .toggle-slider {
    background: linear-gradient(to right, #0f172a 0%, #1e293b 100%);
}
/* Crescent moon emoji knob */
input:checked + .toggle-slider::before {
    content: "🌙";
    transform: translateX(24px);
}
/* Visually hide skip link except when focused */
.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 0;
    height: 0;
    overflow: hidden;
    z-index: 100;
    background: var(--color-bg);
    color: var(--color-text);
    padding: 0.5em 1em;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
    text-decoration: none;
    font-weight: bold;
}
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
}
footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 32px;
    padding-bottom: 16px;
}
footer p {
    margin: 0;
}
footer .social-links {
    margin: 0;
}
/* Mobile: Stack footer vertically */
@media (width <= 500px) {
    footer {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
}

