:root {
    --ink: #17110e;
    --coal: #211714;
    --coal-soft: #2f201b;
    --paper: #ffe3bd;
    --paper-dim: #f6c88b;
    --marigold: #ffae38;
    --geru: #c15d2a;
    --rose: #ef7d68;
    --blue: #2b6f83;
    --line: rgba(255, 227, 189, 0.32);
    --shadow: rgba(12, 7, 5, 0.5);
    --hero-image: none;
    --hero-title-size: clamp(4.2rem, 15vw, 10rem);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Avenir, "Trebuchet MS", Verdana, sans-serif;
    color: var(--paper);
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 174, 56, 0.22), transparent 28rem),
        radial-gradient(circle at 86% 22%, rgba(43, 111, 131, 0.18), transparent 24rem),
        linear-gradient(135deg, rgba(255, 227, 189, 0.06) 25%, transparent 25%) 0 0 / 18px 18px,
        linear-gradient(225deg, rgba(255, 227, 189, 0.04) 25%, transparent 25%) 0 0 / 18px 18px,
        var(--ink);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(90deg, transparent 0 38px, rgba(255, 227, 189, 0.05) 38px 39px),
        repeating-linear-gradient(0deg, transparent 0 38px, rgba(255, 227, 189, 0.04) 38px 39px);
    mix-blend-mode: screen;
    opacity: 0.45;
    animation: streetlight 12s ease-in-out infinite;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 227, 189, 0.45) 0.7px, transparent 0.8px);
    background-size: 4px 4px;
    opacity: 0.18;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.poetry-page {
    --hero-image: url("assets/deadpoetssociety_bg.png");
    --hero-title-size: clamp(4.2rem, 15vw, 10rem);
}

.mini-essays-page {
    --hero-image: url("Mini-essays-photo.jpg");
    --hero-title-size: clamp(3.8rem, 13vw, 9.2rem);
}

.writings-page {
    --hero-image: url("Writings_photo.png");
    --hero-title-size: clamp(4rem, 14vw, 9.8rem);
}

.page {
    width: min(1060px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 42px;
    position: relative;
}

.hero {
    min-height: 48vh;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 44px clamp(18px, 5vw, 56px) 30px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(33, 23, 20, 0.14), rgba(33, 23, 20, 0.9)),
        radial-gradient(circle at 18% 76%, rgba(255, 174, 56, 0.22), transparent 22rem),
        var(--hero-image) center / cover;
    box-shadow: 0 24px 70px var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px dashed rgba(255, 227, 189, 0.36);
    pointer-events: none;
    z-index: 1;
}

.site-tag {
    position: absolute;
    right: clamp(18px, 4vw, 42px);
    top: 24px;
    color: rgba(255, 227, 189, 0.68);
    font-family: Georgia, serif;
    font-size: 0.82rem;
    transform: rotate(2deg);
    z-index: 2;
}

.hero-content {
    max-width: 760px;
    position: relative;
    z-index: 2;
}

.back-button {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--paper);
    background: rgba(33, 23, 20, 0.84);
    border: 1px solid var(--line);
    box-shadow: 5px 5px 0 rgba(193, 93, 42, 0.42);
    position: relative;
    z-index: 2;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.back-button:hover {
    color: var(--ink);
    background: var(--marigold);
    transform: translate(-2px, -2px);
}

.back-button svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kicker {
    display: inline-flex;
    align-items: center;
    margin: 0 0 18px;
    color: var(--coal);
    background: var(--paper);
    padding: 6px 10px;
    border: 1px solid rgba(33, 23, 20, 0.45);
    box-shadow: 5px 5px 0 rgba(193, 93, 42, 0.55);
    font-size: 0.84rem;
    font-weight: 800;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

h1 {
    font-size: var(--hero-title-size);
    text-shadow: 4px 4px 0 var(--geru), 8px 8px 0 rgba(23, 17, 14, 0.85);
}

.intro {
    width: fit-content;
    max-width: 100%;
    margin: 16px 0 0;
    color: var(--paper);
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    background: rgba(23, 17, 14, 0.72);
    border-left: 6px solid var(--marigold);
    padding: 10px 14px;
}

.work-index,
.footer,
.music-toggle {
    border: 1px solid var(--line);
}

.work-index a,
.music-toggle {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--paper);
    background: rgba(33, 23, 20, 0.82);
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: lowercase;
    border: 1px solid var(--line);
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.work-index a:hover,
.music-toggle:hover {
    color: var(--ink);
    background: var(--marigold);
    transform: translate(-2px, -2px);
}

.content-grid {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin-top: 34px;
}

.work-index {
    width: 100%;
    position: sticky;
    top: 18px;
    padding: 14px;
    background:
        linear-gradient(180deg, rgba(255, 174, 56, 0.16), rgba(43, 111, 131, 0.12)),
        rgba(33, 23, 20, 0.86);
    box-shadow: 8px 8px 0 rgba(193, 93, 42, 0.24);
}

.work-index h2 {
    margin: 0 0 12px;
    color: var(--paper);
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    text-transform: lowercase;
    text-shadow: 2px 2px 0 rgba(193, 93, 42, 0.75);
}

.work-links {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.work-index a {
    width: 100%;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--paper);
    font-size: clamp(2.4rem, 6vw, 5rem);
    text-transform: lowercase;
    text-shadow: 3px 3px 0 rgba(193, 93, 42, 0.78);
}

.work-list {
    display: grid;
    gap: 30px;
}

.paper-block {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 44px);
    color: #211714;
    background:
        linear-gradient(rgba(33, 23, 20, 0.045) 1px, transparent 1px) 0 0 / 100% 28px,
        radial-gradient(circle at 12% 18%, rgba(255, 174, 56, 0.16), transparent 18rem),
        #fff1ce;
    border: 1px solid rgba(33, 23, 20, 0.38);
    box-shadow: 10px 10px 0 rgba(193, 93, 42, 0.34), 0 22px 44px rgba(10, 6, 4, 0.24);
    font-family: Georgia, "Times New Roman", serif;
    scroll-margin-top: 24px;
}

