/* ============================================================
   laundry — an ascii terminal theme for ghost
   ------------------------------------------------------------
   This is the development stylesheet. It is plain CSS (no
   imports / postcss features) so `assets/built/screen.css` is a
   byte-for-byte copy and the theme works with or without gulp.

   1.  Tokens + reset
   2.  CRT overlay
   3.  Intro (the washing machine)
   4.  Tag rails + wires
   5.  Open / close choreography
   6.  Archive (the posts grid)
   7.  Post cards
   8.  Single post / page
   9.  Author + error templates
   10. Site chrome (nav, footer)
   11. Responsive
   ============================================================ */


/* 1. Tokens + reset
/* ---------------------------------------------------------- */

:root {
    --bg: #000;
    --fg: #8fffe5;                          /* phosphor green, the body voice */
    --accent: #ffd1bf;                      /* warm secondary, for anything live or selected */
    --hot: #fff;

    /* Legibility first: these are deliberately high for a dark UI. */
    --dim: rgba(143, 255, 229, .82);
    --faint: rgba(143, 255, 229, .6);
    --line: rgba(143, 255, 229, .3);

    --glow: 0 0 6px rgba(143, 255, 229, .45);
    --glow-accent: 0 0 8px rgba(255, 209, 191, .5);
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
    --gutter: 28px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font: 15px/1.65 var(--mono);
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "calt" 0;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, pre {
    margin: 0;
    font-size: inherit;
    font-weight: 400;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--fg); text-decoration: none; }

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

::selection { background: var(--accent); color: #000; }

:focus-visible { outline: 1px dashed var(--accent); outline-offset: 3px; }

.inner { width: min(1180px, 100%); margin: 0 auto; padding: 0 var(--gutter); }

/* A bracketed terminal link: [ like this ] */
.bkt {
    display: inline-block;
    padding: 4px 2px;
    font-size: 14px;
    color: var(--dim);
    white-space: nowrap;
    transition: color .15s linear, text-shadow .15s linear;
}

.bkt:hover,
.bkt:focus-visible { color: var(--accent); text-shadow: var(--glow-accent); }


/* 2. CRT overlay
/* ---------------------------------------------------------- */

.crt {
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    background:
        repeating-linear-gradient(rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .2) 2px 3px),
        radial-gradient(120% 100% at 50% 50%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .5) 100%);
}


/* 3. Intro — the washing machine
/* ---------------------------------------------------------- */

body.has-intro { overflow: hidden; }
body.has-intro.opened { overflow: auto; }

.intro {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    padding: 16px;
    background: var(--bg);
}

.stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 3vw, 44px);
    flex: none;
}

.scene { position: relative; flex: none; }

.rig { position: absolute; inset: 0; }

.ascii {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    white-space: pre;
    pointer-events: none;
    text-shadow: 0 0 5px rgba(143, 255, 229, .35);
}

.drum {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
}

/* Tumbling objects are pure decoration — the whole porthole is the target.
   The drawings were made in a terminal, whose cell is about twice as tall as
   it is wide. A monospace glyph advances 0.6em, so the leading has to be
   1.2em to match; leaving it at 1em is what flattens the artwork. */
.obj {
    position: absolute;
    left: 0;
    top: 0;
    color: inherit;
    font-size: calc(8px * var(--k, 1));
    line-height: calc(9.6px * var(--k, 1));
    white-space: pre;
    pointer-events: none;
    text-shadow: 0 0 4px rgba(143, 255, 229, .5);
    will-change: transform;
}

/* The single hit target: the porthole. */
.machine-hit {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 2;
    cursor: pointer;
}

/* Dead centre of the drum, and only while the pointer is over it. */
.machine-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    padding: 5px 11px;
    background: var(--bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 2px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s linear;
}

body:not(.opened):not(.closing) .machine-hit:hover ~ .machine-hint,
body:not(.opened):not(.closing) .machine-hit:focus-visible ~ .machine-hint {
    opacity: 1;
    text-shadow: var(--glow-accent);
    box-shadow: 0 0 14px rgba(255, 209, 191, .25);
}

.blurb {
    flex: none;
    width: min(660px, 100%);
    text-align: center;
}

.blurb p {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.85;
    color: var(--dim);
}

.blurb b {
    font-weight: 400;
    color: var(--accent);
    text-shadow: var(--glow-accent);
}

.blurb nav {
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: wrap;
}


/* 4. Tag rails + wires
/* ---------------------------------------------------------- */

.rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: none;
    z-index: 3;
}

