/* ---------- shared section rhythm ---------- */
.sec { row-gap: 0; }
.sec > .sec-head > h2, .sec > h2 { margin-bottom: var(--s8); }
.opening { padding-top: var(--s16); }
.opening .lead { margin-top: var(--s8); }
.opening > .note { padding-top: calc(var(--h1) * .25); }

/* ---------- home: the dots ---------- */
.hero { min-height: 100svh; padding-top: var(--s8); padding-bottom: var(--s16); --wh: min(calc(70vw * 969 / 1196), 58svh); position: relative; }
.hero > .gloss-leader { grid-area: auto; position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; transition: opacity .35s var(--lift); }
.gloss-leader.is-on { opacity: 1; }
.gloss-leader path { fill: none; stroke: var(--pink); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 0 7; mix-blend-mode: multiply; }
.gloss-leader circle { fill: var(--pink); mix-blend-mode: multiply; }
.hero-word { grid-column: folio-start / matn-end; grid-row: 1; justify-self: start; position: relative; }
/* on English pages the word is still Arabic: the top of the page is set right to left on the same grid, so the word and its gloss sit exactly where they do in Arabic */
.hero-top { display: contents; }
@media (min-width: 760px) {
  /* the English grid does not always fill the page; the mirrored top takes the whole width so the word still sits on the right gutter */
  :root[lang="en"] .hero { container-type: inline-size; }
  :root[lang="en"] .hero-top { grid-column: full; grid-row: 1; width: 100cqi; justify-self: start; display: grid; grid-template-columns: inherit; align-items: start; direction: rtl; }
  :root[lang="en"] .hero-top > * { direction: ltr; }
}
.hero-word svg { height: var(--wh); width: auto; overflow: visible; }
.hero-word .skel { fill: var(--ink); }
.hero-word .dots { fill: var(--pink); mix-blend-mode: multiply; }
.hero-word .dot { transform-box: fill-box; transform-origin: 50% 100%; }
/* the printed dots wait for the player, so the first drop is not preceded by a dot already at rest */
@media (prefers-reduced-motion: no-preference) {
  .js .hero-word .dots:not(.is-live) { animation: dots-wait 5s step-end both; }
}
@keyframes dots-wait { from { opacity: 0; } }
.hero-gloss { grid-column: hashiya; grid-row: 1; align-self: start; padding-top: calc(var(--wh) * .711 - 1.05em); display: grid; gap: var(--s6); align-content: start; }
:root[lang="en"] .hero-gloss { text-align: end; }
.gloss-line { font-size: 1.375rem; line-height: 1.45; min-height: 2.9em; display: grid; }
:root[lang="en"] .gloss-line { font-size: 1.25rem; }
.gloss-line > span { grid-area: 1 / 1; transition: opacity .2s; }
.gloss-line b { font-weight: 600; }
.gloss-line .roll { display: inline-block; white-space: pre; }
.hero-controls { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); font-size: 1rem; }
:root[lang="en"] .hero-controls { justify-content: flex-end; }
.hero-controls .textbtn { font-size: 1rem; }
.no-js .hero-controls, .no-js .demo-toggle, .no-js .demo-cap { display: none; }
.no-js .demo-after p { opacity: 1; }
.hero-cap { grid-column: matn; grid-row: 2; margin-top: var(--s6); max-width: 30rem; }
.hero h1 { grid-column: matn-start / hashiya-end; grid-row: 3; margin-top: var(--s16); }
.hero .lead { grid-row: 4; margin-top: var(--s8); }

/* ---------- home: contents ---------- */
.contents { padding-top: var(--s16); padding-bottom: var(--s32); }
.toc { display: grid; gap: var(--s8); grid-column: matn-start / hashiya-end; }
.toc a { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; column-gap: var(--s4); }
.toc-title { font-weight: 600; font-size: 2rem; line-height: 1.3; }
:root[lang="en"] .toc-title { font-size: 1.75rem; }
.leader { height: 3px; align-self: baseline; display: flex; gap: 5px; overflow: hidden; translate: 0 -.2em; }
.leader i { flex: none; width: 3px; height: 3px; border-radius: 50%; background: var(--pink); }
.toc-num { font-family: "Matn Skeleton"; font-size: 2rem; line-height: 1; }
.toc-sub { grid-column: 1 / -1; color: var(--graphite); font-size: var(--cap); line-height: var(--cap-lh); margin-top: var(--s1); }
.toc a:hover .toc-title { color: var(--graphite); }

/* ---------- home: the second ink ---------- */
.second { padding-top: var(--s24); }
.demo { position: relative; height: 210svh; margin-top: var(--s8); }
.demo-cap { grid-column: matn; margin-top: var(--s16); }
.demo-stage { position: sticky; top: 16svh; display: grid; }
.demo-stage > .page { row-gap: var(--s6); }
.demo-sentence { grid-column: matn-start / hashiya-end; font-size: clamp(2.6rem, 7.4vw, 7rem); line-height: 1.45; direction: rtl; text-align: right; text-wrap: balance; }
:root[lang="en"] .demo-sentence { text-align: right; }
.demo-sentence .word { display: inline-grid; }
.demo-sentence .word > span { grid-area: 1 / 1; }
.demo-sentence .ws-dots { font-family: "Matn Dots"; color: var(--pink); mix-blend-mode: multiply; translate: .02em -.015em; }
.demo-sentence .ws-skel { font-family: "Matn Skeleton"; }
.demo-sentence.is-bare .ws-dots { opacity: 0 !important; }
.demo-after { grid-column: matn; display: grid; gap: var(--s2); min-height: 4.5em; }
.demo-after p { opacity: 0; transition: opacity .5s var(--lift); }
.demo-after.is-on p { opacity: 1; }
.demo-after .en-tr { font-size: 1.375rem; }
.demo-toggle { grid-column: matn; justify-self: start; }
.second-end { height: 0; }

