@font-face {
  font-family: Archivo;
  src: url("assets/archivo-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url("assets/vazirmatn-arabic-200-normal.woff2") format("woff2");
  font-weight: 200;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #161a19;
  --paper: #f7f4ed;
  --muted: #c0bfba;
  --archive-red: #c22d31;
  --header-gutter: clamp(24px, 4.5vw, 64px);
  --directory-gutter: 64px;
  --directory-inset: max(var(--directory-gutter), calc((100% - 1440px) / 2 + var(--directory-gutter)));
  --content-gutter: var(--directory-inset);
  font-family: Archivo, Arial, sans-serif;
  background: var(--background);
  color: var(--paper);
}

:root:has(.editorial-page) { scrollbar-gutter: stable; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }

.page {
  --heading-size: clamp(2.5rem, 3.8vw, 5.25rem);
  --archive-mark-size: clamp(2.5rem, 3.8vw, 5.125rem);
  --intro-gap: clamp(.75rem, 1.05vw, 1.5rem);
  --summary-width: 34ch;
  position: relative;
  isolation: isolate;
  flex: 1;
  display: grid;
  grid-template-rows: minmax(min-content, max(8rem, 29svh)) auto 1fr;
  padding-bottom: clamp(2rem, 6svh, 5rem);
}

.hero { display: contents; }

.masthead, .teaser h1, .intro, .archive-summary, .signup { position: relative; z-index: 1; }
.masthead {
  --masthead-height: 88px;
  --wordmark-width: 184px;
  align-self: start;
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: var(--masthead-height);
  margin-inline: var(--header-gutter);
}

.hero picture { display: block; max-width: 100%; }

.wordmark {
  display: block;
  width: var(--wordmark-width);
  max-width: 100%;
  height: auto;
  transform: translateY(8%);
}

.teaser, .signup-section {
  align-self: start;
  width: min(calc(100% - var(--content-gutter) - var(--directory-inset)), clamp(26rem, 27vw, 29rem));
  margin-inline-start: var(--content-gutter);
}

.teaser { pointer-events: none; }

.teaser h1 {
  width: fit-content;
  pointer-events: auto;
  margin: 0;
  font-size: var(--heading-size);
  font-weight: 650;
  letter-spacing: -.025em;
  line-height: .94;
  line-height: 1.3cap;
  text-transform: uppercase;
}

.arabic-title {
  display: block;
  width: fit-content;
  margin-bottom: .12em;
  font-family: Vazirmatn, "Geeza Pro", Tahoma, sans-serif;
  font-size: clamp(1.4375rem, 2.25vw, 3.125rem);
  font-weight: 200;
  letter-spacing: 0;
  line-height: 1.1;
}

.intro {
  width: fit-content;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--intro-gap);
  margin-top: calc(var(--heading-size) * .45);
}

.archive-mark {
  display: block;
  flex: none;
  width: var(--archive-mark-size);
  height: auto;
}

