/* AMSSC. Direction: field-ready, sober. Orange comes from the logo and is used as fill, never as small text on light.
   Fonts: Barlow Condensed echoes the condensed lettering on the vest patches (CHEF DE POSTE, VOLONTAIRE).
   Dials: ENERGY 2 / RHYTHM 3 / MOTION 1. */

:root {
  --ink: #1c1b1a;
  --ink-soft: #4a4642;
  --paper: #faf7f2;
  --paper-2: #efe8dc;
  --orange: #f26a1b;
  --orange-ink: #a63f00; /* orange for text on light backgrounds, 5.9:1 on paper */
  --line: #d8cfc0;

  --f-head: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-body: "Barlow", system-ui, sans-serif;
  --hero-dir: to right;

  --s1: .5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2rem; --s5: 3rem; --s6: 5rem; --s7: 7rem;
  --r-ctl: 3px; --r-img: 6px;
  --wrap: 72rem;
}

:root[dir="rtl"] { --hero-dir: to left; }
:root[lang="ar"] { --f-head: "IBM Plex Sans Arabic", system-ui, sans-serif; --f-body: "IBM Plex Sans Arabic", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--f-body);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip; /* off-screen start positions of scroll reveals must never create a horizontal scrollbar */
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 700; line-height: 1.05; margin: 0; text-wrap: balance; }
:root[lang="ar"] h1, :root[lang="ar"] h2, :root[lang="ar"] h3 { line-height: 1.35; }
p { margin: 0; }
a { color: inherit; }

/* Controls: pointer, visible focus */
a[href], button, summary, select, label[for], [role="button"] { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--orange-ink); outline-offset: 3px; }
.hero :focus-visible, .site-footer :focus-visible, 
.join .form :focus-visible { outline-color: var(--orange-ink); }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .75rem 1rem; z-index: 20; }
.skip:focus { top: 1rem; }

/* Patch: the identity motif, a stitched label like the one on the volunteer vest */
.patch {
  display: inline-block; background: var(--orange); color: var(--ink);
  font: 700 .9rem/1 var(--f-head); letter-spacing: .06em; text-transform: uppercase;
  padding: .45rem .7rem; border-radius: 2px;
  outline: 1px dashed rgba(28, 27, 26, .6); outline-offset: -3px;
}
:root[lang="ar"] .patch { letter-spacing: 0; text-transform: none; font-size: 1rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: .7rem 1.4rem; border: 2px solid transparent; border-radius: var(--r-ctl);
  font: 600 1.05rem/1.2 var(--f-body); text-decoration: none; text-align: center;
}
.btn-primary { background: var(--orange); color: var(--ink); }
.btn-primary:hover { background: var(--paper); }
.btn-primary:active { background: var(--paper-2); }
.btn-ghost { border-color: var(--paper); color: var(--paper); }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--orange); color: var(--ink); }
.btn-line { border-color: var(--ink); color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--orange-ink); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 4.5rem; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand img { border-radius: 50%; }
.brand-text strong { display: block; font: 700 1.5rem/1 var(--f-head); }
.brand-text small { display: none; font-size: .8rem; color: var(--ink-soft); max-width: 18rem; line-height: 1.25; }
.nav { display: none; }
.nav a, .lang-btn {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 .9rem;
  font: 500 1rem var(--f-body); text-decoration: none; color: var(--ink);
}
.nav a:hover { color: var(--orange-ink); text-decoration: underline; text-underline-offset: .35em; }
.lang-btn { background: none; border: 2px solid var(--ink); border-radius: var(--r-ctl); font-weight: 600; }
.lang-btn:hover { background: var(--ink); color: var(--paper); }