.rail-left { align-items: flex-end; text-align: right; }
.rail-right { align-items: flex-start; text-align: left; }

.rail a { letter-spacing: 1px; padding: 3px 0; }

/* Everything clickable on the front page is the highlight colour. */
.intro .bkt { color: rgba(255, 209, 191, .8); }
.intro .bkt:hover,
.intro .bkt:focus-visible { color: var(--accent); text-shadow: var(--glow-accent); }

.wires {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    transition: opacity .35s ease;
}

.wires path {
    fill: none;
    stroke: rgba(143, 255, 229, .45);
    stroke-width: 1;
}

.wires .node {
    fill: #000;
    stroke: rgba(143, 255, 229, .7);
    stroke-width: 1;
}

/* Hovering a rail link runs current down its wire. */
.wires g.lit path { stroke: var(--accent); }
.wires g.lit .node { stroke: var(--accent); }


/* 5. Open / close choreography
/* ------------------------------------------------------------
   The rules below are the CLOSING state, so returning from the
   archive plays: grid fades out, machine flies back, door shuts.
   `body.opened` overrides each one with its own opening timing.
   ------------------------------------------------------------ */

.intro { transition: opacity .5s ease, visibility 0s; }
.scene { transition: transform 1.05s cubic-bezier(.4, 0, .2, 1) .1s, opacity .45s ease; }
#door  { transition: transform 1.05s cubic-bezier(.4, 0, .2, 1) .5s; }

.rail,
.blurb { transition: opacity .45s ease .35s; }

/* Wires are drawn against the machine's resting position, so they only fade
   back once the scene has finished flying home — otherwise they point at
   where the objects would be if it weren't still scaled. */
.wires { transition: opacity .4s ease 1.2s; }

body.opened .intro {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .7s ease .55s, visibility 0s linear 1.25s;
}

body.opened .scene {
    transform: scale(3.2);
    opacity: 0;
    transition: transform 1.6s cubic-bezier(.6, 0, .3, 1) .45s, opacity 1.2s ease .55s;
}

body.opened #door {
    transform: perspective(1500px) rotateY(-118deg);
    transition-delay: 0s;
}

body.opened .wires,
body.opened .rail,
body.opened .blurb { opacity: 0; transition-delay: 0s; }

/* Deep links (/#posts) land on the grid with no animation at all. */
body.no-anim .intro,
body.no-anim .scene,
body.no-anim #door,
body.no-anim .archive { transition: none !important; }


/* 6. Archive — the posts grid
/* ---------------------------------------------------------- */

.archive {
    position: relative;
    z-index: 10;
    padding: 40px 0 0;
    min-height: 100vh;
}

body.has-intro .archive {
    opacity: 0;
    transition: opacity .3s ease;   /* closing: get out of the way quickly */
}

body.has-intro.opened .archive {
    opacity: 1;
    transition: opacity .9s ease .85s;
}

.archive-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding-bottom: 16px;
}

/* All green, and clickable: this is how you get back to the machine. */
.prompt {
    display: inline-block;
    font-size: 15px;
    color: var(--dim);
    word-break: break-word;
    transition: text-shadow .15s linear;
}

.prompt .user,
.prompt .path,
.prompt .arg { color: var(--fg); }

a.prompt:hover,
a.prompt:focus-visible { color: var(--fg); text-shadow: var(--glow); }
a.prompt:hover .arg,
a.prompt:focus-visible .arg { text-shadow: var(--glow); }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 16px 0 26px;
    border-top: 1px solid var(--line);
}

.filter { letter-spacing: 1px; }

.filter.is-on {
    color: var(--accent);
    text-shadow: var(--glow-accent);
}

.feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    align-items: start;   /* a card without a feature image shouldn't stretch to match one that has */
    gap: 26px;
    padding-bottom: 44px;
}

.masthead + .feed { padding-top: 28px; }

.archive-note {
    max-width: 660px;
    padding-bottom: 16px;
    font-size: 14px;
    color: var(--faint);
}

.feed-empty {
    padding: 60px 0;
    font-size: 15px;
    color: var(--faint);
    text-align: center;
}


/* 7. Post cards
/* ---------------------------------------------------------- */

.card {
    position: relative;
    border: 1px solid var(--line);
    transition: border-color .15s linear, background-color .15s linear;
}

.card::before,
.card::after {
    position: absolute;
    color: var(--faint);
    font-size: 12px;
    line-height: 1;
    transition: color .15s linear;
}