/* ---------- home: new on the shelf ---------- */
.newbook { padding-top: var(--s12); padding-bottom: var(--s24); }
.newbook-cover { grid-column: folio-start / matn-end; justify-self: end; display: block; }
@media (hover: hover) and (pointer: fine) { .newbook-cover:hover .cover > .c-ink2 { translate: calc(var(--mx) + .25%) calc(var(--my) - .25%); } }
.newbook-cover .cover { height: 64vh; width: auto; aspect-ratio: 13.5 / 21; }
.newbook-text { grid-column: hashiya-start / full-end; padding-inline-end: var(--gutter); display: grid; gap: var(--s6); align-content: start; max-width: 26rem; }
.newbook-text .meta { color: var(--graphite); font-size: var(--cap); }
.verse { font-size: 1.75rem; line-height: 1.6; }
:root[lang="en"] .verse { font-size: 1.5rem; line-height: 1.35; }
.newbook-text p:not(.verse):not(.meta) { font-size: 1.1875rem; }
.newbook-text h3 .link { padding-bottom: .12em; }

/* ---------- home: this month ---------- */
.month-sec { padding-bottom: var(--s24); }
.next3 { grid-column: folio-start / matn-end; display: grid; grid-template-columns: subgrid; row-gap: var(--s8); }
.next3 > li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: start; }
.next3 > li > p { grid-column: 3; }
.ev-when { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; }
.ev-when .num { grid-column: 1; grid-row: 1 / span 2; font-family: "Matn Skeleton"; font-size: 3rem; line-height: 1; justify-self: start; }
.ev-date { grid-column: 3; font-size: 1.0625rem; color: var(--graphite); line-height: 1.4; }
.ev-body { grid-column: 3; }
.ev-title { font-weight: 600; font-size: 1.5rem; line-height: 1.35; }
.ev-desc { color: var(--graphite); font-size: 1.125rem; line-height: 1.6; }
.month-sec > .note { grid-row: 2 / span 3; align-self: start; }

/* ---------- home: above the street ---------- */
.street { padding-bottom: 0; }
.hours-now { font-weight: 600; font-size: 1.5rem; line-height: 1.5; margin-top: var(--s4); }
:root[lang="en"] .hours-now { font-size: 1.375rem; line-height: 1.3; }
.address { color: var(--graphite); margin-top: var(--s2); font-size: 1.125rem; }


