/* Special Elite font for headers */
.font-detective {
    font-family: 'Special Elite', cursive;
}
/* Dark jungle background */
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.95)),
                url('/shared/leavesback.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
    /* Dinos standing beside the folder must never make the page scroll sideways */
    overflow-x: hidden;
}
/* Input focus glow */
input:focus {
    outline: none;
}
/* Smooth transitions, named so nothing else animates by accident */
a, button {
    transition: color var(--dur-base) var(--ease-standard), background-color var(--dur-base) var(--ease-standard),
                border-color var(--dur-base) var(--ease-standard), box-shadow var(--dur-base) var(--ease-standard),
                filter var(--dur-base) var(--ease-standard), opacity var(--dur-base) var(--ease-standard),
                transform var(--dur-base) var(--ease-standard);
}
/* Buttons: the same shape, size and lamp shadow as the tool pages (btn-green in common.css).
   Red is kept only for deleting a key, so the one destructive action looks different on purpose. */
button.btn-green,
a.btn-green,
button.btn-danger {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.25;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
button.btn-green,
a.btn-green {
    background: var(--green);
    color: var(--on-green);
    border: 1px solid var(--green);
    box-shadow: var(--shadow-sheet-dark);
}
/* Lying flat on the paper like everything else; hover lifts it, a click stamps it flat */
button.btn-green:hover,
a.btn-green:hover {
    box-shadow: var(--shadow-paper-lift);
}
button.btn-green:active,
a.btn-green:active {
    box-shadow: none;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    button.btn-green:hover,
    a.btn-green:hover {
        transform: translateY(-2px);
    }
    button.btn-green:active,
    a.btn-green:active {
        transform: translateY(1px) scale(0.98);
        transition-duration: 60ms;
    }
    /* Home cards: picked up off the paper. The lift is an offset rather than a transform:
       a transformed card seals in whatever stands on it, and the notepad dino hangs off his
       card's writing from inside it, so a transform drops him under the folder's lamp
       falloff and dulls him as the card rises. */
    .paper-card {
        position: relative;
        top: 0;   /* the lift animates from here: a transition cannot run from top's default, auto */
    }
    .paper-card:hover {
        top: -3px;
    }
    /* The notepad dino lives inside the Notosaurus card to hang under its words, but he
       stands on the folder like his friends: as the card lifts, he steps down the same
       distance at the same pace, so he stays where he is. He steps with a margin, the same
       kind of measure as the card's lift, so the two land on the same whole pixel and cancel
       exactly; stepping him with a translate left him trembling by a third of a pixel as the
       card moved, because the browser draws the two in different places. */
    .tool-card-notosaurus:hover .dino-desktop.dino-notepad {
        margin-top: 3px;
    }
    .dino-peek.dino-desktop.dino-notepad {
        transition: margin-top 300ms cubic-bezier(0.4, 0, 0.2, 1);
    }
}
/* Section sheets: the tool pages' own pattern, so the settings page belongs to the same world.
   A named tab, and the sheet hanging below it, its bottom tucked behind the panel.
   (The same rules live in common.css for the tool pages; the two stylesheet worlds merge in 1.2.) */
.sub-folder-tab {
    position: absolute;
    top: -2em;
    left: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    height: calc(2em + 0.5rem);
    padding: 0 1.25em;
    font-family: 'Special Elite', cursive;
    font-size: 15px;
    line-height: 1.25;
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: var(--ink-text);
    background-color: var(--sheet);
    background-image: var(--paper-grain);
    border: 1px solid var(--ink-a20);
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-sheet);
    cursor: default;
    user-select: none;
}

.sub-folder-panel {
    position: relative;
    z-index: 20;
    padding: 1.5rem;
    border: 1px solid var(--ink-a20);
    border-radius: var(--radius-lg);
    background-color: var(--sheet);
    background-image: var(--paper-grain);
    box-shadow: var(--shadow-sheet);
}

/* Cozy, not compact: on a full-size screen the sheets breathe like the tool pages' do */
@media (min-width: 769px) {
    .sub-folder-panel {
        padding: 1.75rem;
    }
}

/* Each sheet's status: the same paper, ink, corner and height as the small buttons. It keeps its
   words on one line, so a narrow screen never breaks "Not set" in half. */
.key-status {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    white-space: nowrap;
    padding: 0.375rem 0.75rem;
    min-height: 2rem;
    border-radius: var(--radius-md);
    background: var(--paper-cream);
    border: 1px solid rgba(69, 26, 3, 0.25);
    box-shadow: var(--shadow-sheet);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.25;
    color: var(--ink-text);
    cursor: default;
    user-select: none;
}

/* A sheet that is set up wears a dino color, the way the tools' stickers report */
.key-status.is-set {
    background: var(--green);
    border-color: var(--green);
    color: var(--on-green);
}

/* Cream buttons: thin paper, the same as the tool pages' btn-cream */
a.btn-cream,
button.btn-cream {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.25;
    padding: 0.5rem 1rem;
    min-height: 2.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    background: var(--paper-cream);
    color: var(--ink-text);
    border: 1px solid rgba(69, 26, 3, 0.25);
    box-shadow: var(--shadow-sheet);
}

a.btn-cream:hover,
button.btn-cream:hover {
    background: linear-gradient(var(--ink-a10), var(--ink-a10)), var(--paper-cream);
    border-color: var(--ink-a40);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    a.btn-cream:hover,
    button.btn-cream:hover {
        transform: translateY(-1px) rotate(-0.6deg);
    }

    a.btn-cream:active,
    button.btn-cream:active {
        transform: none;
        transition-duration: 60ms;
    }
}

button.btn-danger {
    background: rgba(220, 38, 38, 0.2);
    color: var(--danger-ink);
    border: 1px solid rgba(239, 68, 68, 0.5);
}
button.btn-danger:hover {
    background: rgba(220, 38, 38, 0.4);
}
/* Hints: placeholder text in one quiet ink, matching the tool pages. The html prefix outranks
   Tailwind's own gray placeholder rule, which is added to the page after ours. */
html input::placeholder,
html textarea::placeholder {
    color: var(--ink-a60);
    opacity: 1;
}
/* Reduced motion: when someone asks their device for less movement, changes happen instantly */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
/* Paper folders, matching the tool pages: one lamp light, a faint paper grain,
   and card stock edges on a layer that never takes clicks */
.paper-folder {
    background-color: var(--folder-amber) !important;
    background-image:
        var(--paper-grain),
        radial-gradient(ellipse 80% 60% at 15% 0%, rgba(255, 250, 235, 0.55), rgba(255, 250, 235, 0) 70%),
        linear-gradient(var(--lamp-angle), var(--folder-amber) 0%, var(--folder-mid-bare) 55%, var(--folder-edge-bare) 100%) !important;
}
/* A long folder (Privacy, Terms): the same lamp, measured in screen distances rather than the
   folder's height. The glow lights only the top, above the first sheet, as a tool's glow lights
   its header; by the first sheet the paper has settled to the amber a tool folder has around its
   sheets, and it holds there, so every sheet lies a shade lighter than the folder under it */