.card::before { content: "+"; top: -6px; left: -4px; }
.card::after { content: "+"; bottom: -6px; right: -4px; }

.card:hover,
.card:focus-within {
    border-color: var(--accent);
    background: rgba(255, 209, 191, .05);
}

.card:hover::before,
.card:hover::after,
.card:focus-within::before,
.card:focus-within::after { color: var(--accent); }

.card-link {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    padding: 18px 20px 20px;
}

/* Feature image, pushed out to the card edges and tinted to phosphor. */
.card-image {
    display: block;
    margin: -18px -20px 4px;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.card-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    filter: grayscale(1) contrast(1.05) brightness(.72) sepia(1) hue-rotate(105deg) saturate(2.4);
    transition: filter .25s ease, transform .35s ease;
}

.card:hover .card-image img,
.card:focus-within .card-image img {
    filter: grayscale(1) contrast(1) brightness(.92) sepia(1) hue-rotate(320deg) saturate(1.8);
    transform: scale(1.02);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--faint);
}

.card-meta .tag { color: var(--fg); }

.card-title {
    font-size: 18px;
    line-height: 1.45;
    color: var(--accent);
    transition: text-shadow .15s linear;
}

.card-title::before { content: "> "; color: var(--faint); }

.card:hover .card-title,
.card:focus-within .card-title { text-shadow: var(--glow-accent); }

.card-excerpt {
    flex: 1 1 auto;
    font-size: 14px;
    line-height: 1.8;
    color: var(--dim);
}

/* A single-page archive has no prev/next, so don't print a lone "1 / 1". */
.pagination:not(:has(a)) { display: none; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 8px 0 60px;
    font-size: 14px;
    color: var(--faint);
}


/* 8. Single post / page
/* ---------------------------------------------------------- */

/* `.single` — never `.post`, which Ghost's {{post_class}} also emits. */
.single { padding: 0 0 20px; }

/* One measure for the whole article, chrome stays full width. */
.post-head,
.post-image,
.post-body,
.post-foot {
    width: min(780px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.post-head { padding: 32px 0 24px; border-bottom: 1px solid var(--line); }

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--faint);
}

.post-meta a { color: var(--accent); }
.post-meta a:hover { text-shadow: var(--glow-accent); }

.post-title {
    margin-top: 14px;
    font-size: 27px;
    line-height: 1.35;
    color: var(--hot);
    text-shadow: var(--glow);
}

.post-title::before { content: "# "; color: var(--accent); text-shadow: none; }

.post-image { margin-top: 26px; }

.post-image img {
    width: 100%;
    filter: grayscale(1) contrast(1.05) brightness(.8) sepia(1) hue-rotate(105deg) saturate(2.4);
}

.post-body {
    padding: 32px 0 44px;
    font-size: 15.5px;
    line-height: 1.95;
    color: var(--dim);
}

.post-body > * + * { margin-top: 1.5em; }

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
    margin-top: 2.4em;
    color: var(--hot);
    line-height: 1.4;
    text-shadow: var(--glow);
}

.post-body h1 { font-size: 23px; }
.post-body h2 { font-size: 20px; }
.post-body h3 { font-size: 18px; }
.post-body h4,
.post-body h5,
.post-body h6 { font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }

.post-body h2::before { content: "## "; color: var(--accent); text-shadow: none; }
.post-body h3::before { content: "### "; color: var(--accent); text-shadow: none; }

.post-body a {
    color: var(--accent);
    border-bottom: 1px solid rgba(255, 209, 191, .4);
}

.post-body a:hover { text-shadow: var(--glow-accent); border-bottom-color: var(--accent); }

.post-body strong { color: var(--hot); font-weight: 400; }
.post-body em { font-style: italic; }

.post-body ul,
.post-body ol { padding-left: 1.6em; }
.post-body li + li { margin-top: .5em; }
.post-body ul { list-style: none; padding-left: 1.2em; }
.post-body ul li::before {
    content: "- ";
    margin-left: -1.2em;
    color: var(--accent);
}

.post-body blockquote {
    padding-left: 18px;
    border-left: 2px solid var(--accent);
    color: var(--faint);
}

.post-body code {
    padding: 1px 5px;
    border: 1px solid var(--line);
    color: var(--accent);
    font-size: .95em;
}

.post-body pre {
    padding: 16px 18px;
    border: 1px solid var(--line);
    overflow-x: auto;
    color: var(--fg);
    font-size: 14px;
    line-height: 1.65;
}

.post-body pre code { padding: 0; border: 0; color: inherit; }