/* ---------- press: shelf ---------- */
.on-drum { position: relative; isolation: isolate; padding-block: var(--s16) var(--s24); }
.on-drum::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--drum); }
.on-drum::after { content: ""; position: absolute; inset: 0; z-index: -1; background: url("../img/speckle.png") 0 0 / 220px; opacity: .5; pointer-events: none; }
.on-drum .lead { grid-row: 3; }
.on-drum h1 { grid-row: 1; grid-column: matn-start / hashiya-end; }
.on-drum > .drum-note { grid-row: 2 / span 2; grid-column: hashiya; color: var(--ink); padding-top: .5em; }
/* the press opens like a title page: the imprint's name, a short rule, the place and the year */
h1.title-page { font-size: clamp(3.8rem, 9.5vw, 9rem); line-height: 1.2; max-width: none; }
:root[lang="en"] h1.title-page { line-height: .98; letter-spacing: -.015em; }
.imprint-line { grid-row: 2; grid-column: matn; margin-top: var(--s8); font-weight: 600; font-size: 1.375rem; line-height: 1.3; }
.imprint-line::before { content: ""; display: block; width: 4.5rem; height: 2px; background: var(--ink); margin-bottom: var(--s4); }
.drum-note a { white-space: nowrap; background: radial-gradient(circle, var(--ink) 1.25px, transparent 1.6px) 0 100% / 6px 3px repeat-x; padding-bottom: .15em; }
.shelf-sec { padding-top: var(--s16); padding-bottom: var(--s16); }
.shelf-hint { grid-column: matn; color: var(--graphite); font-size: var(--cap); line-height: var(--cap-lh); margin-bottom: var(--s12); }
.shelf { --shelf-h: min(58vh, 560px); --cm: calc(var(--shelf-h) / 24); position: relative; }
.shelf-track {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: none; padding-inline: var(--gutter); padding-top: 24px;
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent; cursor: grab; outline: none;
}
.shelf-track.is-dragging { cursor: grabbing; user-select: none; }
.shelf-track.is-dragging .book { pointer-events: none; }
.shelf-track::-webkit-scrollbar { height: 6px; }
.shelf-track::-webkit-scrollbar-track { background: linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat; }
.shelf-track::-webkit-scrollbar-thumb { background: var(--ink); }
.shelf-list { display: flex; align-items: flex-start; gap: clamp(16px, 3vw, 48px); width: max-content; position: relative; padding-bottom: var(--s12); }
.shelf-list::before { content: ""; position: absolute; inset-inline: 0; top: calc(var(--shelf-h) + var(--s4)); height: 2px; background: var(--ink); }
.shelf-list li { display: block; }
.book { display: grid; grid-template-rows: var(--shelf-h) auto; row-gap: calc(var(--s4) + 2px + var(--s4)); color: inherit; justify-items: start; }
.book .cover { contain: layout paint; align-self: end; width: calc(var(--w) * var(--cm)); height: calc(var(--h) * var(--cm)); transform-origin: 50% 100%; rotate: var(--lean, 0deg); transition: translate .22s var(--lift); }
.shelf.is-leaning .book .cover { will-change: rotate; }
.book-cap { width: calc(var(--w) * var(--cm)); min-width: 8.5rem; font-size: 1rem; line-height: 1.35; }
.book-cap b { display: block; font-weight: 600; font-size: 1.125rem; line-height: 1.3; }
.book-cap span { display: block; color: var(--graphite); }
.book:focus-visible { outline: none; }
.book:focus-visible .cover { outline: 2px solid var(--ink); outline-offset: 5px; }
.book:focus-visible::after { display: none; }
@media (hover: hover) and (pointer: fine) {
  .book:hover .cover { translate: 0 -6px; }
  .book:hover .book-cap b { background: radial-gradient(circle, var(--pink) 1.25px, transparent 1.6px) 0 100% / 6px 3px repeat-x; padding-bottom: .15em; }
}
.shelf-cursor { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; display: none; }
.shelf-cursor .cd { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--pink); mix-blend-mode: multiply; transition: width .2s, height .2s, margin .2s; }
.shelf-cursor.is-drag .cd { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.shelf-cursor .cl { position: absolute; top: -.75em; inset-inline-start: 14px; font-weight: 600; font-size: .9375rem; white-space: nowrap; opacity: 0; transition: opacity .2s; background: var(--paper); padding: 0 .3em; }
.shelf-cursor.is-flip .cl { inset-inline-start: auto; inset-inline-end: 14px; }
.shelf-cursor.is-label .cl { opacity: 1; }
.shelf-cursor.is-drag .cl { opacity: 0; }
.shelf.has-cursor .shelf-cursor { display: block; }

/* ---------- press: the book sheet ---------- */
.sheet {
  border: 0; padding: 0; margin: auto; width: min(1180px, calc(100vw - 2 * var(--gutter))); max-height: calc(100svh - 2 * var(--s6)); max-width: none;
  background: var(--stock); color: var(--ink); overflow: hidden; box-shadow: 0 0 0 1px rgb(28 26 23 / .14);
}
.sheet::backdrop { background: rgb(241 236 226 / .94); }
.sheet-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); max-height: calc(100svh - 2 * var(--s6)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-close { position: absolute; inset-inline-end: var(--s4); top: var(--s4); width: 44px; height: 44px; border: 0; background: var(--stock); cursor: pointer; display: grid; place-items: center; z-index: 2; }
.sheet-close svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 1.6; }
.sheet-close:hover { background: var(--ink); }
.sheet-close:hover svg { stroke: var(--paper); }
.sheet-figure {
  position: sticky; top: 0; align-self: start; height: calc(100svh - 2 * var(--s6)); display: grid; align-content: center; justify-items: center; gap: var(--s6);
  padding: var(--s12) var(--s8); background: var(--i2, var(--ink)); color: var(--on-band, var(--ink)); isolation: isolate; overflow: hidden;
}
.sheet-figure::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("../img/speckle.png") 0 0 / 220px; opacity: .45; pointer-events: none; }
.sheet-figure .textbtn { color: inherit; background-image: radial-gradient(circle, currentColor 1.25px, transparent 1.6px); }
.flip { perspective: 1800px; width: 100%; display: grid; justify-items: center; }
.flip-inner { position: relative; transform-style: preserve-3d; transition: transform .6s var(--feed); width: min(100%, calc(min(60svh, 600px) * var(--cw, 13.5) / var(--ch, 21))); }
.flip.is-back .flip-inner { transform: rotateY(180deg); }
.flip .cover { width: 100%; height: auto; backface-visibility: hidden; box-shadow: 0 0 0 1px rgb(28 26 23 / .18); }
/* on a dark panel the cover keeps its edge with a hairline of stock instead */
.band-dark .flip .cover { box-shadow: 0 0 0 1px rgb(246 242 234 / .4); }
.flip .back { position: absolute; inset: 0; transform: rotateY(180deg); backface-visibility: hidden; }
.sheet-text { display: grid; gap: var(--s6); align-content: start; padding-block: var(--s16) var(--s12); padding-inline: var(--s12) 76px; }
.sheet-text h2 { font-size: clamp(1.9rem, 3vw, 2.6rem); color: var(--title, var(--ink)); }
.sheet-author { font-size: 1.375rem; font-weight: 600; margin-top: calc(-1 * var(--s4)); }
.sheet-blurb sup.marker { color: var(--pink-deep); }
.firstline { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .6em; row-gap: var(--s2); margin-inline-start: var(--s8); max-width: 25rem; }
.firstline .marker { color: var(--pink-deep); font-weight: 600; font-size: var(--note); line-height: 1; padding-top: .7em; }
.fl-text { font-size: calc(1.45rem * var(--face, 1)); line-height: var(--face-lh, 1.5); color: var(--title, var(--ink)); }
:root[lang="en"] .fl-text { font-size: calc(1.3rem * var(--face, 1)); line-height: var(--face-lh, 1.3); }
.firstline small { grid-column: 2; font-size: var(--cap); line-height: var(--cap-lh); color: var(--graphite); font-weight: 600; }
.imprint bdi { white-space: nowrap; }
.imprint { font-size: var(--cap); line-height: var(--cap-lh); color: var(--graphite); border-top: 1px solid var(--rule); padding-top: var(--s4); }
.swatch { display: inline-block; width: 12px; height: 12px; vertical-align: -.05em; margin-inline-end: .25em; mix-blend-mode: multiply; }
.swatch + .swatch { margin-inline-start: -.3em; margin-inline-end: .5em; }
.reserve { border-top: 1px solid var(--rule); padding-top: var(--s6); display: grid; gap: var(--s4); }
.reserve h3 { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); }
.reserve h3 bdi { font-weight: 400; font-size: 1.125rem; color: var(--graphite); }
.reserve .form { gap: var(--s4); }
.reserve .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4) var(--s6); }
.reserve .btn--primary { background: var(--i2, var(--ink)); color: var(--btn-fg, var(--paper)); border-color: var(--btn-fg, var(--ink)); }
.reserve .btn--primary:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sheet-nav { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); padding-top: var(--s8); }
.sheet-nav .catchword { margin-inline-start: auto; border: 0; padding: 0; background: none; color: inherit; cursor: pointer; font-family: inherit; }
.sheet-nav .textbtn { color: var(--graphite); }
.sheet-nav .textbtn:hover { color: var(--ink); }