.menu-btn { width: 48px; height: 48px; background: none; border: 2px solid var(--ink); border-radius: var(--r-ctl); position: relative; }
.menu-btn span, .menu-btn span::before, .menu-btn span::after { position: absolute; inset-inline: 11px; height: 2px; background: var(--ink); content: ""; }
.menu-btn span { top: 21px; inset-inline: 11px; }
.menu-btn span::before { top: -7px; inset-inline: 0; }
.menu-btn span::after { top: 7px; inset-inline: 0; }
.menu-btn[aria-expanded="true"] + .nav {
  display: flex; flex-direction: column; align-items: stretch; gap: .25rem;
  position: absolute; inset-inline: 0; top: 100%; background: var(--paper);
  padding: var(--s2) 1rem var(--s3); border-bottom: 1px solid var(--line);
}
.lang-btn { justify-content: center; margin-top: .5rem; }

@media (min-width: 62rem) {
  .menu-btn { display: none; }
  .nav { display: flex; align-items: center; gap: .25rem; }
  .lang-btn { margin: 0 0 0 .75rem; }
  :root[dir="rtl"] .lang-btn { margin: 0 .75rem 0 0; }
  .brand-text small { display: block; }
}

/* Hero */
.hero { position: relative; isolation: isolate; overflow: hidden; color: var(--paper); background: var(--ink); min-height: min(86svh, 46rem); display: flex; align-items: flex-end; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 60% 30%; z-index: -2; }
.hero::before { /* darkening only for text legibility, not decoration */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(20, 19, 18, .94) 0%, rgba(20, 19, 18, .78) 55%, rgba(20, 19, 18, .35) 100%);
}
.hero-body { padding-block: var(--s6) var(--s5); display: grid; gap: var(--s3); }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5.2rem); max-width: 14ch; }
:root[lang="ar"] .hero h1 { max-width: 16ch; font-size: clamp(2.2rem, 6.5vw, 4.2rem); }
.lead { font-size: 1.25rem; max-width: 34rem; }
@media (min-width: 48rem) {
  .hero::before { background: linear-gradient(var(--hero-dir), rgba(20, 19, 18, .92) 0%, rgba(20, 19, 18, .78) 42%, rgba(20, 19, 18, .1) 78%); }
  .hero { align-items: center; }
}

.facts { background: var(--ink); color: var(--paper); border-top: 1px solid rgba(250, 247, 242, .25); }
.facts ul { list-style: none; margin-block: 0; padding: var(--s2) 0; display: flex; flex-wrap: wrap; gap: .5rem var(--s4); font-weight: 500; }
.facts li::before { content: ""; display: inline-block; width: .65rem; height: .6rem; margin-inline-end: .6rem; background: var(--orange); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* Sections */
.section { padding-block: var(--s6); }
.section h2 { font-size: clamp(2rem, 5vw, 3.2rem); margin-block: var(--s2) var(--s3); }

/* Missions: heading column + ruled list (no cards) */
.split { display: grid; gap: var(--s5); }
.split-head p { color: var(--ink-soft); max-width: 26rem; }
@media (min-width: 62rem) {
  .split { grid-template-columns: 4fr 7fr; gap: var(--s6); }
  .split-head { position: sticky; top: 6rem; align-self: start; }
}
.mission-list { list-style: none; margin: 0; padding: 0; counter-reset: m; }
.mission-list li { border-top: 2px solid var(--ink); padding-block: var(--s3) var(--s4); display: grid; gap: .5rem; }
.mission-list li:last-child { border-bottom: 2px solid var(--ink); }
.mission-list h3 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
.mission-list p { color: var(--ink-soft); max-width: 36rem; }
@media (min-width: 48rem) {
  .mission-list li:nth-child(even) { padding-inline-start: var(--s6); }
}

/* Events */
.events { background: var(--paper-2); }
.upcoming {
  background: var(--paper); border: 2px dashed var(--ink); border-radius: var(--r-img);
  padding: var(--s4); display: grid; gap: var(--s3); align-items: center;
}
.upcoming h3 { font-size: 1.9rem; margin-bottom: .35rem; }
.upcoming p { color: var(--ink-soft); }
@media (min-width: 62rem) { .upcoming { grid-template-columns: 1fr auto; } }
.upcoming[hidden], .event-list[hidden] { display: none; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.event-list li { background: var(--paper); border-inline-start: 6px solid var(--orange); border-radius: var(--r-img); padding: var(--s4); }
.event-list h3 { font-size: 1.9rem; margin-bottom: .35rem; }
.event-list p { color: var(--ink-soft); }
.h-past { margin-top: var(--s6) !important; }

.feature { display: grid; gap: var(--s3); margin-bottom: var(--s5); }
.feature h3 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: var(--s1); }
.feature-text p { color: var(--ink-soft); max-width: 30rem; }
.feature-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s1); }
.feature-photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-img); }
.feature-photos img:first-child { grid-row: span 2; height: 100%; aspect-ratio: auto; }
@media (min-width: 62rem) {
  .feature { grid-template-columns: 4fr 8fr; gap: var(--s5); align-items: start; }
  .feature-photos { grid-template-columns: repeat(3, 1fr); }
  .feature-photos img:first-child { grid-row: span 2; }
  .feature-photos img:last-child { grid-column: span 2; aspect-ratio: 16 / 9; }
}

