/* Override this file to customise the theme's CSS for your site */

@import 'fonts.css';
@import 'rosepine-colors.css';
@import 'chroma-rosepine.css';
@import 'code-block.css';

:root {
    /* Hack: UI/body copy — chosen for its plain, highly-legible letterforms */
    --font-monospace: "Hack", "Fira Mono", ui-monospace, Menlo, Consolas, monospace;
    /* Fira Code: code specifically, for its ligatures (->, =>, !=, ...) */
    --font-code: "Fira Code", "Hack", ui-monospace, Menlo, Consolas, monospace;
}

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

/* ---------------------------------------------------------------------
   Keyboard focus — visible on every interactive element, distinct from
   :hover, since the theme otherwise only styles hover/active states.
   --------------------------------------------------------------------- */

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--rp-foam);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ---------------------------------------------------------------------
   Desktop backdrop: the site renders as a floating terminal window,
   so the space around it should read as "desktop", not dead space.
   A faint scatter of suit/clover glyphs reads as felt-table texture at
   this opacity — a nod to the site's stakes-and-luck theme without
   competing with the terminal chrome sitting on top of it.
   --------------------------------------------------------------------- */

body {
    min-height: 100vh;
    background:
        repeating-linear-gradient(0deg, rgba(224, 222, 244, 0.012) 0px, rgba(224, 222, 244, 0.012) 1px, transparent 1px, transparent 3px),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Ctext x='14' y='38' font-size='22' font-family='monospace' fill='%23e0def4' fill-opacity='0.028'%3E%E2%99%A3%3C/text%3E%3Ctext x='58' y='118' font-size='20' font-family='monospace' fill='%23eb6f92' fill-opacity='0.026'%3E%E2%99%A6%3C/text%3E%3Ctext x='150' y='160' font-size='20' font-family='monospace' fill='%239ccf9c' fill-opacity='0.03'%3E%E2%99%A0%3C/text%3E%3Ctext x='20' y='180' font-size='16' font-family='monospace' fill='%23c4a7e7' fill-opacity='0.024'%3E%E2%99%A5%3C/text%3E%3C/svg%3E"),
        radial-gradient(circle at 18% -10%, #34304f 0%, #1c1a2e 45%, #131224 100%);
    background-attachment: fixed;
}

body,
button,
input,
textarea {
    font-feature-settings: "calt" 1, "liga" 1;
}

/* ---------------------------------------------------------------------
   Terminal window chrome
   --------------------------------------------------------------------- */

.terminal {
    max-width: 84rem;
    margin: 2.5rem auto;
    border-radius: 0.75rem;
    border: 1px solid var(--rp-overlay);
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2);
    background: var(--rp-base);
    /* horizontal-only: keeps the sticky sidebar/aside (which stick on the
       y-axis) working, while guarding against any sub-pixel x overflow */
    overflow-x: hidden;
    overflow-y: visible;
    transition: box-shadow 0.3s ease;
}

@media (hover: hover) {
    .terminal:hover {
        box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(196, 167, 231, 0.25), 0 0 5rem rgba(196, 167, 231, 0.08);
    }
}

.terminal__titlebar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: var(--rp-overlay);
    border-bottom: 1px solid var(--rp-hl-high);
    border-radius: 0.75rem 0.75rem 0 0;
}

.terminal__dots {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* Traffic-light dots, played as three poker chips: a bright sheen ring
   near the rim plus a dark table-edge outline, in a red/gold/green
   triad that reads as roulette-pocket colours rather than arbitrary
   palette picks. */
.terminal__dots span {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    display: inline-block;
    box-shadow:
        inset 0 0 0 1.5px rgba(255, 255, 255, 0.32),
        0 0 0 1px rgba(0, 0, 0, 0.28);
}

.terminal__dots span:nth-child(1) { background-color: var(--rp-love); }
.terminal__dots span:nth-child(2) { background-color: var(--rp-gold); }
.terminal__dots span:nth-child(3) { background-color: var(--rp-clover); }

.terminal__path {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--rp-subtle);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.terminal__tag-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    max-width: 9rem;
}

