/* Seraphim Cosplay — a little woodland: canopy at the top, forest floor at the bottom. */

/* IM Fell English by Igino Marini, SIL Open Font License (fonts/OFL.txt). Latin subset. */
@font-face {
    font-family: "IM Fell English";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/im-fell-english-regular.woff2") format("woff2");
}

@font-face {
    font-family: "IM Fell English";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/im-fell-english-italic.woff2") format("woff2");
}

:root {
    color-scheme: light dark;

    --lichen: #dce1c7; /* page */
    --linen: #ebedde; /* patches (links) */
    --moss: #2e3a22; /* ink */
    --fern: #6e8b4a; /* light leaves */
    --ivy: #4c6535; /* vines, deep leaves */
    --bark: #6b4a33; /* frames, seams */
    --foxglove: #7e3f6e; /* accent */
    --thread: #f2ead0; /* stitching, blossoms */
    --pollen: #d3a93e; /* blossom centres */

    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .18 0 0 0 0 .23 0 0 0 0 .13 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root {
        --lichen: #1d2318;
        --linen: #262e20;
        --moss: #e2e0c9;
        --fern: #87a564;
        --ivy: #5f7d45;
        --bark: #b98f68;
        --foxglove: #d9a3c8;
        --thread: #efe6c8;
        --pollen: #e0b94c;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--lichen);
    background-image: var(--grain);
    color: var(--moss);
    font-family: "IM Fell English", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    font-size: 1.1875rem;
    line-height: 1.65;
    text-align: center;
}

/* ---------- Layout ---------- */

.page {
    flex: 1;
    width: 100%;
    max-width: 38rem;
    margin: 0 auto;
    padding: clamp(1.25rem, 5vw, 3.5rem) 1rem 1.5rem;
}

/* ---------- Portrait window ---------- */

.portrait {
    width: min(100%, 17.5rem);
    margin: 0 auto;
}

.portrait svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.window {
    fill: var(--ivy);
}

.frame {
    fill: none;
    stroke: var(--bark);
    stroke-width: 5;
    stroke-linejoin: round;
}

.stitch {
    fill: none;
    stroke: var(--thread);
    stroke-width: 2;
    stroke-dasharray: 9 7;
    stroke-linecap: round;
    opacity: 0.85;
}

.vine {
    fill: none;
    stroke: var(--ivy);
    stroke-width: 3.5;
    stroke-linecap: round;
}

.vine--short {
    stroke-width: 3;
}

.leaf {
    fill: var(--fern);
}

.leaf--deep {
    fill: var(--ivy);
}

.blossom {
    fill: var(--thread);
    stroke: var(--ivy);
    stroke-width: 0.8;
}

/* ---------- Type ---------- */

h1 {
    margin: 1.25rem 0 0;
    font-size: clamp(2.75rem, 11vw, 4.25rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.015em;
}

.tagline {
    margin: 0.5rem 0 0;
    color: var(--foxglove);
    font-size: 1.375rem;
    font-style: italic;
    line-height: 1.3;
    text-wrap: balance;
}

/* Long paragraphs read better with a straight left edge; the column stays centered. */
.bio {
    max-width: 31em;
    margin: 1.75rem auto 0;
    text-align: left;
    text-wrap: pretty;
}

.bio + .bio {
    margin-top: 1rem;
}

/* The sign-off */
.motto {
    max-width: 31em;
    margin: 1.75rem auto 0;
    color: var(--bark);
    font-size: 1.375rem;
    font-style: italic;
    line-height: 1.3;
    text-wrap: balance;
}

/* ---------- Links: hand-cut fabric patches with a sewn seam ---------- */

.links {
    margin-top: 2.75rem;
}

.links h2 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
    font-weight: 400;
    font-style: italic;
}

.links ul {
    display: grid;
    gap: 0.875rem;
    max-width: 20rem;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.links a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem 0.85rem;
    color: var(--moss);
    background-color: var(--linen);
    border: 2px solid var(--bark);
    border-radius: 22px 8px 18px 10px / 10px 20px 8px 22px;
    outline: 1.5px dashed var(--bark);
    outline-offset: -8px;
    font-size: 1.3rem;
    line-height: 1.2;
    text-decoration: none;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        outline-color 0.2s ease,
        transform 0.25s ease;
}

.links .icon {
    flex: none;
    width: 1.05em;
    height: 1.05em;
    fill: currentColor;
}

.links li:nth-child(3n + 2) a {
    border-radius: 10px 20px 8px 22px / 22px 8px 18px 10px;
}

.links li:nth-child(3n + 3) a {
    border-radius: 16px 10px 22px 8px / 8px 22px 10px 16px;
}

.links a:hover {
    color: var(--lichen);
    background-color: var(--moss);
    outline-color: var(--lichen);
    transform: rotate(-0.75deg);
}

.links li:nth-child(even) a:hover {
    transform: rotate(0.75deg);
}

.links a:focus-visible {
    outline-color: var(--foxglove);
    box-shadow:
        0 0 0 3px var(--lichen),
        0 0 0 6px var(--foxglove);
}

/* ---------- Forest floor ---------- */

.ground {
    padding: 0.5rem 1rem 1.5rem;
}

.ground svg {
    display: block;
    width: 15rem;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.ground p {
    margin: 0.25rem 0 0;
    color: var(--bark);
    font-size: 0.95rem;
}

.soil {
    fill: none;
    stroke: var(--bark);
    stroke-width: 2;
    stroke-linecap: round;
}

.grass path {
    fill: none;
    stroke: var(--fern);
    stroke-width: 2;
    stroke-linecap: round;
}

.stem {
    fill: var(--thread);
    stroke: var(--bark);
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.cap {
    fill: var(--bark);
}

.cap--plum {
    fill: var(--foxglove);
}

.spot {
    fill: var(--thread);
}

/* ---------- The one moment: the ivy grows in on load ---------- */

@media (prefers-reduced-motion: no-preference) {
    .vine {
        stroke-dasharray: 1 1;
        animation: vine-grow 2s cubic-bezier(0.45, 0.05, 0.3, 1) 0.2s both;
    }

    .vine--short {
        animation-duration: 1.1s;
        animation-delay: 0.5s;
    }

    .grow {
        animation: unfurl 0.6s cubic-bezier(0.3, 1.45, 0.5, 1) var(--d, 0s) both;
    }
}

@keyframes vine-grow {
    from {
        stroke-dashoffset: 1;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes unfurl {
    from {
        opacity: 0;
        transform: scale(0) rotate(-35deg);
    }
    40% {
        opacity: 1;
    }
    to {
        transform: none;
    }
}