.past-grid { column-gap: var(--s3); columns: 1; }
@media (min-width: 40rem) { .past-grid { columns: 2; } }
@media (min-width: 62rem) { .past-grid { columns: 3; } }
.past-grid article { break-inside: avoid; margin-bottom: var(--s4); }
.past-grid img { width: 100%; border-radius: var(--r-img); margin-bottom: var(--s2); }
.past-grid h3 { font-size: 1.7rem; margin-top: var(--s1); }
.past-grid p { color: var(--ink-soft); }

/* Join: the one full-orange block, because recruiting is the goal of the page */
.join { background: var(--orange); color: var(--ink); }
.join-grid { display: grid; gap: var(--s4); align-items: center; }
.join-photo { width: min(14rem, 60%); border-radius: var(--r-img); }
.join-intro > * + * { margin-top: var(--s3); }
.join-intro p { max-width: 30rem; font-size: 1.2rem; }
.btn-paper { background: var(--paper); color: var(--ink); }
.btn-paper:hover { background: var(--ink); color: var(--paper); }
@media (min-width: 48rem) { .join-grid { grid-template-columns: auto 1fr; gap: var(--s6); } .join-photo { width: 16rem; } }

.form { background: var(--paper); border-radius: var(--r-img); padding: var(--s4); display: grid; gap: var(--s3); }
@media (min-width: 40rem) { .form { grid-template-columns: 1fr 1fr; } .form .wide { grid-column: 1 / -1; } }
.field { display: grid; gap: .4rem; align-content: start; }
label { font-weight: 600; }
label small { font-weight: 400; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: .65rem .8rem; font: inherit; color: var(--ink);
  background: #fff; border: 2px solid var(--ink-soft); border-radius: var(--r-ctl);
}
textarea { resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: #a50e0e; }
.err { color: #a50e0e; font-weight: 600; font-size: .95rem; }
.err::before { content: "! "; }
.consent label { display: flex; gap: .6rem; align-items: start; cursor: pointer; }
.consent input { margin-top: .35rem; width: 1.2rem; height: 1.2rem; flex: none; accent-color: var(--orange-ink); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.result { padding: var(--s3); background: var(--paper-2); border-inline-start: 6px solid var(--ink); border-radius: var(--r-ctl); display: grid; gap: var(--s2); }
.result[hidden], .err[hidden] { display: none; }

/* Footer */
.site-footer { background: var(--ink); color: var(--paper); padding-block: var(--s5) var(--s3); }
.foot { display: grid; gap: var(--s4); }
.foot-id { display: flex; align-items: center; gap: var(--s2); max-width: 24rem; }
.foot-id img { border-radius: 50%; }
.foot-id strong { font: 700 1.3rem/1.15 var(--f-head); }
address { font-style: normal; display: grid; gap: .4rem; }
.site-footer a { text-underline-offset: .25em; }
.site-footer a:hover { color: var(--orange); }
.social { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.social a, address a { display: inline-block; padding-block: .6rem; }
.legal { margin-top: var(--s4); padding-top: var(--s2); border-top: 1px solid rgba(250, 247, 242, .25); font-size: .9rem; }
@media (min-width: 62rem) { .foot { grid-template-columns: 1.4fr 1fr 1fr; align-items: start; } }

/* Objectives, achievements, partners (text from the association's own document) */
.goals { margin-top: var(--s6); padding-top: var(--s5); border-top: 2px solid var(--ink); display: grid; gap: var(--s2) var(--s6); }
.goals h2 { margin-block: 0 var(--s1); }
.goals-intro { color: var(--ink-soft); max-width: 26rem; }
.goal-list { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s2); }
.goal-list li { position: relative; padding-inline-start: 1.75rem; max-width: 40rem; }
.goal-list li::before { content: ""; position: absolute; inset-inline-start: 0; top: .6em; width: .75rem; height: .68rem; background: var(--orange); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
@media (min-width: 62rem) {
  .goals { grid-template-columns: 4fr 7fr; grid-template-rows: auto 1fr; }
  .goals h2 { grid-area: 1 / 1; }
  .goals-intro { grid-area: 2 / 1; align-self: start; }
  .goal-list { grid-area: 1 / 2 / 3 / 3; margin-top: 0; }
}

.achievements { background: var(--ink); color: var(--paper); }
.ach-main { font: 700 clamp(1.9rem, 4.6vw, 3.4rem)/1.12 var(--f-head); max-width: 24ch; margin-bottom: var(--s5); text-wrap: balance; }
:root[lang="ar"] .ach-main { line-height: 1.4; max-width: 28ch; }
.ach-more { display: grid; gap: var(--s3); border-top: 3px solid var(--orange); padding-top: var(--s3); }
.ach-more p { max-width: 30rem; font-size: 1.15rem; }
@media (min-width: 48rem) { .ach-more { grid-template-columns: 1fr 1fr; gap: var(--s5); } }

.partner-cols { display: grid; gap: var(--s4); }
.partner-cols h3 { font-size: 1.7rem; margin-bottom: var(--s1); }
.partner-cols ul { list-style: none; margin: 0; padding: 0; }
.partner-cols li { border-top: 1px solid var(--ink-soft); padding-block: .8rem; }
.partner-cols li:last-child { border-bottom: 1px solid var(--ink-soft); }
@media (min-width: 48rem) { .partner-cols { grid-template-columns: 1fr 1fr; gap: var(--s5); } }

/* Rejoindre page: two choices, the photo wipes in on hover, keyboard focus and selection */
.rj { padding-bottom: var(--s5); }
.rj h1 { font-size: clamp(2.2rem, 6vw, 4rem); margin-block: var(--s2) var(--s2); max-width: 18ch; }
.rj-lead { color: var(--ink-soft); font-size: 1.15rem; }
.choices { display: grid; gap: var(--s3); margin-top: var(--s5); }
@media (min-width: 48rem) { .choices { grid-template-columns: 1fr 1fr; } }
.choice {
  position: relative; isolation: isolate; overflow: hidden; min-height: 22rem; padding: var(--s4);
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: var(--s2);
  border: 2px solid var(--ink); border-radius: var(--r-img); background: var(--paper); color: var(--ink);
  transition: color .45s, border-color .45s;
}
.choice-img {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover;
  clip-path: inset(100% 0 0 0); transform: scale(1.12);
  transition: clip-path .8s cubic-bezier(.65, 0, .25, 1), transform 1.2s cubic-bezier(.2, .7, .2, 1);
}
.choice::after { /* darkening only so the text stays readable over the photo */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .5s;
  background: linear-gradient(to top, rgba(20, 19, 18, .94), rgba(20, 19, 18, .6) 65%, rgba(20, 19, 18, .45));
}
.choice h2 { font-size: clamp(2rem, 4.2vw, 2.9rem); margin: 0; }
.choice p { color: var(--ink-soft); max-width: 24rem; transition: color .45s; }
.choice-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: start; }
.choice-btn::before { content: ""; position: absolute; inset: 0; } /* the whole card is the click target */
.choice-btn:focus-visible { outline: none; }
.choice:has(.choice-btn:focus-visible) { outline: 3px solid var(--orange-ink); outline-offset: 4px; }
.choice.is-open, .choice:has(.choice-btn:focus-visible) { color: var(--paper); border-color: var(--ink); }
.choice.is-open p, .choice:has(.choice-btn:focus-visible) p { color: var(--paper); }
.choice.is-open .choice-img, .choice:has(.choice-btn:focus-visible) .choice-img { clip-path: inset(0); transform: none; }
.choice.is-open::after, .choice:has(.choice-btn:focus-visible)::after { opacity: 1; }
@media (hover: hover) {
  .choice:hover { color: var(--paper); }
  .choice:hover p { color: var(--paper); }
  .choice:hover .choice-img { clip-path: inset(0); transform: none; }
  .choice:hover::after { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .choice, .choice-img, .choice::after, .choice p { transition: none; } }

.panel { background: var(--orange); color: var(--ink); padding-block: var(--s6); scroll-margin-top: 4.5rem; }
.panel[hidden] { display: none; }
.panel-grid { display: grid; gap: var(--s4); }
.panel-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s1); align-content: start; }
.panel-strip img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-img); }
.panel-form h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: var(--s1); }
.panel-form > p { margin-bottom: var(--s3); max-width: 34rem; font-size: 1.1rem; }
.panel-form h2:focus { outline: none; }
@media (min-width: 62rem) {
  .panel-grid { grid-template-columns: 5fr 7fr; gap: var(--s6); align-items: start; }
  .panel-strip { grid-template-columns: 1fr 1fr; }
  .panel-strip img:first-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: no-preference) {
  /* Photos are dealt in one after another each time a panel opens (display:none restarts the animation) */
  .panel-strip img { animation: unveil .9s cubic-bezier(.65, 0, .25, 1) both; animation-delay: calc(.1s + var(--i, 0) * .15s); }
  .panel-form { animation: rise .7s cubic-bezier(.2, .7, .2, 1) .25s both; }
}
@keyframes unveil { from { clip-path: inset(0 0 100% 0); transform: scale(1.08); } to { clip-path: inset(0); transform: none; } }

