/*
 * steveshead.io theme - "Riso Press" on top of Bootstrap 5.3.
 *
 * The look of a small risograph print studio: off-white stock, two inks (fluorescent pink and
 * riso blue) printed slightly out of register, and yellow as a third ink for highlights. Fonts:
 * Bricolage Grotesque for headings, Hanken Grotesk for reading, JetBrains Mono for labels and code.
 *
 * Everything shared lives here as CSS variables. The --r-* tokens are the palette; the --x-*
 * names are Xavier's, kept so the rest of the CSS (and fixes pulled from Xavier) still work:
 * --x-yellow means "the accent fill" and is pink here, --x-charcoal is the ink. Bootstrap reads its
 * --bs-* variables, so changing a value here restyles every page.
 *
 * Contrast: pink and yellow are fills only, with ink text on them (5:1 and 12:1) - never text on
 * the paper. Pink as text uses --r-pink-text, blue as text --r-blue-text. White on --r-blue is 4.7:1.
 * Focus rings are blue, which shows on the paper, pink and yellow.
 */

/* Variable fonts, self-hosted (OFL - the licences are beside the files) */
@font-face {
    font-family: 'Bricolage Grotesque';
    font-style: normal;
    font-weight: 200 800;
    font-stretch: 75% 100%;
    font-display: swap;
    src: url('../vendor/fonts/bricolage-grotesque/bricolage-grotesque-latin-standard-normal.woff2') format('woff2-variations');
    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: 'Hanken Grotesk';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../vendor/fonts/hanken-grotesk/hanken-grotesk-latin-wght-normal.woff2') format('woff2-variations');
    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: 'Hanken Grotesk';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('../vendor/fonts/hanken-grotesk/hanken-grotesk-latin-wght-italic.woff2') format('woff2-variations');
    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: 'JetBrains Mono';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url('../vendor/fonts/jetbrains-mono/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
    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;
}

:root,
[data-bs-theme="light"] {
    /* Riso Press palette */
    --r-paper: #f7f3ee;
    --r-paper-2: #efe9e1;
    --r-card: #fffdfa;
    --r-ink: #1d2340;
    --r-ink-2: #4a4f68;
    --r-muted: #5c6078;
    --r-pink: #ff48b0;
    --r-pink-deep: #e62995;
    --r-pink-soft: #ffe0f1;
    --r-pink-text: #c2187a;
    --r-blue: #0078bf;
    --r-blue-deep: #005d94;
    --r-blue-soft: #dcecf7;
    --r-blue-text: #005d94;
    --r-yellow: #ffe800;
    --r-line: #e2dbd0;
    --r-halftone: rgba(29, 35, 64, .2);
    --r-offset: 4px;
    --r-display-font: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
    --r-mono-font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Xavier's names, pointed at the palette */
    --x-yellow: var(--r-pink);
    --x-yellow-strong: var(--r-pink-deep);
    --x-yellow-soft: var(--r-pink-soft);
    --x-charcoal: var(--r-ink);
    --x-charcoal-2: #2a3150;
    --x-grey: var(--r-ink-2);
    --x-grey-light: var(--r-paper-2);
    --x-line: var(--r-line);
    --x-shadow: 0 1px 2px rgba(29, 35, 64, .06), 0 6px 18px rgba(29, 35, 64, .07);
    --x-radius: 6px;
    --x-script-font: var(--r-display-font);

    /* Bootstrap */
    --bs-body-font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --bs-font-monospace: var(--r-mono-font);
    --bs-body-font-size: 1.0625rem;
    --bs-body-line-height: 1.65;
    --bs-body-color: var(--r-ink-2);
    --bs-body-color-rgb: 74, 79, 104;
    --bs-body-bg: var(--r-paper);
    --bs-body-bg-rgb: 247, 243, 238;
    --bs-emphasis-color: var(--r-ink);
    --bs-heading-color: var(--r-ink);
    --bs-secondary-color: var(--r-muted);
    --bs-secondary-bg: var(--r-paper-2);
    --bs-tertiary-bg: #f3eee7;
    --bs-border-color: var(--r-line);
    --bs-border-radius: 4px;
    --bs-border-radius-lg: var(--x-radius);
    --bs-link-color: var(--r-blue-text);
    --bs-link-color-rgb: 0, 93, 148;
    --bs-link-hover-color: var(--r-ink);
    --bs-link-hover-color-rgb: 29, 35, 64;
    --bs-focus-ring-color: rgba(0, 120, 191, .45);
    --bs-primary: var(--r-pink);
    --bs-primary-rgb: 255, 72, 176;
    --bs-highlight-bg: var(--r-yellow);
    --bs-highlight-color: var(--r-ink);
    --bs-code-color: var(--r-pink-text);
}

/* Dark: deep ink-blue stock, the inks a little lighter so they still read (the Admin Panel's toggle) */
[data-bs-theme="dark"] {
    --r-paper: #141a30;
    --r-paper-2: #1b2240;
    --r-card: #1b2240;
    --r-ink: #ece9f2;
    --r-ink-2: #b4b8cc;
    --r-muted: #9ca1b8;
    --r-pink: #ff6cc0;
    --r-pink-deep: #ff8fcf;
    --r-pink-soft: #3d1f3a;
    --r-pink-text: #ff8fcf;
    --r-blue: #2f9fe6;
    --r-blue-deep: #4fb3ff;
    --r-blue-soft: #16304d;
    --r-blue-text: #6cc0ff;
    --r-line: #2b3354;
    --r-halftone: rgba(0, 0, 0, .35);

    --x-charcoal-2: #dcd9e4;
    --x-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);

    --bs-body-color-rgb: 180, 184, 204;
    --bs-body-bg-rgb: 20, 26, 48;
    --bs-emphasis-color: #fff;
    --bs-tertiary-bg: #171e38;
    --bs-link-color-rgb: 108, 192, 255;
    --bs-link-hover-color: #fff;
    --bs-link-hover-color-rgb: 255, 255, 255;
    --bs-highlight-color: #141a30;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--r-display-font);
    font-weight: 750;
    letter-spacing: -.025em;
    text-wrap: balance;
}