.paper-folder.paper-folder-long {
    background-image:
        var(--paper-grain),
        radial-gradient(ellipse 80% 220px at 15% 0%, rgba(255, 250, 235, 0.55), rgba(255, 250, 235, 0) 70%),
        linear-gradient(var(--lamp-angle), var(--folder-amber) 0, var(--folder-mid-bare) 200px) !important;
}

/* The card stock edges and the lamp's falloff, on one layer over everything on the folder that
   never takes clicks (see --lamp-falloff) */
.paper-folder::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 25;   /* above the divider sheets (20), which lie on the folder */
    border-radius: inherit;
    background: var(--lamp-falloff);
    box-shadow: var(--edge-lit);
    pointer-events: none;
}

/* On a long folder the falloff settles above the first sheet too, at the shade a tool's sheets
   sit in, and holds, so every sheet and the paper around it read flat, as on the tool pages */
.paper-folder.paper-folder-long::after {
    background: linear-gradient(var(--lamp-angle), rgba(69, 26, 3, 0) 0, rgba(69, 26, 3, 0.04) 200px);
}
/* The folder stack lies on the desk: the back sheet casts the lamp shadow onto the jungle */
.folder-back {
    box-shadow: var(--shadow-desk);
}
/* ============================================================
   DINOS AROUND THE CASE FILE
   The dinos sit on top of the folder and may cover paper and boxes, never words.
   Every dino is drawn at one shared scale on every page, in proportion to its artwork,
   with one size set per screen tier: middle windows, wide windows, and phones.
   Home: the pipe dino at the top left, the glass dino at the top right, the pointer dino at the bottom right.
   Login: pipe and glass dinos lean on the folder's sides. Settings: the pointer dino.
   All positions live here.
   ============================================================ */
.dino-peek {
    position: absolute;
    z-index: 30;
    height: auto;
    pointer-events: none;
    /* Default spot: standing on the folder's top edge, feet 1.5rem onto its margin */
    bottom: calc(100% - 1.5rem);
}

/* Desktop windows, 769px and up: one shared scale per width step, each as large as the space
   beside the folder allows. Sizes follow the artwork, so every dino matches its friends. */
.dino-peek.dino-desktop.dino-pipe    { width: 94px; }
.dino-peek.dino-desktop.dino-pointer { width: 119px; }
.dino-peek.dino-desktop.dino-notepad { width: 114px; }   /* the notepad picture is 0.8 times as wide as it is tall, so this width stands him as tall as the pointer dino */
.dino-peek.dino-desktop.dino-glass   { width: 168px; }

/* Home: the pointer stands off the bottom-right card, overlapping only its padding; the notepad
   dino is centered on the bottom-left card's bottom-left corner; the glass dino stands on the folder's top edge at the right at every width
   (the artwork is 0.7 times as tall as it is wide, and his feet stand 3rem onto the folder) */
.dinos-home .dino-peek.dino-desktop.dino-pipe    { bottom: auto; top: 22px; left: -77px; }   /* his snout (92% across, 12.5% down his picture) pokes 10px into the empty space left of the Diffasaurus title, level with it, and his hand (8% further out) stays inside the card's padding, clear of its words; the rest of him stands off the card's left edge; he sits in a wrapper around that card */
.dinos-home .dino-peek.dino-desktop.dino-pointer { bottom: -3.5rem; left: calc(100% - 23px); }   /* he sits in a wrapper around the Lookasaurus card, the bottom-right card of the four, and stands off its right edge, covering only the card's padding (1.5rem), never its words; his feet are 3.5rem below the card, 0.5rem below the folder (the folder's padding is 3rem here, 3.5rem from 1024px) */
.dinos-home .dino-peek.dino-desktop.dino-notepad { bottom: auto; top: 100%; left: -49px; }   /* he sits in a box around the Notosaurus card's paragraph: the top of his picture is on the writing's last line at every width, and he hangs below it and off the card's left edge (the card's padding is 1.5rem, so -49px here puts him 25px past the card's edge) */
.dinos-home .dino-peek.dino-desktop.dino-glass   { right: calc(3rem - 8px); bottom: calc(100% - 3rem - 15px); }   /* standing on the Analysaurus card's top-right corner: the folder's padding is 3rem here, 3.5rem from 1024px */

/* Login: pipe and glass dinos lean on the folder's sides, overlapping 24px of its margin */
.dinos-login .dino-peek.dino-desktop.dino-pipe  { bottom: -0.5rem; left: -70px; }
/* The glass dino leans up into the pocket the tagline and the card leave open, and in toward the
   card as far as he can: only the empty corner of his picture reaches past the button end, never
   his drawing, and never any words. Check him against the button at every width before moving
   him further in. */
.dinos-login .dino-peek.dino-desktop.dino-glass { bottom: auto; top: -3.5rem; right: -128px; }

@media (min-width: 1024px) {
    .dinos-home .dino-peek.dino-desktop.dino-glass { right: calc(3.5rem - 8px); bottom: calc(100% - 3.5rem - 15px); }
    .dinos-home .dino-peek.dino-desktop.dino-pointer { bottom: -4rem; }
}


/* 1100px and up: bigger dinos, same spots */
@media (min-width: 1100px) {
    .dino-peek.dino-desktop.dino-pipe    { width: 124px; }
    .dino-peek.dino-desktop.dino-pointer { width: 157px; }
    .dino-peek.dino-desktop.dino-notepad { width: 151px; }
    .dino-peek.dino-desktop.dino-glass   { width: 222px; }

    .dinos-home .dino-peek.dino-desktop.dino-pipe  { top: 16px; left: -105px; }
    .dinos-home .dino-peek.dino-desktop.dino-pointer { left: calc(100% - 8px); }   /* room beside the folder now, so he stands further off the card */
    .dinos-home .dino-peek.dino-desktop.dino-notepad { left: -68px; }   /* 44px past the card's edge at this size */
    .dinos-login .dino-peek.dino-desktop.dino-pipe  { left: -100px; }
    .dinos-login .dino-peek.dino-desktop.dino-glass { right: -180px; }
}

/* 1280px and up: the biggest dinos, same spots. Home's pipe and pointer stop just below
   the top cards' words. */
@media (min-width: 1280px) {
    .dino-peek.dino-desktop.dino-pipe    { width: 138px; }
    .dino-peek.dino-desktop.dino-pointer { width: 176px; }
    .dino-peek.dino-desktop.dino-notepad { width: 169px; }
    .dinos-home .dino-peek.dino-desktop.dino-notepad { left: -77px; }   /* 53px past the card's edge at this size */
    .dino-peek.dino-desktop.dino-glass   { width: 248px; }

    .dinos-home .dino-peek.dino-desktop.dino-pipe  { top: 14px; left: -118px; }
    .dinos-login .dino-peek.dino-desktop.dino-pipe  { left: -114px; }
    .dinos-login .dino-peek.dino-desktop.dino-glass { right: -206px; }
}