.terminal__tag {
    max-width: 100%;
    font-family: var(--font-monospace);
    font-size: 0.75rem;
    color: var(--rp-muted-text);
    background-color: transparent;
    border: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

.terminal__tag option {
    background-color: var(--rp-surface);
    color: var(--rp-text);
}

.terminal__tag-arrow {
    font-size: 0.7rem;
    color: var(--rp-muted-text);
}

.terminal__tag-wrap:hover .terminal__tag,
.terminal__tag-wrap:hover .terminal__tag-arrow,
.terminal__tag:focus-visible,
.terminal__tag:focus-visible + .terminal__tag-arrow {
    color: var(--rp-foam);
}

@media (max-width: 30rem) {
    .terminal__tag-wrap { display: none; }
}

@media (max-width: 45rem) {
    .terminal {
        margin: 0.75rem;
        border-radius: 0.5rem;
    }
    .terminal__titlebar {
        border-radius: 0.5rem 0.5rem 0 0;
    }
}

.page {
    max-width: none;
    margin: 0;
    padding: 0 1.5rem 1.5rem;
}

@media (max-width: 45rem) {
    .page {
        padding: 0 1rem 1rem;
    }
}

.page__header {
    padding-top: 1.5rem;
}

/* ---------------------------------------------------------------------
   Body pane — an accent ring around .page__body sells the "focused
   terminal pane" metaphor (à la tmux's active-pane border). The existing
   box-shadow spread (faux background bleed) is preserved and a second,
   1px-further-out shadow draws the accent ring just past it.
   --------------------------------------------------------------------- */

.page__body {
    border-radius: 0.4rem;
    box-shadow:
        0 0 0 1rem var(--off-bg),
        0 0 0 calc(1rem + 1px) var(--rp-iris),
        0 0 1.5rem rgba(196, 167, 231, 0.06);
}

/* ---------------------------------------------------------------------
   Content type scale — post/section titles and in-body headings get a
   real hierarchy. Site chrome (logo, hero, sidebar title) sets its own
   sizing elsewhere and is excluded so this doesn't cascade into it.
   --------------------------------------------------------------------- */

.page__body h1:not(.hero__name) {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.page__body h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.page__body h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.page__body h4,
.page__body h5,
.page__body h6 {
    font-weight: 700;
}

/* Cap prose measure for readability now that the terminal is wide */
.page__body p,
.page__body li,
.page__body blockquote,
.page__body table {
    max-width: 70ch;
}

/* ---------------------------------------------------------------------
   Post metadata (single.html): prompt-style header, reading time, tags
   --------------------------------------------------------------------- */

.content__prompt {
    color: var(--rp-subtle);
    margin: 0 0 0.5rem 0;
}

.content__meta {
    color: var(--rp-muted-text);
    font-size: 0.85rem;
}

.tag-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0 0 0;
    padding: 0;
}

.tag-list li::marker {
    content: none;
}

.tag-list a {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 0.3rem;
    background: var(--rp-overlay);
    color: var(--rp-foam);
    text-decoration: none;
    font-size: 0.8rem;
}

.tag-list a:hover {
    background: var(--rp-hl-high);
    color: var(--rp-gold);
    /* echoes the titlebar chip-dots' sheen ring on hover */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--rp-overlay);
}

.post-nav__link {
    max-width: 48%;
    color: var(--rp-foam);
    text-decoration: none;
    font-size: 0.9rem;
}

.post-nav__link:hover {
    color: var(--rp-gold);
}

.post-nav__link--next {
    margin-left: auto;
    text-align: right;
}

/* ---------------------------------------------------------------------
   Blinking cursor
   --------------------------------------------------------------------- */

.cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    margin-left: 0.15em;
    background: currentColor;
    vertical-align: -0.15em;
    animation: rp-blink 1.1s steps(1) infinite;
}

@keyframes rp-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cursor { animation: none; }
}

.page__logo-suffix {
    white-space: pre;
}

/* ---------------------------------------------------------------------
   Nav tabs
   --------------------------------------------------------------------- */

.nav-main-item {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.3rem;
}

.nav-main-item:hover,
.nav-main-item.active {
    background: var(--rp-overlay);
    color: var(--rp-foam);
}

/* ---------------------------------------------------------------------
   Homepage hero
   --------------------------------------------------------------------- */

.hero {
    padding: 1.5rem 0 2rem 0;
    border-bottom: 1px dashed var(--rp-overlay);
    margin-bottom: 2rem;
    animation: rp-fade-in 0.5s ease-out both;
}

.hero__section {
    margin-bottom: 2rem;
    animation: rp-fade-in 0.5s ease-out both;
    animation-delay: 0.1s;
}

@keyframes rp-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero,
    .hero__section {
        animation: none;
    }
}

.hero__prompt {
    color: var(--rp-subtle);
    margin: 0 0 0.75rem 0;
}

.prompt-glyph {
    color: var(--rp-foam);
    margin-right: 0.5rem;
}

.hero__name {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.15;
    overflow-wrap: break-word;
}

.hero__tagline {
    color: var(--rp-muted-text);
    margin: 0.75rem 0 0 0;
    font-size: 0.9rem;
}

.hero__empty {
    color: var(--rp-muted-text);
    font-style: italic;
    margin: 0;
}

.post-listing {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-listing__item {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1rem;
    padding: 0.6rem 0 0.6rem 2.1rem;
    border-bottom: 1px solid var(--rp-hl-low);
}

.post-listing__item:last-child {
    border-bottom: none;
}

/* Card-suit + clover glyphs stand in for the old plain dot markers —
   sized up so they read as a real motif at a glance, not a bullet
   point, while staying text-native to fit the monospace aesthetic. */
.post-listing__item::before {
    position: absolute;
    left: 0;
    top: 0.05rem;
    font-size: 1.7rem;
    line-height: 1;
    color: var(--rp-foam);
}

.post-listing__item:nth-child(5n+1)::before { content: "\2660"; color: var(--rp-subtle); }
.post-listing__item:nth-child(5n+2)::before { content: "\2665"; color: var(--rp-love); }
.post-listing__item:nth-child(5n+3)::before { content: "\2666"; color: var(--rp-gold); }
.post-listing__item:nth-child(5n+4)::before { content: "\2663"; color: var(--rp-iris); }
/* Same club glyph as above, tinted clover-green: U+2618 (actual shamrock
   character) silently falls back to a full-colour emoji glyph on several
   platforms and ignores `color` entirely, so the "lucky" 5th slot is read
   through colour rather than a distinct (unreliable) symbol. */
.post-listing__item:nth-child(5n+5)::before { content: "\2663"; color: var(--rp-clover); }

.post-listing__date {
    color: var(--rp-muted-text);
    font-size: 0.85rem;
    width: 6.5rem;
    flex-shrink: 0;
}

.post-listing__body {
    flex: 1;
    min-width: 12rem;
}

.post-listing__title {
    color: var(--rp-text);
    text-decoration: none;
}

.post-listing__title:hover {
    color: var(--rp-foam);
}

.post-listing__excerpt {
    margin: 0.2rem 0 0 0;
    color: var(--rp-subtle);
    font-size: 0.85rem;
    max-width: 60ch;
}

.hero__more {
    display: inline-block;
    margin-top: 1rem;
    color: var(--rp-foam);
    text-decoration: none;
    font-size: 0.9rem;
}

.hero__more:hover {
    color: var(--rp-gold);
}

/* ---------------------------------------------------------------------
   Sysinfo (aside): neofetch-style structural summary
   --------------------------------------------------------------------- */

.sysinfo__prompt {
    color: var(--rp-subtle);
    margin: 0 0 0.5rem 0;
}

.sysinfo__title {
    margin: 0;
    color: var(--rp-text);
    font-weight: 700;
    font-size: 0.8rem;
    overflow-wrap: break-word;
}

.sysinfo__rule {
    margin: 0 0 0.35rem 0;
    color: var(--rp-muted);
    font-size: 0.8rem;
    overflow: hidden;
    white-space: nowrap;
}

.sysinfo__list {
    margin: 0;
}

.sysinfo__row {
    display: flex;
    gap: 0.3rem;
    padding: 0.05rem 0;
    font-size: 0.78rem;
}

.sysinfo__row dt {
    color: var(--rp-iris);
    font-weight: 700;
    margin: 0;
    flex-shrink: 0;
}

.sysinfo__row dt::after {
    content: ":";
}

.sysinfo__row dd {
    color: var(--rp-subtle);
    margin: 0;
    overflow-wrap: break-word;
}

/* ---------------------------------------------------------------------
   Left-hand sidebar listing content sections, top to bottom
   --------------------------------------------------------------------- */

.page {
    grid-template-areas:
      "header"
      "sidebar"
      "body"
      "aside"
      "footer";
}

@media (min-width: 45rem) {
    .page {
        grid-template-areas:
          "header   header  header"
          "sidebar  body    aside"
          "footer   footer  footer";
        grid-template-columns: 11rem minmax(0, 1fr) 17rem;
    }
}

.page__sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 1rem;
    align-self: start;
}

