/* ============================================================
   منصات العارف — المكوّنات (ورق وحبر). Built only on tokens.css.
   ============================================================ */

/* ---------- الختم المطاطي ---------- */
/* A rotated, double-ruled label in --stamp. Used at most three times on
   the page; ink sits *on* the paper (multiply), never floats above it. */
.stamp {
  display: inline-block;
  padding: 2px 10px 3px;
  border: 3px double var(--stamp);
  border-radius: var(--r-input);
  color: var(--stamp);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--fs-small);
  line-height: 1.3;
  white-space: nowrap;
  transform: rotate(-4deg);
  mix-blend-mode: multiply;
  opacity: .92;
}

/* ---------- كارت التفعيل ---------- */
/* The object the whole identity is built on: a printed activation card the
   student buys at the centre. Landscape 340×210, drawn in CSS only. */
.ac-stack {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 34 / 21;
  margin-inline: auto;
}
/* the blank card underneath — a stack, not a single card */
.ac-stack::before {
  content: '';
  position: absolute;
  inset: 0;
  transform: translate(10px, 10px) rotate(1.5deg);
  background: var(--paper-2);
  border: 1px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-offset);
}
.ac {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 44px;   /* body | tear-off strip (at the inline end) */
  background: var(--paper-2);
  border: 1px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-offset);
  color: var(--ink);
  overflow: hidden;
  transition: transform var(--motion) var(--motion-ease);
  transform-origin: 50% 60%;
}
.ac-stack:hover .ac { transform: rotate(-2deg); }

.ac__body {
  position: relative;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ac__label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ac__serial { font-family: var(--font-mono); font-size: 10px; direction: ltr; color: var(--ink-muted); }
.ac__name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  margin: 0;
}
.ac__course {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.4;
}
.ac__code {
  margin-top: 6px;
  position: relative;
  align-self: flex-start;
  padding: 7px 12px 6px;
  border: 1px dotted var(--ink-muted);
  border-radius: var(--r-input);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .12em;
  direction: ltr;
  unicode-bidi: isolate;
}
.ac__code small {
  position: absolute;
  top: -7px;
  inset-inline-start: 8px;
  padding: 0 4px;
  background: var(--paper-2);
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: 0;
  color: var(--ink-muted);
}
/* «مُفعّل» — pressed after the code, its edge riding over the code box */
.ac__stamp {
  position: absolute;
  inset-inline-end: 26px;
  bottom: 44px;
  transform: rotate(-7deg);
  font-size: 19px;
  padding: 2px 13px 4px;
  border-width: 4px;
}
.ac__foot {
  margin-top: auto;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 9px;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}
.ac__foot span { overflow: hidden; text-overflow: ellipsis; }
/* on a phone the card is narrower than its 340px design; the brand mark is the line to drop */
@media (max-width: 380px) { .ac__foot span:last-child { display: none; } }

/* the tear-off strip: dashed rule, punched notches, subdomain running vertically */
.ac__strip {
  position: relative;
  border-inline-start: 1px dashed var(--ink-muted);
  background:
    repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--rule) 45%, transparent) 6px 7px);
  display: grid;
  place-items: center;
}
.ac__strip::before,
.ac__strip::after {
  content: '';
  position: absolute;
  inset-inline-start: -6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--ink);
}
.ac__strip::before { top: -6px; }
.ac__strip::after  { bottom: -6px; }
.ac__domain {
  writing-mode: vertical-rl;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .04em;
  color: var(--ink-muted);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .ac { transition: none; }
  .ac-stack:hover .ac { transform: none; }
}


/* ============================================================
   حالات وأدوات مشتركة — كل صفحة على /platforms/ بتستعمل دي بدل
   ما تخترع بتاعتها. Built only on tokens.css.
   ============================================================ */

/* ---------- utilities ---------- */
.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* a text link that is still a comfortable tap target on a phone */
.tap { display: inline-flex; align-items: center; min-height: var(--tap); padding-block: 8px; }
.skip { position: absolute; inset-inline-start: var(--s-4); top: -100px; z-index: var(--z-modal); padding: 10px 14px; background: var(--ink); color: var(--paper); border-radius: var(--r-input); text-decoration: none; }
.skip:focus { top: var(--s-3); }

