/* ==========================================================================
   VODI -- portal entry screen
   Layer order: tokens -> reset -> layout -> components -> decoration -> media
   ========================================================================== */


*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body.portal {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-strong);
  background:
    radial-gradient(120% 90% at 50% -10%, var(--ink-inverse) 0%, var(--glow-none) 55%),
    linear-gradient(180deg, var(--surface-page) 0%, var(--surface-raised) 55%, var(--ink-inverse) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* --------------------------------------------------------------------------
   Stage
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 3vw, 34px);
  overflow: hidden;
  isolation: isolate;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row-reverse;      /* logo at the left edge, motto at the right */
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
}

/* The lockup carries its own name and tagline, so nothing is set beside it.
   Height, not width, is what is constrained: the source is nearly square and
   a width rule would let it grow tall enough to crowd the motto. */
.brand__lockup {
  display: block;
  width: auto;
  height: clamp(76px, 8.5vw, 112px);
  object-fit: contain;
}

.motto {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  max-width: 340px;
  border-radius: var(--radius-md);
  background: var(--surface-veil);
  border: 1px solid var(--wash);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
}

.motto__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.motto__icon svg { width: 22px; height: 22px; }

.motto__text {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.75;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: clamp(16px, 3vh, 40px) 0 clamp(8px, 1.2vh, 18px);
  text-align: center;
}

.hero__title {
  margin: 0;
  font-size: clamp(34px, 5.4vw, 62px);
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink-strongest);
  letter-spacing: -0.01em;
}

.hero__subtitle {
  margin: 6px 0 0;
  font-size: clamp(16px, 1.9vw, 24px);
  font-weight: 500;
  color: var(--ink-muted);
}

/* ECG divider */
.pulse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: clamp(10px, 2vh, 20px) 0 clamp(18px, 3vh, 34px);
  color: var(--accent);
}

.pulse__rule {
  width: clamp(28px, 5vw, 56px);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--glow-none) 0%, var(--veil-strong) 100%);
}

.pulse__rule:last-child {
  background: linear-gradient(90deg, var(--veil-strong) 0%, var(--glow-none) 100%);
}

.pulse__line {
  width: clamp(120px, 16vw, 190px);
  height: 34px;
}

.pulse__line path {
  stroke-dasharray: 320;
  animation: pulse-trace 3.4s ease-in-out infinite;
}

@keyframes pulse-trace {
  0%   { stroke-dashoffset: 320; }
  45%  { stroke-dashoffset: 0; }
  75%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0.25; }
}

/* --------------------------------------------------------------------------
   Sign-in gate: the form, and who the platform is for
   -------------------------------------------------------------------------- */
/* Form on the right, film on the left -- RTL, so the first column is the
   right one. The film is a real layout slot rather than a viewport-anchored
   backdrop, which is the only way to keep it beside the form at every width. */
.gate {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 360px);
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.4vw, 36px);
  width: 100%;
}

/* --------------------------------------------------------------------------
   The looping film

   The source is a subject on a near-white field -- measured, not assumed:
   sampled through a canvas at several timestamps it reads 253,253,253 at the
   edges from 0.3s onward. (Frame zero is black: the clip fades in, and reading
   only that frame is what produced an earlier wrong answer.)

   Near-white is not the same white as the page, though, and that small
   difference is the visible seam. Two things close it, and both are needed:

     1. the mask on the video fades it out over a long, multi-stop falloff, so
        there is no radius at which the picture simply stops;
     2. a soft light behind it -- on the container, deliberately outside the
        mask -- lifts the page right around the film, so the eye crosses a
        gradient instead of an edge.

   Nothing here is clickable and nothing here is announced.
   -------------------------------------------------------------------------- */
.gate__film {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 360px;
  margin-inline: auto;
  pointer-events: none;
  user-select: none;
}

/* The light. Outside the video's mask, so it can spread past the picture. */
.gate__film::before {
  content: "";
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 46%,
    var(--wash) 0%,
    var(--surface-veil) 42%,
    var(--glow) 64%,
    var(--glow-none) 78%);
  pointer-events: none;
}

.gate__film video {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  /* A long falloff: no radius at which the picture visibly stops. */
  -webkit-mask-image: radial-gradient(circle at 50% 48%,
    var(--surface-dark) 0%, var(--surface-dark) 24%,
    var(--veil-strong) 38%,
    var(--surface-overlay) 50%,
    var(--veil) 60%,
    var(--shade-strong) 69%,
    transparent 77%);
          mask-image: radial-gradient(circle at 50% 48%,
    var(--surface-dark) 0%, var(--surface-dark) 24%,
    var(--veil-strong) 38%,
    var(--surface-overlay) 50%,
    var(--veil) 60%,
    var(--shade-strong) 69%,
    transparent 77%);
}