/* ---------- press: how a book is made ---------- */
.made { padding-top: var(--s24); padding-bottom: var(--s24); }
.sep-fig { grid-column: folio-start / hashiya-end; margin-top: var(--s12); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s6) var(--s12); align-items: end; }
.press-run { display: contents; }
.plates {
  /* two plates and the gap between them, with room left outside the empty one for its crop marks (11 of its 135 units) */
  --pw: min(calc(50svh * 13.5 / 21), calc((100vw - 2 * var(--gutter) - 32px) / 2.09), 19rem);
  position: relative; width: calc(2 * var(--pw) + 32px); display: flex; justify-content: flex-start; align-items: flex-start; isolation: isolate;
}
/* the empty half of the sheet is where the second plate goes: crop marks and a register target, in both inks */
.plates .slot { position: absolute; z-index: -1; top: 0; inset-inline-start: calc(var(--pw) + 32px); width: var(--pw); height: auto; aspect-ratio: 13.5 / 21; overflow: visible; fill: none; stroke-width: 1; }
.plates .slot * { vector-effect: non-scaling-stroke; }
.plates .crop, .plates .target { stroke: var(--ink); }
.plates .target--2 { stroke: var(--pink); mix-blend-mode: multiply; translate: 1.2px -.8px; }
/* a printer's slug under the empty plate, and a trace of the yellow left on it from the last pull */
.slot-note {
  position: absolute; z-index: -1; top: calc(100% + var(--s4)); inset-inline-start: calc(var(--pw) + 32px); width: var(--pw);
  font-size: var(--cap); line-height: var(--cap-lh); color: var(--graphite); text-align: center;
}
.plate-trace { position: absolute; z-index: -1; top: 0; inset-inline-start: calc(var(--pw) + 32px); width: var(--pw); opacity: var(--trace, .14); pointer-events: none; }
.plate-trace .cover { width: 100%; height: auto; background: none; box-shadow: none; }
.plates .cover { width: var(--pw); height: auto; overflow: visible; }
.plates.is-live::before {
  content: ""; position: absolute; top: 0; inset-inline-start: 0; width: var(--pw); aspect-ratio: 13.5 / 21; background: var(--stock);
  box-shadow: 0 0 0 1px rgb(28 26 23 / .1); translate: var(--off, 0) 0; opacity: var(--ghost, 0);
}
.register { display: grid; gap: var(--s3); align-content: end; max-width: 22rem; padding-bottom: var(--s2); }
.register label { font-weight: 600; font-size: var(--ui); }
.register input[type="range"] { width: 100%; margin: 0; height: 32px; background: transparent; cursor: pointer; appearance: none; }
.register input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
.register input[type="range"]::-moz-range-track { height: 2px; background: var(--ink); }
.register input[type="range"]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--pink); border: 0; margin-top: -9px; box-shadow: 0 0 0 1.5px var(--ink); }
.register input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--pink); border: 0; box-shadow: 0 0 0 1.5px var(--ink); }
.register input[type="range"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.reg-out { min-height: 3.2em; }
.sep-fig figcaption { grid-column: 2; max-width: 22rem; }
.no-js .register { display: none; }

/* ---------- press: contents ---------- */
.biblio { padding-top: var(--s24); padding-bottom: var(--s24); }
.cat { grid-column: folio-start / matn-end; display: grid; grid-template-columns: subgrid; }
.cat > li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; scroll-margin-top: 30svh; }
.cat-line { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: end; padding-block: var(--s3); border-top: 1px solid var(--rule); }
.cat > li:last-child .cat-line { border-bottom: 1px solid var(--rule); }
.cat-no { grid-column: 1; align-self: baseline; font-family: "Matn Skeleton"; font-size: 1.6rem; line-height: 1.2; }
.cat-line > :not(.cat-no) { grid-column: 3; grid-row: 1; }
.cat-cite { padding-inline-end: 11.5rem; font-size: 1.1875rem; line-height: 1.55; align-self: baseline; }
:root[lang="en"] .cat-cite { font-size: 1.125rem; line-height: 1.4; }
.cat-cite cite { font-style: normal; font-weight: 600; }
.cat-price { justify-self: end; align-self: end; font-size: 1.0625rem; line-height: 1.55; padding-inline-start: .5em; background: var(--paper); position: relative; z-index: 1; }
.cat-lead { justify-self: end; align-self: end; width: 11rem; height: 3px; margin-bottom: .5em; background: radial-gradient(circle, var(--pink) 1.4px, transparent 1.8px) 100% 0 / 7px 3px repeat-x; opacity: .3; transition: opacity .25s; }
:root[dir="ltr"] .cat-lead { background-position: 0 0; }
.cat-line:hover .cat-lead, .cat-line:focus-visible .cat-lead, .cat-line.is-peek .cat-lead { opacity: 1; }
.cat-line:hover cite, .cat-line.is-peek cite { background: radial-gradient(circle, var(--pink) 1.25px, transparent 1.6px) 0 100% / 6px 3px repeat-x; padding-bottom: .1em; }
.cat-line:focus-visible { outline-offset: 2px; }
.cat-line:focus-visible::after { display: none; }
.cat-peek { grid-column: hashiya; grid-row: 2 / span 3; position: sticky; top: var(--s12); display: grid; gap: var(--s3); justify-items: start; align-self: start; }
.peek-slot { justify-self: stretch; min-width: 0; }
/* sized by the margin column first, then by the screen height, so a square or wide cover never runs past the column */
.peek-slot .cover { width: min(100%, calc(min(46svh, 26rem) * var(--w) / var(--h))); height: auto; }
.peek-cap { min-height: 1.6em; }

