/* =====================================================================
   Aticatac - Apple II port
   =====================================================================

   The game keeps its clock, its score and its roast bird on a scroll
   down the side of the screen. So the page is that scroll: ink on
   aged paper, one narrow column, and the pixel art set into it like
   plates in a book. Colour is only ever in the pictures.
   ===================================================================== */

:root {
    --paper: #e7dcc2;
    --paper-deep: #d9cba9;
    --ink: #1e1912;
    --ink-soft: #514736;
    --rule: #b5a483;
    --seal: #9c2118;

    --fell: "IM Fell English", Georgia, serif;
    --fell-sc: "IM Fell English SC", Georgia, serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;

    --column: 40rem;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--paper);
    /* The blotching an old sheet has, in three soft washes. Nothing is
       loaded for it; it is all one background. */
    background-image:
        radial-gradient(
            ellipse 60% 40% at 15% 8%,
            rgba(160, 132, 88, 0.16),
            transparent 70%
        ),
        radial-gradient(
            ellipse 50% 35% at 85% 45%,
            rgba(160, 132, 88, 0.13),
            transparent 70%
        ),
        radial-gradient(
            ellipse 70% 50% at 40% 95%,
            rgba(140, 112, 70, 0.14),
            transparent 70%
        );
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--fell);
    font-size: 1.2rem;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
}

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

/* Pixel art is only itself at whole pixels. */
img {
    image-rendering: pixelated;
}

/* Except a capture taken through the emulator's shadow mask, which is
   not clean pixels any more - nearest-neighbour would beat its own
   grille against the screen's and moire. */
img.photo {
    image-rendering: auto;
}

a {
    color: var(--seal);
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
}

::selection {
    background: var(--ink);
    color: var(--paper);
}

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

.sheet {
    max-width: var(--column);
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

/* ---------------------------------------------------------------
   Masthead
   --------------------------------------------------------------- */
.crumb {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 2.5rem;
}

.crumb:hover {
    color: var(--seal);
}

h1 {
    font-family: var(--fell-sc);
    font-weight: 400;
    font-size: clamp(3rem, 12vw, 4.75rem);
    line-height: 1;
    letter-spacing: 0.03em;
    text-align: center;
    margin-bottom: 0.5rem;
}

.standfirst {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-align: center;
    color: var(--ink-soft);
}

/* A rule with a diamond in the middle of it, which is what an old
   sheet puts between one thing and the next. */
.divider {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 2.5rem 0;
    color: var(--rule);
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: currentColor;
}

.divider span {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

/* ---------------------------------------------------------------
   Plates. A picture is set in a double rule and captioned under it.
   --------------------------------------------------------------- */
figure {
    margin: 2.5rem 0;
}

figure .plate {
    border: 1px solid var(--ink);
    padding: 5px;
    background: #000;
    box-shadow: 0 1px 0 var(--rule);
}

figure .plate > div {
    border: 1px solid #3a3226;
    background: #000;
}

figcaption {
    margin-top: 0.7rem;
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.5;
    color: var(--ink-soft);
    text-align: center;
}

/* The rooms break the measure. Four of them at column width are too
   small to read, and a plate block wider than the text it sits in is
   what a printed page does with them anyway. */
.plates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 1.25rem;
    margin: 2.5rem 0;
    width: min(54rem, 100vw - 3rem);
    margin-left: 50%;
    transform: translateX(-50%);
}

.plates figure {
    margin: 0;
}

.plates figcaption {
    font-size: 0.85rem;
}

/* ---------------------------------------------------------------
   Prose
   --------------------------------------------------------------- */
h2 {
    font-family: var(--fell-sc);
    font-weight: 400;
    font-size: 1.7rem;
    letter-spacing: 0.04em;
    margin-bottom: 0.8rem;
}

p + p {
    margin-top: 1rem;
}

section + section {
    margin-top: 2.5rem;
}

/* The opening letter, dropped two lines the way a printed page does
   it. Only the first paragraph of the sheet gets one. */
.opening::first-letter {
    float: left;
    font-family: var(--fell-sc);
    font-size: 3.9rem;
    line-height: 0.78;
    padding: 0.1rem 0.5rem 0 0;
    color: var(--seal);
}

.aside {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--ink-soft);
    font-style: italic;
}

/* ---------------------------------------------------------------
   The keys. A ruled table, as a manual would set it.
   --------------------------------------------------------------- */
.keys {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.2rem;
    font-size: 1rem;
}

.keys th,
.keys td {
    text-align: left;
    padding: 0.5rem 0.2rem;
    border-bottom: 1px solid var(--rule);
    vertical-align: baseline;
}

.keys tr:last-child td {
    border-bottom: 0;
}

.keys th {
    width: 40%;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------
   The download. A stamped block rather than a button, and a seal
   beside it.
   --------------------------------------------------------------- */
.get {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--ink);
    background: rgba(255, 255, 255, 0.18);
}

.seal {
    flex: 0 0 auto;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: var(--seal);
    color: var(--paper);
    display: grid;
    place-content: center;
    text-align: center;
    font-family: var(--mono);
    font-size: 0.58rem;
    line-height: 1.35;
    letter-spacing: 0.08em;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.get-body {
    flex: 1;
}

.get-body p {
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin-top: 0.35rem;
}

.stamp {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--paper);
    background: var(--ink);
    padding: 0.55rem 1.1rem;
}

.stamp:hover,
.stamp:focus-visible {
    background: var(--seal);
    color: var(--paper);
}

.also {
    margin-top: 0.9rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

/* ---------------------------------------------------------------
   Colophon
   --------------------------------------------------------------- */
.colophon {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--ink-soft);
}

.colophon p + p {
    margin-top: 0.6rem;
}

/* ---------------------------------------------------------------
   Narrow sheets
   --------------------------------------------------------------- */
@media (max-width: 34rem) {
    body {
        font-size: 1.1rem;
    }

    .plates {
        grid-template-columns: 1fr;
    }

    .get {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
