
:root {
    --paper:        #fbf4eb;
    --ink:          #1c170b;
    --muted:        #6f6551;
    --rule:         #e4d8c4;
    --card-bg:      rgba(255, 255, 255, 0.55);
    --code-bg:      #f4ecdd;
    --note-bg:      rgba(210, 66, 22, 0.06);

    --amber:        #ffd05f;
    --amber-lift:   #ffdd8a;
    --amber-drop:   #f0b93c;
    --amber-pale:   #fdeecb;
    --rust:         #d24216;
    --rust-deep:    #762116;

    --link:         #1c16d3;
    --link-visited: #6d3f9e;

    --chrome-bg:    #1c170b;
    --chrome-fg:    #f4ecdd;
    --banner-ink:   #1c170b;

    /* Type ------------------------------------------------------------------
       The UI stack matches the wiki so the site and the app feel related; the
       display serif is the nod to the original's serif logotype. */
    --font-ui:      Helvetica, Arial, system-ui, "Segoe UI", Roboto, sans-serif;
    --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
    --font-mono:    "Courier New", Courier, monospace;
    --font-fancy:   "Palatino Linotype", "Book Antiqua", Palatino, serif;

    /* Metrics */
    --strip-h:  22px;
    --rail:     9px;      /* width of the panel's left rail */
    --pad-left: 1.6rem;   /* panel indent; the tab hangs back into it */
    --slope:    2.6em;    /* horizontal run of the tab's sloped edge */
    --measure:  54rem;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper:   #17130a;
        --ink:     #f2ece0;
        --muted:   #a89a80;
        --rule:    #3a3226;
        --card-bg: rgba(255, 255, 255, 0.04);
        --code-bg: #241d12;
        --note-bg: rgba(210, 66, 22, 0.14);

        --amber-pale: #33290f;

        --link:         #9fb0ff;
        --link-visited: #cba6ff;

        --chrome-bg: #100d07;
    }
}

/* --- Base ---------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: var(--link);
    text-underline-offset: 2px;
}
a:visited { color: var(--link-visited); }
a:hover   { text-decoration-thickness: 2px; }

:focus-visible {
    outline: 3px solid var(--rust);
    outline-offset: 2px;
}

.skip {
    position: absolute;
    left: -9999px;
}
.skip:focus {
    left: 0.5rem;
    top: 0.5rem;
    z-index: 10;
    background: var(--amber);
    color: var(--banner-ink);
    padding: 0.5rem 0.9rem;
    font-weight: 700;
}

/* --- Top strip ------------------------------------------------------------
   The original's 18px black bar with little split marks near the right edge.
   Here the marks are the separators between the items. */

.strip {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* The items themselves never break, but the row does: the three of them
       need ~430px, which is wider than a small phone. Without this the strip
       alone would put a horizontal scrollbar on every page. */
    flex-wrap: wrap;
    min-height: var(--strip-h);
    padding: 0 0.5rem;
    background: var(--chrome-bg);
    color: var(--chrome-fg);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.strip__item {
    padding: 0 0.7rem;
    border-left: 1px solid rgba(244, 236, 221, 0.28);
    white-space: nowrap;
}
.strip__item:first-child { border-left: 0; }

.strip a {
    color: inherit;
    text-decoration: none;
}
.strip a:hover { color: var(--amber); }

/* --- Banner ---------------------------------------------------------------
   Amber where the original was green. The crazed-glass texture of the original
   banner image is approximated with a few off-axis hairline gradients, so
   there is no image to ship or scale. */

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 66px;
    padding: 0.4rem 1rem;
    color: var(--banner-ink);
    background-color: var(--amber);
    background-image:
        repeating-linear-gradient(74deg,  rgba(255, 255, 255, 0.30) 0 1px, transparent 1px 23px),
        repeating-linear-gradient(-31deg, rgba(28, 23, 11, 0.055)   0 2px, transparent 1px 37px),
        repeating-linear-gradient(12deg,  rgba(255, 255, 255, 0.18) 0 3px, transparent 1px 53px),
        linear-gradient(180deg, var(--amber-lift), var(--amber-drop));
    border-bottom: 1px solid rgba(28, 23, 11, 0.35);
}

.banner__logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
}

.banner__mark {
    display: block;
    width: 48px;
    height: 48px;
}

.banner__word {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.01em;
}

.banner__tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-align: right;
    color: rgba(28, 23, 11, 0.72);
}

/* --- Nav ------------------------------------------------------------------
   The original was a single page and had none; this keeps the strip's idiom
   so the added row still belongs to the design. */

.nav { background: var(--chrome-bg); }

.nav ul {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0 0.4rem;
    list-style: none;
}

.nav a {
    display: block;
    padding: 0.55rem 0.9rem;
    color: var(--chrome-fg);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}
.nav a:visited { color: var(--chrome-fg); }
.nav a:hover {
    color: var(--amber);
    background: rgba(255, 208, 95, 0.10);
}
.nav a[aria-current="page"] {
    color: var(--amber);
    border-bottom-color: var(--amber);
}

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