/* ---------- reading room ---------- */
.rules-sec { padding-top: var(--s24); padding-bottom: var(--s32); }
/* the house rules are set as one block that narrows to a point, like the colophon; the height of the two shapes is fitted in JS */
.rules-tri { grid-column: matn; grid-row: 2; display: flow-root; --tri-h: 0px; --tri-in: 86%; }
.rules-tri::before, .rules::before { content: ""; width: 49.9%; height: var(--tri-h); }
.rules-tri::before { float: left; shape-outside: polygon(0 0, 0 0, var(--tri-in) 100%, 0 100%); }
.rules::before { float: right; shape-outside: polygon(100% 0, 100% 0, 100% 100%, calc(100% - var(--tri-in)) 100%); }
.rules { counter-reset: rule; text-align: center; hyphens: none; font-size: 1.5rem; line-height: 1.75; }
:root[lang="en"] .rules { font-size: 1.375rem; line-height: 1.5; }
.rules li { display: inline; counter-increment: rule; }
.rules li::before { content: counter(rule, arabic-indic); font-family: "Matn Skeleton"; font-size: 1.2em; line-height: 0; margin-inline: .35em .3em; }
:root[lang="en"] .rules li::before { content: counter(rule); margin-inline: .3em .25em; }
.rules li:first-child::before { margin-inline-start: 0; }
.rules-sec > .rules-note { grid-row: 2; align-self: start; }
.rules-sec > .rules-slant { grid-row: 2; align-self: end; margin-bottom: var(--s6); }

.programme { padding-bottom: var(--s24); scroll-margin-top: var(--s8); }
.how { grid-column: hashiya; grid-row: span 3; }
.how h3 { font-size: 1.25rem; margin-bottom: var(--s3); }
.how p, .how li { font-size: 1.0625rem; line-height: 1.6; color: var(--graphite); }
.how p { color: var(--ink); margin-bottom: var(--s3); max-width: 19rem; }
.cal-wrap { grid-column: folio-start / matn-end; margin-top: var(--s8); }
.cal-nav { display: flex; gap: var(--s6); margin-bottom: var(--s6); }
.cal-nav .textbtn { display: inline-flex; align-items: center; gap: .4em; }
.cal-nav svg { width: 9px; height: 14px; stroke: currentColor; stroke-width: 1.6; fill: none; }
:root[dir="rtl"] .cal-nav svg { scale: -1 1; }
.cal-nav [aria-current="true"] { color: var(--graphite); background: none; cursor: default; }
.poster {
  background: var(--sheet); border: 1px solid var(--ink); padding: var(--s12) var(--s8) var(--s8); position: relative; rotate: -0.6deg; max-width: 64rem;
}
.regmark { position: absolute; top: var(--s4); width: 24px; height: 24px; overflow: visible; }
.regmark--a { inset-inline-start: var(--s4); }
.regmark--b { inset-inline-end: var(--s4); }
.regmark circle, .regmark line { fill: none; stroke-width: 1; }
.rm-ink { stroke: var(--ink); }
.rm-pink { stroke: var(--pink); mix-blend-mode: multiply; translate: 1.2px -.8px; }
.poster-head { display: grid; gap: var(--s2); margin-bottom: var(--s8); }
.poster-head h3 { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3em .5em; font-weight: 400; }
.poster-head .m-name { font-size: 5rem; line-height: 1; }
:root[lang="ar"] .poster-head .m-name { line-height: 1.25; }
.poster-head .m-year { font-family: "Matn Skeleton"; font-size: 2.5rem; line-height: 1; }
.poster-head .m-hijri { color: var(--graphite); font-size: 1.125rem; }
.poster-head .m-book { font-weight: 600; font-size: 1.25rem; }
.poster-head .m-fri { display: none; color: var(--graphite); font-size: 1rem; }
.ramadan { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding-block: var(--s3); font-size: 1.0625rem; line-height: 1.6; max-width: 46rem; }
.weekdays, .month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays li { font-weight: 600; font-size: 1rem; line-height: 1.3; padding: var(--s2) var(--s2); border-bottom: 1px solid var(--ink); }
.weekdays small { display: block; font-weight: 400; font-size: .875rem; color: var(--graphite); }
.month li { min-height: 7.5rem; border-bottom: 1px solid var(--rule); border-inline-end: 1px solid var(--rule); padding: var(--s2); display: grid; align-content: start; gap: 2px; }
.month li:nth-child(7n) { border-inline-end: 0; }
.month li.blank { background: none; }
.month li.past { opacity: .55; }
.month li.fri { background: repeating-linear-gradient(-45deg, transparent 0 7px, rgb(217 210 195 / .45) 7px 8px); }
.day-num { display: flex; align-items: center; gap: 6px; }
.day-num .n { font-family: "Matn Skeleton"; font-size: 1.75rem; line-height: 1.1; }
.day-num .today { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); }
.day-hijri { font-size: .8125rem; color: var(--graphite); line-height: 1.2; }
.day-wd { display: none; }
.cal-ev { margin-top: var(--s1); font-size: .95rem; line-height: 1.25; }
.cal-ev b { font-weight: 600; display: block; text-wrap: balance; hyphens: none; }
.cal-ev bdi { color: var(--graphite); white-space: nowrap; }
.cal-ev .desc { display: none; }
.cal-after { grid-column: matn; margin-top: var(--s12); color: var(--graphite); font-size: var(--cap); line-height: var(--cap-lh); }