@media (prefers-reduced-motion: reduce) {
  .gate__film { display: none; }
}

/* --- the form ----------------------------------------------------------- */
.signin {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(24px, 2.8vw, 34px) clamp(20px, 2.4vw, 30px);
  border-radius: var(--radius-lg);
  background: var(--surface-veil);
  border: 1px solid var(--wash);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}

/* The brand mark, standing at the top of the card.
   No ring around it: the mark carries its own soft glow, and a second circle
   around it would read as a sticker pasted on a badge. The wordmark baked into
   the source is cropped away -- the page already says the name, and at this
   size the lettering would only be mush.
   Width and height are explicit -- the SVG this replaced used percentage
   heights that could not resolve, so it fell back to the 150px default and
   stretched its container into an ellipse. */
.signin__logo {
  display: block;
  width: auto;
  height: clamp(104px, 13vh, 134px);
  margin: -4px 0 10px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px var(--shade-strong));
}

.signin__title {
  margin: 0 0 6px;
  font-size: clamp(19px, 1.7vw, 23px);
  font-weight: 700;
  color: var(--ink-strongest);
  text-align: center;
}

.signin__lead {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink);
  text-align: center;
}

.signin__form { width: 100%; display: grid; gap: 14px; }

.signin__field { display: grid; gap: 6px; }

.signin__field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-strong);
}

/* Chrome draws its own input and button chrome unless every one of these is
   spelled out: the appearance reset, an explicit font stack (`font: inherit`
   alone still lets Chrome substitute for password fields), and the autofill
   override -- Chrome's autofill background is painted by the UA and cannot be
   set with `background`, only masked with an inset shadow. */
.signin__field input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  padding: 12px 14px;
  font-family: "Vazirmatn", system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-strongest);
  background: var(--wash);
  border: 1px solid var(--focus-ring);
  border-radius: var(--radius-md);
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.signin__field input::placeholder { color: var(--ink-muted); opacity: 1; }

.signin__field input:-webkit-autofill,
.signin__field input:-webkit-autofill:hover,
.signin__field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink-strongest);
  -webkit-box-shadow: 0 0 0 40px var(--ink-inverse) inset;
  caret-color: var(--ink-strongest);
  transition: background-color 5000s ease-in-out 0s;
}

.signin__field input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--shade);
}

.signin__submit {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 13px 20px;
  font-family: "Vazirmatn", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-inverse);
  text-decoration: none;          /* it is an <a> when already signed in */
  background: var(--accent-strong);
  border: none;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-cta);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.signin__submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.signin__submit:active { transform: translateY(1px); }

.signin__submit:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

.signin__arrow { width: 19px; height: 19px; flex: none; }

.signin__alert {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: var(--shade-soft);
  border: 1px solid var(--shade-strong);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.75;
}

.signin__alert p { margin: 0; }

.signin__error { font-size: 12px; font-weight: 600; color: var(--danger); }

.signin__form--quiet { margin-top: 12px; }

.signin__secondary {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 10px 16px;
  font-family: "Vazirmatn", system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--focus-ring);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.signin__secondary:hover { background: var(--shade-soft); color: var(--ink-strong); }

.signin__help {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
  text-align: center;
}

/* --- who it is for ------------------------------------------------------ */
.audiences {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: clamp(12px, 1.8vw, 22px);
  width: 100%;
  max-width: 860px;
  margin-top: clamp(10px, 1.6vh, 22px);
}

.audience {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1 1 280px;
  max-width: 400px;
  padding: 15px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-veil);
  border: 1px solid var(--wash);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}

.audience--green { background: var(--ok-faint); }

.audience__icon {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  flex: none;
  border-radius: 50%;
  background: var(--shade-soft);
  border: 1px solid var(--focus-ring);
  color: var(--accent-strong);
}

.audience--green .audience__icon {
  background: var(--focus-ring);
  border-color: var(--focus-ring);
  color: var(--ok);
}

.audience__icon svg { width: 55%; height: 55%; }

.audience__title {
  margin: 0 0 3px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink-strongest);
}

.audience--green .audience__title { color: var(--ok); }
.audience--blue .audience__title { color: var(--accent-strong); }

.audience__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Showcase: the media an administrator chose to greet visitors with
   -------------------------------------------------------------------------- */
.showcase {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(16px, 2.2vw, 28px);
  width: 100%;
  margin-top: clamp(26px, 3vw, 40px);
}

