/* Shared site chrome: nav tabs, white sheet on lavender, footer.
   Frames are a plum line around a lilac mat; buttons are plain plum outlines.
   Loaded by the homepage (template-story.html) and MFO (template-mfo.html). */

@font-face {
    font-family: "Iosevka Web";
    font-display: swap;
    font-weight: 100 900;
    font-style: normal;
    src:
        url("../fonts/Iosevka/WOFF2/Iosevka-Regular.woff2") format("woff2"),
        url("../fonts/Iosevka/TTF/Iosevka-Regular.ttf") format("truetype");
}

:root {
    --mono: "Iosevka Web", "Iosevka", ui-monospace, Menlo, monospace;
    --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
    --ink: #1d1535;
    --ink-2: #5f5577;
    --lilac: #c4a7e7;
    --lilac-2: #e8e0f5;
    --plum: #4c2f8a;
    --bg: #c4a7e7;
    --lilac-4: #b393de;
    /* two-tone divider: plum line over a lilac band */
    --rule: linear-gradient(var(--plum) 0 2px, var(--lilac) 2px 5px);
    color-scheme: light;
}

* { box-sizing: border-box; }

body.chrome {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
.chrome a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.chrome u { text-decoration-color: var(--lilac-4); text-decoration-thickness: 3px; text-underline-offset: 3px; text-decoration-skip-ink: none; }
.chrome a:has(> u) { text-decoration: none; }

/* ---------- nav: folder tabs sitting on top of the sheet ---------- */
.chrome .tabs {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}
.chrome .tabs a {
    font-size: 14px;
    background: var(--lilac-2);
    color: var(--ink);
    border: 2px solid var(--plum);
    border-bottom: 0;
    padding: 6px 16px 4px;
    text-decoration: none;
    position: relative;
    top: 2px; /* cover the sheet's outline */
}
.chrome .tabs a[aria-current] { background: #fff; padding-bottom: 8px; }
.chrome .tabs a:hover { background: #fff; }
.chrome .tabs a:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }

/* ---------- side notes (org footnotes via pandoc/filters/sidenotes.lua,
   Leaflet footnotes via pandoc/leaflet.py) ----------
   On wide screens each note is a paper slip on the lavender, outside the sheet,
   level with the line it belongs to. Narrower than that, tap the number to
   open it under the line. */
.chrome .sn-ref {
    font-size: .75em;
    vertical-align: super;
    line-height: 0;
    color: var(--plum);
    font-weight: 700;
    cursor: pointer;
    padding: 0 1px;
}
.chrome .sn-toggle { display: none; }
.chrome .sidenote {
    display: none;
    margin: 8px 0;
    padding: 10px 12px;
    background: var(--lilac-2);
    border-left: 3px solid var(--plum);
    font-size: 13px;
    font-style: normal;
    line-height: 1.5;
    color: var(--ink);
}
.chrome .sn-toggle:checked + .sidenote { display: block; }
.chrome .sn-num { color: var(--plum); font-weight: 700; margin-right: 4px; }
@media (min-width: 1480px) {
    .chrome .wrap { position: relative; }
    .chrome .sn-ref { cursor: default; }
    /* no top/bottom: an absolute box keeps the vertical spot of the line it's on */
    .chrome .sidenote,
    .chrome .sn-toggle:checked + .sidenote {
        display: block;
        position: absolute;
        --w: min(260px, calc((100vw - 1040px) / 2 - 64px));
        width: var(--w);
        right: calc(-1 * var(--w) - 40px);
        margin: -14px 0 0;
        background: #fff;
        border-left: 0;
        outline: 2px solid var(--plum);
        box-shadow: 0 10px 22px -12px rgba(40, 20, 80, .6);
        transform: rotate(1.5deg);
        transition: background .2s, box-shadow .2s;
    }
    /* hovering the number wiggles its note; hovering the note marks its number */
    .chrome .sn-ref:hover + .sn-toggle + .sidenote {
        animation: sn-wiggle .5s ease-out forwards;
        background: var(--lilac-2);
        box-shadow: 0 16px 28px -12px rgba(40, 20, 80, .7);
    }
    .chrome .sn-ref:hover,
    .chrome .sn-ref:has(+ .sn-toggle + .sidenote:hover) { background: var(--lilac); }
}
@keyframes sn-wiggle {
    0%   { transform: rotate(1.5deg); }
    30%  { transform: rotate(-2deg) scale(1.04); }
    60%  { transform: rotate(1deg) scale(1.04); }
    100% { transform: rotate(0) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
    .chrome .sn-ref:hover + .sn-toggle + .sidenote { animation: none; }
}

/* ---------- sheet ---------- */
.chrome .site { min-height: 100vh; padding: 24px 16px 96px; }
.chrome .wrap {
    max-width: 1040px;
    margin: 0 auto;
    background: #fff;
    border: 6px solid var(--lilac);
    outline: 2px solid var(--plum);
    padding: 48px 48px 56px;
}
.chrome .foot {
    max-width: 1040px;
    margin: 24px auto 0;
    background: #fff;
    border: 6px solid var(--lilac);
    outline: 2px solid var(--plum);
    padding: 10px 18px;
    font-size: 12px;
    color: var(--ink-2);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}
.chrome .foot .mark {
    justify-self: start;
    width: 41px;
    height: 41px;
    border: 2px solid var(--plum);
    background: #fff;
    display: grid;
    place-items: center;
    box-shadow: 3px 3px 0 var(--lilac);
}
.chrome .foot .mark:hover { box-shadow: 3px 3px 0 var(--plum); }
.chrome .foot .mark img { width: 33px; height: 33px; display: block; }
.chrome .foot .colophon { text-align: center; }
.chrome .foot .social { justify-self: end; display: flex; gap: 14px; }
.chrome .foot .social a {
    color: var(--ink);
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
}
.chrome .foot .social a:hover { color: var(--plum); }
.chrome .foot a:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; }

@media (max-width: 760px) {
    .chrome .wrap { padding: 28px 18px 36px; }
    .chrome .tabs a { padding-left: 11px; padding-right: 11px; }
    .chrome .foot { grid-template-columns: 1fr; justify-items: center; }
    .chrome .foot .mark, .chrome .foot .social { justify-self: center; }
}
