/* «المحظرة»: the website, and the base of the staff panel (panel/panel.css). The palette is the logo's: the lawh's
   wood, the ink, the sand, one gold accent. Arabic first: every side is a logical property (inline-start/end), so
   the same rules serve Arabic (rtl) and French or English (ltr). Fonts are the app's own, served from here (the
   CSP allows nothing else); IBM Plex Sans Arabic carries the Latin letters too. */

@font-face {
  font-family: "Amiri";
  src: url("fonts/Amiri-Bold.9d358a17fee7.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/IBMPlexSansArabic-Regular.f36223390481.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/IBMPlexSansArabic-Medium.8ec2dc1fde6b.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/IBMPlexSansArabic-SemiBold.ab61f0dde312.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --sand: #FBF6EA;       /* the page */
  --paper: #FFFDF8;      /* raised surfaces: cards, tables, forms */
  --wood-soft: #F5E9CF;  /* quiet panels */
  --wood: #EAD4A8;       /* the lawh */
  --ink: #2E1C0F;        /* text: 14.6:1 on sand */
  --ink-soft: #66482F;   /* secondary text: 7.2:1 on sand, 6.6:1 on wood-soft */
  --gold: #B8862F;       /* rules, marks and borders only, never text */
  --gold-soft: #E9CF95;
  --line: #E7D9BC;       /* hairlines */
  --danger: #962A1A;     /* 7.3:1 on paper */
  --danger-soft: #FBEDE8;
  --ok: #2F6435;
  --ok-soft: #EAF3E6;
  --focus: #8A5A12;
  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgba(74, 44, 16, 0.06), 0 6px 20px -8px rgba(74, 44, 16, 0.18);
  --shadow-l: 0 2px 4px rgba(74, 44, 16, 0.05), 0 24px 48px -20px rgba(74, 44, 16, 0.32);
  --body: "Plex Arabic", system-ui, sans-serif;
  --display: "Amiri", "Plex Arabic", serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* The Mauritanian zigzag of tents and leatherwork: a band at the top of every page. */
  --band: linear-gradient(135deg, var(--gold) 25%, transparent 25%) -5px 0 / 10px 10px,
          linear-gradient(225deg, var(--gold) 25%, transparent 25%) -5px 0 / 10px 10px,
          var(--ink);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(233, 207, 149, 0.45), transparent 70%),
    radial-gradient(40rem 24rem at 0% 0%, rgba(245, 233, 207, 0.9), transparent 70%),
    var(--sand);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}
body::before { content: ""; display: block; block-size: 6px; background: var(--band); flex: none; }

a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute;
  z-index: 30;
  inset-inline-start: 1rem;
  inset-block-start: -4rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--sand);
  border-radius: var(--radius-s);
}
.skip:focus { inset-block-start: 1rem; }

/* --- the frame -------------------------------------------------------------------------------------------- */

.site-header, main, .site-footer {
  inline-size: 100%;
  max-inline-size: 68rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1;
}
.brand img { border-radius: 12px; box-shadow: var(--shadow); background: var(--paper); }

main { flex: 1; padding-block: 1rem 3.5rem; }
/* The narrow pages (forms, the legal texts) read in one column. */
main > :where(h1, p, form, .card, .notice, ul, ol, article) { max-inline-size: 42rem; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.3; margin-block: 1.75rem 0.6rem; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.6rem); }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }
p, ul, ol { margin-block: 0 1rem; text-wrap: pretty; }
ul, ol { padding-inline-start: 1.5rem; }
li + li { margin-block-start: 0.25rem; }
strong { font-weight: 600; }

/* --- the home page ---------------------------------------------------------------------------------------- */

.hero {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  justify-items: center;
  text-align: center;
  padding-block: 1rem 2.5rem;
}
.hero-text { display: grid; justify-items: center; }
.hero h1 { font-size: clamp(3rem, 2rem + 5vw, 5rem); line-height: 1.15; margin-block: 0 0.25rem; }
.subtitle { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); color: var(--ink-soft); margin-block-end: 1.5rem; }
.hero-art { position: relative; display: grid; place-items: center; inline-size: min(70vw, 20rem); }
.hero-art::before {
  content: "";
  position: absolute;
  inset: 8% -6% -4%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(233, 207, 149, 0.85), rgba(233, 207, 149, 0));
}
.hero-logo {
  position: relative;
  inline-size: 100%;
  block-size: auto;
  border-radius: 36px;
  box-shadow: var(--shadow-l);
  transform: rotate(-2deg);
}
/* Invitation page: the hero without the art. */
.hero > h1 { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.4rem); max-inline-size: 36rem; }