.card-sec { padding-top: var(--s24); padding-bottom: 0; }
.card-side { grid-column: hashiya-start / full-end; grid-row: span 3; padding-inline-end: var(--gutter); position: sticky; top: var(--s8); display: grid; gap: var(--s3); justify-items: start; min-width: 0; }
.rcard {
  width: min(420px, 100%); aspect-ratio: 85.6 / 54; container-type: inline-size; background: var(--sheet); position: relative; overflow: hidden;
  box-shadow: 0 0 0 1px rgb(28 26 23 / .16); color: var(--ink);
}
.rcard .c-speckle { position: absolute; inset: 0; background: url("../img/speckle.png") 0 0 / 220px; opacity: .55; pointer-events: none; }
.rc-in { position: absolute; inset: 7cqw 7cqw 6cqw; display: grid; grid-template-rows: auto 1fr auto auto; }
.rc-top { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 4.2cqw; line-height: 1.2; }
.rc-top svg { height: 6.4cqw; width: auto; overflow: visible; }
.rc-top .skel { fill: var(--ink); }
.rc-top .mark-dots { fill: var(--pink); mix-blend-mode: multiply; }
.rc-name { align-self: end; font-size: 13cqw; line-height: 1.25; min-width: 0; min-height: 1.25em; margin-bottom: 2.5cqw; box-shadow: 0 1px 0 rgb(28 26 23 / .28); }
:root[lang="en"] .rc-name { line-height: 1.05; min-height: 1.05em; }
.rc-name.is-bare .d-dots { opacity: 0; }
.rc-name .d-dots { translate: .4cqw -.4cqw; }
.rc-row { display: flex; justify-content: space-between; gap: 3cqw; align-items: baseline; font-size: 3.6cqw; line-height: 1.3; }
.rc-row .tag { border: 1px solid var(--ink); padding: 0 1.2cqw; margin-inline-start: 1.5cqw; }
.rc-foot { font-size: 3.2cqw; color: var(--graphite); margin-top: 1.5cqw; }
.card-form { margin-top: var(--s8); }
.card-form .checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s4); }

/* ---------- bookshop ---------- */
.started { padding-top: var(--s24); padding-bottom: var(--s24); }
/* the rooftop is a plate in the matn, its caption runs up the margin beside it */
.started .plate { grid-column: folio-start / hashiya-end; display: grid; grid-template-columns: subgrid; margin-block: var(--s2) var(--s12); }
.started .plate picture { grid-column: 3; grid-row: 1; }
.started .plate img { aspect-ratio: 5 / 4; object-fit: cover; object-position: 50% 36%; }
.started .plate figcaption { grid-column: 4; grid-row: 1; align-self: end; justify-self: start; margin: 0; writing-mode: vertical-rl; white-space: nowrap; line-height: 1.2; }
:root[dir="rtl"] .started .plate figcaption { margin-right: var(--s3); }
:root[dir="ltr"] .started .plate figcaption { margin-left: var(--s3); rotate: 180deg; }
.plate img { width: 100%; height: auto; background: var(--rule); }
.photo { opacity: 0; scale: 1.015; transition: opacity .6s var(--lift), scale .6s var(--lift); }
.photo.is-in { opacity: 1; scale: 1; }
.no-js .photo, .reduced .photo { opacity: 1; scale: 1; }

.shelves { padding-top: var(--s24); padding-bottom: var(--s24); }
/* every shelf name on the same step, however long its note */
.sx { grid-column: matn-start / hashiya-end; display: grid; grid-template-columns: subgrid; grid-auto-rows: 1fr; row-gap: var(--s4); }
.sx > li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; }
.sx-word { grid-column: 1; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.35; }
:root[lang="en"] .sx-word { line-height: 1.1; }
.sx-note { grid-column: 3; font-size: var(--note); line-height: var(--note-lh); color: var(--graphite); transition: color .3s; }
.sx > li.is-on .sx-note { color: var(--ink); }
.sx-note .link { color: var(--ink); }
.index-after { grid-column: matn; margin-top: var(--s8); color: var(--graphite); font-size: var(--cap); }