.wrap {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 2.25rem 1.25rem 3rem;
}

.lede {
    max-width: 42rem;
    margin: 0 0 2.5rem;
    font-family: var(--font-display);
    font-size: 1.3rem;
    line-height: 1.45;
}


p.lede {
    position: relative;
    /* font-family: Georgia, serif; */
    /* font-size: 1.1rem; */
    /* line-height: 1.6; */
    text-align: justify;

    /* Modern browsers that support drop caps */
    initial-letter: 3; /* Span 3 lines */
    /* font-family: var(--font-fancy); */
    border-top: 1px solid var(--rule) ;
    border-bottom: 1px solid var(--rule);
    padding: 1.4rem 0;
}

p.lede::first-letter {

    font-family: var(--font-fancy);

    font-size: 3.5rem;     
    font-weight: bold;
    float: left;
    line-height: 1;
    margin-right: 8px;
    margin-top: 4px;
    padding:3px;
    box-shadow: 3px 3px 5px  var(--amber-drop);
    border-radius: 5px;
    background-color: var(--amber-pale);
}


p.lede::first-line {
    color: var(--muted);
    /* font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; */
    /* font-family: var(--font-fancy); */
    font-size: 1.51rem;
}

/* Bottom rule */
p.lede::after {
    content: "✥";
    /* display: block; */
    /* text-align: left; */
    /* font-size: 2rem; */
    color: var(--muted);
    /* margin-bottom: 0.8rem; */
    /* transform: rotate(90deg); */
    opacity: 0.24;
    padding-left:0.5rem;
}

/***************************************************/

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: -1.25rem 0 2.5rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    background: var(--chrome-bg);
    color: var(--amber);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 3px solid var(--amber-drop);
}
.btn:visited { color: var(--amber); }
.btn:hover {
    background: var(--rust-deep);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink);
    border-bottom-width: 3px;
}
.btn--ghost:visited { color: var(--ink); }
.btn--ghost:hover {
    background: var(--ink);
    color: var(--paper);
}

/* --- Tab panel ------------------------------------------------------------
   .panel      indents its content to leave room for the rail
   ::before    the rail: solid down the left, fading out near the bottom
   .panel__tab the folder tab, pulled back over the rail, sloped on the right
   .panel__body its top rule runs from the rail's corner and fades to the right

   The body is pulled left by (pad-left - rail) and padded back by the same
   amount: text stays put, but its background box - and so the top rule -
   starts exactly where the rail ends. */

.panel {
    position: relative;
    margin: 0 0 2.75rem;
    padding-left: var(--pad-left);
}

.panel::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--rail);
    background: linear-gradient(
        to bottom,
        var(--amber) 0,
        var(--amber) calc(100% - 3.5rem),
        rgba(255, 208, 95, 0) 100%
    );
}

.panel__tab {
    display: inline-block;
    margin: 0 0 0 calc(-1 * var(--pad-left));
    padding: 0.4rem calc(var(--slope) + 0.9rem) 0.4rem 1.1rem;
    background: linear-gradient(180deg, var(--amber-lift), var(--amber));
    color: var(--banner-ink);
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    /* Sloped right edge; the top-left corner is chamfered where the original
       used a rounded corner tile. */
    clip-path: polygon(
        0.45em 0,
        calc(100% - var(--slope)) 0,
        100% 100%,
        0 100%,
        0 0.45em
    );
}

.panel__body {
    margin-left: calc(var(--rail) - var(--pad-left));
    padding: 1.15rem 0 0 calc(var(--pad-left) - var(--rail));
    background-image: linear-gradient(
        to right,
        var(--amber) 0,
        var(--amber) 62%,
        rgba(255, 208, 95, 0) 100%
    );
    background-repeat: no-repeat;
    background-size: 100% var(--rail);
    background-position: 0 0;
}

.panel__body > *:first-child { margin-top: 0; }
.panel__body > *:last-child  { margin-bottom: 0; }

/* --- Body copy ----------------------------------------------------------- */

p { margin: 0 0 1rem; }


@media (min-width: 48rem) {
    .panel__body > p {
        text-align: justify;
        hyphens: auto;
    }

    .panel__body > p:has(code) {
        text-align: left;
        hyphens: manual;
    }
}

h1 {
    margin: 0 0 1rem;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
}

/* ⸙ */
h1::after {
    content: "⸙";
    display: inline-block;
    transform: rotate( 90deg);
    margin-left: 1rem;
    font-size:2rem;
}

h1::before {
    content: "⸙";
    display: inline-block;
    margin-right: 1rem;
    transform: rotate(-90deg);
    font-size:2rem;
}


h3 {
    margin: 1.75rem 0 0.5rem;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin: 0 0 0.35rem; }

dl { margin: 0 0 1rem; }
dt { margin-top: 1.1rem; font-weight: 700; }
dd { margin: 0.2rem 0 0; }

hr {
    height: 1px;
    margin: 1.75rem 0;
    border: 0;
    background: var(--rule);
}

.small { font-size: 0.85em; color: var(--muted); }

/* --- Code ---------------------------------------------------------------- */

