/* أقسام تفاعلية: «استكشف الهندسة المدنية» والخط الزمني (عن النادي)، وخريطة الزيارات (الرعاة). */

/* ============ استكشف الهندسة المدنية ============ */
/* الحقل fieldset للدلالة فقط، والشبكة في عنصر داخلي: ترتيب عناصر الشبكة داخل fieldset مباشرة لا يُعاد رسمه في كروم */
.ex-set { position: relative; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.ex { display: grid; grid-template-columns: 1fr; border-block-start: 1px solid var(--line-2); }
.ex-f { position: relative; display: block; cursor: pointer; border-block-end: 1px solid var(--line); -webkit-tap-highlight-color: transparent; }
.ex-f:nth-of-type(1) { order: 0; }
.ex-f:nth-of-type(2) { order: 2; }
.ex-f:nth-of-type(3) { order: 4; }
.ex-f:nth-of-type(4) { order: 6; }
.ex-f:nth-of-type(5) { order: 8; }
.ex-f input { position: absolute; inset-block-start: 50%; inset-inline-start: 12px; inline-size: 1px; block-size: 1px; margin: 0; opacity: 0; pointer-events: none; }
.ex-f-in {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  block-size: 100%; padding: 16px 14px;
  transition: background-color 200ms ease, color 200ms ease;
}
.ex-f-in > span { transition: transform 160ms var(--ease-out); }
.ex-f:active .ex-f-in > span { transform: scale(0.97); }
.ex-n { font-size: var(--t-small); color: var(--brand); transition: color 200ms ease; }
.ex-name { font-weight: 700; line-height: 1.45; }
/* علامة + على الجوال تتحول إلى − للمجال المفتوح */
.ex-f-in::after {
  content: ""; inline-size: 14px; block-size: 14px;
  background: linear-gradient(currentColor, currentColor) center / 14px 1.5px no-repeat,
              linear-gradient(currentColor, currentColor) center / 1.5px 14px no-repeat;
  transition: background-size 240ms var(--ease-out);
}
.ex-f input:checked + .ex-f-in { background: var(--brand); color: #fff; }
.ex-f input:checked + .ex-f-in .ex-n { color: var(--on-brand-soft); }
.ex-f input:checked + .ex-f-in::after { background-size: 14px 1.5px, 1.5px 0; }
.ex-f input:focus-visible + .ex-f-in { outline: 2px solid var(--ink); outline-offset: -6px; }
.ex-f input:checked:focus-visible + .ex-f-in { outline-color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .ex-f:hover input:not(:checked) + .ex-f-in { background: var(--lav-soft); }
}

.ex-panel { order: 1; display: grid; gap: 24px; padding-block: 24px 32px; border-block-end: 1px solid var(--line); }
.ex-q { font-size: clamp(1.375rem, 1.05rem + 1.3vw, 2.25rem); line-height: 1.45; }
.ex-a { margin-block-start: 14px; max-width: 42ch; font-size: var(--t-lead); line-height: 1.8; color: var(--ink-soft); }
.ex-links:empty { display: none; }
.ex-ev { max-width: 46ch; }
.ex-ev-h { padding-block-end: 8px; border-block-end: 1px solid var(--line-2); font-size: var(--t-small); color: var(--ink-soft); }
.ex-ev a { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-block: 12px; border-block-end: 1px solid var(--line); font-weight: 600; text-decoration: none; }
.ex-ev-t { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--line-2); text-underline-offset: 0.35em; transition: text-decoration-color 200ms ease; }
.ex-ev .mono { flex: none; font-size: var(--t-small); color: var(--brand); }
@media (hover: hover) and (pointer: fine) { .ex-ev a:hover .ex-ev-t { text-decoration-color: currentColor; } }

/* الرسم: لوحة مخطط بشبكة خفيفة */
.ex-fig {
  margin: 0; border: 1px solid var(--line-2);
  background-color: var(--paper);
  background-image: linear-gradient(rgb(75 46 131 / 0.055) 1px, transparent 1px), linear-gradient(90deg, rgb(75 46 131 / 0.055) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
}
.ex-svg { display: block; inline-size: 100%; block-size: auto; padding: 8px; direction: ltr; }
.ex-cap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px;
  padding: 10px 14px; border-block-start: 1px solid var(--line-2); background: var(--paper);
  font-size: var(--t-small); line-height: 1.6; color: var(--ink-soft);
}
.ex-cap-t { color: var(--ink); font-weight: 500; }

.ex-svg { --ex-ink: rgb(29 20 48 / 0.42); --ex-hi: var(--brand); --ex-tint: rgb(75 46 131 / 0.14); }
.ex-svg :is(path, rect, circle) {
  fill: none; stroke: var(--ex-ink); stroke-width: 1.25; stroke-linejoin: round; vector-effect: non-scaling-stroke;
  transition: stroke 240ms ease, fill 240ms ease, stroke-width 240ms ease;
}
.ex-svg .s { fill: var(--paper); }
.ex-svg .ground { fill: rgb(29 20 48 / 0.05); stroke: none; }
.ex-svg .surf { stroke: rgb(29 20 48 / 0.7); stroke-width: 1.5; }
.ex-svg .road { stroke-width: 1.5; }
.ex-svg .dash { stroke-dasharray: 6 4; }
.ex-svg .water { fill: rgb(29 20 48 / 0.08); }
.ex-svg .pile { stroke-width: 2; }
.ex-svg text {
  font-family: var(--font); font-weight: 500; font-size: calc(13.5px * var(--z, 1));
  fill: var(--ink-soft); stroke: var(--paper); stroke-width: calc(4px * var(--z, 1)); stroke-linejoin: round; paint-order: stroke;
}
.ex-svg text.hi { fill: var(--ex-hi); font-weight: 700; }

/* ما يظهر مع مجال واحد فقط: الأسهم والطبقات والكتابات */
.ex-svg .only { opacity: 0; transition: opacity 240ms ease; }
.ex-svg .only :is(path, rect, circle) { stroke: var(--ex-hi); }
.ex-svg .ar { stroke: var(--ex-hi); stroke-width: 1.5; marker-end: url(#ex-ar); }
.ex-svg .mk { fill: var(--ex-hi); stroke: none; vector-effect: none; }
.ex-svg .only .flood { fill: rgb(75 46 131 / 0.1); stroke: none; }
.ex-svg .only.cars rect { fill: var(--ex-hi); stroke: none; }
.ex-svg .only .sand { fill: url(#ex-sand); stroke: none; }
.ex-svg .only .clay { fill: url(#ex-clay); stroke: none; }
.ex-svg .only .rock { fill: url(#ex-rock); stroke: none; }
.ex-svg pattern .pb { fill: rgb(75 46 131 / 0.1); stroke: none; vector-effect: none; }
.ex-svg pattern .pd { fill: var(--ex-hi); stroke: none; vector-effect: none; }
.ex-svg pattern .pl { stroke: var(--ex-hi); stroke-width: 1; vector-effect: none; }
.ex-svg .only .bh { fill: var(--ex-hi); }

.ex-fig[data-active="st"] .only[data-f~="st"],
.ex-fig[data-active="tr"] .only[data-f~="tr"],
.ex-fig[data-active="wa"] .only[data-f~="wa"],
.ex-fig[data-active="geo"] .only[data-f~="geo"],
.ex-fig[data-active="cm"] .only[data-f~="cm"] { opacity: 1; }

/* الجزء المرتبط بالمجال المختار بالبنفسجي */
.ex-fig[data-active="st"] .pt[data-f~="st"] :is(path, rect),
.ex-fig[data-active="tr"] .pt[data-f~="tr"] :is(path, rect),
.ex-fig[data-active="wa"] .pt[data-f~="wa"] :is(path, rect),
.ex-fig[data-active="geo"] .pt[data-f~="geo"] :is(path, rect),
.ex-fig[data-active="cm"] .pt[data-f~="cm"] :is(path, rect) { stroke: var(--ex-hi); stroke-width: 2; }
.ex-fig[data-active="st"] .pt[data-f~="st"] .s,
.ex-fig[data-active="tr"] .pt[data-f~="tr"] .s,
.ex-fig[data-active="wa"] .pt[data-f~="wa"] .s,
.ex-fig[data-active="geo"] .pt[data-f~="geo"] .s,
.ex-fig[data-active="cm"] .pt[data-f~="cm"] .s { fill: var(--ex-tint); }
.ex-fig[data-active="wa"] .water { fill: rgb(75 46 131 / 0.3); }
.ex-fig[data-active="geo"] .pile, .ex-fig[data-active="cm"] .pile { stroke-width: 2.5; }

/* إدارة التشييد: الأساسات ثم الركائز ثم السطح على نفس الرسم */
.ex-svg .badge { transform-box: fill-box; transform-origin: center; transform: scale(var(--z, 1)); }
.ex-svg .badge circle { fill: var(--ex-hi); stroke: none; }
.ex-svg .badge text { fill: #fff; stroke: none; font: 600 13px/1 var(--mono); text-anchor: middle; dominant-baseline: central; }
@keyframes ex-build { from { opacity: 0; transform: translateY(14px); } }
@keyframes ex-pop { from { opacity: 0; } }
.ex-fig[data-active="cm"] [data-step] { animation: ex-build 560ms var(--ease-out) both; animation-delay: calc(var(--s) * 520ms + 80ms); }
.ex-fig[data-active="cm"] .badge { animation: ex-pop 300ms ease both; animation-delay: calc(var(--s) * 520ms + 280ms); }
@media (prefers-reduced-motion: reduce) {
  .ex-fig [data-step], .ex-fig .badge { animation: none !important; }
}

/* الكمبيوتر: شريط أفقي من اليمين إلى اليسار، والشرح بجانب الرسم تحته */
@media (min-width: 760px) {
  .ex { grid-template-columns: repeat(5, 1fr); }
  .ex-f { border-block-end-color: var(--line-2); }
  .ex-f:not(:nth-of-type(1)) { border-inline-start: 1px solid var(--line); }
  .ex-f-in { grid-template-columns: 1fr; align-content: start; gap: 6px; padding: 16px 18px 20px; }
  .ex-f-in::after { display: none; }
  .ex-panel { grid-column: 1 / -1; grid-row: 2; gap: 32px; padding-block: clamp(32px, 4vw, 56px) 0; border: 0; }
}
@media (min-width: 1000px) {
  .ex-name { font-size: 1.125rem; }
  /* الشرح وروابط الفعاليات في عمود، والرسم بجانبهما */
  .ex-panel {
    grid-template-columns: 5fr 7fr; grid-template-rows: auto 1fr; grid-template-areas: "text fig" "links fig";
    column-gap: clamp(40px, 5vw, 80px); row-gap: 28px; align-items: start;
  }
  .ex-text { grid-area: text; padding-block-start: 8px; }
  .ex-fig { grid-area: fig; }
  .ex-links { grid-area: links; }
}

/* ============ محطات: مسيرة النادي على مراحل مشروع إنشائي ============ */
.tl-sec { --bar-h: 72px; }
.tl-sec .sheet-head .lead { color: var(--on-brand-soft); }

/* شريط المراحل: يلتصق تحت الترويسة، وعرض كل مرحلة بعدد سنواتها (16 سنة من 2011 إلى 2026) */
.tl-bar {
  position: sticky; inset-block-start: var(--head-h); z-index: 5;
  margin-block-end: clamp(24px, 3vw, 40px);
  /* الخلفية تمتد لعرض الشاشة حتى لا يظهر المحتوى المارّ تحته في الهوامش */
  background: var(--brand); box-shadow: 0 0 0 100vmax var(--brand); clip-path: inset(0 -100vmax);
}
/* المرحلة الثانية سنة واحدة، فخانتها ضيقة: حدّها الأدنى 26 بكسل لتُلمس بالإصبع */
.tl-segs { display: grid; grid-template-columns: 5fr minmax(26px, 1fr) 3fr 4fr 3fr; border-block-start: 1px solid rgb(255 255 255 / 0.45); }
.tl-segs li + li { border-inline-start: 1px solid rgb(255 255 255 / 0.22); }
.tl-segs a {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 8px; block-size: 100%;
  padding: 8px 4px 6px; color: var(--on-brand-soft); text-decoration: none; font-size: 0.75rem; line-height: 1.5;
  transition: background-color 200ms ease, color 200ms ease;
}
.tl-sname, .tl-sy { display: none; }
.tl-segs .past a { color: #fff; }
.tl-segs .on a { color: #fff; background: rgb(255 255 255 / 0.14); }
.tl-segs a > * { transition: transform 160ms var(--ease-out); }
.tl-segs a:active > * { transform: scale(0.97); }
.tl-segs a:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
@media (hover: hover) and (pointer: fine) { .tl-segs a:hover { background: rgb(255 255 255 / 0.1); color: #fff; } }

/* المسطرة: علامة لكل سنة، والخط الأبيض يمتلئ من اليمين حتى المحطة الحالية */
.tl-track {
  position: relative; block-size: 24px;
  background: repeating-linear-gradient(to left, rgb(255 255 255 / 0.35) 0 1px, transparent 1px calc(100% / 16)) 0 16px / 100% 5px no-repeat;
}
.tl-track::before, .tl-fill { content: ""; position: absolute; inset-inline: 0; inset-block-start: 15px; block-size: 2px; }
.tl-track::before { background: rgb(255 255 255 / 0.25); }
.tl-fill { background: #fff; transform-origin: 100% 50%; transform: scaleX(var(--p, 0)); transition: transform 300ms var(--ease-out); }
.tl-run { position: absolute; inset: 0; transform: translateX(calc(var(--p, 0) * -100%)); transition: transform 300ms var(--ease-out); pointer-events: none; }
.tl-now {
  /* السنة تنزلق داخل حدود الشريط: محاذية ليمينه عند البداية وليساره عند النهاية، فلا تخرج إلى حافة الشاشة */
  position: absolute; inset-inline-start: 0; inset-block-start: 3px; transform: translateX(calc(var(--p, 0) * 100%)); transition: transform 300ms var(--ease-out);
  padding: 0 6px; background: #fff; color: var(--brand); font-size: 0.75rem; font-weight: 600; line-height: 18px;
}

/* المراحل */
.tl-ph { display: grid; gap: 20px 48px; padding-block: 32px; border-block-start: 1px solid rgb(255 255 255 / 0.3); scroll-margin-block-start: calc(var(--bar-h) + 16px); }
.tl-ph:first-child { border-block-start: 0; padding-block-start: 8px; }
.tl-k { font-size: var(--t-small); color: var(--on-brand-soft); }
.tl-ph-head h3 { margin-block: 4px 2px; font-size: var(--t-h2s); line-height: 1.35; }
.tl-years { font-size: var(--t-small); color: var(--on-brand-soft); }
.tl-d { margin-block-start: 12px; max-width: 34ch; color: var(--on-brand-soft); }

/* المحطات: علامة مساحة تمتلئ إذا مرّ بها القارئ */
.tl-ms { display: grid; }
.tl-ms li { display: grid; grid-template-columns: 5.75rem 1fr; gap: 12px; padding-block: 14px; border-block-start: 1px solid rgb(255 255 255 / 0.16); }
.tl-ms li:first-child { border-block-start: 0; padding-block-start: 0; }
.tl-date { position: relative; padding-inline-start: 20px; font-size: var(--t-small); line-height: 1.9; color: #fff; transition: color 300ms ease; }
.tl-date::before {
  content: ""; position: absolute; inset-inline-start: 2px; inset-block-start: 0.62em; inline-size: 8px; block-size: 8px;
  border: 1.5px solid currentColor; background: currentColor; transform: rotate(45deg); transition: background-color 300ms ease;
}
.tl-live .tl-ms li:not(.done) .tl-date { color: var(--on-brand-soft); }
.tl-live .tl-ms li:not(.done) .tl-date::before { background: transparent; }
.tl-ms a { color: #fff; text-decoration-thickness: 1px; text-decoration-color: rgb(255 255 255 / 0.4); text-underline-offset: 0.35em; transition: text-decoration-color 200ms ease; }
@media (hover: hover) and (pointer: fine) { .tl-ms a:hover { text-decoration-color: #fff; } }
.tl-src { margin-inline-start: 6px; padding: 0 6px; border: 1px solid rgb(255 255 255 / 0.35); font-size: 0.75rem; color: var(--on-brand-soft); white-space: nowrap; vertical-align: 2px; }

@media (min-width: 960px) {
  .tl-segs a { justify-content: flex-start; padding: 10px 12px 8px; font-size: var(--t-small); }
  .tl-ph { grid-template-columns: 4fr 8fr; padding-block: 48px; }
  .tl-ph-head { position: sticky; inset-block-start: calc(var(--head-h) + var(--bar-h) + 24px); align-self: start; }
  .tl-ms li { grid-template-columns: 7rem 1fr; gap: 24px; }
}
/* الأسماء والسنوات داخل الشريط حين يتسع لها */
@media (min-width: 1180px) {
  /* رقم المرحلة ثم اسمها ثم سنواتها في ثلاثة أسطر، مثل خانات جدول اللوحة */
  .tl-segs a { display: grid; align-content: start; gap: 0; }
  .tl-sname, .tl-sy { display: block; }
  .tl-sname { font-weight: 700; }
  .tl-sy { font-size: 0.75rem; opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-fill, .tl-run, .tl-now { transition: none; }
}

/* ============ خريطة الزيارات (الرعاة) ============ */
.vm { display: grid; gap: 28px; margin-block-end: clamp(40px, 5vw, 72px); }
.vm[hidden] { display: none; }
.vm-fig {
  margin: 0; border: 1px solid var(--line-2);
  background-color: var(--paper);
  background-image: linear-gradient(rgb(75 46 131 / 0.055) 1px, transparent 1px), linear-gradient(90deg, rgb(75 46 131 / 0.055) 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
}
.vm-svg { display: block; inline-size: 100%; block-size: auto; direction: ltr; }
.vm-cap { padding: 10px 14px; border-block-start: 1px solid var(--line-2); background: var(--paper); font-size: var(--t-small); color: var(--ink-soft); }

.vm-svg :is(path, rect, circle) { vector-effect: non-scaling-stroke; }
.vm-road { fill: none; stroke: rgb(29 20 48 / 0.3); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.vm-ring { fill: none; stroke: rgb(75 46 131 / 0.35); stroke-width: 1; stroke-dasharray: 2 4; }
.vm-axis { fill: none; stroke: rgb(29 20 48 / 0.12); stroke-width: 1; }
.vm-svg .vm-far { fill: var(--brand); font-weight: 700; }
.vm-svg text {
  font-family: var(--font); font-weight: 500; font-size: calc(12.5px * var(--z, 1));
  fill: var(--ink-soft); stroke: var(--paper); stroke-width: calc(4px * var(--z, 1)); stroke-linejoin: round; paint-order: stroke;
}
.vm-routes path { fill: none; stroke: var(--brand); stroke-width: 1.25; stroke-dasharray: 4 5; opacity: 0.45; transition: opacity 200ms ease, stroke-width 200ms ease; }
.vm-routes path.hi { opacity: 1; stroke-width: 2; stroke-dasharray: none; }
.vm-dot { transform: scale(var(--z, 1)); }
.vm-home rect { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.vm-svg .vm-home-t { fill: var(--ink); font-weight: 700; }
.vm-pt { cursor: pointer; }
.vm-pt circle { fill: var(--brand); stroke: var(--paper); stroke-width: 2; transition: fill 200ms ease; }
.vm-svg .vm-dot text { fill: #fff; stroke: none; font: 600 12px/1 var(--mono); text-anchor: middle; dominant-baseline: central; }
.vm-pt.hi circle { fill: var(--brand-deep); }
.vm-pt .vm-dot { transition: transform 200ms var(--ease-out); }
.vm-pt.hi .vm-dot { transform: scale(calc(var(--z, 1) * 1.2)); }
.vm-pt:active .vm-dot { transform: scale(calc(var(--z, 1) * 0.92)); transition-duration: 120ms; }
.vm-north path { fill: var(--ink); stroke: none; }

.vm-h { padding-block-end: 8px; border-block-end: 1px solid var(--line-2); font-size: var(--t-small); color: var(--ink-soft); }
.vm-list { display: grid; }
.vm-li { display: grid; grid-template-columns: 28px 1fr auto; align-items: baseline; gap: 12px; padding-block: 12px; border-block-end: 1px solid var(--line); transition: background-color 200ms ease; }
.vm-li.hi { background: rgb(75 46 131 / 0.08); }
.vm-n { display: grid; place-items: center; inline-size: 24px; block-size: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.75rem; font-weight: 600; align-self: center; }
.vm-sq { inline-size: 14px; block-size: 14px; margin-inline-start: 5px; background: var(--ink); align-self: center; }
.vm-li-home { grid-template-columns: 28px 1fr; }
.vm-name { font-weight: 600; }
a.vm-name { text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--line-2); text-underline-offset: 0.35em; transition: text-decoration-color 200ms ease; }
@media (hover: hover) and (pointer: fine) { a.vm-name:hover { text-decoration-color: currentColor; } }
.vm-li time { font-size: var(--t-small); color: var(--brand); }
.vm-note { margin-block-start: 16px; font-size: var(--t-small); line-height: 1.8; color: var(--ink-soft); }
.vm-note time { color: var(--brand); }
@media (min-width: 960px) {
  .vm { grid-template-columns: 8fr 4fr; gap: clamp(32px, 4vw, 56px); align-items: start; }
}