.order-sec { padding-bottom: var(--s24); }
.panel { background: var(--sheet); padding: var(--s8); box-shadow: 0 0 0 1px rgb(28 26 23 / .12); margin-top: var(--s6); }
.panel .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }

.visit { padding-bottom: var(--s24); scroll-margin-top: var(--s8); }
.hours { grid-column: hashiya; grid-row: span 4; display: grid; gap: var(--s4); align-content: start; }
.hours .hours-now { margin-top: 0; font-size: 1.25rem; }
.hours dl { display: grid; gap: var(--s3); }
.hours dt { font-weight: 600; font-size: 1.0625rem; }
.hours dd { font-size: 1.0625rem; color: var(--graphite); }
.hours .closing { font-size: var(--cap); color: var(--graphite); line-height: var(--cap-lh); }
/* the street the address names, printed in the outer margin beside it */
.opening > .plate-open { grid-column: hashiya-start / -2; grid-row: 1 / span 2; justify-self: start; width: 100%; max-width: 34rem; padding-top: calc(var(--h1) * .3); }
.plate-open img { width: 100%; height: auto; background: var(--rule); }
.plate-open figcaption { margin-top: var(--s3); max-width: 24rem; text-wrap: pretty; }

.credits { padding-bottom: 0; }
.credits p { font-size: 1.0625rem; line-height: 1.7; color: var(--graphite); margin-bottom: var(--s3); }