/* Phones: the phone artwork at one shared scale, standing together on the folder's top edge.
   On Home and Settings the page tabs sit at the top right, so the dinos gather on the left. */
@media (max-width: 768px) {
    .dino-stage { margin-top: 60px !important; }   /* the folder sits 60px under the tagline; the dinos no longer stand on it here */
    /* Login: the folder sits under the tagline as on desktop (1.75rem; the header keeps no margin of its own) */
    body:has(.dinos-login) .page-header { margin-bottom: 0; }
    .dinos-login.dino-stage { margin-top: 1.75rem !important; }
    .dino-peek.dino-mobile.dino-pipe    { width: 52px; left: 0.5rem; }
    .dino-peek.dino-mobile.dino-pointer { width: 63px; left: 0.75rem; }
    .dino-peek.dino-mobile.dino-notepad { width: 60px; left: 0.75rem; }
    .dino-peek.dino-mobile.dino-glass   { width: 69px; right: 0.5rem; }
    /* Home: each dino sits on his card's title line, beside the words, as tall as that line
       (2rem) so the card stays as tall as it was without him. Pipe to the left of
       Diffasaurus, glass to the right of Analysaurus, notepad to the left of Notosaurus,
       pointer to the right of Lookasaurus. The title is a centered row; the words' order in
       the markup sets the side. */
    .dinos-home .tool-card h3 {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    .dinos-home .tool-card .dino-peek.dino-mobile {
        display: block !important;
        position: static;
        margin: 0;
        width: auto;
        height: 2rem;
        z-index: auto;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(52, 211, 153, 0.4);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 211, 153, 0.6);
}

/* ============================================================
   DINO ASSET TOGGLE — Desktop vs Mobile
   Desktop versions shown by default, mobile versions hidden.
   At 768px breakpoint, swap visibility.
   ============================================================ */
.dino-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .dino-desktop {
        display: none !important;
    }
    .dino-mobile {
        display: block !important;
    }
    /* Phones: the dinos on the folder stay home; only the profile dino in the header shows */
    .dino-peek.dino-mobile {
        display: none !important;
    }
}

/* ============================================================
   PAGE TABS — Home, Settings, Log out on the folder's right edge
   Same tabs as the tool pages. The current page's tab is cream
   like the active folder tab and is not a link. On phones they
   become a small row at the top right, level with the card's title tab.
   ============================================================ */
.sticky-tabs {
    position: absolute;
    right: -40px;   /* 8px of each tab lies over the back sheet's strip; 32px stands clear */
    top: 60px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* On Settings the pointer dino leans on the same edge, so the tabs start just below its feet */
@media (min-width: 768px) {
    .dinos-settings .sticky-tabs {
        top: 9rem;
    }
}

.sticky-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    padding-left: 8px;   /* the icon sits centered in the part you can see, clear of the folder */
    height: 40px;   /* the phone tab turned on its side: 40 by 32 showing */
    text-decoration: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;   /* the button corner: page tabs are pressed like buttons */
    transition: width var(--dur-base) var(--ease-standard), box-shadow var(--dur-base) var(--ease-standard);
    box-shadow: 1.5px 3px 6px rgba(0, 0, 0, 0.35);
}

.sticky-tab:hover {
    width: 50px;   /* pulled out 10px: the current page, or the tab under the pointer */
    opacity: 1;
    box-shadow: 2.5px 4px 10px rgba(0, 0, 0, 0.45);
}

.sticky-tab-glyph {
    font-size: 18px;
    line-height: 1;
    color: var(--on-green);
}

/* The one green, in the lamp's shade: the tabs stand at the folder's far edge, so they take the
   same few percent of falloff as a green button lying in that corner of the folder, and only a
   faint hairline edge, so they read as the same green as the buttons */
.sticky-tab-green {
    background: linear-gradient(var(--tab-shade), var(--tab-shade)), var(--green);
    border: 1px solid rgba(253, 246, 230, 0.15);
    border-left: none;
}

.sticky-tab-green:hover {
    background: linear-gradient(var(--tab-shade), var(--tab-shade)), var(--green);
}

.sticky-tab-current {
    width: 50px;   /* pulled out 10px: the current page, or the tab under the pointer */
    opacity: 1;
    background: linear-gradient(var(--tab-shade), var(--tab-shade)), var(--green);
    border: 1px solid rgba(253, 246, 230, 0.15);
    border-left: none;
    cursor: default;
}

.sticky-tab-current:hover {
    box-shadow: 1.5px 3px 6px rgba(0, 0, 0, 0.35);
}

/* The current tab is the same green as the others; only how far it stands out marks the page */

@media (max-width: 767px) {
    .sticky-tabs {
        top: auto;
        bottom: 100%;
        left: auto;
        right: 0.5rem;
        flex-direction: row;
        align-items: flex-end;
        gap: 8px;
    }

    .sticky-tab,
    .sticky-tab:hover {
        width: 40px;
        padding-left: 0;
        height: 32px;
        margin-left: 0;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.3);
    }

    .sticky-tab-green {
        border-left: 1px solid rgba(253, 246, 230, 0.15);
        border-bottom: none;
    }

    .sticky-tab-current,
    .sticky-tab-current:hover {
        height: 36px;
        border-left: 1px solid rgba(253, 246, 230, 0.15);
        border-bottom: none;
    }

    .sticky-tab-glyph {
        font-size: 18px;
    }
}
/* Home tool cards: each card takes its tool's color from the tokens, for the title and a
   soft border that firms up on hover */
.tool-card-diffasaurus { --tool: var(--tool-diffasaurus); }
.tool-card-analysaurus { --tool: var(--tool-analysaurus); }
.tool-card-notosaurus  { --tool: var(--tool-notosaurus); }
.tool-card-lookasaurus { --tool: var(--tool-lookasaurus); }

.tool-card {
    border-color: color-mix(in srgb, var(--tool) 30%, transparent);
}

.tool-card:hover {
    border-color: color-mix(in srgb, var(--tool) 60%, transparent);
}

.tool-card h3 {
    color: var(--tool);
}

/* ============================================================
   LIVING THINGS ON THE ACCOUNT PAGES
   Outline dinos are stickers; the plain dinos, the profile dino, the typed title and the
   Aurelia jelly are alive. Each motion is layered on top of the others (listed together), so
   a hover never replays the page-open hello. Hover motion needs a mouse, nothing moves with
   reduced motion, and the title is always complete for screen readers.
   - Dinos move from their feet, each on its own: they hop hello as the page opens, and a dino
     sways only when the mouse is over that dino.
   - The title is typewriter lettering: it types itself on, and jiggles like a typebar on hover.
   - The profile dino pops in, and looks around on hover.
   - The tagline comes into focus phrase by phrase, and each phrase snaps sharper on hover.
   - The Aurelia jelly swims: one pulse-and-glide as the page opens, and it keeps swimming while hovered.
   ============================================================ */
