@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300..700&family=Geist+Mono:wght@300..700&display=swap');

:root { --bar: #3b4d5a; --rule: #8cc4ea; --ink: #32414c; --sub: #e4e7e9;
        --mono: "Geist Mono", ui-monospace, monospace; }

/* One centred spread: page links, text, and (on the home page) news in the
   right margin. A wider screen adds white margin, never line length. */
body { margin: 0; display: grid; align-content: start;
       grid-template-columns: minmax(1.75rem, 1fr) 10rem 3.5rem minmax(0, 56.5rem) minmax(1.75rem, 1fr);
       grid-template-rows: auto auto auto 1fr auto;
       background: #fff; color: #1a1a1a; font: 15.5px/1.65 Geist, system-ui, sans-serif;
       -webkit-text-size-adjust: 100%; }
a { color: #003399; text-underline-offset: 2px; } a:visited { color: #663399; } a:hover { color: #cc0000; }
#preamble, #postamble { display: contents; }

.top { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid;
       background: var(--bar); color: #fff; border-bottom: 3px solid var(--rule); padding-block: 16px; }
.top b, .top small { grid-column: 2 / -2; }
.top b { font: 600 20px var(--mono); }
.top small { color: var(--sub); font-size: 13px; margin-top: 2px; }

.pages, .else { grid-column: 2; font: 13px/1.9 var(--mono); }
.pages { grid-row: 2; padding-top: 36px; }
.else { grid-row: 3; align-self: start; }
.pages a, .else a { display: block; text-decoration: none; }
.pages a.on { color: #000; font-weight: 600; }
.pages a.sub { padding-left: 1rem; font-size: 12px; }
.else h4 { margin: 18px 0 2px; font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #777; }

#content { grid-column: 4; grid-row: 2 / 5; padding-top: 36px; }
#content p, #content li { max-width: 36rem; }
h2 { font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin: 2.6rem 0 .9rem; }
#content > section:first-child h2 { margin-top: 0; }
#content > section:first-child p:first-of-type { margin-top: 0; }
h3 { font: 600 13px var(--mono); margin: 1.6em 0 .4em; }
#content li { margin-bottom: .6em; }
.note { font-size: 13px; color: #666; }

/* A section marked HTML_CONTAINER_CLASS aside sits in the right margin */
#content:has(> .aside) { display: grid; grid-template-columns: minmax(0, 36rem) 17rem; column-gap: 3.5rem; align-items: start; }
.aside { grid-column: 2; grid-row: 1 / span 9; font-size: 14px; line-height: 1.55; }
.aside h2 { margin-top: 0; }
table.news { width: 100%; }
.aside tr { display: block; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px dotted #ccc; }
.aside td { display: block; padding: 0; border: 0; }
.aside td:first-child { font: 12px var(--mono); color: #777; margin-bottom: 2px; }

/* Label and items, one shared label column so every list on a page lines up */
#content dl { display: grid; grid-template-columns: 10rem minmax(0, 1fr); column-gap: 1.5rem; margin: 0; max-width: 44rem; }
#content dt, #content dd { padding: 8px 0; border-bottom: 1px dotted #ccc; }
#content dt { font: 12px/2 var(--mono); color: #666; }
#content dd { margin: 0; }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font: 500 11px var(--mono); letter-spacing: .06em; color: #666; border-bottom: 1px solid #ccc; padding: 4px 12px 4px 0; }
td { vertical-align: top; padding: 6px 12px 6px 0; border-bottom: 1px dotted #ccc; }
td:first-child { white-space: nowrap; color: #666; }
td:first-child b { font-weight: normal; }

figure.frame { display: inline-block; vertical-align: top; width: 15rem; margin: 0 1.2rem 1.2rem 0; font-size: 13px; }
figure.frame img { display: block; width: 100%; height: 11.25rem; object-fit: cover; border: 1px solid #000; margin-bottom: 4px; }

.foot { grid-column: 4; grid-row: 5; border-top: 1px solid #ccc; margin: 3rem 0 2.5rem; padding-top: 10px; font: 12px var(--mono); color: #777; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: .7rem; }
.b { display: flex; width: 88px; height: 31px; box-sizing: border-box; overflow: hidden;
     border: 2px outset #ccc; font: bold 9px/1 Verdana, sans-serif; color: #000; }
.b span { display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 3px; }
.b .l { width: 34px; }
.b .r { flex: 1; }
.b.emacs { background: #7f5ab6; color: #fff; } .b.emacs .l { background: #4b2c7f; }
.b.org { background: #77aa99; }
.b.nojs { background: #000; color: #0f0; }
.b.any { background: #ffc; }

/* iPad: news drops under the text */
@media (max-width: 1100px) {
    #content:has(> .aside) { display: block; }
    .aside { margin-top: 2.5rem; }
}

/* Phone: page links on one line, then the text, then the outward links */
@media (max-width: 640px) {
    body { display: block; font-size: 16px; }
    .top { display: block; padding: 18px 20px 16px; }
    .top small { display: block; }
    .pages { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0 20px 28px; padding: 10px 0; border-bottom: 1px solid #e4e4e4; }
    .pages a { padding-block: 6px; }
    .pages a.sub { padding-left: 0; }
    #content { padding: 0 20px; }
    #content ul { padding-left: 1.2rem; }
    #content dl { display: block; }
    #content dt { border: 0; padding: 12px 0 0; }
    #content dd { padding-top: 2px; }
    /* A wide table scrolls sideways in its own strip, edge to edge, as on the wikis */
    #content table:not(.news) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
        width: auto; margin-inline: -20px; padding-inline: 20px; scrollbar-width: none; }
    #content table:not(.news)::-webkit-scrollbar { display: none; }
    #content table:not(.news) :is(th, td) { white-space: nowrap; }
    .else { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 2.5rem 20px 0; }
    .else h4 { flex-basis: 100%; margin: 10px 0 0; }
    .else a { padding-block: 5px; }
    .foot { margin: 2rem 20px 2.5rem; }
    .badges { display: grid; grid-template-columns: repeat(2, 88px); gap: 6px; }
}