code {
    padding: 0.1em 0.35em;
    background: var(--code-bg);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.92em;
}

pre {
    position:relative;
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    overflow-x: auto;
    background: var(--code-bg);
    /* border-left: 3px solid var(--amber-drop); */
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    padding-left: 14px;
}
pre::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--amber-drop), var(--amber-pale), var(--amber-drop), var(--amber-pale));
  background-size: 100% 300%;
  animation: borderShift 14s linear infinite;
}
@keyframes borderShift {
    0% {background-position: 0% 0%;}
    100% {background-position: 0% 100%;}
}


pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}
pre .c { color: var(--muted); }   /* comment */

/* --- Tables -------------------------------------------------------------- */

.table-wrap {
    margin: 0 0 1rem;
    overflow-x: auto;
}

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

th, td {
    padding: 0.45rem 0.6rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--rule);
}

thead th {
    background: var(--amber-pale);
    border-bottom: 2px solid var(--amber-drop);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:nth-child(even) { background: rgba(255, 208, 95, 0.07); }

td code { white-space: nowrap; }

/* --- Note / caution ------------------------------------------------------ */

.note {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--note-bg);
    border-left: 3px solid var(--rust);
    font-size: 0.95em;
    text-align: left;
}
.note > *:last-child { margin-bottom: 0; }
.note strong { color: var(--rust); }

/* --- Card grid ----------------------------------------------------------- */

/* 18rem holds the grid to two columns at the page's measure, so the four cards
   on the home page land 2x2 rather than 3 + an orphan. */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.card {
    margin: 0;
    padding: 0.9rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--rule);
    border-top: 3px solid var(--amber);
}

.card h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card p {
    margin: 0;
    font-size: 0.9em;
    color: var(--muted);
    text-align: left;
}

/* --- Screenshots --------------------------------------------------------- */

.shots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.shots figure { margin: 0; }

.shots img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--paper);
    border: 1px solid var(--rule);
}

.shots figcaption {
    padding-top: 0.4rem;
    font-size: 1rem;
    color: var(--muted);
}

/* --- Lightbox -------------------------------------------------------------
   Click-to-enlarge with no script: each thumbnail links to a full-size copy of
   itself that sits hidden until the URL points at it, which is what :target
   tests. Closing is a link back to the thumbnail's <li>, so the reader lands
   where they left. Back/forward and Escape-free browsers behave sanely; a
   reader without CSS just sees both images. */

.shots__zoom {
    display: block;
    cursor: zoom-in;
}

.shots__zoom:hover img,
.shots__zoom:focus-visible img {
    border-color: var(--rust);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    place-items: center;
    padding: clamp(0.5rem, 3vw, 2.5rem);
    background: rgba(12, 9, 4, 0.88);
    cursor: zoom-out;
    /* The overlay is its own surface: kill the inherited link underline. */
    text-decoration: none;
}

.lightbox:target { display: grid; }

.lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    background: #fff;
    border: 1px solid var(--rule);
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.5);
}

/* A fade where the browser supports transitioning out of display:none; older
   ones ignore the whole block and snap open, which is fine. */
@media (prefers-reduced-motion: no-preference) {
    .lightbox {
        opacity: 0;
        transition: opacity 0.15s ease, display 0.15s allow-discrete;
    }
    .lightbox:target { opacity: 1; }

    @starting-style {
        .lightbox:target { opacity: 0; }
    }
}

/* Stand-in until a real PNG is dropped in; delete the class, not the markup. */
.shot-empty {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    padding: 1rem;
    background: var(--code-bg);
    border: 2px dashed var(--rule);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* --- Footer ---------------------------------------------------------------
*/

.panel--footer { margin: 3.5rem 0 0; }
.panel--footer .panel__body { font-size: 0.85em; color: var(--muted); }
.panel--footer .panel__body p { text-align: left; }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0.6rem 0 0;
    padding: 0;
    list-style: none;
}
.footer-links li { margin: 0; }

/* --- Narrow screens -------------------------------------------------------
 */

@media (max-width: 40rem) {
    :root {
        --slope: 1.6em;
        --pad-left: 1.05rem;
        --rail: 7px;
    }

    body { font-size: 15px; }

    .banner__word { font-size: 25px; }
    .banner__mark { width: 40px; height: 40px; }
    .banner__tag  { display: none; }

    .wrap { padding: 1.75rem 1rem 2.5rem; }
    .lede { font-size: 1.15rem; }
    .panel__tab { font-size: 14px; }
}

/* Below ~480px the strip's three items wrap to two lines, which reads as a
   glitch rather than a design. Drop the wordiest one instead; it repeats what
   the home page says anyway. */
@media (max-width: 30rem) {
    .strip__item:first-child { display: none; }
    .strip__item:nth-child(2) { border-left: 0; }
}

/* --- Print --------------------------------------------------------------- */

@media print {
    .strip, .nav, .actions { display: none; }
    /* An open lightbox would otherwise print as a black page. */
    .lightbox, .lightbox:target { display: none; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .banner { border-bottom: 2px solid #000; }
    a { color: #000; }
}