.dino-peek {
    transform-origin: 50% 100%;
}

.dino-peek.dino-pipe {
    --hello: dino-hop 0.7s var(--ease-standard) 0.3s both;
}

.dino-peek.dino-pointer {
    --hello: dino-hop 0.7s var(--ease-standard) 0.5s both;
}

.dino-peek.dino-notepad {
    --hello: dino-hop 0.7s var(--ease-standard) 0.6s both;
}

.dino-peek.dino-glass {
    --hello: dino-hop 0.7s var(--ease-standard) 0.7s both;
}

/* The title is a centered block sized to its words (so typing reveals just the text) with no
   stray line space beneath it. Where the profile dino follows, the circle sits optically centered
   between the title and the tagline: the eye measures from the title's baseline, and the
   typewriter face leaves room for descenders below it, so the title's margin is pulled in. */
.site-title {
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

h1.site-title:has(+ img.profile-dino) {
    margin-bottom: 39px;
}

/* Desktop: measured from the letters, about 65px above the circle and 18px below it, a touch
   bottom-weighted so the circle reads as resting centered */
@media (min-width: 769px) {
    h1.site-title:has(+ img.profile-dino) {
        margin-bottom: 33px;
    }

    img.profile-dino.dino-desktop {
        margin-bottom: 15px;
    }
}

@keyframes dino-hop {
    0%   { transform: translateY(0) scale(1, 1); }
    20%  { transform: translateY(0) scale(1.03, 0.95); }
    50%  { transform: translateY(-8px) scale(0.98, 1.03); }
    80%  { transform: translateY(0) scale(1.02, 0.97); }
    100% { transform: translateY(0) scale(1, 1); }
}

@keyframes dino-sway {
    0%   { transform: rotate(0deg); }
    25%  { transform: translateY(-4px) rotate(-4deg); }
    55%  { transform: translateY(0) rotate(3deg); }
    80%  { transform: rotate(-1.5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes type-on {
    from { clip-path: inset(-40px 100% -40px -40px); }
    to   { clip-path: inset(-40px -40px -40px -40px); }
}

@keyframes typebar-jiggle {
    0%   { transform: none; }
    25%  { transform: translate(0.5px, -1px) rotate(-0.6deg); }
    50%  { transform: translate(-0.5px, 0.5px) rotate(0.4deg); }
    75%  { transform: translateY(-0.5px); }
    100% { transform: none; }
}

@keyframes profile-pop {
    0%   { transform: scale(0.85); opacity: 0; }
    60%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes profile-look {
    0%   { transform: rotate(0deg); }
    30%  { transform: rotate(-8deg); }
    65%  { transform: rotate(6deg); }
    100% { transform: rotate(0deg); }
}

/* The Aurelia jelly glows softly like the title, and glows brighter as it swims */
.footer-jelly {
    filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.45));
}

/* A jellyfish swims by pulsing: the bell squeezes in, pushes up with a soft glow, then drifts down */
@keyframes jelly-swim {
    0%   { transform: translateY(0) scale(1, 1);          filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.45)); }
    18%  { transform: translateY(1px) scale(1.06, 0.92);  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.4)); }
    40%  { transform: translateY(-8px) scale(0.95, 1.06); filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.8)); }
    65%  { transform: translateY(-6px) scale(1.01, 0.99); filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.6)); }
    100% { transform: translateY(0) scale(1, 1);          filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.45)); }
}

@keyframes jelly-swim-held {
    0%   { transform: translateY(0) scale(1, 1);          filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.45)); }
    18%  { transform: translateY(1px) scale(1.06, 0.92);  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.4)); }
    40%  { transform: translateY(-8px) scale(0.95, 1.06); filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.8)); }
    65%  { transform: translateY(-6px) scale(1.01, 0.99); filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.6)); }
    100% { transform: translateY(0) scale(1, 1);          filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.45)); }
}

/* The tagline and the footer lines share the body font, each a point larger than its Tailwind size
   (text-sm and text-xs); the element selectors outrank the Tailwind classes */
p.tagline {
    font-size: calc(0.875rem + 1pt);
}

p.footer-line {
    font-size: calc(0.75rem + 1pt);
}

/* The tagline: each phrase comes into focus and then, one after another, snaps bigger for a
   beat; under the mouse a phrase snaps again */
.tagline span {
    display: inline-block;
}

/* Two spaces after each full stop: the real space between the phrases, plus one more space's
   width (a space in this face is 0.28 of the font size) */
.tagline span + span {
    margin-left: 0.28em;
}

/* The social icons: one centered row of small green icons at the very bottom of the footer,
   under the two lines of words. Each turns white under the mouse. */
.social-icons {
    display: flex;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 0.5rem;
    color: #10b981;
}

.social-icons a {
    display: inline-flex;
    color: inherit;
    transition: color 0.15s ease;
}

.social-icons a:hover {
    color: #fff;
}

.social-icons svg {
    width: 20px;
    height: 20px;
}

/* The footer's links are boxes of their own, so they can scale under the mouse */
.footer-line a,
.footer-line [aria-current] {
    display: inline-block;
}

@keyframes phrase-focus {
    from { opacity: 0; filter: blur(4px); transform: translateY(4px); }
    to   { opacity: 1; filter: blur(0);   transform: translateY(0); }
}

/* The same fade without the blur, for phones: iOS Safari can stall an animation that changes a
   filter, leaving a phrase half-drawn, so there the phrases simply rise into place */
@keyframes phrase-rise {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes phrase-snap {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.08); text-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
    100% { transform: scale(1); }
}

.tagline span:nth-child(1) { --focus: phrase-focus 0.5s var(--ease-standard) 1.2s both, phrase-snap 0.35s var(--ease-standard) 1.65s; }
.tagline span:nth-child(2) { --focus: phrase-focus 0.5s var(--ease-standard) 1.4s both, phrase-snap 0.35s var(--ease-standard) 1.85s; }
.tagline span:nth-child(3) { --focus: phrase-focus 0.5s var(--ease-standard) 1.6s both, phrase-snap 0.35s var(--ease-standard) 2.05s; }
.tagline span:nth-child(4) { --focus: phrase-focus 0.5s var(--ease-standard) 1.8s both, phrase-snap 0.35s var(--ease-standard) 2.25s; }
.tagline span:nth-child(5) { --focus: phrase-focus 0.5s var(--ease-standard) 2.0s both, phrase-snap 0.35s var(--ease-standard) 2.45s; }

