:root {
    --heading-font: "Cormorant Garamond", Georgia, serif;
    --body-font: "Cormorant Garamond", Georgia, serif;
    --mono-font: "IBM Plex Mono", "Courier New", monospace;
    --black: #030302;
    --ink: #eee4d3;
    --ink-dim: #cbb9a7;
    --paper: #43342b;
    --paper-2: #43342b;
    --cover: #200408;
    --blood: #891a1a;
    --blood-dark: #6a0e15;
    --verdigris: #718066;
    --page-pad: clamp(34px, 5vw, 64px);
    --book-pad: clamp(16px, 2vw, 28px);
    --gutter: clamp(24px, 3vw, 36px);
}

@font-face {
    font-family: "Cormorant Garamond";
    src: url("assets/fonts/CormorantGaramond-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("assets/fonts/IBMPlexMono-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--black);
    color-scheme: dark;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--black);
    font-family: var(--body-font);
    font-size: 19px;
    font-weight: 400;
    line-height: 1.36;
}

.candle-cluster {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    width: min(1200px, calc(100% - 32px));
    height: 58px;
    margin: 18px auto 8px;
}

.candle-trigger {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    height: 58px;
    padding: 18px 14px 8px;
    isolation: isolate;
}

.candle {
    position: relative;
    display: block;
    width: 15px;
    height: 33px;
    border: 1px solid rgba(238, 228, 211, 0.2);
    border-radius: 3px 3px 2px 2px;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.24), transparent 36%, rgba(238, 228, 211, 0.1) 52%, rgba(0, 0, 0, 0.34)),
        #d8c5a6;
    box-shadow:
        inset 0 -8px 12px rgba(75, 9, 13, 0.18),
        0 0 18px rgba(158, 27, 35, 0.16);
}

.candle:nth-child(1) {
    height: 26px;
}

.candle:nth-child(2) {
    height: 40px;
}

.candle:nth-child(3) {
    height: 30px;
}

.candle::before {
    position: absolute;
    left: 50%;
    top: -18px;
    width: 11px;
    height: 17px;
    content: "";
    border-radius: 76% 24% 58% 42% / 76% 26% 74% 38%;
    background:
        radial-gradient(circle at 50% 76%, rgba(255, 235, 169, 0.98) 0 16%, transparent 38%),
        linear-gradient(180deg, rgba(255, 244, 191, 0.95), rgba(214, 66, 74, 0.9) 56%, rgba(75, 9, 13, 0.16));
    filter:
        drop-shadow(0 0 6px rgba(214, 66, 74, 0.72))
        drop-shadow(0 0 18px rgba(158, 27, 35, 0.36));
    transform: translateX(-50%);
    transform-origin: 50% 88%;
    animation: candle-flame 900ms ease-in-out infinite alternate;
}

.candle::after {
    position: absolute;
    top: 3px;
    left: 50%;
    width: 4px;
    height: 2px;
    content: "";
    border-radius: 50%;
    background: rgba(75, 9, 13, 0.52);
    transform: translateX(-50%);
}

.candle:nth-child(2)::before {
    animation-delay: -320ms;
}

.candle:nth-child(3)::before {
    animation-delay: -620ms;
}

.candle-trigger.is-puffing .candle::before {
    animation: candle-vanish-return 1320ms ease-in-out both;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    content: "";
    background-image: radial-gradient(rgba(238, 228, 211, 0.24) 0.6px, transparent 0.6px);
    background-size: 5px 7px;
    opacity: 0.08;
}

body::after {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    content: "";
    background: radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.7));
}

.flame-cursor-root,
.flame-cursor-root * {
    cursor: none;
}

.book {
    --book-height: min(65svh, 660px, calc((100vw - 32px) * 1.4567));
    position: relative;
    z-index: 1;
    width: min(calc(var(--book-height) * 1.2342), calc(100% - 32px));
    margin: 0 auto 40px;
}