.sidebar-nav__title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.sidebar-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-nav__item {
    margin: 0.15rem 0;
    white-space: nowrap;
}

.sidebar-nav__glyph {
    color: var(--rp-muted);
    margin-right: 0.3rem;
}

.sidebar-nav__link {
    color: var(--link);
    text-decoration: none;
}

.sidebar-nav__link:hover {
    color: var(--hover);
}

.sidebar-nav__link.active {
    color: var(--highlight);
    font-weight: bold;
}

.sidebar-nav__count {
    margin-left: 0.35rem;
    color: var(--rp-muted-text);
    font-size: 0.8rem;
}

/* ---------------------------------------------------------------------
   Coin flip page — a 16-bit-inspired pixel coin (hand-plotted SVG rects,
   crisp edges, no anti-aliasing) that always settles on heads. Every
   flip adds whole 360deg turns in JS, so the spin is real but the
   result never is.
   --------------------------------------------------------------------- */

.coinflip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2.5rem 0 1.5rem;
    padding: 2rem 1rem;
    border: 1px dashed var(--rp-overlay);
    border-radius: 0.5rem;
    background: var(--rp-surface);
}

.coinflip__coin {
    display: block;
    width: 9rem;
    height: 9rem;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    perspective: 60rem;
    -webkit-tap-highlight-color: transparent;
}

.coinflip__coin[aria-disabled="true"] {
    cursor: default;
}

.coinflip__coin:focus-visible {
    outline: 2px solid var(--rp-foam);
    outline-offset: 4px;
    border-radius: 50%;
}

.coinflip__inner {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.1s cubic-bezier(0.35, 0.02, 0.15, 1);
    filter: drop-shadow(0 0.5rem 0.75rem rgba(0, 0, 0, 0.45));
}

@media (hover: hover) {
    .coinflip__coin:not([aria-disabled="true"]):hover .coinflip__inner {
        transform: scale(1.04);
    }
}

/* Small squash-and-stretch pop while the coin is airborne — reads as a
   toss rather than a flat spin-in-place. */
.coinflip__coin.is-flipping .coinflip__inner {
    animation: coinflip-toss 0.6s ease-in-out 2;
}

@keyframes coinflip-toss {
    0% { translate: 0 0; }
    50% { translate: 0 -0.9rem; }
    100% { translate: 0 0; }
}

