:root {
    color-scheme: light dark;
    --paper: #ecebeb;
    --ink: #050505;
    --soft-white: #e8e3e0;
    --muted: #aaa2a0;
    --wine: #743f47;
    --rail-width: clamp(20rem, 22.25vw, 30rem);
    background: var(--ink);
    font-family: "Times New Roman", Times, serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 20rem;
    min-height: 100%;
    background: var(--ink);
    overflow: hidden;
}

body {
    height: 100svh;
    margin: 0;
    background: var(--ink);
    overflow: hidden;
}

a {
    color: inherit;
}

.ayaka-page {
    position: relative;
    min-height: 100svh;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        var(--paper) 0 var(--rail-width),
        var(--ink) var(--rail-width) 100%
    );
}

.lace-edge {
    position: fixed;
    z-index: 2;
    top: 0;
    left: calc(var(--rail-width) - 0.65rem);
    width: 3.25rem;
    height: 100svh;
    overflow: hidden;
    pointer-events: none;
}

.lace-ribbon {
    position: absolute;
    top: 0;
    left: 3.25rem;
    display: block;
    width: 100svh;
    height: 3.25rem;
    background-image: url("/assets/ayaka/lace.svg");
    background-repeat: repeat-x;
    background-position: center;
    background-size: 32rem 32rem;
    transform: rotate(90deg);
    transform-origin: top left;
}

.identity {
    position: fixed;
    z-index: 1;
    top: 43%;
    left: clamp(2rem, 2.2vw, 3rem);
    color: #080808;
    transform: translateY(-50%);
}

.identity h1 {
    margin: 0;
    font-size: clamp(3.6rem, 3.75vw, 4.8rem);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.045em;
    line-height: 0.85;
}

.identity p {
    margin: 1.05rem 0 0;
    font-size: clamp(1.15rem, 1.35vw, 1.65rem);
    font-style: italic;
    line-height: 1.1;
}

.portrait-stage {
    --portrait-bottom: 8svh;
    --portrait-height: min(80svh, 64rem);
    position: fixed;
    z-index: 3;
    inset: 0;
    pointer-events: none;
}

.portrait-trigger {
    position: fixed;
    z-index: 1;
    bottom: var(--portrait-bottom);
    left: var(--rail-width);
    width: auto;
    height: var(--portrait-height);
    aspect-ratio: 1888 / 4093;
    pointer-events: auto;
    transform: translateX(-55%);
}

.portrait {
    position: fixed;
    z-index: 3;
    bottom: var(--portrait-bottom);
    left: var(--rail-width);
    height: var(--portrait-height);
    margin: 0;
    pointer-events: none;
    transform: translateX(-55%);
}

.portrait > img {
    display: block;
    width: auto;
    height: 100%;
    filter: drop-shadow(1.1rem 1rem 1rem rgb(0 0 0 / 0.18));
    user-select: none;
    -webkit-user-drag: none;
}

.portrait .artwork-credit {
    right: -4.25rem;
    bottom: 4rem;
}

