/*
 * The identity provider's pages: a brand panel beside the form, in Persian (right to left) or English.
 * Served from this origin only: the content policy allows nothing else. No script, so every effect here is CSS.
 * Logical properties throughout (inline-start / inline-end), so one stylesheet serves both directions.
 */

/* Vazirmatn (SIL Open Font License, see fonts/LICENSE-vazirmatn.txt): the Arabic-script subset for Persian, the Latin one for the rest. */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/vazirmatn-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --brand: #183888;
  --brand-strong: #142e72;
  --brand-bright: #2a52bf;
  --ink: #0f172a;
  --muted: #55607a;
  --line: #d9e0ee;
  --page: #eef2fa;
  --card: #ffffff;
  --field: #ffffff;
  --link: #183888;
  --danger: #b42318;
  --danger-bg: #fef1f0;
  --soft: #f1f4fb;
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9edf9;
    --muted: #9ba6c4;
    --line: #2a3563;
    --page: #0b1020;
    --card: #121a38;
    --field: #0d1430;
    --link: #8fb0ff;
    --danger: #ffb4ab;
    --danger-bg: #3a1613;
    --soft: #18214a;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--page);
}

/* ---- the two halves ---- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4.5rem);
  color: #fff;
  background-color: var(--brand);
  background-image: linear-gradient(160deg, rgb(24 56 136 / 0.15), rgb(10 24 70 / 0.55)), url("panel.webp");
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

/* a soft glow behind the logo, so the white tile floats */
.brand::before {
  content: "";
  position: absolute;
  inset-inline-start: -8rem;
  inset-block-start: -8rem;
  inline-size: 26rem;
  block-size: 26rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(120 160 255 / 0.28), transparent 70%);
  pointer-events: none;
}

.brand-inner {
  position: relative;
  max-inline-size: 30rem;
}

.logo-tile {
  display: grid;
  place-items: center;
  inline-size: 6.25rem;
  block-size: 6.25rem;
  margin-block-end: 1.75rem;
  background: #fff;
  border-radius: 1.75rem;
  box-shadow: 0 18px 40px -14px rgb(5 14 50 / 0.65), 0 0 0 1px rgb(255 255 255 / 0.35);
}

.logo-tile img {
  display: block;
  inline-size: 3.75rem;
  block-size: auto;
}

.brand-name {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0.6rem 0 0;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  font-weight: 500;
  color: rgb(255 255 255 / 0.9);
}

.points {
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.9rem;
}

.points li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 500;
  color: rgb(255 255 255 / 0.95);
}

.points li::before {
  content: "✓";
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 1.65rem;
  block-size: 1.65rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.16);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.35);
  font-size: 0.85rem;
  font-weight: 700;
}

.form-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  background: radial-gradient(60rem 40rem at 100% 0%, rgb(42 82 191 / 0.08), transparent 60%), var(--page);
}

.topbar {
  inline-size: 100%;
  max-inline-size: 28rem;
  display: flex;
  justify-content: flex-end;
  min-block-size: 2.25rem;
}

/* ---- the card ---- */

.card {
  inline-size: 100%;
  max-inline-size: 28rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: 0 24px 60px -28px rgb(24 56 136 / 0.35);
}

h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}

p {
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

/* ---- the form ---- */

label {
  display: grid;
  gap: 0.4rem;
  margin-block: 1.05rem;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--ink);
}

input:not([type="checkbox"]):not([type="hidden"]) {
  inline-size: 100%;
  min-block-size: 3rem;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: 0.85rem;
  text-align: start;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="checkbox"]):not([type="hidden"]):hover {
  border-color: color-mix(in srgb, var(--brand-bright) 45%, var(--line));
}

input:not([type="checkbox"]):not([type="hidden"]):focus {
  outline: none;
  border-color: var(--brand-bright);
  box-shadow: 0 0 0 4px rgb(42 82 191 / 0.22);
}

input[type="checkbox"] {
  flex: none;
  inline-size: 1.15rem;
  block-size: 1.15rem;
  margin-block-start: 0.3rem;
  accent-color: var(--brand);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: 400;
}

button {
  inline-size: 100%;
  min-block-size: 3.1rem;
  margin-block-start: 1.4rem;
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand));
  border: 0;
  border-radius: 0.85rem;
  box-shadow: 0 12px 24px -12px rgb(24 56 136 / 0.7);
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 28px -12px rgb(24 56 136 / 0.8);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
.lang:focus-visible {
  outline: 3px solid var(--brand-bright);
  outline-offset: 3px;
}

[role="alert"] {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-block: 0 1rem;
  padding: 0.75rem 0.95rem;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-inline-start-width: 4px;
  border-radius: 0.75rem;
}

code {
  padding: 0.15rem 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  word-break: break-all;
  background: var(--soft);
  border-radius: 0.4rem;
  direction: ltr;
  unicode-bidi: isolate;
}

ul:not(.points) {
  padding-inline-start: 1.25rem;
}

/* ---- language switcher and footer ---- */

.langs {
  display: inline-flex;
  padding: 0.2rem;
  gap: 0.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang {
  padding: 0.25rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  border-radius: 999px;
}

a.lang:hover {
  color: var(--ink);
  background: var(--soft);
}

.lang.current {
  color: #fff;
  background: var(--brand);
}

footer {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---- a phone or a narrow window: the panel becomes a banner ---- */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .brand {
    justify-content: flex-start;
    padding: 1.1rem 1.25rem;
  }

  .brand-inner {
    display: flex;
    align-items: center;
    gap: 0.9rem;
  }

  .logo-tile {
    inline-size: 3.25rem;
    block-size: 3.25rem;
    margin: 0;
    border-radius: 1rem;
  }

  .logo-tile img {
    inline-size: 2rem;
  }

  .brand-name {
    font-size: 1.4rem;
  }

  .tagline,
  .points {
    display: none;
  }

  .form-side {
    justify-content: flex-start;
    padding-block-start: 1.25rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    animation: rise 0.45s ease-out both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