@media (prefers-reduced-motion: no-preference) {
    .dino-peek {
        animation: var(--hello);
    }

    .site-title {
        animation: type-on 1.1s steps(21, end) 0.1s both;
    }

    .profile-dino {
        animation: profile-pop 0.6s var(--ease-standard) 0.2s both;
    }

    .footer-jelly {
        transform-origin: 50% 40%;
        animation: jelly-swim 1.8s ease-in-out 2.4s 1;
    }

    .tagline span {
        animation: var(--focus);
    }

    @media (hover: none) {
        .tagline span {
            animation-name: phrase-rise;
        }
    }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    /* Each dino is petted on its own: /shared/dino-pet.js marks only the dino under the mouse,
       and the dinos never take the mouse themselves, so clicks always reach the page beneath */
    .dino-peek.is-petted {
        animation: var(--hello), dino-sway 0.8s var(--ease-standard);
    }

    .site-title:hover {
        animation: type-on 1.1s steps(21, end) 0.1s both, typebar-jiggle 0.35s var(--ease-standard);
    }

    .profile-dino:hover {
        animation: profile-pop 0.6s var(--ease-standard) 0.2s both, profile-look 0.9s var(--ease-standard);
    }

    .footer-jelly:hover {
        animation: jelly-swim 1.8s ease-in-out 2.4s 1, jelly-swim-held 1.8s ease-in-out infinite;
    }

    .tagline span:hover {
        animation: var(--focus), phrase-snap 0.35s var(--ease-standard);
    }

    /* The footer lines: each link snaps sharper under the mouse, as the tagline's phrases do */
    .footer-line a:hover,
    .footer-line [aria-current]:hover {
        animation: phrase-snap 0.35s var(--ease-standard);
    }
}

/* ============================================================
   THE LOGIN BUTTON — a dino stamp that glows like the jelly
   It works like every green button (it rises as you reach for it and stamps down when
   clicked, casting the same lamp shadow), and on the dark jungle it glows like the Aurelia
   jelly: a soft emerald halo at rest that breathes while hovered and flashes as it stamps.
   With reduced motion the glow simply brightens on hover.
   ============================================================ */
.login-btn {
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--on-green);
    background: var(--green);
    border: 1px solid var(--green);
    box-shadow: var(--shadow-sheet-dark), 0 0 18px rgba(16, 185, 129, 0.25);
    text-decoration: none;
}

.login-btn:hover {
    box-shadow: var(--shadow-paper-lift), 0 0 28px rgba(16, 185, 129, 0.5);
}

.login-btn:active {
    box-shadow: 0 0 36px rgba(16, 185, 129, 0.7);
}

/* While hovered, the lifted button pulses like the jelly's bell (a slight squeeze and release)
   in time with its breathing glow */
@keyframes login-glow-breathe {
    0%, 100% { transform: translateY(-2px) scale(1, 1);         box-shadow: var(--shadow-paper-lift), 0 0 22px rgba(16, 185, 129, 0.35); }
    50%      { transform: translateY(-3px) scale(0.992, 1.012); box-shadow: var(--shadow-paper-lift), 0 0 34px rgba(16, 185, 129, 0.65); }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    /* The page-open motion stays first in each list, so hovering or pressing never replays it */
    .login-btn:hover {
        transform: translateY(-2px);
        animation: button-stamp 0.35s var(--ease-standard) 0.3s both,
                   login-glow-breathe 2.4s ease-in-out infinite;
    }

    .login-btn:active {
        transform: translateY(1px) scale(0.98);
        transition-duration: 60ms;
        animation: button-stamp 0.35s var(--ease-standard) 0.3s both;
    }
}

/* ============================================================
   COMPACT HEADER SPACING (desktop only; phones keep their own)
   The tagline sits the same distance above the case file as the title and dino sit above it.
   Settings keeps its dino headroom; Home and Login dinos stand beside the card and move with it.
   ============================================================ */
/* At every width, the title's letters sit 67px down (with the body's 16px): the tagline-to-folder gap */
/* Home: an empty line under the title, the height of the tagline's line (text-sm: 20px), as if the
   tagline were still there */
.header-space {
    height: 20px;
}

.page-header {
    padding-top: 52px;
}

/* Phones: the header sits as far from the top as the footer sits from the bottom, which is
   only the body's own padding (1rem) */
@media (max-width: 768px) {
    .page-header {
        padding-top: 0;
    }
    /* Home leads its header with the round dino, whose own top margin would add to that */
    .page-header > .profile-dino:has(~ .site-title) {
        margin-top: 0;
    }
}

@media (min-width: 769px) {
    .page-header {
        margin-bottom: 0 !important;
    }

    .dinos-login.dino-stage {
        margin-top: 1.75rem !important;
    }

    /* Home and Settings: the folder comes up under the tagline */
    .dinos-home.dino-stage     { margin-top: 67px !important; }
    .dinos-settings.dino-stage { margin-top: 67px !important; }   /* no dino on this folder now, so no headroom for one */
}


/* Legal pages: a long sheet of reading on the folder. Section names in the Case Font; the words
   in the body font at a comfortable reading size and spacing, in the warm text ink. */
.legal-sheet {
    color: var(--ink-text);
    font-size: 15px;
    line-height: 1.7;
}

.legal-sheet .legal-updated {
    text-align: center;
    color: var(--ink-a70);
    font-size: 14px;
    margin-bottom: 2rem;
}

/* Section headings read in the body font, a step bolder: the typewriter names the sheets on
   their tabs, and is tiring to read heading after heading */
.legal-sheet h3 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 17px;
    line-height: 1.35;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

/* The sections are grouped on divider sheets, like the settings page's; the sheet's own edge
   gives the first heading its room */
.legal-sheet .sub-folder-panel > :first-child {
    margin-top: 0;
}

/* A sub-heading within a section: the body font, one step bolder, so the typewriter keeps
   naming only the sections */
.legal-sheet h4 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.legal-sheet strong {
    font-weight: 600;
}

.legal-sheet p + p,
.legal-sheet p + ul,
.legal-sheet ul + p {
    margin-top: 0.75rem;
}

.legal-sheet ul {
    list-style: disc;
    padding-left: 1.25rem;
}

.legal-sheet li + li {
    margin-top: 0.25rem;
}

