@font-face { font-family: "Markazi"; src: url("../fonts/markazi-text-arabic-wght.woff2") format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Markazi"; src: url("../fonts/markazi-text-latin-wght.woff2") format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Matn Skeleton"; src: url("../fonts/matn-skeleton-ar.woff2") format("woff2"); font-display: block; unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D; }
@font-face { font-family: "Matn Skeleton"; src: url("../fonts/matn-skeleton-la.woff2") format("woff2"); font-display: block; unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201D, U+2026; }
@font-face { font-family: "Matn Dots"; src: url("../fonts/matn-dots-ar.woff2") format("woff2"); font-display: block; unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D; }
@font-face { font-family: "Matn Dots"; src: url("../fonts/matn-dots-la.woff2") format("woff2"); font-display: block; unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201D, U+2026; }

:root {
  --paper: #F1ECE2;
  --sheet: #FAF7F0;
  --ink: #1C1A17;
  --graphite: #5E5A52;
  --rule: #D9D2C3;
  --pink: #FF48B0;
  --pink-deep: #C2187A;
  --error: #B3261E;
  --stock: #F6F2EA;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px; --s16: 64px; --s24: 96px; --s32: 128px; --s48: 192px;
  --gutter: clamp(16px, 4vw, 56px);
  --settle: cubic-bezier(.3, 1.35, .45, 1);
  --feed: cubic-bezier(.65, 0, .35, 1);
  --lift: cubic-bezier(.25, .46, .45, .94);
  --measure: 36rem;
  --body: 1.375rem; --body-lh: 1.85;
  --lead: 1.625rem; --lead-lh: 1.75;
  --note: 1.0625rem; --note-lh: 1.7;
  --ui: 1.125rem;
  --cap: 1rem; --cap-lh: 1.6;
  --h1: clamp(2.4rem, 5.2vw, 4.75rem); --h1-lh: 1.3; --h1-ls: 0;
  --h2: clamp(1.9rem, 3.4vw, 2.9rem); --h2-lh: 1.35;
  --h3: 1.5rem; --h3-lh: 1.5;
  color-scheme: light;
}
:root[lang="en"] {
  --measure: 34rem;
  --body: 1.25rem; --body-lh: 1.5;
  --lead: 1.5rem; --lead-lh: 1.42;
  --note: 1rem; --note-lh: 1.45;
  --ui: 1.0625rem;
  --cap: .9375rem; --cap-lh: 1.4;
  --h1: clamp(2.25rem, 4.8vw, 4.5rem); --h1-lh: 1.02; --h1-ls: -0.01em;
  --h2: clamp(1.75rem, 3vw, 2.6rem); --h2-lh: 1.12;
  --h3: 1.375rem; --h3-lh: 1.25;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: clamp(15px, calc(11.5px + .44vw), 19px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: rgb(28 26 23 / .35) transparent; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }
body {
  margin: 0; min-height: 100svh; background: var(--paper); color: var(--ink);
  font-family: "Markazi", serif; font-size: var(--body); line-height: var(--body-lh); font-weight: 400;
  font-synthesis: none; font-kerning: normal; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* the grain is black at a very low opacity: it prints the same pixels a multiplied grey tile would, without a blend layer over the whole page as it scrolls */
body::before { content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; background: url("../img/grain-ink.png"); opacity: .0174; }
::selection { background: var(--pink); color: var(--ink); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgb(28 26 23 / .35); }
::-webkit-scrollbar-track { background: transparent; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
p, li, dd { text-wrap: pretty; }

/* links: a row of round pink dots */
a { color: inherit; text-decoration: none; }
.link, .prose a, .note a {
  background: radial-gradient(circle, var(--pink) 1.25px, transparent 1.6px) 0 100% / 6px 3px repeat-x;
  padding-bottom: .18em; transition: background-position .4s var(--lift);
}
.link:hover, .link:focus-visible, .prose a:hover, .prose a:focus-visible, .note a:hover { background-position: 6px 100%; }
:root[dir="rtl"] .link:hover, :root[dir="rtl"] .link:focus-visible, :root[dir="rtl"] .prose a:hover, :root[dir="rtl"] .note a:hover { background-position: -6px 100%; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
a:focus-visible, button:focus-visible { position: relative; }
a:focus-visible::after, button:focus-visible::after {
  content: ""; position: absolute; inset-inline-start: -13px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--pink); pointer-events: none;
}

.skip { position: absolute; inset-inline-start: var(--gutter); top: -100px; z-index: 200; background: var(--ink); color: var(--paper); padding: .4em 1em; font-weight: 600; }
.skip:focus { top: 12px; }

/* header */
.site-head {
  height: 76px; display: flex; align-items: center; justify-content: space-between; gap: var(--s6);
  padding-inline: var(--gutter); background: var(--paper); position: relative; z-index: 10;
  box-shadow: inset 0 -1px 0 rgb(28 26 23 / .12);
}
.logo { display: block; view-transition-name: mark; }
.logo svg { height: 40px; width: auto; overflow: visible; }
.logo .skel { fill: var(--ink); }
.logo .mark-dots { fill: var(--pink); mix-blend-mode: multiply; }
.nav { display: flex; gap: clamp(14px, 2.4vw, 36px); font-weight: 600; font-size: var(--ui); line-height: 1; }
.nav a { position: relative; padding-block: 10px; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: 50%; bottom: 0; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--pink); }
.nav a:hover { color: var(--graphite); }
.nav .lang { font-weight: 600; }

/* the glossed page */
.page {
  display: grid;
  grid-template-columns:
    [full-start] var(--gutter)
    [folio-start] minmax(3rem, 5.5rem) [folio-end]
    var(--s8)
    [matn-start] minmax(0, var(--measure)) [matn-end]
    var(--s16)
    [hashiya-start] minmax(11rem, 19rem) [hashiya-end]
    minmax(0, 1fr)
    var(--gutter) [full-end];
  align-items: start;
}
.page > * { grid-column: matn; min-width: 0; }
.page > .spread { grid-column: full; }
.page > .note, .page > .side { grid-column: hashiya; }
.page > .wide { grid-column: matn-start / hashiya-end; }
.sec-head { display: contents; }
.sec-head > h2 { grid-column: matn; }
.folio {
  grid-column: folio; align-self: baseline; font-family: "Matn Skeleton"; font-size: 2rem; line-height: 1;
  font-weight: 400; color: var(--ink); white-space: nowrap; font-variant-numeric: lining-nums;
}
.page > h2, .sec-head > h2 { align-self: baseline; }
h2 { font-weight: 600; font-size: var(--h2); line-height: var(--h2-lh); text-wrap: balance; }
h3 { font-weight: 600; font-size: var(--h3); line-height: var(--h3-lh); }
.prose > p + p, .page > p + p { margin-top: 0; }
.page > p { margin-bottom: var(--s6); }
/* justified only where the measure is long enough to hide the spacing */
@media (min-width: 760px) { :root[lang="ar"] .matn-p { text-align: justify; text-justify: inter-word; } }
.lead { font-size: var(--lead); line-height: var(--lead-lh); }
.caption { font-size: var(--cap); line-height: var(--cap-lh); color: var(--graphite); }

.note { font-size: var(--note); line-height: var(--note-lh); color: var(--graphite); padding-top: .35em; }
.note .marker, sup.marker { color: var(--pink-deep); }
sup.marker { font-size: .62em; line-height: 0; vertical-align: .55em; padding-inline: .08em; font-weight: 600; }
.note .marker { font-weight: 600; margin-inline-end: .3em; }
.note--slant { rotate: -6deg; transform-origin: top right; max-width: 15rem; text-wrap: balance; color: var(--ink); font-weight: 600; font-size: calc(var(--note) * 1.12); }
:root[dir="ltr"] .note--slant { rotate: 6deg; transform-origin: top left; }
.note--slant::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pink); margin-inline-end: .45em; vertical-align: .2em; }