.portrait-stage:hover .portrait .artwork-credit {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.portrait:focus-visible {
    filter: drop-shadow(0 0 0.2rem rgb(255 255 255 / 0.28));
}

.profile-nav {
    position: fixed;
    z-index: 2;
    top: calc(100svh - var(--portrait-bottom) - var(--portrait-height) + clamp(5.25rem, 11svh, 8rem));
    left: calc(var(--rail-width) + 1.65rem);
    display: flex;
    flex-direction: column;
    height: min(15rem, calc(var(--portrait-height) - clamp(7rem, 15svh, 11rem)));
    min-height: 11rem;
    align-items: flex-start;
    justify-content: space-between;
    pointer-events: none;
}

.profile-nav a {
    display: block;
    color: var(--soft-white);
    font-size: clamp(1.35rem, 1.45vw, 1.8rem);
    line-height: 1;
    opacity: 0;
    text-decoration: none;
    text-shadow: 0 0 0.65rem #000;
    transform: translateX(-1rem);
    transition:
        color 150ms ease,
        opacity 220ms ease calc(var(--order) * 45ms),
        transform 260ms ease calc(var(--order) * 45ms);
}

.portrait-stage:hover .profile-nav,
.portrait-stage:focus-within .profile-nav {
    pointer-events: auto;
}

.portrait-stage:hover .profile-nav a,
.portrait-stage:focus-within .profile-nav a {
    opacity: 1;
    transform: translateX(var(--reach));
}

.profile-nav a:hover,
.profile-nav a:focus-visible {
    color: #b77680;
    outline: none;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

.profile-nav .home-link {
    color: #b77680;
    font-size: clamp(1rem, 1.05vw, 1.3rem);
    font-style: italic;
}

.profile-nav .home-link::before {
    content: "[";
}

.profile-nav .home-link::after {
    margin-left: 0;
    color: inherit;
    content: "]";
    opacity: 1;
    transform: none;
}

.profile-nav a::after {
    display: inline-block;
    margin-left: 0.55rem;
    color: var(--wine);
    content: "—";
    opacity: 0;
    transform: translateX(-0.35rem);
    transition:
        opacity 150ms ease,
        transform 150ms ease;
}

.profile-nav a:hover::after,
.profile-nav a:focus-visible::after {
    opacity: 1;
    transform: translateX(0);
}

.reading-pane {
    position: fixed;
    z-index: 1;
    inset: 0 0 0 var(--rail-width);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--ink);
    color: var(--soft-white);
    scrollbar-color: #625b5a var(--ink);
    scrollbar-width: thin;
}

.reading-content {
    width: 100%;
    min-height: 100%;
    padding:
        clamp(4rem, 8svh, 6.5rem)
        clamp(2.5rem, 8%, 8rem)
        clamp(4rem, 10svh, 8rem)
        clamp(11rem, 17%, 20rem);
}

.profile-section {
    display: none;
    width: min(100%, 58rem);
    color: #f0efed;
    text-shadow:
        1px 1px 0 #000,
        -1px 1px 0 #000,
        1px -1px 0 #000,
        -1px -1px 0 #000;
}

.profile-section:target {
    display: block;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    align-items: baseline;
    margin-bottom: clamp(2rem, 5svh, 3.5rem);
}

.section-heading h2,
.section-heading p {
    margin: 0;
}

.section-heading h2 {
    font-size: clamp(2.25rem, 3.1vw, 3.25rem);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.035em;
    line-height: 1;
}

.section-heading p {
    color: #8d8987;
    font-size: clamp(1.15rem, 1.65vw, 1.65rem);
    font-weight: 400;
    line-height: 1.1;
}

.section-body h3:not(:first-child) {
    margin-top: clamp(2rem, 5svh, 3.5rem);
}

.section-body h3 {
    margin: 0 0 0.25rem;
    font-size: clamp(1.45rem, 2vw, 2.05rem);
    font-style: italic;
    font-weight: 400;
    line-height: 1.18;
    text-transform: uppercase;
}

.section-body h3 span {
    text-transform: none;
}

.section-body p,
.section-body ul,
.section-body ol,
.section-body blockquote {
    font-size: clamp(0.95rem, 1.15vw, 1.2rem);
    font-weight: 400;
    line-height: 1.4;
}

.section-body p {
    margin: 0;
}

.section-body p + p,
.section-body p + ul,
.section-body p + ol,
.section-body ul + p,
.section-body ol + p {
    margin-top: 1rem;
}

.section-body ul,
.section-body ol {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.section-body blockquote {
    margin: 1.5rem 0;
    padding-left: 1rem;
    border-left: 1px solid var(--wine);
    color: #c9c4c1;
}

.section-body blockquote p {
    font-size: inherit;
}

.section-body img {
    display: block;
    max-width: 100%;
    height: auto;
}

.section-body .section-artwork {
    position: relative;
    width: fit-content;
    margin: 0;
}

.section-body .section-artwork img {
    width: auto;
    max-height: min(68svh, 42rem);
    object-fit: contain;
    object-position: left top;
    filter: drop-shadow(0.75rem 0.75rem 0.9rem rgb(0 0 0 / 0.3));
}

.section-artwork .artwork-credit {
    top: 100%;
    left: 0;
    margin-top: 0.7rem;
}

.section-body a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.section-body a:hover,
.section-body a:focus-visible {
    color: #b9b4b1;
    outline: none;
    text-decoration-style: solid;
}

.bio-manga {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0;
}

.section-body:has(> *) + .bio-manga {
    margin-top: clamp(2rem, 5svh, 3.5rem);
}

.bio-manga-layout {
    display: flex;
    gap: clamp(1.25rem, 2.5vw, 2.5rem);
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
    max-height: clamp(12rem, 45svh, 28rem);
}

.bio-manga img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: clamp(12rem, 45svh, 28rem);
    filter: invert(1) grayscale(1);
    mix-blend-mode: screen;
    opacity: 0.88;
}

.manga-translation {
    display: flex;
    width: clamp(13rem, 19vw, 20rem);
    max-height: clamp(12rem, 45svh, 28rem);
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: space-evenly;
    padding: clamp(0.4rem, 1.5svh, 1rem) 0;
    overflow: hidden;
    color: var(--soft-white);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-1rem);
    transition:
        opacity 220ms ease,
        transform 260ms ease;
}

