/* jglot-site: a magazine of homemade software.
   Paper and ink, one spot colour per feature (--accent), dark plates for the
   screenshots. Layout is CSS grid on a 12-column measure. */

@font-face { font-family: "Display"; src: url("../fonts/display-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Display"; src: url("../fonts/display-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Display"; src: url("../fonts/display-black.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Display"; src: url("../fonts/display-black-italic.woff2") format("woff2"); font-weight: 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Text"; src: url("../fonts/serif-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Text"; src: url("../fonts/serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Text"; src: url("../fonts/serif-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Label"; src: url("../fonts/sans-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Label"; src: url("../fonts/sans-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Mono"; src: url("../fonts/mono-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #f4efe4;
  --paper-deep: #e9e1d0;
  --ink: #17140f;
  --ink-soft: #4a443a;
  --rule: #17140f;
  --hairline: rgb(23 20 15 / 0.22);
  --plate: #0c0b0a;
  --red: #d63a1f;
  --accent: var(--red);

  --display: "Display", "Noto Serif Display", "Playfair Display", Didot, Georgia, serif;
  --text: "Text", "Noto Serif", Georgia, "Times New Roman", serif;
  --label: "Label", "Noto Sans", system-ui, sans-serif;
  --mono: "Mono", "NotoSansM Nerd Font Mono", ui-monospace, Menlo, Consolas, monospace;

  --measure: 82rem;
  --gutter: clamp(1rem, 2.4vw, 2.5rem);
  --pad: clamp(1.1rem, 4vw, 4rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.09rem/1.62 var(--text);
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  hanging-punctuation: first;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
p { margin: 0 0 1em; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: rgb(23 20 15 / 0.07); padding: 0.08em 0.36em; border-radius: 3px; white-space: nowrap; }
::selection { background: var(--accent); color: var(--paper); }

.wrap { max-width: var(--measure); margin-inline: auto; padding-inline: var(--pad); }

.label {
  font: 700 0.74rem/1.2 var(--label);
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

/* ── Masthead ─────────────────────────────────────────────────────────── */

.pages { display: flex; gap: 1.6rem; padding-top: 0.8rem; }
.pages a { text-decoration: none; }
.pages [aria-current] { color: var(--red); }
/* As for the topline below: a layer of its own, to stay clickable. */
.pages { position: relative; z-index: 1; }

.topline {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-block: 0.8rem;
  border-bottom: 1px solid var(--rule);
}
.topline span { white-space: nowrap; }
/* The masthead's letters are set so tight that their boxes reach up over this
   line; without a layer of its own the language link under them cannot be
   clicked. */
.topline { position: relative; z-index: 1; }

.masthead { padding-top: 0.4rem; border-bottom: 6px solid var(--rule); }
.masthead__title {
  margin: 0;
  font: 900 clamp(5.2rem, 23.5vw, 23rem)/0.78 var(--display);
  letter-spacing: -0.045em;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding-bottom: 0.25em;
}
.masthead__title i { color: var(--red); font-style: italic; padding-right: 0.04em; }
.masthead__strap {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter);
  border-top: 1px solid var(--rule);
  padding-block: 0.75rem;
}
.masthead__strap > :nth-child(2) { text-align: center; }
.masthead__strap > :nth-child(3) { text-align: right; }

/* ── Cover ────────────────────────────────────────────────────────────── */

.cover {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter);
  padding-block: clamp(1.5rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.cover__lead { grid-column: 1 / span 5; }
.cover__headline {
  margin: 0 0 0.35em;
  font: 900 clamp(2.8rem, 6.3vw, 6.4rem)/0.92 var(--display);
  letter-spacing: -0.03em;
}
.cover__headline em { font-weight: 400; color: var(--red); }
.cover__deck { font: italic 400 clamp(1.2rem, 1.75vw, 1.6rem)/1.36 var(--display); margin-bottom: 1.3em; max-width: 30em; }
.cover__lines { list-style: none; margin: 1.6rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.cover__lines li { padding: 0.62rem 0; border-bottom: 1px solid var(--hairline); display: flex; gap: 0.9rem; align-items: baseline; }
.cover__lines b { font: 700 0.74rem/1.2 var(--label); letter-spacing: 0.15em; text-transform: uppercase; color: var(--red); flex: 0 0 5.6rem; }
.cover__lines span { font: 400 1.12rem/1.3 var(--display); }

.cover__art { grid-column: 6 / -1; position: relative; aspect-ratio: 10 / 9; }
.cover__art .shot { position: absolute; margin: 0; }
.cover__art .shot figcaption { display: none; }
.cover__art .shot:nth-child(1) { width: 86%; top: 0; right: 0; transform: rotate(1.2deg); }
.cover__art .shot:nth-child(2) { width: 62%; left: 0; top: 37%; transform: rotate(-2.4deg); z-index: 2; }
.cover__art .shot:nth-child(3) { width: 50%; right: 2%; bottom: 0; transform: rotate(2.2deg); z-index: 3; }
.cover__stamp {
  position: absolute; z-index: 4; left: -2%; top: -3%;
  width: clamp(6.5rem, 11vw, 9.5rem); aspect-ratio: 1; border-radius: 50%;
  background: var(--red); color: var(--paper);
  display: grid; place-content: center; text-align: center;
  font: 900 clamp(0.95rem, 1.5vw, 1.3rem)/1.02 var(--display);
  transform: rotate(-13deg);
  box-shadow: 0 0.5rem 1.4rem rgb(0 0 0 / 0.28);
}
.cover__stamp small { display: block; font: 700 0.6rem/1.3 var(--label); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 0.3rem; }

/* ── Contents ─────────────────────────────────────────────────────────── */

.contents { border-top: 6px solid var(--rule); border-bottom: 1px solid var(--rule); padding-block: 1.2rem 0; }
.contents__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.6rem; }
.contents__head h2 { margin: 0; font: italic 400 clamp(1.8rem, 3.2vw, 2.8rem)/1 var(--display); }
.contents ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--rule); }
.contents li { border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.contents li:nth-child(5n) { border-right: 0; }
.contents li:nth-last-child(-n + 5) { border-bottom: 0; }
.contents a { display: block; padding: 0.95rem 1rem 1.1rem; text-decoration: none; height: 100%; transition: background 0.15s, color 0.15s; }
.contents a:hover { background: var(--ink); color: var(--paper); }
.contents .n { font: 900 2.5rem/1 var(--display); color: var(--accent); display: block; }
.contents .t { font: 900 1.45rem/1.1 var(--display); display: block; margin: 0.25rem 0 0.3rem; }
.contents .d { font: 500 0.82rem/1.38 var(--label); color: var(--ink-soft); display: block; }
.contents a:hover .d { color: inherit; }

/* ── Features ─────────────────────────────────────────────────────────── */

.feature { padding-block: clamp(3rem, 7vw, 6.5rem); border-bottom: 1px solid var(--rule); position: relative; }
.feature--dark { background: var(--plate); color: #efe8da; --ink: #efe8da; --ink-soft: #b4ab99; --rule: #efe8da; --hairline: rgb(239 232 218 / 0.24); border-bottom: 0; }
.feature--dark code { background: rgb(239 232 218 / 0.12); }
.feature--tint { background: var(--paper-deep); }

.feature__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); align-items: start; }

.feature__head { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); align-items: end; margin-bottom: clamp(1.2rem, 3vw, 2.6rem); }
.feature__no {
  grid-column: 1 / span 2;
  font: 900 clamp(4.5rem, 12vw, 11.5rem)/0.74 var(--display);
  letter-spacing: -0.05em;
  color: var(--accent);
}
.feature__title { grid-column: 3 / -1; }
.feature__kicker { display: flex; gap: 0.9rem; align-items: center; margin-bottom: 0.9rem; color: var(--accent); }
.feature__kicker::after { content: ""; flex: 1; height: 1px; background: var(--rule); opacity: 0.55; }
.feature__name { margin: 0; font: 900 clamp(3rem, 8.6vw, 8.4rem)/0.86 var(--display); letter-spacing: -0.035em; overflow-wrap: anywhere; }
.feature__headline { margin: 0.45em 0 0; font: italic 400 clamp(1.45rem, 2.9vw, 2.75rem)/1.12 var(--display); max-width: 24em; }

.feature__copy { grid-column: 1 / span 5; }
.feature__art { grid-column: 6 / -1; }
.feature--flip .feature__copy { grid-column: 8 / -1; grid-row: 2; }
.feature--flip .feature__art { grid-column: 1 / span 7; grid-row: 2; }
.feature--wide .feature__art { grid-column: 1 / -1; }
.feature--wide .feature__copy { grid-column: 1 / -1; columns: 3; column-gap: var(--gutter); column-rule: 1px solid var(--hairline); }
.feature--wide .feature__copy > * { break-inside: avoid; }

.standfirst { font: 400 clamp(1.18rem, 1.5vw, 1.4rem)/1.42 var(--display); margin-bottom: 1.2em; }
.dropcap::first-letter {
  font: 900 4.55em/0.76 var(--display);
  float: left; padding: 0.06em 0.09em 0 0; color: var(--accent); text-transform: uppercase;
}
.feature__copy h3 { font: 700 0.74rem/1.2 var(--label); letter-spacing: 0.17em; text-transform: uppercase; margin: 1.9em 0 0.6em; color: var(--accent); }

.pull {
  margin: 1.5em 0; padding: 0.9em 0 0.95em;
  border-top: 4px solid var(--rule); border-bottom: 1px solid var(--rule);
  font: italic 400 clamp(1.5rem, 2.3vw, 2.15rem)/1.16 var(--display);
}
.pull b { font-weight: 900; font-style: normal; color: var(--accent); }

.specs { margin: 1.7em 0 0; border-top: 4px solid var(--rule); font: 500 0.86rem/1.4 var(--label); }
.specs div { display: grid; grid-template-columns: 6.6rem 1fr; gap: 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid var(--hairline); }
.specs dt { font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; font-size: 0.7rem; padding-top: 0.14rem; color: var(--accent); }
.specs dd { margin: 0; }

.repo { display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 1.4rem; padding: 0.6rem 0.95rem; border: 1.5px solid var(--rule); font: 700 0.74rem/1 var(--label); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; }
.repo::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); }
a.repo:hover { background: var(--ink); color: var(--paper); }

/* ── Plates (screenshots) ─────────────────────────────────────────────── */

.shot { margin: 0; }
.shot__frame {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  background: var(--plate); border-radius: 9px; overflow: hidden;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.55), 0 1.3rem 2.8rem -0.9rem rgb(20 12 0 / 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font: inherit; color: inherit; text-align: left;
}
.shot__frame:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.55), 0 2rem 3.4rem -1rem rgb(20 12 0 / 0.6); }
.shot__frame:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.feature--dark .shot__frame { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.16), 0 1.3rem 2.8rem -0.9rem #000; }
.shot__bar {
  display: flex; align-items: center; gap: 0.42rem;
  padding: 0.5rem 0.75rem; background: #201e1b; color: #a39b8c;
  font: 400 0.72rem/1 var(--mono); border-bottom: 1px solid #000;
}
.shot__bar i { width: 0.62rem; height: 0.62rem; border-radius: 50%; background: #4a463f; flex: none; }
.shot__bar i:first-child { background: var(--accent); }
.shot__bar span { margin-left: 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot--web .shot__bar span { background: #131210; padding: 0.3rem 0.8rem; border-radius: 99px; flex: 1; max-width: 26rem; }
.shot--bare .shot__bar { display: none; }
.shot img { width: 100%; }
.shot figcaption { margin-top: 0.75rem; font: 500 0.83rem/1.45 var(--label); color: var(--ink-soft); max-width: 46em; }
.shot figcaption b { font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; font-size: 0.68rem; color: var(--accent); margin-right: 0.45rem; }

.shot--phone { max-width: 17.5rem; }
.shot--phone .shot__frame { border-radius: 1.7rem; border: 0.5rem solid #1b1916; }
.shot--phone .shot__bar { display: none; }

.plates { display: grid; gap: var(--gutter); }
.plates > .shot + .shot { margin-top: 0; }
.plates--2 { grid-template-columns: repeat(2, 1fr); }
.plates--3 { grid-template-columns: repeat(3, 1fr); }
.plates--main { grid-template-columns: 1fr; }
.plates--lead-phone { grid-template-columns: 1fr minmax(9rem, 15rem); align-items: start; }
.feature__more { grid-column: 1 / -1; margin-top: clamp(1.4rem, 3vw, 2.6rem); align-items: start; }
.feature__art .plates { margin-top: var(--gutter); }

.versus { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--gutter); align-items: start; margin-top: clamp(1.4rem, 3vw, 2.6rem); }
.versus__amp { font: italic 400 clamp(3rem, 6vw, 5.5rem)/1 var(--display); color: var(--accent); align-self: center; }
.versus h3 { font: 900 clamp(1.4rem, 2.2vw, 2rem)/1.1 var(--display); margin: 0 0 0.8rem; }
.versus .shot + .shot { margin-top: var(--gutter); }

/* ── Interlude and colophon ───────────────────────────────────────────── */

.interlude { background: var(--red); color: var(--paper); padding-block: clamp(3rem, 8vw, 7rem); --accent: var(--paper); }
.interlude p { font: 900 clamp(2.1rem, 6vw, 5.8rem)/0.98 var(--display); letter-spacing: -0.025em; margin: 0; max-width: 17em; }
.interlude p em { font-weight: 400; }
.interlude .label { margin-bottom: 1.4rem; display: block; }
.interlude ::selection { background: var(--ink); }

.colophon { padding-block: clamp(3rem, 6vw, 5.5rem); }
.colophon__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gutter); }
.colophon h2 { grid-column: 1 / span 4; margin: 0; font: 900 clamp(2.4rem, 5vw, 4.6rem)/0.94 var(--display); letter-spacing: -0.03em; }
.colophon h2 em { font-weight: 400; color: var(--red); }
.colophon__body { grid-column: 6 / -1; columns: 2; column-gap: var(--gutter); }
.colophon__body p { break-inside: avoid; }
.colophon__body h3 { font: 700 0.74rem/1.2 var(--label); letter-spacing: 0.17em; text-transform: uppercase; color: var(--red); margin: 0 0 0.5em; }
.footer { border-top: 6px solid var(--rule); padding-block: 1rem 1.5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ── Lightbox ─────────────────────────────────────────────────────────── */

.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgb(8 7 6 / 0.92); }
.lightbox img { max-width: 96vw; max-height: 88vh; width: auto; border-radius: 6px; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.15); cursor: zoom-out; }
.lightbox p { color: #d9d1c2; font: 500 0.85rem/1.4 var(--label); margin: 0.8rem 0 0; text-align: center; }

/* ── Motion ───────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(1.4rem); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .reveal.is-in { opacity: 1; transform: none; }
}

/* ── Narrower pages ───────────────────────────────────────────────────── */

@media (max-width: 68rem) {
  .contents ol { grid-template-columns: repeat(2, 1fr); }
  .contents li, .contents li:nth-child(5n) { border-right: 1px solid var(--hairline); }
  .contents li:nth-child(2n) { border-right: 0; }
  .contents li:nth-last-child(-n + 5) { border-bottom: 1px solid var(--hairline); }
  .contents li:nth-last-child(-n + 2) { border-bottom: 0; }
  .feature--wide .feature__copy { columns: 2; }
}

@media (max-width: 56rem) {
  .cover__lead, .cover__art,
  .feature__copy, .feature__art,
  .feature--flip .feature__copy, .feature--flip .feature__art,
  .colophon h2, .colophon__body { grid-column: 1 / -1; grid-row: auto; }
  .cover__art { margin-top: 1.5rem; }
  .feature__no { grid-column: 1 / -1; font-size: 5rem; }
  .feature__title { grid-column: 1 / -1; }
  .feature--wide .feature__copy, .colophon__body { columns: 1; }
  .plates--3 { grid-template-columns: 1fr; }
  .versus { grid-template-columns: 1fr; }
  .versus__amp { justify-self: center; }
  .masthead__strap { grid-template-columns: 1fr; gap: 0.2rem; }
  .masthead__strap > * { text-align: left !important; }
}

@media (max-width: 36rem) {
  body { font-size: 1.02rem; }
  .plates--2, .plates--lead-phone { grid-template-columns: 1fr; }
  .contents ol { grid-template-columns: 1fr; }
  .contents li { border-right: 0 !important; border-bottom: 1px solid var(--hairline) !important; }
  .shot__bar { display: none; }
}

@media print {
  .shot__frame { box-shadow: none; }
  .feature { break-inside: avoid-page; }
}

/* Small plates in a row of three are cut to one shape, from the top left,
   where a terminal or a page keeps what matters. */
.plates--3 .shot:not(.shot--bare):not(.shot--phone) img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }

@media (max-width: 56rem) {
  code { white-space: normal; overflow-wrap: anywhere; }
}

.contact { margin: 0; padding-bottom: 1.5rem; text-align: center; font: 500 0.72rem/1 var(--label); letter-spacing: 0.06em; }
.contact a { color: var(--ink-soft); opacity: 0.55; text-decoration: none; }
.contact a:hover { opacity: 1; color: var(--red); }