.legal-sheet .legal-link {
    color: var(--green);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* The contact page's address: the words a step larger and plainer than the text around them,
   selectable in one press, with the Copy button beside them */
.legal-sheet .contact-address-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.legal-sheet .contact-address {
    font-size: 18px;
    font-weight: 600;
    user-select: all;
}

.legal-sheet .contact-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.legal-sheet .contact-copy .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

/* ============================================================
   DESK MOTION ON THE ACCOUNT PAGES
   The same motions the tool pages use, so a button, a tab or a sticker behaves the same
   wherever it sits: green buttons stamp, cream buttons slip like paper, tabs lift to peek,
   stickers stick on and wiggle. Mouse only, and never with reduced motion.
   ============================================================ */

@keyframes sticker-stick {
    0%   { transform: scale(0.9) rotate(-3deg); }
    60%  { transform: scale(1.06) rotate(1deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes sticker-wiggle {
    0%   { transform: translateY(0) rotate(0deg); }
    35%  { transform: translateY(-3px) rotate(-2deg); }
    70%  { transform: translateY(-3px) rotate(1.5deg); }
    100% { transform: translateY(-3px) rotate(0deg); }
}

.sub-folder-tab,
.key-status {
    transition: transform var(--dur-base) var(--ease-standard);
}

/* Your Account: who is signed in, shown as plain words (nothing here looks like a field to type
   in, because the details are changed at Tendril Terminal). The label is a quiet body-font label;
   the value is account data, in the terminal font. */
.account-details {
    display: grid;
    gap: var(--space-4);
    margin: 0;
}

/* A caption above each value */
.account-details > div {
    display: grid;
    gap: var(--space-2);
}

.account-details dt {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 13px;
    color: var(--ink-a70);
}

/* Each value sits in a cream box exactly like the tools' writing boxes (paper cream, a thin ink
   edge, the 8px corner, flat, the terminal font at 14px), but for reading: the plain arrow, and
   no typing, since the details are changed at Tendril Terminal */
.account-details dd {
    margin: 0;
    padding: var(--space-3);
    background: var(--paper-cream);
    border: 1px solid var(--ink-a30);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink-text);
    cursor: default;
    overflow-wrap: anywhere;   /* a long email wraps rather than running off the sheet */
}

.account-note {
    margin-top: var(--space-4);
    font-size: 13px;
    color: var(--ink-a70);
}

/* Bring your own key, coming soon: the sheets show how it will work, grayed and not yet usable.
   The status sticker and a Forget button (for a key saved on this device before) stay clear. */

/* Your Own Keys: one sheet built like Your Account. A short note, then each company under a quiet
   caption (the same as Your Account's), with room between them */
.own-keys-lede {
    margin-top: 0;
}

/* The key fields are the Account sheet's boxes, for typing: the same cream, edge, corner and
   terminal font, so the two sheets match */
.own-key-field {
    padding: var(--space-3);
    background: var(--paper-cream);
    border: 1px solid var(--ink-a30);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
    color: var(--ink-text);
}

.own-key-block + .own-key-block,
.own-keys-lede + .own-key-block {
    margin-top: var(--space-6);
}

.own-key-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 2rem;   /* the sticker's height, so the caption row never jumps when it appears */
    margin-bottom: var(--space-2);
}

.own-key-caption {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 13px;
    color: var(--ink-a70);
}

.own-keys-soon .sub-folder-panel input,
.own-keys-soon .sub-folder-panel label,
.own-keys-soon .button-pair {
    opacity: 0.55;
    pointer-events: none;
}

/* Buttons land the way the tool pages' do (common.css): cream paper is laid down, sliding in a
   little from the lamp's side; green is stamped, coming down, squashing a hair and settling.
   Scale, rotate and translate rather than transform, so hover and press still work on top. */
@keyframes paper-lay {
    0%   { translate: -6px -4px; rotate: -2deg; }
    100% { translate: 0 0;       rotate: 0deg; }
}

@keyframes button-stamp {
    0%   { scale: 1.1;       translate: 0 -3px; }
    50%  { scale: 1.03 0.93; translate: 0 0; }
    75%  { scale: 0.99 1.02; }
    100% { scale: 1;         translate: 0 0; }
}

/* The page opens: each sheet's status is slapped onto its paper, the cream trays and buttons are
   laid down (a tray as one piece), then the green buttons are stamped. Forget Key is laid down
   the same way when a key is saved. */
@media (prefers-reduced-motion: no-preference) {
    .key-status {
        animation: sticker-stick 0.35s var(--ease-standard) 0.15s both;
    }

    .btn-cream,
    .btn-danger,
    .button-pair {
        animation: paper-lay 0.35s var(--ease-standard) 0.2s both;
    }

    .btn-green,
    .login-btn {
        animation: button-stamp 0.35s var(--ease-standard) 0.3s both;
    }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    /* A section tab lifts to peek, as it does on the desk */
    .sub-folder-tab:hover {
        transform: translateY(-2px);
    }

    /* A sticker wiggles when touched; the page-open motion stays first in the list, so
       hovering never replays it */
    .key-status:hover {
        transform: translateY(-3px);
        animation: sticker-stick 0.35s var(--ease-standard) 0.15s both,
                   sticker-wiggle 0.5s var(--ease-standard);
    }

    /* Forget Key presses like every other button */
    button.btn-danger:hover {
        transform: translateY(-2px);
    }

    button.btn-danger:active {
        transform: translateY(1px) scale(0.98);
        transition-duration: 60ms;
    }
}

/* ============================================================
   A PAIR OF BUTTONS IN ONE TRAY
   Save Key and Get Key belong to each other, so they sit in one cream tray the way a toggle
   does: the same height, the same corner, the same sheet shadow. They are two real buttons,
   not a switch — the green one acts, the cream one fetches — so neither ever looks "chosen".
   ============================================================ */

.button-pair {
    display: inline-flex;
    align-items: stretch;
    min-width: 0;          /* never pushes its sheet wider than the folder */
    min-height: 2.25rem;
    gap: 2px;
    padding: 2px;
    background: var(--paper-cream);
    border: 1px solid rgba(69, 26, 3, 0.25);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sheet);
}

.button-pair > * {
    flex: 1;   /* even halves, so neither button crowds the other */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.25;
    padding: 0.375rem 0.875rem;
    border: 0;
    border-radius: calc(var(--radius-md) - 2px);
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    min-height: 0;
}

/* The green piece: the pair's one action, lying in the tray like a toggle's chosen side */
.button-pair .pair-action {
    background: var(--green);
    color: var(--on-green);
    box-shadow: var(--shadow-sheet-dark);
}

.button-pair .pair-action:active {
    box-shadow: none;
}

/* The cream piece: the quiet errand, the same paper as the tray it sits in */
.button-pair .pair-aside {
    background: transparent;
    color: var(--ink-text);
}

/* A reading rather than a button: what is left to spend, sitting in the tray beside the action.
   Nothing to press, so the plain arrow and no hover of its own. */
.button-pair .pair-reading {
    background: transparent;
    color: var(--ink-text);
    cursor: default;
    user-select: none;
}

.button-pair .pair-aside:hover {
    background: var(--ink-a10);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .button-pair .pair-action:hover {
        box-shadow: var(--shadow-paper-lift);
        transform: translateY(-1px);
    }

    .button-pair .pair-action:active {
        transform: translateY(1px) scale(0.98);
        transition-duration: 60ms;
    }

    .button-pair .pair-aside:hover {
        transform: translateY(-1px);
    }
}

/* Trial Mode: a sticker at the folder's top-left corner, lying over the folder, its tabs and
   the dinos, for anyone signed in without a subscription. It is pinned to that corner, so it
   moves with the folder when the page scrolls. It wiggles when touched (mouse only, and never
   with reduced motion), and opens the Tendril Terminal dashboard. */
.trial-mode {
    position: absolute;
    top: -4.5rem;   /* 38px higher than the folder corner used to hold it */
    left: -6rem;   /* far enough left to stay off the folder tabs on the tool pages */
    z-index: 60;   /* the top layer: over the folder (20), its tabs (10) and the dinos (30) */
    width: 9rem;
    rotate: -13deg;   /* stuck on a little crooked, leaning left; rotate rather than transform, so the hover wiggle still works on top */
    transition: transform var(--dur-base) var(--ease-standard);
}

.trial-mode img {
    display: block;
    width: 100%;
    height: auto;
}

.trial-mode[hidden] {
    display: none;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .trial-mode:hover {
        transform: translateY(-3px);
        animation: sticker-wiggle 0.5s var(--ease-standard);
    }
}

/* On phones the sticker is 60% of its desktop size and sticky: it starts on the folder's
   top-left corner as before, then stays near the top of the screen as the reader scrolls down
   the folder. The sticky box has no height, so it takes no room above the folder; the image
   hangs from it, lifted a little so it lies over the corner. */
@media (max-width: 768px) {
    .trial-mode {
        position: sticky;
        display: block;   /* a link is inline by default; without this its width and height would be ignored */
        top: 3.2rem;      /* 0.5rem from the screen top once stuck, allowing for the lifted image below */
        left: auto;
        width: 5.4rem;    /* 60% of the desktop 9rem */
        height: 0;
        margin-left: 0.5rem;
    }
    .trial-mode img {
        position: relative;
        top: -2.7rem;   /* half its height above the folder's top edge, as on desktop (a margin here would collapse through the empty box and move the folder) */
    }
}

/* ============================================================
   LOGIN: THE "NEW HERE?" NOTE
   The business card's twin (common.css, BUSINESS CARD PEEK-A-BOO), in white card stock, folded
   in half: the top half is folded down over the bottom half, so its outside, "New here?", is all
   that shows. It starts tucked behind the folder's bottom-right corner, peeking out like the
   business card with "New here?" at its foot. Hovering lifts it to the middle of the folder and
   unfolds it; a click (a tap on phones) pins it there, open, and a click on the open note tucks
   it back. The sheet is placed with right/bottom inside a box that covers the folder with the
   same 30px overhang on every side, so "the middle" is the folder's middle at every width.
   ============================================================ */
.login-note-peekaboo {
    --note-w: min(360px, 100vw - 24px);   /* the sheet; on a narrow phone it keeps a 12px gutter each side */
    --note-half: 232px;                   /* each half of the folded sheet; the words sit with equal paper above and below */
    position: absolute;
    inset: -30px;    /* the folder plus the business card's overhang on every side */
    z-index: 35;     /* pinned: over the folder (z-20) and the dinos (z-30) */
    pointer-events: none;   /* the box covers the folder; only the sheet itself takes the mouse */
}

/* Where the folder reaches the sides of the screen there is no room beside it, and the note's
   corner hung off the page. It keeps its overhang below the folder and tucks its right edge
   back to the folder's, as the business card does on the tool pages. */
@media (max-width: 768px) {
    .login-note-peekaboo {
        right: 8px;   /* the sheet's shadow falls a few px to its right, so the note sits in by
                         that much and the whole of it, shadow included, stays on the page */
    }
}

.login-note-sheet {
    position: absolute;
    right: 0;    /* tucked: at the folder's bottom-right corner, where the business card rests */
    bottom: 0;
    width: var(--note-w);
    z-index: 1;
    pointer-events: auto;
    cursor: pointer;
    perspective: 1000px;   /* the fold turns in depth */
    transform: rotate(4deg);
    transition: right var(--dur-slow) var(--ease-standard),
                bottom var(--dur-slow) var(--ease-standard),
                transform var(--dur-slow) var(--ease-standard);
}

/* Hovering moves the sheet, so the mouse that found its edge would lose it, the sheet would
   slide back under the mouse, and the note would flicker. Two still targets hold the hover:
   an invisible 12px margin around the sheet, and a "keeper" over the tucked note's spot at the
   corner, so the mouse that lifted the note from there keeps it up until it moves away. The
   keeper sits under the sheet and takes the same click. */
.login-note-sheet::before {
    content: '';
    position: absolute;
    inset: -12px;
}

.login-note-peekaboo::after {
    content: '';
    position: absolute;
    right: -12px;      /* the tucked sheet's box, 12px larger on every side... */
    bottom: -22px;
    width: calc(var(--note-w) + 24px);
    height: calc(var(--note-half) + 24px);
    transform: rotate(4deg);   /* ...and tilted with it, so its corners are covered too */
    z-index: 0;   /* under the sheet (z 1) */
    pointer-events: auto;
    cursor: pointer;
}

/* Tucked: behind the folder, peeking out at its corner as the business card rests, a little
   deeper so the "New here?" line at its foot shows */
.login-note-peekaboo.is-tucked {
    z-index: 15;
}

.login-note-peekaboo.is-tucked .login-note-sheet {
    bottom: -10px;
}

.login-note-peekaboo.is-tucked:hover {
    z-index: 35;
}

/* Hovered, or pinned up by a click: lifted to the middle of the folder. The sheet's own box is
   its bottom half (the top half hangs above it when open), so its bottom sits one half below the
   folder's center and the open note is centered. A pinned note holds the lift, so the mouse
   passing over it never bobs it up and down. */
.login-note-peekaboo:hover .login-note-sheet,
.login-note-peekaboo.is-open .login-note-sheet {
    right: calc(50% - var(--note-w) / 2);
    bottom: calc(50% - var(--note-half));
    transform: rotate(-1deg);
}

/* Desktop: the open note is taller than the folder, and centered on it its top would cover the
   tagline, so it sits 40px lower, hanging further below the folder instead */
@media (min-width: 769px) {
    .login-note-peekaboo:hover .login-note-sheet,
    .login-note-peekaboo.is-open .login-note-sheet {
        bottom: calc(50% - var(--note-half) - 40px);
    }
}

/* The same white card stock as the business card, with its paper grain */
.login-note {
    background: var(--card-white);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04), 1px 2px 2px rgba(0,0,0,0.1), 3px 4px 8px rgba(0,0,0,0.08);
    /* The sheet is rotated inside the fold's 3D context, which draws it as a flat bitmap and
       turns that, leaving jagged edges. A transparent outline and a hidden back face make the
       browser smooth the rotated edges again. */
    outline: 1px solid transparent;
    backface-visibility: hidden;
}