.manga-translation p {
    margin: 0;
    font-size: clamp(0.68rem, 1.45svh, 0.95rem);
    font-style: italic;
    line-height: 1.25;
}

.bio-manga:hover .manga-translation,
.bio-manga:focus-visible .manga-translation,
.bio-manga:focus-within .manga-translation {
    opacity: 1;
    transform: translateX(0);
}

.bio-manga .artwork-credit {
    top: 100%;
    left: 0;
    margin: 0.7rem 0 0;
}

.bio-sketch {
    position: fixed;
    z-index: 4;
    right: clamp(1.25rem, 2.5vw, 3rem);
    bottom: 0;
    width: clamp(10rem, 16vw, 17rem);
    margin: 0;
    outline: none;
}

.bio-sketch > img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 42svh;
    object-fit: contain;
    object-position: bottom right;
    filter: drop-shadow(0.75rem 0.5rem 0.8rem rgb(0 0 0 / 0.35));
}

.bio-sketch figcaption {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    width: max-content;
    color: var(--muted);
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.4rem);
    transition:
        opacity 160ms ease,
        transform 160ms ease;
}

.bio-sketch:hover figcaption,
.bio-sketch:focus-visible figcaption,
.bio-sketch:focus-within figcaption {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.bio-sketch a {
    color: #bbb5b2;
    text-decoration: underline dotted;
    text-underline-offset: 0.18em;
}

.mameshiba {
    position: relative;
    display: inline-block;
    cursor: help;
    outline: none;
    text-decoration: underline dotted;
    text-underline-offset: 0.18em;
}

.mameshiba-popup {
    position: absolute;
    z-index: 5;
    bottom: calc(100% + 0.35rem);
    left: 50%;
    width: 7.5rem;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
}

.mameshiba-popup img {
    display: block;
    width: 100%;
    height: auto;
}

.mameshiba:hover .mameshiba-popup,
.mameshiba:focus-visible .mameshiba-popup {
    opacity: 1;
    animation: mameshiba-shake 180ms steps(2, jump-none) infinite;
}

@keyframes mameshiba-shake {
    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -0.45rem);
    }
}

@media (hover: none) {
    .profile-nav {
        pointer-events: auto;
    }

    .profile-nav a {
        opacity: 1;
        transform: translateX(var(--reach));
    }
}

@media (max-width: 56rem) {
    :root {
        --rail-width: 43vw;
    }

    .ayaka-page {
        min-height: 100svh;
        overflow: visible;
        background:
            linear-gradient(
                    90deg,
                    var(--paper) 0 var(--rail-width),
                    var(--ink) var(--rail-width) 100%
                )
                no-repeat 0 0 / 100% 76svh,
            var(--ink);
    }

    .lace-edge {
        position: absolute;
        height: 76svh;
    }

    .lace-ribbon {
        width: 76svh;
    }

    .identity {
        position: absolute;
        top: 61svh;
        left: 1rem;
        transform: none;
    }

    .identity h1 {
        font-size: clamp(2.7rem, 13vw, 4rem);
    }

    .identity p {
        max-width: 8.5rem;
        margin-top: 0.8rem;
        font-size: clamp(0.95rem, 4vw, 1.2rem);
    }

    .portrait-stage {
        --portrait-bottom: 4svh;
        --portrait-height: min(65svh, 38rem);
        position: absolute;
        height: 76svh;
    }

    .portrait-trigger {
        position: absolute;
        bottom: var(--portrait-bottom);
        height: var(--portrait-height);
        transform: translateX(-57%);
    }

    .portrait {
        position: absolute;
        bottom: var(--portrait-bottom);
        height: var(--portrait-height);
        transform: translateX(-57%);
    }

    .portrait .artwork-credit {
        right: -2.5rem;
        bottom: 2rem;
        max-width: 13rem;
    }

    .profile-nav {
        position: absolute;
        top: calc(76svh - var(--portrait-bottom) - var(--portrait-height) + 6svh);
        left: calc(var(--rail-width) - 0.5rem);
        height: clamp(11rem, 24svh, 13rem);
    }

    .profile-nav a {
        font-size: clamp(1.05rem, 5vw, 1.4rem);
    }

    .profile-nav a,
    .portrait-stage:hover .profile-nav a,
    .portrait-stage:focus-within .profile-nav a {
        opacity: 1;
        transform: translateX(min(var(--reach), 3.75rem));
    }

    .reading-content {
        padding-right: 1.5rem;
        padding-left: clamp(8rem, 23%, 11rem);
    }

    .section-heading {
        display: block;
    }

    .section-heading p {
        margin-top: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