code, kbd, pre, samp {
    font-family: var(--r-mono-font);
}

a {
    text-decoration-color: var(--r-pink);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* Visible keyboard focus everywhere: blue shows on the paper and on both inks */
:focus-visible {
    outline: 3px solid var(--r-blue);
    outline-offset: 2px;
}

::selection {
    background: var(--r-yellow);
    color: #1d2340;
}

/* Small mono labels (kickers, dates, edition numbers) */
.r-label {
    font-family: var(--r-mono-font);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* Buttons: pink with ink text is the main action, its blue shadow printed slightly off register */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: 999px;
    --bs-btn-padding-x: 1.25rem;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}

.btn-sm {
    --bs-btn-padding-x: .85rem;
}

.btn-primary {
    --bs-btn-color: #1d2340;
    --bs-btn-bg: var(--r-pink);
    --bs-btn-border-color: var(--r-pink);
    --bs-btn-hover-color: #1d2340;
    --bs-btn-hover-bg: var(--r-pink);
    --bs-btn-hover-border-color: var(--r-pink);
    --bs-btn-active-color: #1d2340;
    --bs-btn-active-bg: var(--r-pink-deep);
    --bs-btn-active-border-color: var(--r-pink-deep);
    --bs-btn-disabled-color: #1d2340;
    --bs-btn-disabled-bg: var(--r-pink);
    --bs-btn-disabled-border-color: var(--r-pink);
    --bs-btn-focus-shadow-rgb: 0, 120, 191;
    box-shadow: 3px 3px 0 var(--r-blue);
}

.btn-primary:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--r-blue);
}

.btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--r-blue);
}

.btn-dark {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--r-blue);
    --bs-btn-border-color: var(--r-blue);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--r-blue-deep);
    --bs-btn-hover-border-color: var(--r-blue-deep);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--r-blue-deep);
    --bs-btn-active-border-color: var(--r-blue-deep);
    --bs-btn-focus-shadow-rgb: 0, 120, 191;
}

[data-bs-theme="dark"] .btn-dark {
    --bs-btn-color: #141a30;
    --bs-btn-hover-color: #141a30;
    --bs-btn-active-color: #141a30;
}