.coinflip__face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    shape-rendering: crispEdges;
    image-rendering: pixelated;
}

.coinflip__face--heads {
    transform: rotateY(0deg);
}

.coinflip__face--tails {
    transform: rotateY(180deg);
}

.coinflip__face .coinflip__fill { fill: var(--rp-gold); }
.coinflip__face .coinflip__rim { fill: #b0873f; }
.coinflip__face .coinflip__sym { fill: var(--rp-base); }

@media (prefers-reduced-motion: reduce) {
    .coinflip__inner {
        transition-duration: 0.01s !important;
    }
    .coinflip__coin.is-flipping .coinflip__inner {
        animation: none;
    }
}

.coinflip__hint {
    margin: 0;
    color: var(--rp-muted-text);
    font-size: 0.85rem;
}

.coinflip__result {
    margin: 0;
    min-height: 1.4em;
    color: var(--rp-gold);
    font-weight: 700;
    font-size: 1rem;
}

/* ---------------------------------------------------------------------
   Fortune card — the {{< quote >}} shortcode's artistic pull-quote.
   A dashed, ticket-like border with a giant translucent suit watermark
   and a gold corner mark, dealt at a slight tilt. Suit/colour rotate
   through the same five-pairing used by the post-listing bullets
   (::before rules below "post-listing__item"), so a quote dropped into
   any post reads as the same visual language as the rest of the site
   rather than a one-off component.
   --------------------------------------------------------------------- */

.fortune-card {
    position: relative;
    margin: 2rem 0;
    padding: 1.85rem 2rem 1.5rem;
    background: var(--rp-surface);
    border: 1px dashed var(--rp-overlay);
    border-radius: 0.6rem;
    overflow: hidden;
    transform: rotate(-0.5deg);
    transition: transform 0.25s ease;
}

@media (hover: hover) {
    .fortune-card:hover {
        transform: rotate(0deg);
    }
}

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

.fortune-card__suit {
    position: absolute;
    top: -1.5rem;
    right: -0.9rem;
    font-size: 7rem;
    line-height: 1;
    opacity: 0.07;
    pointer-events: none;
    user-select: none;
}

.fortune-card__quote {
    position: relative;
    margin: 0;
    padding: 0;
    max-width: 58ch;
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.6;
    color: var(--rp-text);
}

/* Cancel the theme's default `blockquote::before { content: "> " }` —
   the oversized mark below replaces it. */
.fortune-card__quote::before {
    content: none;
}

.fortune-card__quote p {
    margin: 0 0 0.75rem 0;
}

.fortune-card__quote p:last-child {
    margin-bottom: 0;
}

.fortune-card__mark {
    display: inline-block;
    margin-right: 0.2rem;
    font-style: normal;
    font-weight: 800;
    font-size: 1.7em;
    line-height: 0;
    vertical-align: -0.34em;
}

.fortune-card__cite {
    display: block;
    margin-top: 0.9rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--rp-overlay);
    font-style: normal;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--rp-muted-text);
}

.fortune-card--subtle .fortune-card__suit,
.fortune-card--subtle .fortune-card__mark { color: var(--rp-subtle); }
.fortune-card--love .fortune-card__suit,
.fortune-card--love .fortune-card__mark { color: var(--rp-love); }
.fortune-card--gold .fortune-card__suit,
.fortune-card--gold .fortune-card__mark { color: var(--rp-gold); }
.fortune-card--iris .fortune-card__suit,
.fortune-card--iris .fortune-card__mark { color: var(--rp-iris); }
.fortune-card--clover .fortune-card__suit,
.fortune-card--clover .fortune-card__mark { color: var(--rp-clover); }

@media (max-width: 45rem) {
    .fortune-card {
        padding: 1.5rem 1.25rem 1.15rem;
    }
    .fortune-card__suit {
        font-size: 5rem;
    }
}