.show {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  width: min(100%, 540px);
}

.show__frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface-dark);
  border: 1px solid var(--wash);
  box-shadow: var(--shadow-card);
  line-height: 0;
}

.show__media {
  display: block;
  width: 100%;
  height: auto;
  max-height: 62vh;
  object-fit: contain;
  background: var(--surface-dark);
}

.show__caption {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 4px;
  text-align: center;
}

.show__caption strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-strongest);
}

.show__caption span {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Feature strip
   -------------------------------------------------------------------------- */
.features {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(24px, 5vw, 76px);
  margin: clamp(16px, 2.6vh, 36px) 0 0;
  padding: 0;
  list-style: none;
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
}

.feature__icon { width: 28px; height: 28px; color: var(--accent-strong); opacity: 0.85; }

.feature__label { font-size: 13px; font-weight: 500; }

/* --------------------------------------------------------------------------
   Backdrop decoration
   -------------------------------------------------------------------------- */
.backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.backdrop > svg,
.backdrop > img { position: absolute; }

/* The three artwork pieces below replaced inline SVG symbols. They are already
   a single brand-blue channel with their edges faded to nothing (see
   `scripts/build_portal_art.py`), so all the stylesheet decides is where they
   sit and how far they recede -- the opacities are low on purpose: the eye
   should register texture, never a picture. */
.backdrop__dna {
  top: -2%;
  right: auto;
  left: 3%;
  width: clamp(130px, 13vw, 210px);
  height: auto;
  opacity: 0.22;
}

.backdrop__heart {
  top: 5%;
  right: 4%;
  width: clamp(190px, 19vw, 320px);
  height: auto;
  opacity: 0.24;
  animation: heart-breathe 7s ease-in-out infinite;
  transform-origin: center;
}

@keyframes heart-breathe {
  0%, 100% { opacity: 0.21; transform: scale(1); }
  50%      { opacity: 0.27; transform: scale(1.015); }
}

.backdrop__molecules {
  bottom: 26%;
  left: 12%;
  width: clamp(130px, 14vw, 220px);
  height: auto;
  color: var(--line-faint);
}

.backdrop__clinic {
  bottom: -4%;
  left: -4%;
  width: clamp(220px, 24vw, 400px);
  height: auto;
  opacity: 0.18;
}

.backdrop__books {
  bottom: 3%;
  right: -3%;
  width: clamp(230px, 25vw, 420px);
  height: auto;
  opacity: 0.20;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .backdrop__molecules { display: none; }
}

@media (max-width: 900px) {
  .topbar { flex-direction: column-reverse; align-items: center; text-align: center; }
  .motto { max-width: none; }
  .gate { grid-template-columns: minmax(0, 1fr); max-width: 440px; }
  .gate__film { order: -1; max-height: 220px; }
  .backdrop__clinic,
  .backdrop__books,
  .backdrop__dna { display: none; }
  .backdrop__heart { opacity: 0.14; animation: none; }
}

@media (max-width: 560px) {
  .features { gap: 22px 34px; }
  .hero { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .pulse__line path { stroke-dasharray: none; }
}

/* --------------------------------------------------------------------------
   فروشگاه — the catalogue, and nothing that takes money.

   A grid of offers with three filters above it. Deliberately plain: the page
   exists to be read and searched, and the cards carry a price that is often
   "not set yet", so the design must not shout about money it cannot take.
   -------------------------------------------------------------------------- */
.shop { max-width: 1100px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 72px; }
.shop__head h1 { margin: 0 0 8px; font-family: var(--font-display, inherit); }
.shop__note {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: 13.5px;
}

.shop__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 22px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-card);
}
.shop__filters label { display: grid; gap: 5px; font-size: 13px; }
.shop__filters select { min-width: 160px; padding: 8px 10px; border-radius: 10px; }
.shop__filters button { padding: 9px 18px; border-radius: 10px; }

.shop__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.shop__card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-card);
}
.shop__card h2 { margin: 0; font-size: 16.5px; }
.shop__seller { margin: 0; font-size: 13px; color: var(--ink-muted); }
.shop__level {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  font-size: 12px;
}
.shop__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.shop__tag {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
}
.shop__price { margin: auto 0 0; font-weight: 700; }
.shop__empty { padding: 28px; color: var(--ink-muted); }

/* --- the first-password page: the sign-in card, alone (plan 2026-10-20-student-import) ------------------ */
.hero--alone { justify-content: center; min-height: 100vh; min-height: 100dvh; padding-block: 24px; }
.signin--alone { width: min(380px, 100%); }
.signin--alone .signin__title { text-align: center; }
