/* Self-hosted Cormorant Garamond (SIL OFL 1.1, see fonts/OFL.txt), Latin subset. */
@font-face
{
    font-family: "Cormorant Garamond";
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url("fonts/cormorant-garamond-300.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face
{
    font-family: "Cormorant Garamond";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/cormorant-garamond-400-italic.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Registered so the flip between the two sides can transition them. */
@property --ink { syntax: "<color>"; inherits: true; initial-value: #ece6da; }
@property --ground { syntax: "<color>"; inherits: true; initial-value: #090b0b; }
@property --muted { syntax: "<color>"; inherits: true; initial-value: #8f8b84; }
@property --wk { syntax: "<number>"; inherits: true; initial-value: 1; }

:root { color-scheme: dark; }
:root[data-side="paper"] { color-scheme: light; }

body
{
    margin: 0;
    background: #060808;
    transition: background-color .9s ease;
}

[data-side="paper"] body { background: #eee8da; }

[hidden] { display: none !important; }

/* The two sides of the card. */
[data-side="water"] { --wk: .9; --ink: #ece6da; --ground: #060808; --muted: color-mix(in oklab, #ece6da 61%, #060808); }
[data-side="paper"] { --wk: 1; --ink: #1c2230; --ground: #eee8da; --muted: color-mix(in oklab, #1c2230 74%, #eee8da); }

.page
{
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    padding: 0 0 3rem;
    overflow: hidden;
    background: var(--ground);
    color: var(--ink);
    font-family: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: --ink .9s ease, --ground .9s ease, --muted .9s ease, --wk .9s ease;
}

.page ::selection { background: var(--ink); color: var(--ground); }

/* Surface texture: film grain on the dark side, paper grain and mottling on the paper side. */
.tex { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tex rect { transition: opacity .9s ease; }
[data-side="water"] .t-iso { opacity: .07; }
[data-side="water"] .t-grain, [data-side="water"] .t-mottle, [data-side="water"] .t-fleck { opacity: 0; }
[data-side="paper"] .tex { mix-blend-mode: multiply; }
[data-side="paper"] .t-grain { opacity: .14; }
[data-side="paper"] .t-mottle { opacity: .11; }
[data-side="paper"] .t-fleck, [data-side="paper"] .t-iso { opacity: 0; }

.vig { position: absolute; inset: 0; pointer-events: none; transition: opacity .9s ease; }
.vig-water { background: radial-gradient(120% 95% at 50% 44%, transparent 42%, rgba(0, 0, 0, .55) 100%); }
.vig-paper { background: radial-gradient(130% 100% at 50% 45%, transparent 55%, rgba(110, 85, 45, .09) 100%); opacity: 0; }
[data-side="paper"] .vig-water { opacity: 0; }
[data-side="paper"] .vig-paper { opacity: 1; }

.stage { position: relative; z-index: 1; width: 100%; display: flex; flex-direction: column; align-items: center; }
.markwrap { position: relative; width: 100%; }

/* Invisible button over the otter: turns the card over. */
.flip
{
    position: absolute;
    z-index: 2;
    left: calc(50% - 184px);
    top: 26px;
    width: 368px;
    height: 76px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 40px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.flip:focus-visible { outline: 1px solid var(--muted); outline-offset: 6px; }

.mark
{
    display: block;
    width: 100%;
    height: 126px;
    overflow: visible;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 33%, #000 67%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 33%, #000 67%, transparent 100%);
}

.ln { fill: none; stroke: var(--ink); stroke-width: calc(1.4px * var(--wk)); stroke-linecap: round; stroke-linejoin: round; }
.wh { fill: none; stroke: var(--ink); stroke-width: calc(.55px * var(--wk)); stroke-linecap: round; }
.dot { fill: var(--ink); }
.eye-open, .eye-closed { transition: opacity .28s ease; }
.eye-closed { fill: none; stroke: var(--ink); stroke-width: .75; stroke-linecap: round; opacity: 0; }
.otter-g:hover .eye-open, .flip:hover + .mark .eye-open { opacity: 0; }
.otter-g:hover .eye-closed, .flip:hover + .mark .eye-closed { opacity: 1; }
.hit { fill: transparent; pointer-events: all; }
.ripple { fill: none; stroke: var(--ink); stroke-width: .55; stroke-linecap: round; opacity: .28; transform-box: fill-box; transform-origin: center; }
.blink { transform-box: fill-box; transform-origin: center; animation: blink 7.3s ease-in-out 6s infinite; }

.card { margin-top: 46px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.name { margin: 0; font-weight: 300; font-size: 48px; line-height: 1.1; letter-spacing: .012em; color: var(--ink); font-kerning: normal; }
[data-side="water"] .name { text-shadow: 0 0 1px rgba(236, 230, 218, .1); }
[data-side="paper"] .name, [data-side="paper"] .mail span { text-shadow: 0 1px 0 rgba(255, 255, 255, .55); }

.mail
{
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 10px 6px;
    color: var(--muted);
    text-decoration: none;
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    letter-spacing: .025em;
    transition: color .35s ease;
}

a.mail:hover, a.mail:focus-visible { color: var(--ink); }
.mail:focus-visible { outline: 1px solid var(--muted); outline-offset: 4px; border-radius: 2px; }

/* Fallback without JavaScript: the address is stored reversed and shown the right way round. */
.rev { unicode-bidi: bidi-override; direction: rtl; }

/* Underline that turns into a drifting wave on hover. */
.u
{
    display: block;
    width: 100%;
    height: 6px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%);
}

.u-drift { animation: drift 1.4s linear infinite; animation-play-state: paused; }
.u-line, .u-wave { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; transition: opacity .35s ease; }
.u-line { opacity: .28; }
.u-wave { opacity: 0; }
a.mail:hover .u-line, a.mail:focus-visible .u-line { opacity: 0; }
a.mail:hover .u-wave, a.mail:focus-visible .u-wave { opacity: .85; }
a.mail:hover .u-drift, a.mail:focus-visible .u-drift { animation-play-state: running; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 92%, 97%, 100% { transform: scaleY(1); } 94.5% { transform: scaleY(.1); } }
@keyframes ripple { 0% { opacity: 0; transform: scaleX(.35); } 30% { opacity: .42; } 100% { opacity: 0; transform: scaleX(1.25); } }
@keyframes drift { to { transform: translateX(-12px); } }

/* Intro: the otter is drawn in one line, then the water, then the name rises. */
.anim .otter { stroke-dasharray: 298; stroke-dashoffset: 298; animation: draw 2s cubic-bezier(.6, .04, .3, 1) .35s forwards; }
.anim .wl, .anim .wr { stroke-dasharray: 901; stroke-dashoffset: 901; animation: draw 2.4s cubic-bezier(.12, .7, .25, 1) 2.15s forwards; }
.anim .w1, .anim .w2 { stroke-dasharray: 16; stroke-dashoffset: 16; animation: draw .45s ease-out 2.3s forwards; }
.anim .w2 { animation-delay: 2.4s; }
.anim .nose { opacity: 0; animation: fade .3s ease-out 1.25s forwards; }
.anim .eye { opacity: 0; animation: fade .45s ease-out 2.2s forwards; }
.anim .ripple { opacity: 0; animation: ripple 6.5s ease-in-out 4.2s infinite; }
.anim .r2 { animation-delay: 5.9s; }
.anim .r3 { animation-delay: 7.4s; }
.anim .name { opacity: 0; animation: rise 1.3s cubic-bezier(.2, .7, .2, 1) 2.45s forwards; }
.anim .mail { opacity: 0; animation: rise 1.3s cubic-bezier(.2, .7, .2, 1) 2.7s forwards; }

@media (prefers-reduced-motion: reduce)
{
    body, .page, .tex rect, .vig { transition: none; }
    .anim .otter, .anim .wl, .anim .wr, .anim .w1, .anim .w2 { animation: none; stroke-dashoffset: 0; }
    .anim .nose, .anim .eye, .anim .name, .anim .mail { animation: none; opacity: 1; }
    .blink, .anim .ripple { animation: none; }
    .anim .ripple { opacity: .28; }
    .mail .u-drift { animation: none !important; }
}

/* Phone */
@media (max-width: 640px)
{
    .mark
    {
        height: 92px;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
    }

    .flip { left: calc(50% - 136px); top: 19px; width: 272px; height: 56px; }
    .ln { stroke-width: calc(1.6px * var(--wk)); }
    .wh { stroke-width: calc(.65px * var(--wk)); }
    .card { margin-top: 34px; }
    .name { font-size: 36px; }
    .mail { font-size: 18px; }
}