/* ---------- 404 ---------- */
.lost { min-height: 70svh; padding-top: var(--s12); position: relative; }
.lost-word { grid-column: matn-start / hashiya-end; position: relative; }
.lost-word svg { width: min(70vw, 40rem); height: auto; overflow: visible; }
.lost-word .skel { fill: var(--ink); }
.lost-word .dots path { fill: var(--pink); mix-blend-mode: multiply; transform-box: fill-box; transform-origin: 50% 50%; }
.lost-text { display: grid; gap: var(--s4); margin-top: var(--s16); align-content: start; grid-row: 2; }
.lost-text ul { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s8); }
/* the English is the gloss of the Arabic: same top line, in the margin, smaller and in graphite */
.lost > .lost-gloss { grid-column: hashiya; gap: var(--s3); color: var(--graphite); }
.lost-gloss h2.dotted { font-size: clamp(1.9rem, 2.6vw, 2.5rem); line-height: 1.05; letter-spacing: -.01em; color: var(--ink); padding-top: .35em; }
.lost-gloss .lead { font-size: var(--note); line-height: var(--note-lh); }
.lost-gloss p:has(.textbtn) { margin-top: var(--s2); }
.lost-gloss .textbtn { color: var(--ink); }
.lost-gloss ul { font-size: var(--note); gap: var(--s2) var(--s6); }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .newbook-cover .cover { height: 52vh; }
  .sep-fig { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .sep-fig figcaption { grid-column: 1; }
  .card-side { grid-column: hashiya; padding-inline-end: 0; }
  .rcard { width: 100%; }
  /* the margin is too narrow for the street: the plate drops under the lead, at the measure */
  .opening > .plate-open { grid-column: matn; grid-row: auto; max-width: none; padding-top: 0; margin-top: var(--s8); }
  /* the poster needs the margin too once the margin is narrow: the month's rules move above it */
  .cal-wrap { grid-column: folio-start / hashiya-end; }
  .how { grid-column: matn; grid-row: auto; margin-bottom: var(--s8); }
}
@media (max-width: 899px) {
  .poster { rotate: none; padding: var(--s12) var(--s4) var(--s6); }
  .weekdays { display: none; }
  .poster-head .m-fri { display: block; }
  .month { display: grid; grid-template-columns: minmax(0, 1fr); }
  .month li { min-height: 0; border-inline-end: 0; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--s1) var(--s4); padding-block: var(--s4); }
  .month li.blank, .month li.quiet { display: none; }
  .month li.fri { background: none; }
  .day-num, .day-wd, .day-hijri { grid-column: 1; }
  .day-wd { display: block; font-weight: 600; font-size: 1rem; line-height: 1.2; }
  .day-num .n { font-size: 2.25rem; }
  .cal-ev { grid-column: 2; grid-row: span 1; }
  .month li > .cal-ev:first-of-type { grid-row: 1; }
  .cal-ev .desc { display: block; color: var(--graphite); font-size: .95rem; margin-top: 2px; }
  .poster-head .m-name { font-size: 3.4rem; }
}
@media (max-width: 759px) {
  .hero { --wh: calc(92vw * 969 / 1196); padding-top: var(--s6); min-height: 0; }
  .hero-word, :root[lang="en"] .hero-word { grid-column: matn; justify-self: center; margin-inline-end: 0; }
  .hero-word svg { width: 100%; height: auto; }
  .hero-gloss, :root[lang="en"] .hero-gloss { grid-column: matn; grid-row: 2; padding-block: 0; margin-top: var(--s4); justify-self: stretch; text-align: start; max-width: none; }
  :root[lang="en"] .hero-controls { justify-content: flex-start; }
  .hero-cap { grid-row: 3; }
  .hero > .gloss-leader { display: none; }
  .hero h1 { grid-row: 4; margin-top: var(--s12); grid-column: matn; }
  .hero .lead { grid-row: 5; }
  .toc { grid-column: matn; }
  .toc-title, :root[lang="en"] .toc-title { font-size: 1.5rem; }
  .toc-num { font-size: 1.5rem; }
  .demo-sentence { grid-column: matn; font-size: clamp(2.3rem, 10.5vw, 3.4rem); }
  .newbook-cover { grid-column: matn; justify-self: center; }
  .newbook-cover .cover { height: auto; width: 70vw; }
  .newbook-text { grid-column: matn; padding-inline-end: 0; margin-top: var(--s8); }
  .shelf { --shelf-h: min(48vh, 400px); }
  .sheet { width: 100vw; max-height: 100svh; height: 100svh; }
  .sheet-body { max-height: 100svh; }
  .sheet-text { padding: var(--s8) var(--gutter) var(--s12); }
  .reserve .row2, .panel .row2 { grid-template-columns: 1fr; }
  .sep-fig { grid-column: matn; grid-template-columns: 1fr; margin-bottom: var(--s6); }
  .sep-fig figcaption { grid-column: 1; }
  .register { max-width: none; }
  .cat { grid-column: matn; grid-template-columns: 2.25rem minmax(0, 1fr); column-gap: var(--s3); }
  .cat > li, .cat-line { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .cat-line > :not(.cat-no) { grid-column: 2; }
  .cat-no { font-size: 1.25rem; }
  .cat-cite { padding-inline-end: 0; padding-bottom: 1.7em; font-size: 1.125rem; }
  .cat-lead { width: auto; margin-inline-end: 5rem; justify-self: stretch; }
  .cat-peek { display: none; }
  .on-drum > .drum-note { grid-row: 4; grid-column: matn; margin-top: var(--s6); }
  .next3 { grid-column: matn; grid-template-columns: 3.25rem minmax(0, 1fr); column-gap: var(--s3); }
  .next3 > li, .ev-when { grid-template-columns: subgrid; }
  .ev-when .num { font-size: 2.25rem; }
  .ev-date, .ev-body { grid-column: 2; }
  .month-sec > .note { grid-row: auto; }
  .rules { font-size: 1.3rem; }
  .rules-tri { --tri-in: 70%; }
  .rules-tri, .rules-sec > .rules-note, .rules-sec > .rules-slant { grid-row: auto; }
  .rules-sec > .rules-note { margin-top: var(--s8); }
  .rules-sec > .rules-slant { margin-top: var(--s6); }
  .card-side { grid-column: matn; grid-row: auto; position: static; margin-block: var(--s8) 0; }
  .card-form .checks { grid-template-columns: 1fr; }
  .started .plate { grid-column: matn; grid-template-columns: 1fr; margin-block: var(--s2) var(--s8); }
  .started .plate img { aspect-ratio: auto; }
  .started .plate picture, .started .plate figcaption { grid-column: 1; grid-row: auto; justify-self: start; text-align: start; max-width: none; }
  .started .plate figcaption, :root[dir] .started .plate figcaption { margin: var(--s3) 0 0; writing-mode: horizontal-tb; rotate: none; white-space: normal; line-height: var(--cap-lh); }
  .sx { grid-column: matn; grid-template-columns: 1fr; grid-auto-rows: auto; row-gap: var(--s6); }
  .sx > li { grid-template-columns: 1fr; }
  .sx-note { grid-column: 1; }
  .hours { grid-column: matn; grid-row: auto; margin-block: var(--s8) var(--s6); }
  .panel { padding: var(--s6) var(--s4); }
  .poster-head .m-name { font-size: 2.8rem; }
  .lost-text { grid-row: auto; }
  .lost > .lost-gloss { margin-top: var(--s12); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hero { --wh: 62svh; min-height: 0; }
  .sheet { width: 100vw; max-height: 100svh; height: 100svh; }
  .sheet-body { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); max-height: 100svh; }
  .sheet-figure { position: sticky; height: 100svh; padding: var(--s6); }
  .flip-inner { width: min(100%, calc(72svh * var(--cw, 13.5) / var(--ch, 21))); }
  .shelf { --shelf-h: 62svh; }
  .newbook-cover .cover { height: 82svh; }
  .plates { --pw: min(calc(70svh * 13.5 / 21), 19rem); }
}
@media (max-width: 899px) and (min-height: 501px) {
  .sheet[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .sheet-close { position: static; justify-self: end; margin: var(--s1) var(--s2); }
  .sheet-body { grid-template-columns: 1fr; grid-auto-rows: max-content; max-height: none; min-height: 0; }
  .sheet-text { padding-inline: var(--gutter); }
  .sheet-figure { position: static; height: auto; max-height: none; padding: var(--s12) var(--gutter) var(--s8); }
  .flip-inner { width: min(100%, calc(min(50svh, 30rem) * var(--cw, 13.5) / var(--ch, 21))); }
}

@media (prefers-reduced-motion: reduce) {
  .demo { height: auto; padding-block-end: var(--s16); }
  .demo-stage { position: relative; inset-block-start: auto; height: auto; min-height: 100svh; align-content: center; }
  .photo { opacity: 1; scale: 1; }
  .flip-inner { transition: none; }
}
.sheet-title:focus { outline: none; }
