/* =========================================================
   أنماط المكوّنات — Component styles
   (buttons, header, footer, cards, progress, modal, toast…)
   Uses logical properties (inline-start/end) so RTL works.
   ========================================================= */

/* ---------- Icons ---------- */
.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--ink); --fg: var(--ivory);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px; border-radius: 999px;
  background: var(--bg); color: var(--fg);
  font-weight: 500; font-size: 1rem; white-space: nowrap;
  border: 1px solid var(--bg);
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.4s var(--ease);
}
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--gold); transform: scaleX(0); transform-origin: right;
  transition: transform 0.55s var(--ease);
}
.btn:hover::before { transform: scaleX(1); transform-origin: left; }
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(0.98); }
.btn .icon { transition: transform 0.4s var(--ease); }
.btn:hover .icon { transform: translateX(-4px); }
.btn--gold { --bg: var(--gold); --fg: #fff; }
.btn--gold::before { background: var(--ink); }
.btn--gold:hover { border-color: var(--ink); }
.btn--ghost { --bg: transparent; --fg: var(--ink); border-color: var(--line-strong); }
.btn--ghost::before { background: var(--ink); }
.btn--ghost:hover { color: var(--ivory); border-color: var(--ink); }
.btn--light { --bg: var(--ivory); --fg: var(--ink); }
.btn--sm { min-height: 42px; padding: 0 20px; font-size: 0.92rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; transition: background 0.3s, border-color 0.3s;
}
.icon-btn:hover { background: var(--cream); border-color: var(--line-strong); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 0.95rem;
  color: var(--ink); border-bottom: 1px solid transparent; transition: color 0.3s, gap 0.3s var(--ease);
}
.link-arrow:hover { color: var(--gold-deep); gap: 12px; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px; font-size: 0.78rem; font-weight: 500;
  background: var(--ivory); color: var(--ink); border: 1px solid var(--line);
}
.badge .icon { width: 14px; height: 14px; }
.badge--float { position: absolute; top: 16px; inset-inline-start: 16px; backdrop-filter: blur(6px); background: rgba(251, 248, 243, 0.88); }
.badge--owned { background: var(--ink) !important; color: var(--ivory); border-color: var(--ink); }
.badge--owned.badge--float { inset-inline-start: auto; inset-inline-end: 16px; }
.badge--gold { background: transparent; color: var(--gold-deep); border-color: var(--gold-soft); }

.chip {
  min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 0.92rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  transition: all 0.3s var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-active { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(251, 248, 243, 0.78); backdrop-filter: saturate(1.3) blur(14px); -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color 0.4s, background 0.4s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: rgba(251, 248, 243, 0.92); }
.site-header__inner { height: 100%; display: flex; align-items: center; gap: 32px; }
.site-header__actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }

.logo { display: inline-flex; align-items: center; gap: 12px; }
.logo__mark svg { width: 40px; height: 40px; transition: transform 0.8s var(--ease); }
.logo:hover .logo__mark svg { transform: rotate(-25deg); }
.logo__text { display: flex; flex-direction: column; line-height: 1.1; direction: ltr; text-align: start; }
.logo__en { font-family: var(--font-latin); font-size: 1.4rem; font-weight: 500; letter-spacing: 0.01em; }
.logo__en em { color: var(--gold-deep); font-style: italic; }
.logo__by { font-family: var(--font-latin); font-style: italic; font-size: 0.85rem; color: var(--taupe-deep); }

.nav { display: flex; gap: 6px; }
.nav__link { position: relative; padding: 8px 14px; font-size: 0.97rem; color: var(--ink-soft); transition: color 0.3s; }
.nav__link::after {
  content: ''; position: absolute; inset-inline: 14px; bottom: 2px; height: 1px; background: var(--gold);
  transform: scaleX(0); transition: transform 0.4s var(--ease);
}
.nav__link:hover, .nav__link.is-active { color: var(--ink); }
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); }
.menu-toggle { display: none; }

@media (max-width: 960px) {
  .nav { display: none; }
  .menu-toggle { display: inline-grid; }
}
@media (max-width: 420px) { .logo__en { font-size: 1.2rem; } .logo__mark svg { width: 34px; height: 34px; } }

/* ---------- Account menu ---------- */
.account { position: relative; }
.account__btn { display: inline-flex; align-items: center; gap: 10px; padding: 4px; padding-inline-end: 12px; border-radius: 999px; border: 1px solid var(--line); transition: background 0.3s; }
.account__btn:hover { background: var(--cream); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--ivory); font-family: var(--font-display); font-size: 1.1rem; }
.account__name { font-size: 0.92rem; font-weight: 500; }
.account__chev { width: 16px; height: 16px; transition: transform 0.3s; }
.account.is-open .account__chev { transform: rotate(180deg); }
.account__menu {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; min-width: 240px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all 0.3s var(--ease);
}
.account.is-open .account__menu { opacity: 1; visibility: visible; transform: none; }
.account__who { display: flex; flex-direction: column; padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.account__who strong { font-size: 0.98rem; }
.account__menu a, .account__menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.93rem; text-align: start; }
.account__menu a:hover, .account__menu button:hover { background: var(--cream); }
.account__menu .icon { width: 18px; height: 18px; color: var(--gold-deep); }
@media (max-width: 640px) { .account__btn { padding: 3px; border: 0; } }