.btn-outline-dark {
    --bs-btn-color: var(--r-ink);
    --bs-btn-border-color: var(--r-ink);
    --bs-btn-hover-color: var(--r-paper);
    --bs-btn-hover-bg: var(--r-ink);
    --bs-btn-hover-border-color: var(--r-ink);
    --bs-btn-active-color: var(--r-paper);
    --bs-btn-active-bg: var(--r-ink);
    --bs-btn-active-border-color: var(--r-ink);
}

.btn-outline-secondary {
    --bs-btn-color: var(--r-ink);
    --bs-btn-border-color: var(--r-line);
    --bs-btn-hover-color: var(--r-ink);
    --bs-btn-hover-bg: var(--r-paper-2);
    --bs-btn-hover-border-color: #cfc6b8;
    --bs-btn-active-color: var(--r-ink);
    --bs-btn-active-bg: var(--r-paper-2);
    --bs-btn-active-border-color: #cfc6b8;
}

@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }

    .btn-primary:hover,
    .btn-primary:active {
        transform: none;
    }
}

/* Page links: the current page is pink, like the main buttons */
.pagination {
    --bs-pagination-color: var(--r-ink);
    --bs-pagination-bg: var(--r-card);
    --bs-pagination-border-color: var(--r-line);
    --bs-pagination-hover-color: var(--r-ink);
    --bs-pagination-hover-bg: var(--r-paper-2);
    --bs-pagination-hover-border-color: var(--r-line);
    --bs-pagination-focus-color: var(--r-ink);
    --bs-pagination-focus-bg: var(--r-paper-2);
    --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(0, 120, 191, .35);
    --bs-pagination-active-color: #1d2340;
    --bs-pagination-active-bg: var(--r-pink);
    --bs-pagination-active-border-color: var(--r-pink);
    --bs-pagination-disabled-color: var(--bs-secondary-color);
    --bs-pagination-disabled-bg: var(--r-card);
    --bs-pagination-disabled-border-color: var(--r-line);
}

.form-control,
.form-select {
    padding: .6rem .9rem;
    background-color: var(--r-card);
    border-color: #d6cdbf;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    border-color: #34406a;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--r-blue);
    box-shadow: 0 0 0 .2rem rgba(0, 120, 191, .25);
}

.form-check-input:checked {
    background-color: var(--r-blue);
    border-color: var(--r-blue);
}

.form-label {
    font-weight: 600;
    color: var(--r-ink);
}

.alert {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: 4px;
}

.card {
    --bs-card-bg: var(--r-card);
    --bs-card-border-color: var(--r-line);
    --bs-card-border-radius: var(--x-radius);
}

.badge {
    font-weight: 600;
}

/* Highlight a word with yellow ink: <span class="x-mark">word</span> */
.x-mark {
    background: linear-gradient(transparent 55%, var(--r-yellow) 55%);
    color: inherit;
    padding: 0 .1em;
}

/* A picture printed in one ink: <div class="r-duo"><img ...></div>, or r-duo-blue. The photo is
   turned grey and multiplied onto the ink, with a halftone dot screen on top. */
.r-duo {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--r-pink);
    isolation: isolate;
}

.r-duo-blue {
    background: var(--r-blue);
}

.r-duo-yellow {
    background: var(--r-yellow);
}

.r-duo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) contrast(1.3) brightness(1.08);
    mix-blend-mode: multiply;
    transition: filter .35s ease, mix-blend-mode .35s ease;
}

.r-duo::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--r-halftone) 1px, transparent 1.4px);
    background-size: 5px 5px;
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* Registration mark, the crosshair printers line the inks up with */
.r-reg {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--r-ink);
    border-radius: 50%;
    pointer-events: none;
}

.r-reg::before,
.r-reg::after {
    content: '';
    position: absolute;
    background: var(--r-ink);
}

.r-reg::before {
    left: 50%;
    top: -6px;
    bottom: -6px;
    width: 1.5px;
    transform: translateX(-50%);
}

.r-reg::after {
    top: 50%;
    left: -6px;
    right: -6px;
    height: 1.5px;
    transform: translateY(-50%);
}