.paper-block:nth-child(odd) {
    transform: rotate(-0.35deg);
}

.paper-block:nth-child(even) {
    transform: rotate(0.35deg);
    box-shadow: 10px 10px 0 rgba(43, 111, 131, 0.3), 0 22px 44px rgba(10, 6, 4, 0.24);
}

.paper-block h3 {
    margin-bottom: 20px;
    color: var(--coal);
    font-size: clamp(2rem, 4vw, 3.2rem);
    text-align: center;
    text-shadow: 2px 2px 0 rgba(255, 174, 56, 0.34);
}

.paper-block p {
    margin: 0;
}

.poem-text {
    white-space: pre-line;
    color: #211714;
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    line-height: 1.62;
    text-align: center;
}

.essay-text {
    color: #211714;
    font-size: clamp(1.08rem, 2vw, 1.32rem);
    line-height: 1.72;
}

.essay-text p + p {
    margin-top: 1.1rem;
}

.author-name {
    margin-top: 1rem;
    color: rgba(33, 23, 20, 0.72);
    font-style: italic;
    text-align: right;
}

.document-list {
    gap: 34px;
}

.document-block {
    width: min(820px, 100%);
    padding: 0;
    overflow: hidden;
}

.document-block h3 {
    margin-bottom: 14px;
    text-align: left;
}

.document-copy {
    padding: clamp(24px, 5vw, 38px) clamp(24px, 5vw, 42px) 22px;
}

.document-copy p:not(.document-label) {
    color: #211714;
    font-size: clamp(1.04rem, 1.8vw, 1.24rem);
    line-height: 1.68;
}

.document-label {
    width: fit-content;
    margin: 0 0 14px;
    padding: 5px 9px;
    color: var(--paper);
    background: var(--coal);
    border: 1px solid rgba(33, 23, 20, 0.42);
    box-shadow: 4px 4px 0 rgba(193, 93, 42, 0.35);
    font-family: Avenir, "Trebuchet MS", Verdana, sans-serif;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: lowercase;
}

.document-link {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    margin-top: 20px;
    padding: 8px 12px;
    color: var(--paper);
    background: var(--coal);
    border: 1px solid rgba(33, 23, 20, 0.46);
    box-shadow: 5px 5px 0 rgba(43, 111, 131, 0.28);
    font-family: Avenir, "Trebuchet MS", Verdana, sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: lowercase;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.document-link:hover {
    color: var(--ink);
    background: var(--marigold);
    transform: translate(-2px, -2px);
}

.document-frame {
    margin: 0 clamp(14px, 4vw, 28px) clamp(14px, 4vw, 28px);
    height: clamp(420px, 72vh, 760px);
    background:
        linear-gradient(135deg, rgba(33, 23, 20, 0.08) 25%, transparent 25%) 0 0 / 14px 14px,
        #2f201b;
    border: 1px solid rgba(33, 23, 20, 0.45);
    box-shadow: inset 0 0 0 8px rgba(255, 227, 189, 0.12);
}

.document-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff1ce;
}

.footer {
    margin-top: 46px;
    padding: 4px 18px;
    color: rgba(255, 227, 189, 0.7);
    text-align: center;
    background: rgba(33, 23, 20, 0.72);
}

.cursor {
    display: inline-block;
    color: var(--marigold);
    animation: blink 1s steps(1, end) infinite;
}

.music-widget {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 10;
    display: grid;
    justify-items: end;
    gap: 12px;
}

.music-toggle {
    cursor: pointer;
    justify-content: center;
    box-shadow: 5px 5px 0 rgba(193, 93, 42, 0.36);
}

.spotify-embed {
    width: min(320px, calc(100vw - 36px));
    background: rgba(33, 23, 20, 0.82);
    border: 1px solid var(--line);
    box-shadow: 8px 8px 0 rgba(43, 111, 131, 0.28);
}

.spotify-embed[hidden] {
    display: none;
}

.spotify-embed iframe {
    display: block;
    width: 100%;
    border: 0;
}

@keyframes blink {
    50% { opacity: 0; }
}

@keyframes streetlight {
    0%, 100% { opacity: 0.35; transform: translate3d(0, 0, 0); }
    50% { opacity: 0.58; transform: translate3d(8px, -6px, 0); }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 22px, 1060px);
        padding-top: 18px;
    }

    .hero {
        min-height: 50vh;
        align-items: flex-end;
        gap: 16px;
        padding: 72px 18px 24px;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .work-index {
        position: static;
    }

    .work-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .work-index a {
        flex: 1 1 132px;
        justify-content: center;
    }

    .paper-block,
    .paper-block:nth-child(n) {
        transform: none;
    }

    .document-frame {
        height: 68vh;
        min-height: 380px;
    }

    .music-widget {
        right: 11px;
        bottom: 11px;
    }
}
