/* ================================
   BASE (Mobile First)
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #0a0a0f;
    color: #ffffff;
    font-family: "SF Mono", "Fira Code", "Consolas", "Monaco", "Courier New", monospace;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Prevent scrolling on homepage */
.page-home {
    overflow: hidden;
    height: 100vh;
}

/* ================================
   LAYOUT
   ================================ */
.content-layer {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-area {
    flex: 1;
}

/* ================================
   HEADER
   ================================ */
.header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg,
        rgba(22, 22, 29, 0.9),
        rgba(25, 25, 34, 0.9),
        rgba(30, 30, 38, 0.9),
        rgba(32, 32, 42, 0.9),
        rgba(35, 35, 44, 0.9),
        rgba(47, 47, 60, 0.9),
        rgba(55, 55, 70, 0.9),
        rgba(47, 47, 60, 0.9),
        rgba(35, 35, 44, 0.9),
        rgba(32, 32, 42, 0.9),
        rgba(30, 30, 38, 0.9),
        rgba(25, 25, 34, 0.9),
        rgba(22, 22, 29, 0.9));
    background-size: 200% 200%;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: metallicShine 44s infinite alternate ease-in-out;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

@keyframes metallicShine {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.header-text {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-size: 22px;
    letter-spacing: 0.4px;
}

.site-title a {
    text-decoration: none;
    color: #ffffff;
}

.subtitle {
    font-size: 12px;
    color: #ffffff;
    margin-top: 6px;
    letter-spacing: 0.4px;
}

/* ================================
   NAVIGATION
   ================================ */
/* Hamburger button */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: #fff;
    transition: all 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Navigation menu */
.nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 180px;
    height: 100vh;
    background-color: rgba(13, 13, 13, 0.95);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    padding-top: 5rem;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s ease;
}

.nav-menu.active {
    transform: translateX(0);
    visibility: visible;
}

.nav-menu ul {
    list-style: none;
}

.nav-menu a {
    display: block;
    padding: 1rem 2rem;
    text-decoration: none;
    color: #fff;
    transition: background-color 0.2s;
}

.nav-menu a:hover {
    background-color: #333;
}

/* ================================
   SIGNAL CANVAS (digital rain, index only)
   ================================ */
#signal-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ================================
   PAGE-SPECIFIC OVERRIDES
   ================================ */
.page-standard {
    background-color: #16161d;
}

.page-title {
    font-size: 28px;
    letter-spacing: 1px;
    padding: 1.5rem 20px 1rem 20px;
    text-align: center;
}

/* ================================
   ARTICLE CONTENT PAGE
   ================================ */
.content-article {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 3rem 20px;
}

.article-content {
    line-height: 1.8;
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content h2 {
    font-size: 26px;
    font-weight: normal;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.article-content h3 {
    font-size: 22px;
    font-weight: normal;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.article-content h4 {
    font-size: 18px;
    font-weight: normal;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.article-content a {
    color: #88ccff;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.article-content a:hover {
    color: #aaddff;
}

.article-content ul {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.article-content em {
    font-style: italic;
}

.article-updated {
    font-size: 14px;
    margin-top: 3rem;
    opacity: 0.7;
}

/* ================================
   BOOKS PAGE
   ================================ */

.books-container {
    padding: 16px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.book {
    margin-bottom: 3rem;
}

.book-title {
    font-size: 24px;
    font-weight: normal;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.book-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.book-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.book-description p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.book-description p:last-child {
    margin-bottom: 0;
}

.book-links {
    display: flex;
    gap: 12px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.buy-button {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 16px;
    font-weight: normal;
    transition: outline 0.2s ease;
    text-align: center;
}

.buy-button:hover,
.buy-button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.kindle-button {
    background-color: #232f3e;
    color: #ffffff;
}

.paperback-button {
    background-color: #ff9900;
    color: #000000;
}

.goodreads-button {
    background-color: #372213;
    color: #ffffff;
}

.external-link-icon {
    width: 20px;
    height: 20px;
    vertical-align: -5%;
    margin-left: 4px;
    filter: invert(1) brightness(100%);
}

/* ================================
   EXTERNAL LINK INDICATORS
   ================================ */
/* Add SVG icon to external links */
a[target="_blank"]::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 0.3em;
    background-color: currentColor;
    mask-image: url('/images/open-outline.svg');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-image: url('/images/open-outline.svg');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    vertical-align: -0.1em;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    font-style: normal;
}

a[target="_blank"]:hover::after {
    opacity: 1;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ================================
   DESKTOP (768px and up)
   ================================ */
@media (min-width: 768px) {
    .header {
        padding: 30px;
    }

    .site-title {
        font-size: 32px;
    }

    .subtitle {
        font-size: 16px;
        margin-top: 8px;
    }

    .nav-menu {
         width: 280px;
    }

    /* non index page */
    .page-title {
        font-size: 36px;
        padding: 2rem 30px 1rem 30px;
    }

    /* article pages */
    .content-article {
        padding: 0 30px 4rem 30px;
    }

    .article-content h2 {
        font-size: 32px;
        margin-top: 3rem;
        margin-bottom: 1.5rem;
    }

    .article-content h3 {
        font-size: 26px;
        margin-top: 2.5rem;
        margin-bottom: 1rem;
    }

    .article-content h4 {
        font-size: 20px;
        margin-top: 2rem;
        margin-bottom: 0.75rem;
    }

    .article-updated {
        font-size: 16px;
    }

    /* books page */
    .books-container {
        padding: 20px 30px;
    }

    .book-title {
        font-size: 32px;
        margin-bottom: 1.5rem;
    }

    .book-content {
        flex-direction: row;
        gap: 2rem;
        align-items: flex-start;
    }

    .book-image {
        flex-shrink: 0;
        max-width: 250px;
    }

    .book-description {
        flex: 1;
        padding-top: 2rem;
    }

    .book-links {
        margin-top: 2rem;
    }
    
    .buy-button {
        font-size: 18px;
        padding: 14px 28px;
    }
}