.login-note-grain {
    background-image: url('data:image/svg+xml,%3Csvg viewBox=%220 0 200 200%22 xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cfilter id=%22noise%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.85%22 numOctaves=%224%22 stitchTiles=%22stitch%22/%3E%3C/filter%3E%3Crect width=%22100%25%22 height=%22100%25%22 filter=%22url(%23noise)%22/%3E%3C/svg%3E');
}

/* Both halves are the same height, so the fold lands on the crease exactly */
.login-note-half {
    height: var(--note-half);
}

/* The bottom half is one layer of its own, so its words stay under the folded flap (z 2) instead
   of their z-10 wrapper rising through it */
.login-note-sheet > .login-note {
    z-index: 1;
}

/* The bottom half carries the lifted shadow while the note is up */
.login-note-peekaboo:not(.is-tucked) .login-note-sheet > .login-note,
.login-note-peekaboo.is-tucked:hover .login-note-sheet > .login-note {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04),
                5px 8px 30px rgba(0,0,0,0.25),
                8px 12px 40px rgba(0,0,0,0.15);
}

/* The top half: hinged on the crease (its bottom edge), folded down over the bottom half at
   rest and standing up open while the note is hovered or tapped open. Its two faces sit back
   to back, each a hair in front of its own side so only the one facing the viewer shows: the
   first words inside, and the title on the outside, which reads upright once folded. The faces
   also trade places at the fold's halfway point, when the flap is edge-on, so nothing of the
   hidden face ever shows through. */
