/* A Letter to the Ummah
   Design system taken from hjeewa.com: black page with film grain, Lab Grotesque for
   reading, PP Neue Montreal for display, quiet greys, 12-16px radii, small arrows.
   The one difference: the frame is wide, not a narrow column. */

@font-face { font-family: "PP Neue Montreal"; src: url(/fonts/PPNeueMontreal-Book.woff2) format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "PP Neue Montreal"; src: url(/fonts/PPNeueMontreal-Medium.woff2) format("woff2"); font-weight: 500; font-display: block; }
@font-face { font-family: "Lab Grotesque"; src: url(/fonts/LabGrotesque-Regular.woff2) format("woff2"); font-weight: 300; font-display: block; }
@font-face { font-family: "Lab Grotesque"; src: url(/fonts/LabGrotesque-Italic.woff2) format("woff2"); font-weight: 300; font-style: italic; font-display: block; }
@font-face { font-family: "Lab Grotesque"; src: url(/fonts/LabGrotesque-Bold.woff2) format("woff2"); font-weight: 500; font-display: block; }

:root {
  --u: 1px;
  --black: #000;
  --page: #121212;
  --ink: #fafafa;
  --dim: #a3a3a3;
  --faint: #6b6b6b;
  --box: #1c1c1c;
  --box-2: #232323;
  --rule: #333;
  --wash: rgb(255 255 255 / 6%);
  --sans: "Lab Grotesque", "Helvetica Neue", Arial, sans-serif;
  --display: "PP Neue Montreal", "Helvetica Neue", Arial, sans-serif;
  --t-small: 14px;
  --t-body: 17px;
  --t-read: 19px;
  --t-h2: 24px;
  --t-title: clamp(34px, 4.4vw, 60px);
  --window: 1280px;
  --measure: 640px;
  --header-h: 72px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.2, 1.5, .35, 1);
}
@media (max-width: 480px) {
  :root { --t-body: 15px; --t-read: 17px; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, p, ul, li, figure, fieldset, legend, dialog, button, input, textarea { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; }
img, svg { display: block; }
[hidden] { display: none !important; }

html { color-scheme: dark; background: var(--page); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  position: relative;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: 300;
  line-height: 1.35;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#app { min-height: 100lvh; background: var(--black); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--black); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 200; top: 8px; left: 8px; width: auto; height: auto; clip: auto; padding: 8px 12px; background: #fff; color: #000; }

/* Film grain over everything, as on hjeewa.com */
.grain { position: absolute; z-index: 40; inset: 0; width: 100%; height: 100%; opacity: .16; pointer-events: none; }

/* Header */
.site-header {
  --pad: max(20px, (100% - var(--window)) / 2);
  position: fixed; z-index: 50; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: var(--header-h); padding-inline: var(--pad);
  background: var(--page);
}
.site-header::before { content: ""; position: absolute; top: 100%; left: 0; right: 0; height: 5rem; background: linear-gradient(to bottom, var(--page), transparent); pointer-events: none; }
.site-header::after { content: ""; position: absolute; bottom: 0; left: var(--pad); right: var(--pad); height: 1px; background: var(--rule); }
.brand { font-family: var(--display); font-size: 19px; font-weight: 500; letter-spacing: -.03em; color: #fff; }
.site-nav__list { display: flex; gap: 20px; }
.site-nav__list a { font-weight: 500; color: #fff; }
.site-nav__list a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Frame and bands. Wide frame; label sits in a left column on big screens. */
.frame { display: flex; flex-direction: column; width: min(100% - 40px, var(--window)); min-height: 100svh; margin-inline: auto; }
.main { flex: 1; padding-top: calc(var(--header-h) + 88px); }
.band { display: grid; grid-template-columns: 1fr; gap: 28px; }
.band + .band, .site-footer { margin-top: 96px; padding-top: 48px; border-top: 1px solid var(--rule); }
@media (min-width: 960px) {
  .band { grid-template-columns: 280px minmax(0, 1fr); gap: 48px; }
  .band--full { grid-template-columns: 1fr; gap: 28px; }
  .band--full .band__label { display: flex; align-items: baseline; gap: 16px; }
  .band--full .label-meta { margin-top: 0; }
}

.label { font-family: var(--display); font-size: var(--t-h2); font-weight: 500; line-height: 1.3; letter-spacing: -.04em; -webkit-text-stroke: .3px currentColor; }
.label-meta { margin-top: 6px; font-size: var(--t-small); color: var(--dim); font-variant-numeric: tabular-nums; }
.eyebrow { font-size: var(--t-small); color: var(--dim); max-width: 220px; line-height: 1.4; }

/* Hero */
.statement {
  max-width: 17ch;
  font-family: var(--display); font-size: var(--t-title); font-weight: 500;
  line-height: 1.02; letter-spacing: -.045em; text-wrap: balance;
}
.statement--small { font-size: clamp(30px, 3.4vw, 44px); }
.hero__intro { max-width: var(--measure); margin-top: 40px; color: var(--dim); font-size: var(--t-read); line-height: 1.45; text-wrap: pretty; }
.hero__intro p + p { margin-top: 20px; }
.hero__intro p:first-child { color: var(--ink); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.js .statement { animation: fade-in .6s ease-out .15s both; }
.js .hero__intro { animation: fade-in .6s ease-out .4s both; }
.js .hero__actions, .js .hero .eyebrow { animation: fade-in .6s ease-out .55s both; }
@keyframes fade-in { from { opacity: 0; } }

/* Buttons */
.button {
  display: inline-flex; align-items: center; gap: .55em;
  height: 48px; padding: 0 20px;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--box); color: var(--ink);
  font-weight: 500; white-space: nowrap;
  transition: background-color .15s, border-color .15s, opacity .15s, transform .2s var(--ease);
}
.button:hover { background: var(--box-2); border-color: #444; }
.button:active { transform: scale(.98); }
.button--solid { background: var(--ink); color: var(--black); border-color: var(--ink); }
.button--solid:hover { background: var(--ink); border-color: var(--ink); opacity: .86; }
.button--small { height: 40px; padding: 0 16px; border-radius: 10px; font-size: 15px; }
.button[disabled] { opacity: .5; cursor: default; }
.button .arrow { width: .7em; height: .7em; transition: transform .2s var(--ease); }
.button:hover .arrow { transform: translateX(.15em); }
.button .shuffle { width: 1em; height: 1em; transition: transform .35s var(--ease); }
.button:hover .shuffle { transform: rotate(-8deg) scale(1.08); }

.text-button { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; transition: opacity .15s; }
.text-button:hover { opacity: .7; }
.text-button--dim { color: var(--dim); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.toolbar__actions { display: flex; align-items: center; gap: 20px; }
.filter { display: inline-flex; padding: 4px; gap: 2px; border: 1px solid var(--rule); border-radius: 12px; background: var(--box); }
.filter button { height: 32px; padding: 0 14px; border-radius: 8px; color: var(--dim); font-size: 15px; transition: background-color .2s, color .2s; }
.filter button:hover { color: var(--ink); }
.filter button[aria-checked="true"] { background: var(--ink); color: var(--black); font-weight: 500; }

/* The wall of letters, slightly askew */
.wall { margin-top: 40px; columns: 4 260px; column-gap: 28px; }
.wall__item { break-inside: avoid; padding: 10px 0 18px; }
.card {
  --tilt: 0deg;
  position: relative; display: block; width: 100%; text-align: left;
  padding: 24px 24px 20px;
  border: 1px solid var(--rule); border-radius: 16px;
  background: var(--box);
  box-shadow: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 10px 30px rgb(0 0 0 / 35%);
  transform: rotate(var(--tilt));
  transition: transform .45s var(--spring), border-color .2s, background-color .2s, box-shadow .3s;
}
.card:hover, .card:focus-visible { transform: rotate(0deg) translateY(-4px) scale(1.015); border-color: #474747; background: var(--box-2); box-shadow: 0 1px 0 rgb(255 255 255 / 5%) inset, 0 18px 40px rgb(0 0 0 / 55%); z-index: 2; }
.card:focus-visible { outline-offset: 6px; }
.card__body {
  display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 16px; line-height: 1.45; color: #e6e6e6; text-wrap: pretty; white-space: pre-line;
}
.card--short .card__body { font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.22; letter-spacing: -.02em; color: var(--ink); }
.card__foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--dim); }
.card__who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__len { flex: none; font-variant-numeric: tabular-nums; }

.js .wall__item { animation: card-in .6s var(--ease) var(--delay, 0ms) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }

.wall__empty { margin-top: 32px; color: var(--dim); }

/* Skeleton while loading */
.card--ghost { height: var(--h, 180px); background: linear-gradient(100deg, var(--box) 40%, var(--box-2) 50%, var(--box) 60%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* Footer */
.footer__line { max-width: var(--measure); color: var(--dim); font-size: var(--t-read); line-height: 1.45; text-wrap: pretty; margin-bottom: 28px; }
.colophon { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4em 1.4em; margin-top: 72px; padding-bottom: 96px; font-size: var(--t-small); color: var(--dim); }
.colophon a { text-decoration: underline; text-underline-offset: 2px; }
.colophon a:hover { color: var(--ink); }

/* Sheets (dialogs) */
.sheet {
  width: min(100% - 24px, 760px); max-height: min(100dvh - 48px, 900px);
  margin: auto; padding: 0;
  border: 1px solid var(--rule); border-radius: 20px;
  background: #141414; color: var(--ink);
  box-shadow: 0 40px 120px rgb(0 0 0 / 70%);
  overflow: hidden;
}
.sheet::backdrop { background: rgb(0 0 0 / 62%); backdrop-filter: blur(10px) saturate(.8); -webkit-backdrop-filter: blur(10px) saturate(.8); }
.sheet[open] { animation: sheet-in .5s var(--ease) both; }
.sheet[open]::backdrop { animation: fade-in .3s ease-out both; }
.sheet.is-closing { animation: sheet-out .2s ease-in both; }
.sheet.is-closing::backdrop { animation: fade-out .2s ease-in both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes fade-out { to { opacity: 0; } }

.sheet__inner { max-height: inherit; overflow-y: auto; padding: 0 clamp(22px, 5vw, 56px) clamp(28px, 4vw, 44px); overscroll-behavior: contain; }
.sheet__bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 18px; margin-bottom: 12px; background: linear-gradient(#141414 70%, transparent); }
.sheet__kicker { font-size: var(--t-small); color: var(--dim); }
.close { display: grid; place-items: center; width: 36px; height: 36px; margin-right: -8px; border-radius: 50%; color: var(--dim); transition: background-color .15s, color .15s; }
.close:hover { background: var(--wash); color: var(--ink); }
.close svg { width: 14px; height: 14px; }

/* A single letter */
.letter { min-height: 200px; }
.letter__body { font-size: var(--t-read); line-height: 1.6; text-wrap: pretty; }
.letter__body p + p { margin-top: 1em; }
.letter__body.is-short { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; letter-spacing: -.025em; }
.letter__sign { margin-top: 36px; color: var(--dim); }
.letter__sign strong { color: var(--ink); font-weight: 500; }
.letter.is-swapping { animation: swap .45s var(--ease); }
@keyframes swap { 0% { opacity: 0; transform: translateY(10px); filter: blur(6px); } }

.sheet__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--rule); }
.sheet__links { display: flex; gap: 20px; font-size: 15px; }

.flag { margin-top: 24px; padding: 20px; border: 1px solid var(--rule); border-radius: 14px; background: var(--box); }
.flag__title { font-weight: 500; }
.flag__options { display: grid; gap: 10px; margin-top: 14px; color: var(--dim); font-size: 15px; }
.flag__options label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.flag__options label:has(input:checked) { color: var(--ink); }
.flag__options input { accent-color: var(--ink); }
.flag__actions { display: flex; align-items: center; gap: 20px; margin-top: 18px; }

.status { margin-top: 14px; font-size: var(--t-small); color: var(--dim); }
.status:empty { display: none; }
.status[data-state="error"] { color: #ff8a80; }

/* Writing */
.write__body {
  display: block; width: 100%; min-height: 300px; resize: vertical;
  padding: 0; border: 0; outline: 0;
  font-size: var(--t-read); line-height: 1.6; color: var(--ink);
  caret-color: var(--ink);
}
.write__body::placeholder { color: var(--faint); }
.write__body:focus-visible { outline: 0; }
.write__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.write__meta [data-words].is-ready { color: var(--ink); }

.write__who { margin-top: 36px; border: 0; }
.write__legend { margin-bottom: 18px; font-family: var(--display); font-size: 20px; font-weight: 500; letter-spacing: -.03em; }
.write__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; transition: opacity .25s; }
.write__fields.is-off { opacity: .35; pointer-events: none; }
.field label { display: block; margin-bottom: 8px; font-size: var(--t-small); color: var(--dim); }
.field input {
  width: 100%; height: 48px; padding: 0 16px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--box);
  font-size: max(16px, var(--t-body));
  transition: border-color .15s;
}
.field input::placeholder { color: var(--faint); }
.field input:focus-visible { outline: 0; border-color: var(--dim); }

.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track { position: relative; width: 44px; height: 26px; border-radius: 13px; background: #3a3a3a; transition: background-color .25s; }
.toggle__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 30%); transition: transform .3s var(--spring); }
.toggle input:checked + .toggle__track { background: var(--ink); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); background: var(--black); }
.toggle input:focus-visible + .toggle__track { outline: 1px solid var(--ink); outline-offset: 3px; }

.write__submit { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--rule); }
.write__note { font-size: 13px; color: var(--dim); max-width: 34ch; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.sent { padding: 24px 0 8px; }
.sent__line { max-width: 52ch; margin-top: 20px; color: var(--dim); font-size: var(--t-read); line-height: 1.45; }
.sent__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.sent .statement { animation: swap .6s var(--ease) both; }

/* Small screens */
@media (max-width: 640px) {
  .main { padding-top: calc(var(--header-h) + 48px); }
  .hero__actions .button { flex: 1 1 100%; justify-content: center; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter { width: 100%; }
  .filter button { flex: 1; padding: 0 6px; font-size: 14px; }
  .toolbar__actions { justify-content: space-between; }
  .wall { columns: 1; }
  .sheet { width: 100%; max-width: 100%; max-height: calc(100dvh - 12px); margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .sheet__foot .button { flex: 1 1 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Themes ---------- */
.themes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.themes button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px;
  color: var(--dim); font-size: 14px; transition: color .15s, border-color .15s, background-color .2s;
}
.themes button:hover { color: var(--ink); border-color: #4a4a4a; }
.themes button[aria-checked="true"] { color: var(--black); background: var(--ink); border-color: var(--ink); font-weight: 500; }
.themes .n { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .themes { flex-wrap: nowrap; overflow-x: auto; margin-inline: -20px; padding-inline: 20px; scrollbar-width: none; }
  .themes::-webkit-scrollbar { display: none; }
  .themes button { flex: none; }
}

.card__theme { display: block; margin-bottom: 14px; font-size: 12px; letter-spacing: .02em; color: var(--dim); }
.card__len { display: inline-flex; align-items: center; gap: 12px; }
.card__likes { display: inline-flex; align-items: center; gap: 4px; }
.card__likes svg { width: 13px; height: 13px; }

.letter__themes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.letter__themes:empty { display: none; }
.tag { height: 26px; padding: 0 11px; border: 1px solid var(--rule); border-radius: 999px; font-size: 13px; color: var(--dim); transition: color .15s, border-color .15s; }
.tag:hover { color: var(--ink); border-color: #4a4a4a; }

/* ---------- Thumbs up ---------- */
.sheet__primary { display: flex; align-items: center; gap: 10px; }
.like {
  display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--box); color: var(--dim); font-weight: 500; font-variant-numeric: tabular-nums;
  transition: color .15s, border-color .15s, background-color .15s;
}
.like svg { width: 18px; height: 18px; transition: transform .35s var(--spring); }
.like:hover { color: var(--ink); border-color: #4a4a4a; }
.like[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.like[aria-pressed="true"] svg path { fill: currentColor; fill-opacity: .18; }
.like.is-pop svg { animation: pop .5s var(--spring); }
@keyframes pop { 30% { transform: scale(1.3) rotate(-12deg); } }
@media (max-width: 640px) { .sheet__primary { width: 100%; } .sheet__primary .button { flex: 1; justify-content: center; } }

/* ---------- Writing: email ---------- */
.optional { margin-left: 8px; font-family: var(--sans); font-size: 13px; font-weight: 300; letter-spacing: 0; color: var(--dim); }
.write__email { margin-top: 32px; }
.write__email .field label { line-height: 1.45; }
.check { display: inline-flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 15px; color: var(--dim); cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box { position: relative; flex: none; width: 20px; height: 20px; border: 1px solid #555; border-radius: 6px; transition: background-color .15s, border-color .15s; }
.check__box::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--black); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .2s var(--spring); }
.check input:checked + .check__box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .check__box::after { transform: rotate(45deg) scale(1); }
.check input:checked ~ span:last-child { color: var(--ink); }
.check input:focus-visible + .check__box { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- Weekly sign-up ---------- */
.weekly__line { max-width: var(--measure); color: var(--dim); font-size: var(--t-read); line-height: 1.45; text-wrap: pretty; }
.weekly { max-width: 760px; margin-top: 28px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px; font-size: 14px; color: var(--dim); transition: color .15s, background-color .2s, border-color .15s; }
.chip:hover span { color: var(--ink); border-color: #4a4a4a; }
.chip input:checked + span { background: var(--ink); color: var(--black); border-color: var(--ink); font-weight: 500; }
.chip input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 3px; }
.weekly__row { display: flex; gap: 8px; margin-top: 18px; max-width: 520px; }
.input {
  flex: 1; min-width: 0; height: 48px; padding: 0 16px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--box);
  font-size: max(16px, var(--t-body)); transition: border-color .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus-visible { outline: 0; border-color: var(--dim); }

/* ---------- Simple pages (privacy, subscribed) ---------- */
.page { max-width: 720px; }
.page .entry { margin-top: 36px; font-size: var(--t-read); line-height: 1.55; color: var(--dim); }
.page .entry p + p, .page .entry h2 + p { margin-top: 16px; }
.page .entry h2 { margin-top: 40px; color: var(--ink); font-family: var(--display); font-size: 22px; font-weight: 500; letter-spacing: -.03em; }
.page .entry strong { color: var(--ink); font-weight: 500; }
.page .entry a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