/* dotted headings: two fonts, two inks */
.dotted { display: grid; font-weight: 400; }
.dotted > span { grid-area: 1 / 1; }
/* no Latin ligatures: an fi would swallow the i's own tittle */
.d-skel, .d-dots { font-variant-ligatures: none; }
.d-skel { font-family: "Matn Skeleton"; }
.d-dots { font-family: "Matn Dots"; color: var(--pink); mix-blend-mode: multiply; translate: .02em -.015em; pointer-events: none; user-select: none; }
.d-skel .w, .d-dots .w { display: inline-block; }
h1.dotted { font-size: var(--h1); line-height: var(--h1-lh); letter-spacing: var(--h1-ls); max-width: 18ch; text-wrap: balance; }
:root[lang="en"] h1.dotted { max-width: 20ch; }
.dotted.folio { display: inline-grid; }
/* one section a page is headed in the display face, like a notice pinned to the stair door */
h2.h2-ink { font-weight: 400; font-size: clamp(2.5rem, 4.6vw, 4.3rem); line-height: 1.3; }
:root[lang="en"] h2.h2-ink { font-size: clamp(2.3rem, 4.3vw, 4rem); line-height: 1.02; letter-spacing: -.01em; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5em; border: 1.5px solid var(--ink); border-radius: 0; background: var(--paper);
  color: var(--ink); padding: .55em 1.1em; font-weight: 600; font-size: var(--ui); line-height: 1.2; cursor: pointer;
  transition: background-color .22s, color .22s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--pink); color: var(--ink); border-color: var(--ink); }