@media (min-width: 760px) {
  .hero:has(.hero-art) {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    justify-items: start;
    text-align: start;
    padding-block: 3rem 4rem;
  }
  .hero:has(.hero-art) .hero-text { justify-items: start; }
  .hero:has(.hero-art) .stores { justify-content: flex-start; }
  .hero-art { justify-self: center; inline-size: min(100%, 22rem); }
}

.lawh {
  background: linear-gradient(180deg, var(--wood-soft), var(--wood) 140%);
  border-radius: var(--radius-l);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  box-shadow: inset 0 0 0 1px rgba(184, 134, 47, 0.25), var(--shadow);
}
.lawh > h2 { margin-block-start: 0; }

.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; counter-reset: feature; }
.features li {
  counter-increment: feature;
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding-block: 1rem;
  margin: 0;
  font-size: 1.1rem;
}
.features li + li { border-block-start: 1px solid rgba(184, 134, 47, 0.35); }
.features li::before {
  content: counter(feature);
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1;
  color: var(--gold);
  text-align: center;
}
@media (min-width: 760px) {
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
  .features li { grid-template-columns: 1fr; padding-block: 0.5rem; }
  .features li + li { border-block-start: 0; border-inline-start: 1px solid rgba(184, 134, 47, 0.35); padding-inline-start: 2rem; }
  .features li::before { text-align: start; font-size: 2.6rem; }
}

.stores { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-block: 0.5rem 1rem; }
.stores-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-soft);
  font-weight: 500;
}
.stores-soon::before { content: ""; inline-size: 0.5rem; block-size: 0.5rem; border-radius: 50%; background: var(--gold); }

/* --- components ------------------------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 3rem;
  padding: 0.55rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--sand);
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 2px 6px -2px rgba(46, 28, 15, 0.5);
  transition: background-color 180ms var(--ease), transform 120ms var(--ease), box-shadow 180ms var(--ease);
}
.button:hover { background: #422917; }
.button:active { transform: translateY(1px); box-shadow: none; }
.button.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 2px rgba(74, 44, 16, 0.08); }
.button.secondary:hover { background: var(--wood-soft); border-color: var(--gold-soft); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: #7C1F12; }

.card {
  background: var(--paper);
  border-radius: var(--radius-l);
  padding: 1.25rem 1.5rem;
  margin-block: 1rem;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.code {
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(1.6rem, 1rem + 3vw, 2.5rem);
  letter-spacing: 0.2em;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: center;
  margin-block: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-wrap: anywhere;
}

.notice, .draft-note {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: #FBF1DA;
  box-shadow: inset 0 0 0 1px var(--gold-soft);
  border-inline-start: 4px solid var(--gold);
}
.notice.error { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px #EFC9BE; border-inline-start-color: var(--danger); font-weight: 500; }
.error { color: var(--danger); }
.muted { color: var(--ink-soft); font-size: 0.95rem; }

form.stack { display: grid; gap: 0.5rem; max-inline-size: 26rem; margin-block-end: 1.25rem; }
form.stack label { margin-block-start: 0.5rem; }
form.stack label:first-of-type { margin-block-start: 0; }
form.stack .button { margin-block-start: 0.75rem; }
label { font-weight: 500; }
input[type="tel"], input[type="text"], input[type="password"], input[type="search"], select {
  inline-size: 100%;
  min-block-size: 3rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid #D9C6A0;
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 2px rgba(74, 44, 16, 0.06);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input:hover, select:hover { border-color: var(--gold); }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(184, 134, 47, 0.3); }
input::placeholder { color: #7E664C; } /* 5.4:1 on paper */
input.ltr { direction: ltr; text-align: start; }
[dir="rtl"] input.ltr { text-align: end; } /* a phone typed in an Arabic page lines up with its label */

/* --- the legal pages -------------------------------------------------------------------------------------- */

.legal { max-inline-size: 44rem; }
.legal h2 { padding-block-start: 1rem; border-block-start: 1px solid var(--line); }
.legal li { padding-inline-start: 0.25rem; }
.legal li::marker { color: var(--gold); }

/* --- the footer ------------------------------------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem 2rem;
  border-block-start: 1px solid var(--line);
  font-size: 0.95rem;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.footer-links a { text-decoration: none; color: var(--ink-soft); }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); }

.languages { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; }
.languages-label { color: var(--ink-soft); }
.languages button {
  font: inherit;
  font-size: 0.9rem;
  min-block-size: 2.25rem;
  padding: 0.2rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.languages button:hover { border-color: var(--gold); }
.languages button[aria-current="true"] { background: var(--ink); color: var(--sand); border-color: var(--ink); }