/* ---------- buttons: loading + ghost ---------- */
.btn--ghost { border-color: transparent; color: var(--ink-muted); }
.btn--ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn { min-height: var(--tap); position: relative; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.btn.is-loading { color: transparent !important; cursor: progress; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px;
  border: 2px solid currentColor; border-color: var(--paper) transparent var(--paper) transparent;
  border-radius: 50%; animation: spin .8s linear infinite;
  color: var(--stamp-ink);
}
.btn.is-loading:not(.btn--stamp)::after { border-color: var(--ink) transparent var(--ink) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- inline messages under a field ---------- */
.msg { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: var(--fs-small); font-weight: 500; line-height: 1.5; }
.msg--err { color: var(--err); }
.msg--ok  { color: var(--ok); }
.msg--hint { color: var(--ink-muted); font-weight: 400; }
.msg:empty { display: none; }
.input.is-invalid, .is-invalid .input { border-color: var(--err); box-shadow: 0 0 0 1px var(--err) inset; }
.input.is-valid { border-color: var(--ok); }
.input:disabled { background: var(--paper); color: var(--ink-muted); }
/* a password field with its show/hide button */
.pw { position: relative; }
.pw .input { padding-inline-end: 48px; }
.pw__toggle { position: absolute; inset-inline-end: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-muted); border-radius: var(--r-input); cursor: pointer; }
.pw__toggle:hover { color: var(--ink); background: var(--paper); }
.pw__toggle .ico { width: 20px; height: 20px; }
/* checkbox rows: the box itself is small; the row is the target */
.check { display: flex; gap: var(--s-3); align-items: flex-start; min-height: var(--tap); padding-block: 6px; cursor: pointer; font-size: var(--fs-small); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--stamp); }

/* ---------- alerts (in page) ---------- */
.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: 12px 14px; border: 1px solid var(--rule); border-inline-start-width: 4px; border-radius: var(--r-input); background: var(--info-soft); font-size: var(--fs-small); line-height: 1.6; }
.alert .ico { margin-top: 2px; }
.alert--ok   { border-color: var(--ok);  background: var(--ok-soft); }
.alert--err  { border-color: var(--err); background: var(--err-soft); }
.alert--warn { border-color: var(--warn); background: var(--warn-soft); }
.alert b { display: block; }

/* ---------- toasts (Django messages) ---------- */
.toasts { position: fixed; inset-inline: var(--s-4); bottom: var(--s-4); z-index: var(--z-toast); display: grid; gap: var(--s-2); pointer-events: none; }
@media (min-width: 640px) { .toasts { inset-inline: auto var(--s-5); width: 24rem; } }
.toast { pointer-events: auto; display: flex; gap: var(--s-3); align-items: flex-start; padding: 12px 14px; background: var(--ink); color: var(--paper); border-radius: var(--r-card); box-shadow: var(--shadow-offset); font-size: var(--fs-small); line-height: 1.6; animation: toast-in var(--motion) var(--motion-ease); }
.toast--ok { background: var(--moss); }
.toast--err { background: var(--stamp); color: var(--stamp-ink); }
.toast .ico { flex: none; margin-top: 2px; }
.toast__x { margin-inline-start: auto; width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: inherit; opacity: .8; cursor: pointer; border-radius: var(--r-input); flex: none; }
.toast__x:hover { opacity: 1; background: rgba(255,255,255,.12); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: var(--s-7) var(--s-4); border: 1px dashed var(--rule); border-radius: var(--r-card); background: var(--paper-2); }
.empty .ico { width: 32px; height: 32px; color: var(--ink-muted); }
.empty h3 { margin-top: var(--s-3); font-size: var(--fs-h3); }
.empty p { margin-top: var(--s-2); color: var(--ink-muted); max-width: 40ch; margin-inline: auto; }
.empty .btn { margin-top: var(--s-4); }

/* ---------- skeleton ---------- */
.skeleton { display: block; border-radius: var(--r-input); background: linear-gradient(90deg, var(--paper-2) 25%, var(--rule) 50%, var(--paper-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; color: transparent; min-height: 1em; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- progress (the three signup steps, live) ---------- */
.prog { display: grid; gap: var(--s-3); text-align: start; }
.prog li { display: grid; grid-template-columns: 28px 1fr; gap: var(--s-3); align-items: start; color: var(--ink-muted); }
.prog__n { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper-2); font-family: var(--font-mono); font-size: .8rem; }
.prog li.is-done { color: var(--ink); }
.prog li.is-done .prog__n { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.prog li.is-current { color: var(--ink); font-weight: 500; }
.prog li.is-current .prog__n { border-color: var(--stamp); color: var(--stamp); }
.prog li.is-current .prog__n::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--stamp); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- disclosure («تفاصيل إضافية») ---------- */
.disc summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 500; color: var(--ink-muted); }
.disc summary::-webkit-details-marker { display: none; }
.disc summary .ico { width: 18px; height: 18px; transition: transform var(--motion) var(--motion-ease); }
.disc[open] summary .ico { transform: rotate(45deg); }
.disc summary:hover { color: var(--ink); }
.disc__body { display: grid; gap: var(--s-4); margin-top: var(--s-3); }

/* ---------- copy field (a URL with its copy button) ---------- */
.copy { display: flex; gap: var(--s-2); align-items: stretch; }
.copy .input { flex: 1; min-width: 0; font-family: var(--font-mono); direction: ltr; text-align: left; }
.copy .btn { flex: none; }

@media (prefers-reduced-motion: reduce) {
  .btn.is-loading::after, .skeleton, .prog li.is-current .prog__n::after, .toast { animation: none; }
}