.description {
  margin: 0;
  font-size: clamp(1.125rem, 1.65vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -.015em;
}

.archive-summary {
  max-width: var(--summary-width);
  margin: .75rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
  pointer-events: auto;
}

.signup-toggle { display: none; }
.signup-disclosure, .signup-panel, .signup-panel-scroll { display: contents; }

.signup {
  margin-top: clamp(1.5rem, 1.85vw, 2.25rem);
  font-size: .875rem;
  pointer-events: auto;
}

.signup-controls {
  width: min(100%, 21rem);
  aspect-ratio: 424 / 54;
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
  column-gap: 2.1%;
}

.signup input[type="email"] {
  width: 100%;
  min-height: 2.25rem;
  padding: .3rem .75em;
  border: 1px solid #686c68;
  border-radius: 0;
  font-size: 1rem;
  background: rgb(33 36 33 / 70%);
  color: var(--paper);
}

.signup input::placeholder { color: #adada5; opacity: 1; }
.signup input[type="email"]:focus {
  border-color: #cf3035;
  outline: none;
}

@media (forced-colors: active) {
  .signup input[type="email"]:focus { outline: 1px solid Highlight; outline-offset: 1px; }
}

.signup button {
  min-height: 2.25rem;
  padding: .375rem .625rem;
  border: 0;
  border-radius: 100px;
  background: var(--archive-red);
  color: #fff;
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1.4;
}
.signup button:hover:enabled { background: #a52329; }
.signup button:focus-visible { outline-color: var(--archive-red); }
.signup button:disabled { opacity: .7; }

.signup-note, .signup-status {
  margin: .6rem 0 0;
  color: var(--muted);
  font-size: max(.8rem, .875em);
  line-height: 1.45;
}
.signup-status { color: var(--paper); }
.signup-status:empty { margin: 0; }

.network-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  overflow: hidden;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: pan-y;
}

.network-art:focus-visible { outline-offset: -5px; }
.network-art svg {
  display: block;
  width: 100%;
  height: 100%;
  mask-image: linear-gradient(to bottom, transparent 0%, #00000008 6%, #00000026 14%, #00000066 25%, #000000b3 38%, #000 55%);
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to right, #161a19fa 0%, #161a19e8 12%, #161a19b0 24%, #161a1970 40%, #161a1900 61%);
}

.network-node { fill: #656965; transition: fill .2s; }
.network-node.is-connected { fill: #f05a5d; }
.network-node.is-source { fill: #fff; }
.network-node.is-source .network-pulse { stroke: var(--paper); stroke-width: 1.5; }
.network-hit { fill: transparent; pointer-events: all; }
.network-pulse { transform-box: fill-box; transform-origin: center; pointer-events: none; }

.network-links {
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s ease-out;
}
.network-art.is-active .network-links { opacity: 1; }
.network-links line {
  stroke: #e66568;
  stroke-width: .75px;
  stroke-opacity: .9;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  animation: draw-connection .22s ease-out both;
  animation-delay: var(--link-delay);
}
@keyframes draw-connection {
  from { stroke-dashoffset: 1; opacity: 0; }
  to { stroke-dashoffset: 0; opacity: 1; }
}

.page-footer {
  padding: clamp(1rem, 2vw, 1.75rem) 22px;
  background: #181a19;
}

.page + .page-footer {
  position: relative;
  padding-block: 6px 22px;
}

.page-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 30px;
}

.page-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: #efefec;
  font-size: .875rem;
  line-height: 1.4;
  text-decoration: none;
}

.page-footer a:hover { color: #ed666b; }
.page-footer a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: .25em;
}

.curatorial-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 24px 0 0;
  color: #b5b5af;
  font-size: .6875rem;
  line-height: 1.5;
  letter-spacing: .035em;
  text-align: center;
}

.curatorial-credit img {
  display: block;
  width: 72px;
  height: auto;
}

.page + .page-footer .curatorial-credit {
  margin-block-start: 2px;
  gap: 4px;
}

@media (width > 1100px) {
  :root { --content-gutter: max(var(--directory-inset), calc(var(--header-gutter) + 124px)); }
}

@media (max-width: 1279px) {
  .masthead { --wordmark-width: clamp(152px, 17.5vw, 184px); }
}

@media (max-width: 820px) {
  .masthead {
    --masthead-height: 72px;
    --wordmark-width: 176px;
  }
}

@media (width > 760px) {
  .page {
    --hero-lift: clamp(.875rem, calc(2.5rem - 4svh), 1.5rem);
    grid-template-rows: minmax(min-content, calc(max(8rem, 29svh) - var(--hero-lift))) auto 1fr;
  }
  .arabic-title { margin-bottom: .06em; }
  .archive-summary { margin-top: .5rem; }
  .signup { margin-top: clamp(1.6875rem, 2vw, 2.4375rem); }
}

@media (max-width: 760px) {
  :root {
    --header-gutter: 16px;
    --directory-gutter: 22px;
  }
  .page {
    --heading-size: clamp(2.25rem, 8.4vw, 3.875rem);
    display: block;
    padding: 0;
  }
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(min-content, clamp(6rem, 18svh, 9.5rem)) auto minmax(1.5rem, 1fr);
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
  }
  .masthead {
    --masthead-height: 64px;
    --wordmark-width: 144px;
  }
  .page .masthead { grid-area: 1 / 1; }
  .page .masthead, .editorial-page > .masthead {
    --masthead-height: 0px;
    --wordmark-width: clamp(12rem, 56vw, 16rem);
    max-width: calc(100% - 2 * var(--content-gutter));
    margin-top: 1.5rem;
    margin-inline: var(--content-gutter);
  }
  .page .wordmark, .editorial-page > .masthead .wordmark {
    transform: none;
  }
  .teaser {
    grid-area: 2 / 1;
    position: relative;
    z-index: 1;
  }
  .arabic-title { font-size: clamp(1.75rem, 7.7vw, 2rem); }
  .signup-section {
    position: relative;
    width: 100%;
    margin: 0;
    padding: clamp(3rem, 9svh, 5rem) var(--content-gutter) 1.5rem;
  }
  .signup { margin-top: 0; }
  .signup-controls { min-height: 44px; }
  .signup button { min-height: 44px; font-size: .875rem; }
  .page-footer nav { gap: 8px 22px; }
  .page-footer a { min-height: 40px; font-size: .8125rem; }
  .network-art svg {
    mask-image: linear-gradient(to bottom, transparent, #000 8%);
  }
  .page::before { content: none; }
  .hero::before {
    content: "";
    grid-area: 1 / 1 / 3 / 2;
    margin-bottom: clamp(-5rem, calc(23rem - 100dvh), -2.25rem);
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(
      ellipse 145% 80% at left 20%,
      #161a19d9,
      #161a19cf 36%,
      #161a19b0 61%,
      #161a1978 78%,
      #161a1935 91%,
      transparent
    );
  }
  .mobile-signup .signup-disclosure {
    --arrow-size: 48px;
    --panel-gap: .5rem;
    --visible-height: var(--signup-viewport-height, 100dvh);
    --hero-clearance: calc(max(2rem, 4.25svh) + env(safe-area-inset-bottom, 0px));
    --panel-motion: 280ms cubic-bezier(.2, .65, .3, 1);
    position: fixed;
    inset-inline: 0;
    top: var(--signup-viewport-bottom, 100dvh);
    z-index: 2;
    display: block;
    transform: translateY(-100%);
    pointer-events: none;
  }
  .mobile-signup .signup-toggle {
    display: grid;
    place-items: center;
    width: var(--arrow-size);
    height: var(--arrow-size);
    margin: 0 auto var(--hero-clearance);
    padding: 0;
    border: 1px solid rgb(247 244 237 / 17%);
    border-radius: 50%;
    background: rgb(14 17 16 / 82%);
    color: var(--paper);
    pointer-events: auto;
    transition: margin-bottom var(--panel-motion);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-signup .signup-toggle:active { background: rgb(28 32 30 / 88%); }
  .signup-toggle[aria-expanded="true"] { margin-bottom: var(--panel-gap); }
  .signup-toggle svg {
    transform: rotate(90deg);
    transition: transform var(--panel-motion);
  }
  .signup-toggle[aria-expanded="true"] svg { transform: rotate(-90deg); }
  .mobile-signup .signup-panel {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows var(--panel-motion), visibility 0s linear 280ms;
  }
  .mobile-signup .signup-toggle[aria-expanded="true"] + .signup-panel {
    grid-template-rows: 1fr;
    visibility: visible;
    transition-delay: 0s;
    pointer-events: auto;
  }
  .mobile-signup .signup-panel-scroll {
    display: block;
    min-height: 0;
    max-height: min(
      calc(var(--visible-height) * .42),
      max(4.25rem, calc(var(--signup-space-below-copy, var(--visible-height)) - var(--arrow-size) - var(--panel-gap))),
      max(0px, calc(var(--visible-height) - var(--arrow-size) - 1rem - env(safe-area-inset-top, 0px)))
    );
    overflow: auto;
    overscroll-behavior: contain;
    background: linear-gradient(to bottom, transparent, #161a19dc 1.25rem, var(--background));
  }
  .mobile-signup .signup-section { padding-block: 1.25rem .625rem; }
  .mobile-signup .signup-panel .page-footer {
    padding-block: .25rem calc(1rem + env(safe-area-inset-bottom, 0px));
    background: none;
  }
  .mobile-signup .signup-panel .curatorial-credit { gap: 4px; margin-block-start: 2px; }
}

@media (max-width: 18rem) {
  .signup-controls {
    aspect-ratio: auto;
    grid-template-columns: 1fr;
    gap: .5rem;
  }
  .signup button { justify-self: start; }
}

@media (max-width: 360px) {
  :root { --header-gutter: 12px; }
  .masthead { --wordmark-width: 136px; }
}

@media (prefers-reduced-motion: reduce) {
  .network-links, .network-node { transition: none; }
  .network-links line { animation: none; }
  .mobile-signup .signup-toggle, .signup-toggle svg, .mobile-signup .signup-panel { transition: none; }
}
