/* ═══════════════════════════════════════════════════════════
   07 · لوحة البادجات + نافذة «قصة البادج»
   ═══════════════════════════════════════════════════════════ */

/* اللوحة واقفة على الأرض بجانب الطريق (الألوان في zones.css) */
.z-board .land { padding-inline: var(--pad); }
.boardwrap {
  position: relative; z-index: 10;
  display: grid; gap: clamp(16px, 3svh, 34px);
  inline-size: min(1040px, calc(100vw - var(--strip) * .86 - var(--pad)));
}
.board__head .title { margin: 0; font-size: clamp(1.6rem, min(5vw, 7svh), 4.6rem); }

.board {
  position: relative;
  padding: clamp(9px, 1.3vw, 17px);
  border-radius: 26px;
  background: linear-gradient(180deg, #3D3734 0%, #24201E 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .1), 0 40px 80px rgb(0 0 0 / .55);
}
.board__label {
  position: absolute; z-index: 5; top: 0; left: 50%; translate: -50% -50%;
  padding: .5em 2em; border: 1px solid rgb(255 255 255 / .15); border-radius: 8px;
  background: #2B2725;
  font: 700 .76rem/1.5 var(--mono); white-space: nowrap;
  box-shadow: 0 6px 14px rgb(0 0 0 / .45);
}
html[lang="en"] .board__label { letter-spacing: .1em; }
.board__label::before, .board__label::after {
  content: ""; position: absolute; top: 50%; translate: 0 -50%;
  inline-size: 5px; block-size: 5px; border-radius: 50%; background: #8E877F;
}
.board__label::before { left: 9px; }
.board__label::after { right: 9px; }

.cork {
  position: relative;
  block-size: clamp(440px, 66svh, 640px);
  border-radius: 14px; overflow: hidden;
  background-color: #5B4634;
  background-image:
    radial-gradient(rgb(0 0 0 / .24) 1px, transparent 1.5px),
    radial-gradient(rgb(255 220 170 / .12) 1px, transparent 1.5px),
    radial-gradient(rgb(0 0 0 / .14) 1.4px, transparent 1.8px);
  background-size: 7px 7px, 11px 11px, 17px 17px;
  background-position: 0 0, 3px 5px, 8px 2px;
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / .5), inset 0 10px 44px rgb(0 0 0 / .6);
  touch-action: pan-y;
}
.rail {
  position: absolute; z-index: 1; inset-inline: 3%; top: var(--rail-y, 34px);
  block-size: 3px; border-radius: 2px;
  background: linear-gradient(180deg, #D1CAC0 0%, #6F6A64 100%);
  box-shadow: 0 2px 3px rgb(0 0 0 / .55);
}
.rail--2 { display: none; top: var(--rail2-y, 52%); }
.cork.is-two .rail--2 { display: block; }

/* الحبال */
.lanyards { position: absolute; inset: 0; z-index: 3; inline-size: 100%; block-size: 100%; overflow: visible; pointer-events: none; }
.ly__shadow { fill: none; stroke: rgb(0 0 0 / .32); stroke-width: 10; stroke-linecap: round; transform: translate(2px, 3px); }
.ly__ribbon { fill: none; stroke: var(--lc); stroke-width: 9; stroke-linecap: round; }
.ly__weave { fill: none; stroke: url(#ly-weave); stroke-width: 9; stroke-linecap: round; }
.ly__text { fill: rgb(255 255 255 / .82); font: 700 5.4px var(--mono); letter-spacing: .5px; dominant-baseline: central; }
.ly__hook { fill: #CFC8BE; stroke: #4A4541; stroke-width: 1.5; }

/* البادجات */
.hangers { position: absolute; inset: 0; z-index: 4; }
.badge {
  position: absolute; left: 0; top: 0;
  inline-size: var(--bw); aspect-ratio: 1 / 1.42; margin-left: calc(var(--bw) / -2);
  padding: 0; border: 0; background: none;
  transform-origin: 50% 0;
  cursor: grab; touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.badge.is-drag { cursor: grabbing; }
.badge:focus-visible { outline: none; }
.badge:focus-visible .badge__card { box-shadow: 0 0 0 3px var(--saffron), 0 10px 22px rgb(0 0 0 / .5); }
.badge__clip {
  position: absolute; z-index: 2; left: 50%; top: 0; translate: -50% -55%;
  inline-size: 20%; aspect-ratio: 1 / 1.15; border-radius: 3px;
  background: linear-gradient(180deg, #ECECEC 0%, #8C8C8C 100%);
  box-shadow: 0 1px 2px rgb(0 0 0 / .55);
}
.badge__card {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 3%;
  padding: 15% 9% 8%;
  border-radius: 9% / 6.4%;
  background: var(--c1); color: var(--c2);
  font-size: calc(var(--bw) / 11); text-align: start; direction: ltr;
  box-shadow: 0 10px 22px rgb(0 0 0 / .5), inset 0 0 0 1px rgb(255 255 255 / .14);
  overflow: hidden;
  transition: scale .2s;
}
.badge:hover .badge__card { scale: 1.03; }
.badge__card::before { /* فتحة الحبل */
  content: ""; position: absolute; top: 4%; left: 50%; translate: -50% 0;
  inline-size: 26%; block-size: 3%; border-radius: 99px;
  background: rgb(0 0 0 / .6);
}
.badge__card.is-light::before { background: rgb(0 0 0 / .32); }
.badge__card::after { /* لمعة البلاستيك */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgb(255 255 255 / .24) 0%, transparent 28%, transparent 72%, rgb(255 255 255 / .09) 100%);
}
.badge__org { font: 700 .62em/1.35 var(--mono); letter-spacing: .04em; opacity: .9; }
.badge__mark { display: grid; place-items: center; min-block-size: 0; }
.badge__mark svg { inline-size: 62%; block-size: auto; max-block-size: 100%; }
.badge__name { font-size: 1.3em; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; }
.badge__role { justify-self: start; padding: .28em .5em; border-radius: 3px; background: var(--c2); color: var(--c1); font: 700 .58em/1.3 var(--mono); }
.badge__card--photo { padding: 0; background: none; }
.badge__card--photo::before { display: none; }
.badge__card--photo img { inline-size: 100%; block-size: 100%; object-fit: cover; }

/* الزينة المثبّتة بالدبابيس */
.deco { position: absolute; z-index: 2; }
.pin {
  position: absolute; z-index: 2; top: -6px; left: 50%; translate: -50% 0;
  inline-size: 13px; block-size: 13px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FF9B7D 0%, #D5482A 60%, #8E2B16 100%);
  box-shadow: 1px 3px 3px rgb(0 0 0 / .5);
}
/* الأماكن محسوبة لتقع تحت البادجات ذات الحبال القصيرة (الثالث والخامس والسابع) */
.deco--note {
  left: 26%; bottom: 4.5%;
  inline-size: 12.2%; padding: 1.1em .9em 1em;
  background: #F3E3B3; color: #3A2F1A;
  font: 500 clamp(.72rem, .95vw, .9rem)/1.55 var(--hand);
  rotate: -5deg;
  box-shadow: 2px 8px 16px rgb(0 0 0 / .4);
  clip-path: polygon(0 0, 100% 0, 100% 86%, 88% 100%, 0 100%);
}
.deco--note .pin { background: radial-gradient(circle at 35% 30%, #FFE08A 0%, #E39B14 60%, #9A6500 100%); }
.deco--polaroid {
  left: 50%; bottom: 3%;
  inline-size: 12%; padding: 6px 6px 0;
  background: #FBF8F1; color: #2A2622;
  rotate: 6deg;
  box-shadow: 2px 10px 18px rgb(0 0 0 / .45);
}
.polaroid__img {
  aspect-ratio: 1 / .92; overflow: hidden;
  background: radial-gradient(90% 90% at 50% 0%, #6B2E94 0%, #2A1140 70%);
}
.polaroid__img img { inline-size: 100%; block-size: auto; margin-top: 4%; }
.deco--polaroid p { padding: .35em 0 .5em; text-align: center; font: 500 clamp(.68rem, .9vw, .86rem)/1.4 var(--hand); }
.deco--medals { left: 73.6%; bottom: 6%; inline-size: 12.4%; display: flex; justify-content: space-between; }
.medal {
  position: relative; display: grid; place-items: center;
  inline-size: 29%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFEFA8 0%, #F4B740 55%, #B97D0A 100%);
  color: #6B4300; font: 800 1rem/1 var(--mono);
  box-shadow: 0 4px 8px rgb(0 0 0 / .5), inset 0 0 0 2px rgb(255 255 255 / .3);
}
.medal::before {
  content: ""; position: absolute; z-index: -1; bottom: 72%; left: 50%; translate: -50% 0;
  inline-size: 52%; block-size: 95%;
  background: linear-gradient(90deg, var(--coral) 0 34%, var(--cream) 34% 66%, var(--teal) 66%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}

.board__hint { display: inline-flex; align-items: center; gap: .7em; font: 500 .82rem/1.6 var(--mono); opacity: .7; text-align: center; }
html[lang="ar"] .board__hint { font-family: var(--font); font-size: .9rem; }

/* ── نافذة قصة البادج ── */
.memory {
  inline-size: min(880px, 92vw); max-block-size: 90svh;
  padding: 0; border: 0; border-radius: 22px;
  background: #1B1917; color: var(--cream);
  box-shadow: 0 40px 100px rgb(0 0 0 / .65);
  overflow: auto;
}
.memory[open] {
  display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  animation: memory-in .4s cubic-bezier(.2, .9, .2, 1);
}
.memory::backdrop { background: rgb(8 6 5 / .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes memory-in { from { opacity: 0; transform: translateY(26px) scale(.96); } }
.memory__visual {
  position: relative; display: grid; place-items: center;
  min-block-size: 360px; padding: 3.4rem 1.5rem 2.2rem;
  background: var(--mc, var(--coral));
  background-image: radial-gradient(rgb(255 255 255 / .16) 1px, transparent 1.4px);
  background-size: 9px 9px;
  overflow: hidden;
}
.memory__no { position: absolute; top: 1.1rem; inset-inline-start: 1.3rem; font: 700 .72rem/1.4 var(--mono); color: rgb(255 255 255 / .92); }
html[lang="en"] .memory__no { letter-spacing: .1em; text-transform: uppercase; }
.memory__badge { --bw: clamp(150px, 20vw, 210px); position: relative; inline-size: var(--bw); aspect-ratio: 1 / 1.42; rotate: -5deg; filter: drop-shadow(0 22px 30px rgb(0 0 0 / .4)); }
.memory__body { position: relative; display: grid; align-content: center; gap: .5rem; padding: clamp(1.5rem, 3vw, 2.5rem); }
.memory__close {
  position: absolute; top: 1rem; inset-inline-end: 1rem;
  inline-size: 38px; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .25); background: none; cursor: pointer;
  transition: background .2s;
}
.memory__close:hover, .memory__nav button:hover { background: rgb(255 255 255 / .1); }
.memory__from { font: 700 .7rem/1.5 var(--mono); opacity: .6; }
html[lang="en"] .memory__from { letter-spacing: .1em; text-transform: uppercase; }
.memory__title { padding-inline-end: 2.4rem; font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 800; line-height: 1.35; }
.memory__org { font-size: .95rem; opacity: .75; }
.memory__chips { display: flex; flex-wrap: wrap; gap: .5em; margin-top: .4rem; }
.memory__chips span { padding: .3em .75em; border-radius: 6px; background: rgb(255 255 255 / .1); font: 600 .76rem/1.5 var(--font); }
.memory__story { margin-top: .9rem; font-size: clamp(1rem, 1.3vw, 1.14rem); line-height: 1.9; }
.memory__foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid rgb(255 255 255 / .13);
  font: 700 .74rem/1.4 var(--mono);
}
.memory__nav { display: flex; gap: 8px; }
.memory__nav button {
  inline-size: 36px; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .25); background: none; cursor: pointer;
  font-size: 0;
  transition: background .2s;
}
.memory__nav button::before { font: 700 1rem/1 var(--mono); color: var(--cream); }
[data-memory-prev]::before { content: "←"; }
[data-memory-next]::before { content: "→"; }
[dir="rtl"] [data-memory-prev]::before { content: "→"; }
[dir="rtl"] [data-memory-next]::before { content: "←"; }

@media (max-aspect-ratio: 1/1) {
  /* على الجوال اللوحة بعرض الشاشة، والطريق يمرّ من وراها */
  .z-board .land { padding-inline: 14px; }
  .boardwrap { inline-size: 100%; z-index: 34; }
  .board__head .title { font-size: clamp(1.5rem, 9vw, 3rem); }
  .cork { block-size: min(150vw, 660px); }
  .deco { display: none; }
  .board__label { font-size: .66rem; }
  .board__hint { font-size: .8rem; }
}
@media (max-width: 680px) {
  .memory[open] { grid-template-columns: 1fr; }
  .memory__visual { min-block-size: 0; padding: 2.8rem 1rem 1.6rem; }
  .memory__badge { --bw: 118px; }
}