.login-note-flap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: var(--note-half);
    z-index: 2;
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
    transform: rotateX(-180deg);
    transition: transform 0.65s var(--ease-standard);
}

.login-note-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    transition: opacity 0s linear 0.325s;
}

/* The inside face's words sit down toward the crease (the markup leaves 27px of paper between them
   and the fold), so the paper left over above the first line is the sheet's head margin, and it is
   the same as the paper under the paw: the top half carries 22px fewer words than the bottom half,
   and the 27px at the fold, against the bottom half's 5px, makes up that difference */
.login-note-inside {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transform: translateZ(1px);
    opacity: 0;
}

.login-note-outside {
    transform: rotateX(180deg) translateZ(1px);
    opacity: 1;
}

/* Open: a mouse over the note, or a tap on a phone */
.login-note-peekaboo:hover .login-note-flap,
.login-note-peekaboo.is-open .login-note-flap {
    transform: rotateX(0deg);
}

.login-note-peekaboo:hover .login-note-inside,
.login-note-peekaboo.is-open .login-note-inside {
    opacity: 1;
}

.login-note-peekaboo:hover .login-note-outside,
.login-note-peekaboo.is-open .login-note-outside {
    opacity: 0;
}

/* Open, the two halves read as one sheet of paper: the crease corners go square, the inside
   face casts no shadow onto the lower half, the lower half's own shadow goes, and the one blurred
   shadow under the sheet stretches to cover both halves */
.login-note-inside {
    box-shadow: none;
    height: calc(var(--note-half) + 2px);   /* 2px taller than its half, so its white laps over the crease and no line shows between the halves */
}

.login-note-shadow {
    transition: top 0.65s var(--ease-standard);
}

.login-note-peekaboo.login-note-peekaboo:hover .login-note-sheet > .login-note,
.login-note-peekaboo.login-note-peekaboo.is-open .login-note-sheet > .login-note {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    box-shadow: none;
}

/* Put away with a click: the pointer is still on the note, and the hover rules would unfold
   it again straight away, so the note stops taking the mouse until the pointer moves off it.
   The script by the note adds this and takes it off again. */
@media (hover: hover) {
    .login-note-peekaboo.is-dismissed .login-note-sheet,
    .login-note-peekaboo.is-dismissed::after {
        pointer-events: none;
    }
}

.login-note-peekaboo:hover .login-note-shadow,
.login-note-peekaboo.is-open .login-note-shadow {
    top: calc(-1 * var(--note-half));
    box-shadow: 5px 8px 30px rgba(0,0,0,0.25), 8px 12px 40px rgba(0,0,0,0.15);
}

/* The words: the title in DDA's typewriter lettering, the rest in the body font at a reading size */
.login-note-title {
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1.35;
    letter-spacing: 0.02em;
    color: var(--ink-text);
}

.login-note-text {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-text);
}

.login-note-text + .login-note-text {
    margin-top: 0.5rem;
}

/* The signature at the bottom of the note, in a handwriting font, with the paw sticker beside it,
   the pair centered as a block */
.login-note-signed {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
    font-family: 'Caveat', cursive;
    font-size: 19px;
    font-weight: 500;
    color: var(--ink-text);
}

.login-note-signoff {
    text-align: left;   /* the two lines sit left-aligned with each other */
}

.login-note-paw {
    display: block;
    height: 36px;
    width: auto;
}

/* "click to dismiss": a quiet line at the foot of the open note, so a visitor knows a click
   puts it away ("tap", in the corner, on phones: see below). Once tucked, a click pins it back
   instead, so the line goes. */
/* The line sits in the sheet's bottom-right corner, inside its padding (its wrapper fills the bottom
   half's padding box), out of the flow of the words above it */
.login-note-dismiss {
    position: absolute;
    right: 0;
    bottom: 0;
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0.02em;
    color: var(--ink-a60);
}

.login-note-dismiss-tap {
    display: none;
}

.login-note-peekaboo.is-tucked .login-note-dismiss {
    display: none;
}

/* Phones: the line says "tap" */
@media (hover: none) {
    .login-note-dismiss-click { display: none; }
    .login-note-dismiss-tap   { display: inline; }
}

/* Narrow phones: the sheet is narrower, so the words wrap onto more lines and each half is taller.
   The bottom half gains a line and the top half does not, so the top half leaves 18px more paper
   at the fold to keep the margins above the first line and under the paw the same */
@media (max-width: 380px) {
    .login-note-peekaboo {
        --note-half: 252px;
    }

    .login-note-flap .login-note-inside {
        padding-bottom: 45px;
    }
}

/* Phones: the same note at the same corner, opening to the same middle. There is nothing to
   hover, so a tap pins it up, open, and a tap on the open note tucks it. A finger leaves a stuck
   hover behind on some phones, so here only the is-open class lifts or opens the note. */
@media (hover: none) {
    .login-note-peekaboo::after {
        display: none;   /* no hover to hold, and the keeper would take taps meant for the folder's corner */
    }

    .login-note-peekaboo.is-tucked:hover {
        z-index: 15;
    }

    .login-note-peekaboo:not(.is-open):hover .login-note-sheet {
        right: 0;
        bottom: 0;
        transform: rotate(4deg);
    }

    .login-note-peekaboo.is-tucked:not(.is-open):hover .login-note-sheet {
        bottom: -10px;
    }

    .login-note-peekaboo.is-tucked:not(.is-open):hover .login-note-sheet > .login-note {
        box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04), 1px 2px 2px rgba(0,0,0,0.1), 3px 4px 8px rgba(0,0,0,0.08);
    }

    .login-note-peekaboo:not(.is-open):hover .login-note-flap {
        transform: rotateX(-180deg);
    }

    .login-note-peekaboo:not(.is-open):hover .login-note-inside {
        opacity: 0;
    }

    .login-note-peekaboo:not(.is-open):hover .login-note-outside {
        opacity: 1;
    }

    .login-note-peekaboo:not(.is-open):hover .login-note-shadow {
        top: 0;
        box-shadow: none;
    }

    .login-note-peekaboo.login-note-peekaboo:not(.is-open):hover .login-note-sheet > .login-note {
        border-top-left-radius: 0.5rem;
        border-top-right-radius: 0.5rem;
    }
}