/* ---------- Mobile drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 80; background: rgba(46, 41, 37, 0.35); opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s; }
.drawer.is-open { opacity: 1; visibility: visible; }
.drawer__panel {
  position: absolute; inset-block: 0; inset-inline-start: 0; width: min(380px, 88vw);
  background: var(--ivory); padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 32px;
  transform: translateX(100%); transition: transform 0.55s var(--ease);
}
.drawer.is-open .drawer__panel { transform: none; }
.drawer__top { display: flex; justify-content: space-between; align-items: center; }
.drawer__nav { display: flex; flex-direction: column; }
.drawer__nav a {
  font-family: var(--font-display); font-size: 1.7rem; padding: 12px 0; border-bottom: 1px solid var(--line);
  opacity: 0; transform: translateX(20px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  transition-delay: calc(var(--i) * 60ms + 150ms);
}
.drawer.is-open .drawer__nav a { opacity: 1; transform: none; }
.drawer__actions { margin-top: auto; display: grid; gap: 10px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: rgba(251, 248, 243, 0.72); padding-block: 80px 32px; margin-top: 0; }
.site-footer .logo__en { color: var(--ivory); }
.site-footer .logo__by { color: var(--sand); }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 48px; }
.site-footer__brand p { margin-top: 20px; max-width: 36ch; font-size: 0.95rem; }
.site-footer h4 { color: var(--ivory); font-weight: 500; font-size: 0.95rem; margin-bottom: 16px; }
.site-footer__grid a:not(.logo) { display: block; padding: 4px 0; font-size: 0.95rem; transition: color 0.3s; }
.site-footer__grid a:not(.logo):hover { color: var(--gold-soft); }
.site-footer__bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 64px; padding-top: 24px; border-top: 1px solid rgba(251, 248, 243, 0.12); font-size: 0.85rem; }
.site-footer .muted { color: var(--taupe); }
@media (max-width: 860px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } .site-footer__brand { grid-column: 1 / -1; } }

/* ---------- Generated artwork frame ---------- */
.art { width: 100%; height: 100%; }
.frame { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--beige); }
.frame .art { transition: transform 1.4s var(--ease); }

/* ---------- Course card ---------- */
.course-card {
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--line); overflow: hidden;
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease), border-color 0.6s;
}
.course-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: transparent; }
.course-card__media { position: relative; display: block; aspect-ratio: 4 / 3.4; overflow: hidden; background: var(--beige); }
.course-card__media .art { transition: transform 1.4s var(--ease); }
.course-card:hover .course-card__media .art { transform: scale(1.06); }
.course-card__body { display: flex; flex-direction: column; gap: 10px; padding: 26px 26px 24px; flex: 1; }
.course-card__title { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.4; }
.course-card__title a { background: linear-gradient(var(--gold), var(--gold)) no-repeat right bottom / 0 1px; transition: background-size 0.5s var(--ease); }
.course-card__title a:hover { background-size: 100% 1px; }
.course-card__text { color: var(--ink-soft); font-size: 0.97rem; line-height: 1.85; }
.course-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.course-card__foot .progress { flex: 1; max-width: 55%; }

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.86rem; color: var(--taupe-deep); }
.meta li { display: inline-flex; align-items: center; gap: 6px; }
.meta .icon { width: 16px; height: 16px; color: var(--gold); }

.price { display: inline-flex; align-items: baseline; gap: 4px; }
.price__num { font-family: var(--font-latin); font-size: 1.9rem; font-weight: 500; line-height: 1; }
.price__cur { font-size: 0.85rem; color: var(--taupe-deep); }
.price-soon { font-size: 0.92rem; color: var(--gold-deep); font-weight: 500; }
.course-card .eyebrow.latin { font-family: var(--font-latin); font-style: italic; font-size: 1rem; letter-spacing: 0; align-self: flex-start; }
.course-card .eyebrow.latin::before { display: none; }

.grid-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: clamp(20px, 2.5vw, 32px); }

/* ---------- Progress ---------- */
.progress { display: flex; align-items: center; gap: 12px; }
.progress__track { flex: 1; height: 6px; border-radius: 99px; background: var(--beige); overflow: hidden; }
.progress__bar { display: block; height: 100%; width: var(--p); border-radius: inherit; background: linear-gradient(to left, var(--gold), var(--taupe-deep)); transition: width 1s var(--ease); }
.progress__label { font-family: var(--font-latin); font-size: 1.05rem; font-weight: 500; min-width: 3ch; }
.progress--compact .progress__track { height: 4px; }

.ring { flex: none; direction: ltr; }
.ring__bg, .ring__fg { fill: none; stroke-width: 4; }
.ring__bg { stroke: var(--beige); }
.ring__fg { stroke: var(--gold); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1s var(--ease); }
.ring text { font-family: var(--font-latin); font-size: 15px; font-weight: 600; fill: var(--ink); }

/* ---------- Section head ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(36px, 5vw, 64px); }
.section-head .h2 { margin-top: 12px; }
.section-head .lead { margin-top: 14px; }
.section-head--center { justify-content: center; text-align: center; }
.section-head--center .lead { margin-inline: auto; }
.section-head--center .eyebrow::after { content: ''; width: 22px; height: 1px; background: currentColor; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 120; transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 14px 22px; border-radius: 999px; background: var(--ink); color: var(--ivory);
  box-shadow: var(--shadow-lg); font-size: 0.95rem; transition: transform 0.5s var(--ease);
}
.toast .icon { color: var(--gold-soft); }
.toast.is-show { transform: translate(-50%, 0); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(46, 41, 37, 0.45); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.4s; }
.modal__panel {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--ivory); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(24px) scale(0.98); transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.modal.is-open .modal__backdrop { opacity: 1; }
.modal.is-open .modal__panel { opacity: 1; transform: none; }
.modal__close { position: absolute; top: 16px; inset-inline-end: 16px; z-index: 2; background: var(--ivory); }