.post-body hr { border: 0; border-top: 1px dashed var(--line); }

.post-body img,
.post-body video {
    width: 100%;
    filter: grayscale(1) contrast(1.05) brightness(.8) sepia(1) hue-rotate(105deg) saturate(2.4);
}

.post-body figcaption {
    margin-top: 8px;
    font-size: 13px;
    color: var(--faint);
    text-align: center;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.post-body th,
.post-body td {
    padding: 8px 10px;
    border: 1px solid var(--line);
    text-align: left;
}

.post-body th { color: var(--hot); }

.post-body iframe { width: 100%; border: 1px solid var(--line); }

.post-body .kg-gallery-container { display: flex; flex-direction: column; }
.post-body .kg-gallery-row { display: flex; flex-direction: row; justify-content: center; }
.post-body .kg-gallery-image img { width: 100%; height: 100%; }
.post-body .kg-gallery-row + .kg-gallery-row,
.post-body .kg-gallery-image + .kg-gallery-image { margin: 6px 0 0 6px; }
.post-body .kg-gallery-row + .kg-gallery-row { margin-left: 0; }

.post-foot { padding-top: 22px; border-top: 1px solid var(--line); }

.byline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 14px;
    color: var(--faint);
}

.byline b { color: var(--fg); font-weight: 400; }

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding-top: 12px;
}

.read-next { padding: 44px 0 60px; }

.read-next h3 {
    padding-bottom: 18px;
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--faint);
    text-transform: uppercase;
}

/* Reading progress bar pinned to the top of the viewport. */
.progress {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 80;
    width: 100%;
    height: 2px;
    appearance: none;
    border: 0;
    background: transparent;
}

.progress::-webkit-progress-bar { background: transparent; }
.progress::-webkit-progress-value { background: var(--accent); box-shadow: var(--glow-accent); }
.progress::-moz-progress-bar { background: var(--accent); }


/* 9. Author + error templates
/* ---------------------------------------------------------- */

.masthead { padding: 34px 0 20px; border-bottom: 1px solid var(--line); }

.masthead h1 {
    font-size: 24px;
    color: var(--hot);
    text-shadow: var(--glow);
}

.masthead p {
    max-width: 660px;
    padding-top: 10px;
    font-size: 14px;
    color: var(--dim);
}

.error {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    min-height: 52vh;
    text-align: center;
}

.error pre {
    font-size: 13px;
    line-height: 1.15;
    white-space: pre;
    color: var(--fg);
    text-shadow: var(--glow);
}

.error h1 { font-size: 20px; letter-spacing: 3px; color: var(--accent); text-shadow: var(--glow-accent); }
.error p { color: var(--faint); }

.error-template .feed { padding: 30px 0 60px; }

.error-stack {
    width: min(780px, 100%);
    margin: 30px auto 0;
    padding: 16px;
    border: 1px solid var(--line);
    font-size: 14px;
    color: var(--dim);
    text-align: left;
}


/* 10. Site chrome
/* ---------------------------------------------------------- */

.site-nav {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding: 24px 0 18px;
    border-bottom: 1px solid var(--line);
}

.site-nav-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }

.site-nav .home { font-size: 15px; color: var(--hot); }
.site-nav .home:hover { color: var(--accent); text-shadow: var(--glow-accent); }

.site-foot {
    padding: 22px 0 34px;
    font-size: 13px;
    color: var(--faint);
}

.site-foot .inner {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.site-foot-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }


/* 11. Responsive
/* ---------------------------------------------------------- */

@media (max-width: 900px) {
    :root { --gutter: 20px; }

    /* Rails move above and below the drum; the wires still reach in. */
    .stage {
        flex-direction: column;
        gap: 26px;
    }

    .stage .rail {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px 18px;
    }

    .rail-left { order: 1; text-align: center; align-items: center; }
    .scene { order: 2; }
    .rail-right { order: 3; text-align: center; align-items: center; }
}

@media (max-width: 640px) {
    .intro { padding: 12px; gap: 20px; }
    .blurb p { font-size: 13.5px; line-height: 1.75; }
    .archive { padding-top: 26px; }
    .feed { grid-template-columns: 1fr; gap: 20px; }
    .post-title { font-size: 22px; }
    .post-body { font-size: 15px; }
}

@media (orientation: landscape) and (max-height: 560px) {
    .intro { flex-direction: row; gap: 18px; }
    .blurb { width: min(380px, 40%); text-align: left; }
    .blurb nav { justify-content: flex-start; }
}

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