/* Motion (MOTION 2). Purpose: show where the eye should go next as sections arrive; nothing loops.
   Only runs when JS added .js and the visitor has not asked for reduced motion. */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: var(--orange); transform-origin: 0 50%; transform: scaleX(0); z-index: 30; pointer-events: none; }
:root[dir="rtl"] .progress { transform-origin: 100% 50%; }

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1), clip-path .9s cubic-bezier(.65, 0, .25, 1); transition-delay: calc(var(--i, 0) * 90ms); }
  .js [data-reveal="rise"] { opacity: 0; transform: translateY(1.5rem); }
  .js [data-reveal="slide"] { opacity: 0; transform: translateX(var(--dx, -2rem)); }
  :root[dir="rtl"] { --dx: 2rem; }
  .js [data-reveal="wipe"] { clip-path: inset(0 0 100% 0); transform: scale(1.06); }
  .js [data-reveal].is-in { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }

  /* Hero plays once on load */
  .js .hero-body > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.15s + var(--h, 0) * .12s); }
  .js .hero-body > :nth-child(2) { --h: 1; }
  .js .hero-body > :nth-child(3) { --h: 2; }
  .js .hero-img { transform: translate3d(0, var(--py, 0px), 0) scale(1.12); animation: settle 1.6s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(1.5rem); } }
@keyframes settle { from { scale: 1.08; } }