.btn--primary:focus-visible { outline-offset: 4px; }
.btn[aria-busy="true"] { pointer-events: none; }
.textbtn {
  border: 0; padding: 4px 0; background: none; cursor: pointer; font-weight: 600; font-size: var(--ui); line-height: 1.3;
  background: radial-gradient(circle, var(--pink) 1.25px, transparent 1.6px) 0 100% / 6px 3px repeat-x; padding-bottom: .2em;
  transition: background-position .4s var(--lift);
}
.textbtn:hover { background-position: 6px 100%; }

/* forms */
.form { display: grid; gap: var(--s6); }
.field { display: grid; gap: var(--s2); }
.field > label, legend { font-weight: 600; font-size: var(--ui); line-height: 1.3; }
.hint { font-size: var(--cap); line-height: var(--cap-lh); color: var(--graphite); }
.input {
  width: 100%; border: 0; border-radius: 0; background: transparent; padding: .35em 0 .3em; font-size: 1.25rem; line-height: 1.5;
  min-height: 48px; box-shadow: inset 0 -1.5px 0 var(--ink); transition: box-shadow .22s var(--lift);
}
:root[lang="en"] .input { font-size: 1.1875rem; }
.input:hover { box-shadow: inset 0 -2.5px 0 var(--ink); }
textarea.input { min-height: 6.5em; resize: vertical; padding: .4em .1em; line-height: 2rem; background: repeating-linear-gradient(transparent 0 calc(2rem - 1px), var(--rule) calc(2rem - 1px) 2rem) 0 .4em / 100% 2rem local; box-shadow: inset 0 -1.5px 0 var(--ink); }
.input:focus { outline: none; }
.input:focus-visible { outline: none; box-shadow: inset 0 -3px 0 var(--ink); background-image: radial-gradient(circle, var(--pink) 3px, transparent 3.5px); background-size: 8px 8px; background-repeat: no-repeat; background-position: 100% 50%; }
:root[dir="ltr"] .input:focus-visible { background-position: 0 50%; }
:root[dir="rtl"] .input:focus-visible { padding-right: 16px; }
:root[dir="ltr"] .input:focus-visible { padding-left: 16px; }
textarea.input:focus-visible { background: repeating-linear-gradient(transparent 0 calc(2rem - 1px), var(--rule) calc(2rem - 1px) 2rem) 0 .4em / 100% 2rem local; padding-inline-start: .1em; }
.input[aria-invalid="true"] { box-shadow: inset 0 -2.5px 0 var(--error); }
.err { color: var(--error); font-size: var(--cap); line-height: 1.45; font-weight: 600; }
.err:empty { display: none; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s2); min-width: 0; }
.choice { display: flex; align-items: center; gap: .6em; min-height: 40px; font-size: var(--ui); line-height: 1.35; cursor: pointer; }
.choice input { appearance: none; margin: 0; width: 22px; height: 22px; border: 1.5px solid var(--ink); background: transparent; flex: none; display: grid; place-items: center; cursor: pointer; }
.choice input[type="radio"] { border-radius: 50%; }
.choice input::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); mix-blend-mode: multiply; scale: 0; translate: 0 -7px; opacity: 0; transition: scale .3s var(--settle), translate .42s var(--settle), opacity .15s; }
.choice input:checked::before { scale: 1; translate: 1px -1px; opacity: 1; }
.choice input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.choice input[aria-invalid="true"] { border-color: var(--error); }
/* a field that still needs something gets a dot, printed in red, beside its label */
.field:has(> .input[aria-invalid="true"]) > label::before,
fieldset:has([aria-invalid="true"]) > legend::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--error);
  margin-inline-end: .5em; vertical-align: .14em; animation: err-dot .52s var(--settle) both;
}
@keyframes err-dot { from { translate: 0 -14px; opacity: 0; } }
.done { display: grid; gap: var(--s4); justify-items: start; }
.done:focus { outline: none; }
.done h3 { font-size: var(--h3); }
.counter { font-size: var(--cap); color: var(--graphite); justify-self: end; }

/* catchword */
/* the catchword sits under the last line of the matn, with the folio of the page it leads to */
.catchword-row { margin-top: var(--s8); }
.catchword { grid-column: matn; justify-self: end; font-weight: 600; font-size: 1.5rem; line-height: 1.4; display: inline-flex; align-items: baseline; gap: .6em; }
.cw-word { position: relative; display: inline-block; padding-bottom: 18px; }
.catchword .cw-dot { position: absolute; inset-inline-end: .02em; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); transition: translate .52s var(--settle); }
.cw-no { font-family: "Matn Skeleton"; font-weight: 400; font-size: 1.25rem; color: var(--graphite); }
.catchword:hover .cw-dot, .catchword:focus-visible .cw-dot { translate: 0 6px; }

