/* ===========================
   Daniel Björk — Personal Site
   Inspired by Fantastic Man
   =========================== */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base */
:root {
    --black: #1a1a18;
    --white: #F0EEE9;
    --grey: #8a8780;
    --light-grey: #d8d5cf;
    --page-padding: 2rem;
    --font-main: 'Cormorant Garamond', serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    color: var(--black);
    background: var(--white);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: var(--black);
    text-decoration: none;
}

.about-text a,
.journal-pub a {
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
    transition: opacity 0.2s;
}

.about-text a:hover,
.journal-pub a:hover {
    opacity: 0.5;
}

img {
    max-width: 100%;
    display: block;
}

/* ===========================
   Language Toggle
   =========================== */

.lang-toggle {
    position: fixed;
    top: var(--page-padding);
    left: var(--page-padding);
    z-index: 100;
    background: var(--white);
    border: 1px solid var(--black);
    font-family: var(--font-main);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.4em 0.8em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.lang-toggle:hover {
    background: var(--black);
    color: var(--white);
}

/* ===========================
   Navigation
   =========================== */

.nav {
    position: fixed;
    top: var(--page-padding);
    right: var(--page-padding);
    z-index: 100;
}

.nav-toggle {
    background: var(--white);
    border: 1px solid var(--black);
    font-family: var(--font-main);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.4em 0.8em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nav-toggle:hover {
    background: var(--black);
    color: var(--white);
}

.nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--white);
    border: 1px solid var(--black);
    min-width: 220px;
}

.nav-menu.open {
    display: block;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--light-grey);
    transition: background 0.2s, color 0.2s;
}

.nav-menu a:last-child {
    border-bottom: none;
}

.nav-menu a:hover {
    background: var(--black);
    color: var(--white);
}

/* ===========================
   Hero
   =========================== */

.hero {
    position: relative;
    padding: var(--page-padding);
    padding-top: 5rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid var(--black);
}

.hero-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 300;
    letter-spacing: 0.3em;
    text-align: center;
    line-height: 1.1;
    text-transform: uppercase;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.hero-name span {
    display: inline-block;
}

.hero-name br {
    flex-basis: 100%;
    height: 0.15em;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
}

.hero-photo {
    grid-column: 2;
    position: relative;
    overflow: visible;
    max-width: clamp(300px, 46vw, 660px);
}

.hero-photo img {
    width: 100%;
    height: auto;
}

.hero-photo-credit {
    position: absolute;
    right: -1.5em;
    bottom: 0;
    writing-mode: vertical-rl;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--grey);
}

.hero-descriptor {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    display: flex;
    flex-direction: column;
    gap: 1.0em;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--grey);
    line-height: 1;
}

.hero-descriptor span:last-child {
    line-height: 1;
}

/* ===========================
   Sections
   =========================== */

.section {
    border-bottom: 1px solid var(--black);
    padding: 6rem var(--page-padding);
}

.section-inner {
    max-width: 800px;
    margin: 0 auto;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 3rem;
    color: var(--grey);
}

/* ===========================
   About
   =========================== */

.about-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    align-items: start;
}

.about-photo {
    position: relative;
}

.about-photo img {
    width: 100%;
    height: auto;
    border: 1px solid var(--light-grey);
}

.photo-credit {
    position: absolute;
    left: -1.5em;
    bottom: 0;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--grey);
}

.about-text p {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.about-text p:last-child {
    margin-bottom: 0;
}

/* ===========================
   Books
   =========================== */

.book {
    margin-bottom: 0;
}

.book-layout {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 2rem;
    align-items: start;
}

.book-cover {
    width: 140px;
}

.book-cover img {
    width: 100%;
    height: auto;
    border: 1px solid var(--light-grey);
}

.book-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.book-title {
    font-size: 1.75rem;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.02em;
}

.book-year {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--grey);
}

.book-meta {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--grey);
    margin-bottom: 1.25rem;
}

.book-description {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.book-quote {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--grey);
    font-style: italic;
}

.book-press {
    margin-bottom: 0.75rem;
}

.press-quote {
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.5;
}

.press-source {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--grey);
    text-transform: uppercase;
}

.book-divider {
    height: 1px;
    background: var(--light-grey);
    margin: 3rem 0;
}

/* ===========================
   Editing & Journalism
   =========================== */

.journal-entries {
    display: grid;
    gap: 2.5rem;
}

.journal-entry {
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--light-grey);
}

.journal-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.journal-role {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--grey);
    margin-bottom: 0.35rem;
}

.journal-pub {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.02em;
}

/* ===========================
   Footer
   =========================== */

.footer {
    padding: 3rem var(--page-padding);
}

.footer-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--grey);
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-contact {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--grey);
    text-decoration: none;
    transition: opacity 0.2s;
}

.footer-contact:hover {
    opacity: 0.5;
}

/* ===========================
   Easter Egg Trigger
   =========================== */

.easter-egg-trigger {
    position: fixed;
    bottom: var(--page-padding);
    right: var(--page-padding);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.15;
    transition: opacity 0.3s;
    z-index: 50;
    user-select: none;
}

.easter-egg-trigger:hover {
    opacity: 0.8;
}

/* ===========================
   Game Overlay
   =========================== */

.game-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.game-overlay.active {
    display: flex;
}

.game-container {
    background: #000;
    border: 2px solid #00aa00;
    max-width: 680px;
    width: 100%;
    box-shadow: 0 0 60px rgba(0, 170, 0, 0.15);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #001a00;
    border-bottom: 1px solid #00aa00;
}

.game-title {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #00aa00;
    letter-spacing: 0.05em;
}

.game-close {
    background: none;
    border: none;
    color: #00aa00;
    font-size: 1.25rem;
    cursor: pointer;
    font-family: monospace;
    line-height: 1;
}

.game-close:hover {
    color: #00ff00;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.game-text-box {
    padding: 1rem;
    background: #001a00;
    border-top: 1px solid #004400;
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
}

.game-text-box p {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #00dd00;
    line-height: 1.6;
}

.game-input-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #001a00;
    border-top: 1px solid #004400;
}

.game-prompt {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #00aa00;
    margin-right: 0.5rem;
}

.game-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #00ff00;
    caret-color: #00ff00;
}

.game-input::placeholder {
    color: #004400;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 700px) {
    :root {
        --page-padding: 1.25rem;
    }

    /* Hero — stack vertically */
    .hero-name {
        font-size: clamp(2rem, 10vw, 4rem);
        letter-spacing: 0.15em;
    }

    .hero-content {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .hero-photo {
        grid-column: 1;
        max-width: 80%;
    }

    .hero-descriptor {
        grid-column: 1;
        grid-row: 3;
        align-self: start;
        align-items: center;
        margin-top: 1.5rem;
    }

    /* About — stack */
    .about-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-photo img {
        max-width: 280px;
    }

    .section {
        padding: 4rem var(--page-padding);
    }

    /* Books — stack: header/meta, then cover, then description */
    .book-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .book-cover {
        width: 160px;
        order: 2;
        margin: 1.25rem 0;
    }

    .book-info {
        display: contents;
    }

    .book-header {
        order: 1;
    }

    .book-meta {
        order: 1;
    }

    .book-description {
        order: 3;
    }

    .book-press {
        order: 4;
    }

    .book-title {
        font-size: 1.35rem;
    }

    .journal-pub {
        font-size: 1.2rem;
    }
}
