/* ------------------------------------------------------------------
   verticalcoding — azulejo

   Colour, typeface and link styling come from the Ignite themes in
   Sources/Themes, which feed Bootstrap's own custom properties. This file
   only adds what the Penpot design needs on top: the tile wall, the centre
   column, the photo duotone and the type scale.

   Dark mode is Ignite's: its JavaScript sets data-bs-theme on <html>, and
   [data-bs-theme*="dark"] is the same hook the framework uses internally.
   ------------------------------------------------------------------ */

:root {
    /* The grid the whole design sits on. */
    --cell: 120px;
    --col: 720px;

    /* Design-specific roles Bootstrap has no slot for. */
    --vc-line: #9FB2E4;             /* grout between tiles */
    --vc-card: var(--bs-body-bg);
    --vc-chip-bg: #D49A1A;
    --vc-chip-fg: #0C1030;

    --vc-duo-screen: #1E2A9E;
    --vc-duo-multiply: transparent;

    --vc-ornament: url("/images/azulejo-light.svg");
    --vc-ornament-inverted: url("/images/azulejo-light-inverted.svg");

    /* Bootstrap defaults inline code to pink; the design has no pink in it. */
    --bs-code-color: #1E2A9E;
}

[data-bs-theme*="dark"] {
    --vc-line: #1E2A9E;
    --vc-card: #141B6B;

    --vc-duo-screen: #141B6B;
    --vc-duo-multiply: #9FB2E4;

    --vc-ornament: url("/images/azulejo-dark.svg");
    --vc-ornament-inverted: url("/images/azulejo-dark-inverted.svg");

    --bs-code-color: #9FB2E4;
}

/* ------------------------------------------------------------------ */
/* Page shell                                                          */
/* ------------------------------------------------------------------ */

body {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* The decorative wall sits behind the column and never blocks clicks. */
.wall {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* The grout lines. A percentage in `background-position` resolves against
   (container - tile), so a bare 50% lands at W/2 - 60px. Half a cell is added
   back to put a line exactly on the centre. 720 and 360 are both whole numbers
   of cells, so the lines then meet both edges of the column. */
.wall--grid {
    background-image:
        linear-gradient(to right, var(--vc-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--vc-line) 1px, transparent 1px);
    background-position: calc(50% + var(--cell) / 2) 0;
    background-size: var(--cell) var(--cell);
}

/* Position and size come from inline styles set in TileWall.swift. */
.deco {
    position: absolute;
    pointer-events: auto;
}

.column {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--col);
    margin: 0 auto;
    padding: var(--cell) 0;
}

.tile {
    background: var(--vc-card);
    border: 2px solid var(--bs-border-color);
    padding: 40px;
}

/* Blocks in the column butt against each other, so every pair of touching
   borders is pulled back into a single 2px line. Scoped to direct children:
   inside the prev/next row the collapse runs horizontally instead, and a
   stray -2px there knocks the two tiles out of alignment. */
.column > * + * { margin-top: -2px; }

/* ------------------------------------------------------------------ */
/* Type scale from the design                                          */
/* ------------------------------------------------------------------ */

.site-name {
    display: block;
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
    text-transform: uppercase;
    color: var(--bs-body-color);
    text-decoration: none;
}

.handle {
    margin: 8px 0 0;
    font-family: var(--bs-font-monospace);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--bs-link-color);
}

.site-nav {
    margin-top: 8px;
    font-family: var(--bs-font-monospace);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 1px;
}

.site-nav a {
    color: var(--bs-body-color);
    text-decoration: none;
    margin-right: 28px;
    white-space: nowrap;
}

.site-nav a:hover { text-decoration: underline; }
.site-nav a:last-child { margin-right: 0; }

.post-meta,
.article-meta {
    margin: 0;
    font-family: var(--bs-font-monospace);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--bs-link-color);
    white-space: pre-wrap;
}

.post-title {
    margin: 12px 0 0;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.post-title a,
.nav-title a { text-decoration: none; color: inherit; }
.post-title a:hover,
.nav-title a:hover { text-decoration: underline; }

.post-excerpt {
    margin: 12px 0 0;
    font-size: 17px;
    line-height: 1.55;
}

.read-link {
    display: inline-block;
    margin-top: 12px;
    font-family: var(--bs-font-monospace);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-decoration: none;
}

.read-link:hover { text-decoration: underline; }

.chip {
    display: inline-block;
    margin: 0 0 12px;
    padding: 4px 8px;
    background: var(--vc-chip-bg);
    color: var(--vc-chip-fg);
    font-family: var(--bs-font-monospace);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 1px;
}

/* ------------------------------------------------------------------ */
/* Articles and the about page                                         */
/* ------------------------------------------------------------------ */

.tile--compact { padding: 24px; }

.back-link {
    display: block;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.3px;
    color: var(--bs-body-color);
    text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.compact-nav {
    margin-top: 6px;
    font-family: var(--bs-font-monospace);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--bs-link-color);
}

.compact-nav a { text-decoration: none; margin-right: 16px; }
.compact-nav a:last-child { margin-right: 0; }
.compact-nav a:hover { text-decoration: underline; }

.sep { opacity: 0.6; margin: 0 10px; }

.article-title {
    margin: 16px 0 0;
    font-size: 60px;
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -1.5px;
    text-transform: uppercase;
}

.article-lead {
    margin: 16px 0 0;
    font-size: 22px;
    line-height: 1.45;
}

.hero { line-height: 0; border: 2px solid var(--bs-border-color); }
.hero img { display: block; width: 100%; height: 360px; object-fit: cover; }

/* Markdown body. Bootstrap handles tables, lists and inline code; this is the
   handful of places the design departs from it. */
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }

.prose { overflow-wrap: break-word; }

.prose p { margin: 0 0 20px; font-size: 18px; line-height: 1.7; }
.prose ul, .prose ol { margin: 0 0 20px; font-size: 18px; line-height: 1.7; }
.prose li { margin-bottom: 6px; }

.prose h2 { margin: 20px 0; font-size: 28px; font-weight: 800; letter-spacing: -0.4px; }
.prose h3 { margin: 20px 0; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }

.prose blockquote {
    margin: 20px 0;
    padding-left: 20px;
    border-left: 4px solid var(--bs-link-color);
    font-size: 24px;
    font-style: italic;
    line-height: 1.4;
}

.prose blockquote p { font: inherit; margin: 0; }

.prose img {
    display: block;
    width: 100%;
    height: auto;
    border: 2px solid var(--bs-border-color);
    margin: 20px 0;
}

.prose hr { margin: 30px 0; border: 0; border-top: 1px solid var(--vc-line); }

/* Prism styles fenced blocks that declare a language. A block with no language
   gets none of that, so it needs the same ink box to avoid sitting bare on the
   tile. */
.prose pre:not([class*="language-"]) {
    margin: 20px 0;
    padding: 20px;
    background: #0C1030;
    color: #F3F0E8;
    overflow-x: auto;
}

.prose pre:not([class*="language-"]) code {
    font-size: 15px;
    line-height: 1.6;
    color: inherit;
    background: none;
    padding: 0;
}

/* Previous / next */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; }
.prevnext > * { margin-top: 0; }
.prevnext > * + * { margin-left: -2px; }
.nav-tile { padding: 30px; }
.nav-tile--next { text-align: right; }

.nav-kicker {
    margin: 0;
    font-family: var(--bs-font-monospace);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--bs-link-color);
}

.nav-title { margin: 8px 0 0; font-size: 22px; font-weight: 800; line-height: 1.15; }

.tile--footer { padding: 24px; }

.site-footer {
    font-family: var(--bs-font-monospace);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.5px;
    color: var(--bs-link-color);
}

.site-footer a { text-decoration: none; margin-right: 16px; }
.site-footer a:last-child { margin-right: 0; }
.site-footer a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ */
/* Photo tiles — cobalt duotone, full colour on hover                  */
/* ------------------------------------------------------------------ */

.tile-img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    line-height: 0;
}

.tile-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-img::before,
.tile-img::after {
    content: "";
    position: absolute;
    inset: 0;
    transition: opacity 0.25s ease;
}

.tile-img::before { background: var(--vc-duo-screen); mix-blend-mode: screen; }
.tile-img::after { background: var(--vc-duo-multiply); mix-blend-mode: multiply; }

.tile-img:hover::before,
.tile-img:hover::after { opacity: 0; }

/* ------------------------------------------------------------------ */
/* Azulejo ornament                                                    */
/* ------------------------------------------------------------------ */

.ornament {
    width: 100%;
    height: 100%;
    background: var(--vc-ornament) center / cover no-repeat;
}

.ornament--inverted { background-image: var(--vc-ornament-inverted); }

/* ------------------------------------------------------------------ */
/* Mobile — layout A: no wall, photo strips between posts              */
/* ------------------------------------------------------------------ */

.strip { display: none; }

@media (max-width: 900px) {
    .wall { display: none; }

    .column { padding: 0; max-width: 100%; }

    .tile { padding: 20px; border-left: none; border-right: none; }

    .site-name { font-size: 30px; }
    .site-nav { font-size: 12px; letter-spacing: 0; }
    .site-nav a { margin-right: 18px; }

    .post-title { font-size: 24px; }

    .article-title { font-size: 38px; letter-spacing: -1px; }
    .article-lead { font-size: 19px; }
    .tile--compact { padding: 20px; }
    .back-link { font-size: 20px; }

    .prose p, .prose ul, .prose ol { font-size: 17px; }
    .prose h2 { font-size: 24px; }
    .prose blockquote { font-size: 20px; }

    .hero img { height: 195px; }

    /* Photo strips stand in for the wall on small screens. */
    .strip {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        height: 130px;
        border-top: 2px solid var(--bs-border-color);
        border-bottom: 2px solid var(--bs-border-color);
    }

    .prevnext { grid-template-columns: 1fr; }
    .prevnext > * + * { margin-left: 0; margin-top: -2px; }
    .strip { margin-top: -2px; }
    .nav-tile { padding: 20px; }
    .nav-tile--next { text-align: left; }
}

@media (max-width: 420px) {
    .site-name { font-size: 26px; }
    .article-title { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    .tile-img::before,
    .tile-img::after { transition: none; }
}