/* The open book is always one spread. Its height follows the available width,
   including while the window is being resized. There is no stacked-page mode. */
.book[open] {
    --book-height: min(65svh, 660px, calc((100vw - 32px) / 1.2342));
}

.book-toggle {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    list-style: none;
    text-align: center;
    cursor: pointer;
}

.book-toggle::-webkit-details-marker {
    display: none;
}

.book-toggle:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 8px;
}

.book-cover {
    display: block;
    width: auto;
    height: var(--book-height);
    max-width: 100%;
    object-fit: contain;
    transition: transform 350ms ease, filter 350ms ease;
    filter: drop-shadow(0 20px 24px #000);
}

@media (hover: hover) {
    .book-toggle:hover .book-cover {
        transform: rotate(-3deg) translateY(-5px);
        filter: drop-shadow(0 26px 30px #000) brightness(1.08);
    }
}

.book-toggle:focus-visible .book-cover {
    transform: rotate(-3deg);
}

.book[open] .book-cover {
    display: none;
}

/* The outer edge remains a keyboard-accessible way to close the book. */
.book[open] .book-toggle {
    position: absolute;
    inset: 0 auto auto 0;
    z-index: 2;
    width: 5%;
    height: var(--book-height);
}

.poster-book {
    /* All sizes use the same scale, based on the original 660px-high spread.
       The reference paragraph size is 16px; headings and artwork scale with it. */
    --book-unit: calc(var(--book-height) / 660);
    --ink: #302018;
    --ink-dim: #50372b;
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: var(--book-height);
    padding: 6% 5%;
    font-size: calc(16 * var(--book-unit));
    /* Keep automatic text enlargement from changing the book's proportions. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    color: var(--ink);
    background: url("assets/book-open.webp") center / 100% 100% no-repeat;
    filter: drop-shadow(0 18px 24px #000);
}

.book:not([open]) .book-toggle,
.book[open] .poster-book {
    animation: book-reveal 420ms ease-out both;
}

@keyframes book-reveal {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.page {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: calc(12 * var(--book-unit)) calc(6 * var(--book-unit));
    background: none;
}

.page-left {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: calc(28 * var(--book-unit));
}

.page-right {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    padding-left: 14%;
    padding-right: 0;
    margin-right: -5%;
}

.poster-book .poster-grid {
    min-height: 0;
    align-content: safe center;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-dim) transparent;
    gap: calc(18 * var(--book-unit));
}

.poster-book .module { padding-bottom: calc(20 * var(--book-unit)); }
.poster-book .module:last-child { padding-bottom: 0; }
.poster-book h2 { font-size: calc(26 * var(--book-unit)); margin-bottom: calc(10 * var(--book-unit)); }
.poster-book .glyph { width: calc(110 * var(--book-unit)); margin-bottom: calc(18 * var(--book-unit)); }
.poster-book .brand-name { font-size: calc(42 * var(--book-unit)); }
.poster-book .link-list li {
    grid-template-columns: 0.9fr 1fr;
    gap: calc(10 * var(--book-unit));
    padding: calc(4 * var(--book-unit)) 0;
}
.poster-book .module:not(:last-child)::after { height: calc(16 * var(--book-unit)); }
.poster-book p, .poster-book ul { margin-bottom: calc(13 * var(--book-unit)); }
.poster-book .rat-figure { padding-top: calc(18 * var(--book-unit)); }
.poster-book .rat-figure pre { font-size: calc(12 * var(--book-unit)); }
.poster-book .social-links {
    gap: calc(12 * var(--book-unit));
    margin-top: calc(18 * var(--book-unit));
}
.poster-book .social-link {
    width: calc(42 * var(--book-unit));
    height: calc(42 * var(--book-unit));
}
.poster-book .social-link svg {
    width: calc(21 * var(--book-unit));
    height: calc(21 * var(--book-unit));
}

.poster-book .glyph img {
    filter: brightness(0);
    opacity: 0.85;
}

.poster-book .brand-name {
    text-shadow: none;
}

.poster-book,
.poster-book .brand-name,
.poster-book h2,
.poster-book a {
    font-weight: 700;
}

.poster-book a {
    color: #791b25;
    text-decoration-color: currentColor;
    overflow-wrap: anywhere;
}

.poster-book a:hover,
.poster-book a:focus-visible {
    color: #fff4dc;
}

.poster-book .social-link {
    border-color: #72523b;
    background: transparent;
}

.poster-book .social-link:hover,
.poster-book .social-link:focus-visible {
    background: var(--blood-dark);
}

.masthead {
    position: relative;
    z-index: 1;
    grid-row: 2;
    align-self: center;
    justify-self: center;
    margin: 0;
    text-align: center;
}

.glyph {
    position: relative;
    display: block;
    width: 180px;
    max-width: 68%;
    margin: 0 auto 24px;
    filter: drop-shadow(0 0 12px rgba(158, 27, 35, 0.4));
    isolation: isolate;
}

.glyph img {
    display: block;
    width: 100%;
    height: auto;
}

h1,
h2,
p,
ul,
figure {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
}

.brand-name {
    position: relative;
    display: block;
    color: var(--ink);
    font-family: var(--heading-font);
    font-size: clamp(52px, 6vw, 76px);
    font-weight: 400;
    line-height: 0.94;
    text-decoration: none;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 2px 2px 0 var(--blood-dark);
    isolation: isolate;
}

.brand-name span {
    display: block;
}

.vanish-trigger {
    appearance: none;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    outline: 1px solid transparent;
    outline-offset: 10px;
    text-align: inherit;
    transition:
        box-shadow 160ms ease,
        outline-color 160ms ease;
}

.vanish-trigger:hover,
.vanish-trigger:focus-visible {
    color: inherit;
    background: transparent;
}

.vanish-trigger:hover {
    box-shadow: 0 0 22px rgba(158, 27, 35, 0.16);
}

.vanish-trigger:focus-visible {
    outline-offset: 8px;
    box-shadow: 0 0 28px rgba(158, 27, 35, 0.2);
}

.vanish-trigger::before,
.vanish-trigger::after {
    position: absolute;
    inset: 8%;
    z-index: -1;
    content: "";
    pointer-events: none;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.38);
}

.vanish-trigger::before {
    background:
        radial-gradient(circle at 26% 42%, rgba(238, 228, 211, 0.76) 0 4px, transparent 5px),
        radial-gradient(circle at 66% 30%, rgba(158, 27, 35, 0.7) 0 5px, transparent 6px),
        radial-gradient(circle at 48% 68%, rgba(238, 228, 211, 0.42) 0 7px, transparent 8px),
        radial-gradient(circle, rgba(158, 27, 35, 0.3), transparent 68%);
    filter: blur(0.4px);
}

.vanish-trigger::after {
    border: 1px solid rgba(238, 228, 211, 0.24);
    box-shadow: 0 0 24px rgba(158, 27, 35, 0.34);
}

.vanish-trigger.is-puffing::before {
    animation: puff-cloud 1200ms ease-out both;
}

.vanish-trigger.is-puffing::after {
    animation: puff-ring 780ms ease-out both;
}

.glyph.is-puffing img,
.brand-name.is-puffing span {
    animation: vanish-return 1320ms ease-in-out both;
}

.studio-line {
    max-width: 28ch;
    margin: 22px 0 0;
    color: var(--ink-dim);
    font-size: 15px;
}

.rat-figure {
    position: relative;
    z-index: 1;
    grid-row: 3;
    align-self: end;
    max-width: 100%;
    margin: 0;
    padding-top: 18px;
    color: var(--ink);
}

.rat-figure pre {
    margin: 0;
    overflow: hidden;
    font-family: var(--mono-font);
    font-size: 12px;
    line-height: 1.05;
    white-space: pre;
}

.poster-grid {
    position: relative;
    z-index: 1;
    display: grid;
    align-content: center;
    gap: 32px;
    min-height: 100%;
}

.module {
    position: relative;
    min-width: 0;
    padding-bottom: 38px;
}

.module:last-child {
    padding-bottom: 0;
}

.module:not(:last-child)::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 16px;
    content: "";
    pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--ink) 18%, var(--ink) 82%, transparent) center / 100% 1px no-repeat;
    opacity: 0.85;
}

h2 {
    margin-bottom: 14px;
    color: var(--ink);
    font-family: var(--heading-font);
    font-size: 44px;
    font-weight: 400;
    line-height: 1.08;
}

p,
ul {
    margin-bottom: 13px;
}

ul {
    padding-left: 20px;
}

li {
    margin-bottom: 7px;
}

li::marker {
    color: var(--blood);
}

.link-list {
    display: grid;
    gap: 0;
    padding-left: 0;
    list-style: none;
}

.link-list li {
    display: grid;
    grid-template-columns: minmax(148px, 0.48fr) 1fr;
    gap: 14px;
    margin-bottom: 0;
    padding: 4px 0;
}

.link-list span {
    color: var(--ink-dim);
    font-size: 1.08em;
    letter-spacing: 0.015em;
    white-space: nowrap;
}

a {
    color: #d6424a;
    font-weight: 400;
    text-decoration-color: rgba(214, 66, 74, 0.56);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
    color: var(--ink);
    background: var(--blood-dark);
    text-decoration-color: transparent;
}

a:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

::selection {
    color: var(--black);
    background: var(--blood);
}

.flame-cursor,
.cursor-light {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2147483646;
    pointer-events: none;
    opacity: 0;
    transform: translate(-200px, -200px);
    transition: opacity 160ms ease;
}

.flame-cursor {
    width: 30px;
    height: 42px;
    margin: -34px 0 0 -15px;
    mix-blend-mode: screen;
}

.flame-cursor::before,
.flame-cursor::after {
    position: absolute;
    content: "";
    transform-origin: 50% 82%;
}

.flame-cursor::before {
    inset: 0 4px 3px;
    background:
        radial-gradient(circle at 50% 73%, rgba(255, 213, 116, 0.98) 0 13%, transparent 36%),
        linear-gradient(180deg, rgba(255, 238, 183, 0.96), rgba(214, 66, 74, 0.92) 52%, rgba(75, 9, 13, 0.18));
    border-radius: 78% 22% 62% 38% / 72% 28% 72% 38%;
    clip-path: polygon(50% 0, 76% 34%, 95% 66%, 68% 100%, 32% 100%, 5% 66%, 28% 34%);
    filter:
        drop-shadow(0 0 8px rgba(214, 66, 74, 0.75))
        drop-shadow(0 0 18px rgba(158, 27, 35, 0.46));
    animation: flame-waver 760ms ease-in-out infinite alternate;
}

.flame-cursor::after {
    inset: 13px 10px 6px;
    background: linear-gradient(180deg, rgba(255, 244, 191, 0.96), rgba(214, 66, 74, 0.66));
    border-radius: 64% 36% 58% 42% / 76% 30% 70% 38%;
    clip-path: polygon(50% 0, 76% 42%, 88% 72%, 63% 100%, 35% 100%, 13% 72%, 30% 40%);
    animation: flame-waver 520ms ease-in-out infinite alternate-reverse;
}

.cursor-light {
    z-index: 2;
    width: 220px;
    height: 220px;
    margin: -110px 0 0 -110px;
    background:
        radial-gradient(circle, rgba(255, 238, 183, 0.13) 0%, rgba(238, 228, 211, 0.11) 9%, rgba(214, 66, 74, 0.14) 24%, rgba(158, 27, 35, 0.09) 43%, rgba(75, 9, 13, 0.04) 58%, transparent 78%);
    border-radius: 50%;
    mix-blend-mode: screen;
}

.flame-cursor.is-visible,
.cursor-light.is-visible {
    opacity: 1;
}

.flame-cursor.is-pressed::before {
    filter:
        drop-shadow(0 0 13px rgba(214, 66, 74, 0.94))
        drop-shadow(0 0 28px rgba(158, 27, 35, 0.68));
}

@keyframes vanish-return {
    0% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0) scale(1);
    }

    14% {
        opacity: 0;
        filter: blur(10px);
        transform: translateY(-7px) scale(0.94);
    }

    58% {
        opacity: 0;
        filter: blur(7px);
        transform: translateY(6px) scale(0.96);
    }

    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0) scale(1);
    }
}

@keyframes puff-cloud {
    0% {
        opacity: 0;
        transform: scale(0.35) rotate(0deg);
    }

    15% {
        opacity: 0.88;
    }

    100% {
        opacity: 0;
        transform: scale(1.52) rotate(-8deg);
    }
}

@keyframes puff-ring {
    0% {
        opacity: 0;
        transform: scale(0.46);
    }

    22% {
        opacity: 0.78;
    }

    100% {
        opacity: 0;
        transform: scale(1.38);
    }
}

@keyframes flame-waver {
    0% {
        transform: rotate(-5deg) scaleX(0.92) scaleY(1.02);
    }

    100% {
        transform: rotate(5deg) scaleX(1.08) scaleY(0.94);
    }
}

.social-links {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 0;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(238, 228, 211, 0.28);
    color: var(--ink);
    background: rgba(0, 0, 0, 0.22);
    text-decoration: none;
    transition:
        border-color 160ms ease,
        color 160ms ease,
        background-color 160ms ease,
        transform 160ms ease;
}

.social-link svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.social-link:hover,
.social-link:focus-visible {
    border-color: rgba(238, 228, 211, 0.72);
    color: #fffaf0;
    background: var(--blood-dark);
    transform: translateY(-2px);
}

@keyframes candle-vanish-return {
    0% {
        opacity: 1;
        filter: blur(0) drop-shadow(0 0 6px rgba(214, 66, 74, 0.72)) drop-shadow(0 0 18px rgba(158, 27, 35, 0.36));
        transform: translateX(-50%) translateY(0) scale(1);
    }

    14% {
        opacity: 0;
        filter: blur(10px);
        transform: translateX(-50%) translateY(-7px) scale(0.94);
    }

    58% {
        opacity: 0;
        filter: blur(7px);
        transform: translateX(-50%) translateY(6px) scale(0.96);
    }

    100% {
        opacity: 1;
        filter: blur(0) drop-shadow(0 0 6px rgba(214, 66, 74, 0.72)) drop-shadow(0 0 18px rgba(158, 27, 35, 0.36));
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes candle-flame {
    0% {
        transform: translateX(-50%) rotate(-4deg) scaleX(0.92) scaleY(1.02);
    }

    100% {
        transform: translateX(-50%) rotate(5deg) scaleX(1.08) scaleY(0.95);
    }
}

@media (max-width: 680px) {
    body { font-size: 18px; }
    .candle-cluster { height: 46px; margin-top: 12px; }
}

@media (pointer: coarse) {
    .flame-cursor-root,
    .flame-cursor-root * {
        cursor: auto;
    }

    .flame-cursor,
    .cursor-light {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .book:not([open]) .book-toggle,
    .book[open] .poster-book,
    .candle::before,
    .glyph.is-puffing img,
    .brand-name.is-puffing span,
    .vanish-trigger.is-puffing::before,
    .vanish-trigger.is-puffing::after {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .book-cover { transition: none; }
    .book-toggle:hover .book-cover,
    .book-toggle:focus-visible .book-cover { transform: none; }
}