/* the colophon */
.colophon { padding: var(--s32) var(--gutter) var(--s12); position: relative; z-index: 1; }
.colophon-text { display: grid; justify-items: center; text-align: center; font-size: 1.125rem; line-height: 1.85; hyphens: none; }
.colophon-text[lang="en"], :root[lang="en"] .colophon-text { font-size: 1.0625rem; line-height: 1.6; }
.colophon-text .cl { display: block; white-space: nowrap; }
.colophon-text .cl:nth-last-child(2) { margin-top: .35em; }
.colophon-text .end { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); margin-top: .55em; }
.colophon-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s8); margin-top: var(--s16);
  font-size: .9375rem; line-height: 1.5; color: var(--graphite);
}
.colophon-row ul { display: flex; flex-wrap: wrap; gap: 0 var(--s6); }
.colophon-row a { display: inline-flex; align-items: center; min-height: 44px; }
.colophon-row a:hover { color: var(--ink); }
.colophon-row .credit { margin-inline-start: auto; }

noscript p, .noscript { grid-column: matn; font-size: var(--cap); color: var(--graphite); padding-top: var(--s4); }

/* loader */
.loader { position: fixed; inset: 0; z-index: 300; background: var(--sheet); display: grid; place-items: center; }
.loader svg { width: 64px; height: 64px; overflow: visible; grid-area: 1 / 1; }
.loader circle, .loader line { fill: none; stroke-width: 1.5; }
.loader .reg-ink { stroke: var(--ink); }
.loader .reg-pink { stroke: var(--pink); mix-blend-mode: multiply; }
.loader .skipbtn { position: absolute; inset-inline-end: var(--gutter); bottom: var(--gutter); }
html.no-loader .loader, .no-js .loader { display: none; }

/* page transition: the sheet feeds through */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 300ms cubic-bezier(.55, 0, .675, .19) both sheet-out; }
::view-transition-new(root) { animation: 420ms var(--settle) both sheet-in; }
::view-transition-group(mark) { animation-duration: 0s; }
@keyframes sheet-out { to { translate: 5vw 0; opacity: 0; } }
@keyframes sheet-in { from { translate: -3vw 0; opacity: 0; } }
:root[dir="rtl"]::view-transition-old(root) { animation-name: sheet-out-rtl; }
:root[dir="rtl"]::view-transition-new(root) { animation-name: sheet-in-rtl; }
@keyframes sheet-out-rtl { to { translate: -5vw 0; opacity: 0; } }
@keyframes sheet-in-rtl { from { translate: 3vw 0; opacity: 0; } }

@media (max-width: 1199px) {
  .page {
    grid-template-columns:
      [full-start] var(--gutter)
      [folio-start] 2.5rem [folio-end]
      var(--s6)
      [matn-start] minmax(0, var(--measure)) [matn-end]
      var(--s8)
      [hashiya-start] minmax(10rem, 15rem) [hashiya-end]
      0
      var(--gutter) [full-end];
  }
  .folio { font-size: 1.6rem; }
}
@media (max-width: 759px) {
  .page {
    grid-template-columns: [full-start] var(--gutter) [folio-start matn-start hashiya-start] minmax(0, 1fr) [folio-end matn-end hashiya-end] var(--gutter) [full-end];
  }
  .sec-head { display: flex; align-items: baseline; gap: .35em; grid-column: matn; }
  .folio { font-size: 1.25rem; }
  .page > .note:not(.keep) {
    margin-top: var(--s3); margin-bottom: var(--s6); padding-inline-start: var(--s6); position: relative; padding-top: 0;
  }
  .page > p + .note:not(.keep) { margin-top: calc(var(--s3) - var(--s6)); }
  .page > .note:not(.keep)::before { content: ""; position: absolute; inset-inline-start: calc(var(--s6) - 14px); top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
  .page > .note--slant::before { display: none; }
  .site-head { height: 60px; }
  .logo svg { height: 32px; }
}
@media (max-width: 759px) {
  .colophon-text { font-size: clamp(.95rem, 4.1vw, 1.125rem); }
  .colophon-row { justify-content: flex-start; }
  .colophon-row ul { gap: 0 var(--s4); }
  .colophon-row .credit { margin-inline-start: 0; flex-basis: 100%; order: 3; }
}
@media (max-width: 419px) {
  .site-head { height: auto; flex-wrap: wrap; padding-block: 12px 4px; row-gap: 4px; }
  .nav { width: 100%; justify-content: space-between; font-size: 15px; gap: 0; }
  .nav a { padding-block: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  .loader { display: none; }
}
.nobr { white-space: nowrap; }
