/* Identity page. */

/* ---------- Hero: a perforated screen (you see out, nobody sees in) behind the record. ---------- */

.id-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 7vh, 5.5rem);
  min-height: max(700px, calc(100svh - 68px));
  display: grid;
  align-items: center;
}
.id-screen {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 58%;
  background: var(--pattern-screen) 0 0 / 40px 28px, linear-gradient(var(--clay), var(--ink));
  opacity: 0.28;
  mask-image: linear-gradient(to left, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(to left, #000 40%, transparent);
  pointer-events: none;
}
[dir='rtl'] .id-screen {
  mask-image: linear-gradient(to right, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(to right, #000 40%, transparent);
}
.id-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 36rem);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.id-copy {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}
.id-copy h1 {
  font-size: clamp(2.4rem, 4.6vw, 4.8rem);
}
.id-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

/* The demo panel. */
.reveal {
  display: grid;
  gap: 1rem;
  background: var(--night-2);
  border: 1px solid var(--night-line);
  border-radius: 6px;
  padding: clamp(1rem, 2vw, 1.5rem);
  box-shadow: 0 40px 70px -40px rgba(0, 0, 0, 0.92);
}
.reveal-head {
  display: grid;
  gap: 0.6rem;
}
.seg {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--night-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--on-night);
  background: none;
  border: 0;
  border-inline-start: 1px solid var(--night-line);
  padding: 0.6rem 0.4rem;
  min-height: 46px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.seg button:first-child {
  border-inline-start: 0;
}
.seg button:hover {
  background: var(--night-3);
}
.seg button[aria-checked='true'] {
  background: var(--gold);
  color: var(--night);
}

/* The record: a paper file on the night desk. */
.record {
  background: var(--plaster);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.2rem;
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 18px 30px -20px rgba(0, 0, 0, 0.92);
}
.record ::selection {
  background: var(--ink);
  color: var(--gold);
}
.record-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}
.record-top .chip {
  flex: none;
}
.record-top .chip .ic {
  width: 1em;
  height: 1em;
}
.record-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.8rem, 2.6vw, 2.4rem);
  line-height: 1.15;
  margin-block-start: 0.2rem;
  transition: background-color 0.3s;
}
.record-name.is-real {
  display: inline;
  background: linear-gradient(transparent 55%, color-mix(in oklab, var(--gold) 70%, transparent) 55%);
}
.record-rows {
  margin: 0;
  display: grid;
}
.record-rows div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding-block: 0.5rem;
  border-block-start: 1px solid var(--ink-hair);
  font-size: 0.95rem;
}
.record-rows dt {
  color: color-mix(in oklab, var(--ink) 75%, var(--plaster));
}
.record-rows dd {
  margin: 0;
  font-weight: 600;
}
.via,
.hid {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.45rem;
  border: 1px dashed currentColor;
  border-radius: 999px;
  margin-inline-start: 0.35rem;
}
.hid {
  margin-inline-start: 0;
}
.record-why {
  font-size: 0.92rem;
  color: color-mix(in oklab, var(--ink) 84%, var(--plaster));
  min-height: 2.9em;
}
.record-act {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.no-reveal,
.revealed-note {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 650;
}
.no-reveal .ic {
  color: var(--clay);
}
.reason {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}
.reason label {
  font-weight: 650;
  font-size: 0.9rem;
}
.reason .select {
  min-height: 44px;
  background: color-mix(in oklab, var(--plaster) 70%, var(--brick));
}
.reason .select[aria-invalid='true'] {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--clay) 30%, transparent);
}
.reason-err {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 650;
}
.reason-err .ic {
  color: var(--clay);
}
.reason-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.record .btn-line {
  color: var(--ink);
}

.reveal-log {
  display: grid;
  gap: 0.5rem;
}
.reveal-log ol,
.audit ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.reveal-log li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  font-size: 0.86rem;
  padding-block: 0.45rem;
  border-block-start: 1px solid var(--night-line);
}
.reveal-log li .num {
  color: var(--gold);
  font-weight: 650;
}
.fresh {
  animation: fresh-in 2.4s var(--ease-out);
}
@keyframes fresh-in {
  from {
    background: color-mix(in oklab, var(--gold) 30%, transparent);
  }
}

@media (max-width: 960px) {
  .id-grid {
    grid-template-columns: 1fr;
  }
  .id-screen {
    width: 100%;
    opacity: 0.16;
  }
}
@media (max-width: 520px) {
  .seg {
    grid-template-columns: 1fr 1fr;
  }
  .seg button:nth-child(3) {
    border-inline-start: 0;
  }
  .seg button:nth-child(n + 3) {
    border-block-start: 1px solid var(--night-line);
  }
  .record-rows div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

/* ---------- Phone sign-in device ---------- */

.otp-col {
  position: relative;
  display: grid;
  justify-items: center;
  padding-block-start: 1.5rem;
}
.otp-arch {
  position: absolute;
  inset-block: 0 -2rem;
  width: min(420px, 92%);
  background: var(--pattern-screen) center / 40px 28px, var(--clay);
}
.otp-col .device {
  position: relative;
  --d-w: 300px;
}
.otp {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
  padding-block-start: 0.75rem;
}
.otp h3 {
  font-size: 1.35rem;
}
.otp label {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--on-night-soft);
}
.otp-mark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--night-3);
  color: var(--gold);
}
.otp-mark .ic {
  width: 1.6rem;
  height: 1.6rem;
}
.otp-mark.ok {
  background: var(--gold);
  color: var(--night);
}
.otp-input {
  display: flex;
  direction: ltr;
  background: var(--night-2);
  border: 1px solid var(--night-line);
  border-radius: 12px;
  overflow: hidden;
}
.otp-input:focus-within {
  border-color: var(--gold);
}
.otp-input span {
  display: grid;
  place-items: center;
  padding-inline: 0.7rem;
  font-weight: 650;
  border-inline-end: 1px solid var(--night-line);
}
.otp-input input,
.otp-code {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--on-night);
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding-inline: 0.7rem;
  outline: none;
}
.otp-code {
  flex: none;
  direction: ltr;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  padding-inline-start: 0.5em;
  background: var(--night-2);
  border: 1px solid var(--night-line);
  border-radius: 12px;
  min-height: 56px;
}
.otp-code:focus {
  border-color: var(--gold);
}
.otp-code[aria-invalid='true'],
.otp-input input[aria-invalid='true'] {
  color: var(--gold);
}
.otp-ch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.otp-ch button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  min-height: 38px;
  color: var(--on-night);
  background: none;
  border: 1px solid var(--night-line);
  border-radius: 999px;
  cursor: pointer;
}
.otp-ch button[aria-checked='true'] {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.otp-go {
  margin-block-start: auto;
}
.otp-sub,
.otp-demo {
  font-size: 0.82rem;
  color: var(--on-night-soft);
}
.otp-demo {
  border: 1px dashed var(--night-line);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
}
.otp-err {
  display: flex;
  gap: 0.4rem;
  align-items: start;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--on-night);
}
.otp-err .ic {
  color: var(--gold);
  flex: none;
  margin-block-start: 0.1em;
}
.otp-back {
  font: inherit;
  font-size: 0.82rem;
  color: var(--on-night);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
  align-self: center;
  padding: 0.3rem;
}
.otp-roles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.otp-roles li {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  background: var(--night-2);
  border: 1px solid var(--night-line);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.86rem;
}
.otp-roles .ic {
  color: var(--gold);
}
.otp-done .otp-back {
  margin-block-start: auto;
}

/* ---------- Roles matrix ---------- */

.matrix-wrap {
  overflow-x: auto;
  background: var(--plaster);
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem 0.75rem;
  box-shadow: 0 24px 40px -30px rgba(0, 0, 0, 0.80);
}
.matrix {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.matrix th,
.matrix td {
  text-align: start;
  vertical-align: top;
  padding: 0.7rem 0.9rem 0.7rem 0;
  border-block-start: 1px solid var(--ink-hair);
}
[dir='rtl'] .matrix th,
[dir='rtl'] .matrix td {
  padding: 0.7rem 0 0.7rem 0.9rem;
}
.matrix thead th {
  border-block-start: 0;
  border-block-end: 2px solid var(--ink);
  padding-block: 0.8rem 0.55rem;
}
.matrix tbody th {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  white-space: nowrap;
}
.matrix tbody tr:hover {
  background: color-mix(in oklab, var(--brick) 18%, transparent);
}
.m {
  display: inline-flex;
  gap: 0.45rem;
  align-items: baseline;
  line-height: 1.35;
}
.m::before {
  content: '';
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  transform: translateY(1px);
}
.m-all::before {
  background: var(--gold);
}
.m-part::before {
  background: linear-gradient(90deg, var(--gold) 50%, transparent 50%);
}
[dir='rtl'] .m-part::before {
  background: linear-gradient(270deg, var(--gold) 50%, transparent 50%);
}
.m-alias::before {
  border-style: dashed;
  border-color: var(--clay);
}
.m-none {
  color: color-mix(in oklab, var(--ink) 55%, var(--plaster));
}
.m-none::before {
  display: none;
}
.matrix-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-block-start: 1rem;
  font-size: 0.92rem;
}

/* ---------- Isolation and audit ---------- */

.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.audit {
  display: grid;
  gap: 0.75rem;
  border-block-start: 2px solid var(--on-night);
  padding-block-start: 0.9rem;
}
.audit li {
  display: grid;
  grid-template-columns: 1.4rem 3.6rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding-block: 0.85rem;
  border-block-end: 1px solid var(--night-line);
  font-size: 0.95rem;
}
.audit li .ic {
  color: var(--gold);
  margin-block-start: 0.15em;
}
.audit li .num {
  font-weight: 700;
}
@media (max-width: 960px) {
  .audit-grid {
    grid-template-columns: 1fr;
  }
}

/* On brick: no outer panel; the role switch and the paper record sit on the ground. */
.id-hero .reveal {
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}
.id-hero .seg {
  border-color: var(--ink-line);
  background: color-mix(in oklab, var(--plaster) 55%, transparent);
}
.id-hero .seg button {
  color: var(--ink);
  border-color: var(--ink-line);
}
.id-hero .seg button:hover {
  background: var(--plaster);
}
.id-hero .seg button[aria-checked="true"] {
  background: var(--ink);
  color: var(--plaster);
}
.id-hero .reveal-log li {
  border-color: var(--ink-line);
}
.id-hero .reveal-log li .num {
  color: var(--ink);
}
.id-hero .record {
  box-shadow: 0 24px 40px -26px rgba(0, 0, 0, 0.85);
}

/* ================= Second option: identity in neon ================= */

/* A drifting violet dot field behind the record: you see through it, nobody sees in. */
.id-screen {
  background:
    radial-gradient(circle, rgba(139, 92, 255, 0.75) 1.3px, transparent 1.9px) 0 0 / 22px 22px,
    radial-gradient(60% 55% at 62% 50%, rgba(139, 92, 255, 0.35), transparent 70%);
  opacity: 0.55;
  animation: id-drift 40s linear infinite;
}
@keyframes id-drift {
  to {
    background-position: 220px 110px, 0 0;
  }
}

.id-hero .seg {
  background: rgba(13, 17, 36, 0.72);
  border-color: var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.id-hero .seg button {
  color: var(--ink-soft);
  border-color: var(--line);
  border-radius: 0;
}
.id-hero .seg button:hover {
  background: rgba(160, 175, 255, 0.08);
  color: var(--ink);
}
.id-hero .seg button[aria-checked='true'] {
  background: var(--cyan);
  color: #04050a;
  box-shadow: 0 0 24px -6px var(--cyan);
}

/* The record: a glass file glowing violet. */
.id-hero .record,
.record {
  background: linear-gradient(160deg, rgba(26, 31, 60, 0.94), rgba(12, 15, 30, 0.94));
  border: 1px solid rgba(139, 92, 255, 0.45);
  border-radius: 20px;
  box-shadow: 0 0 60px -20px rgba(139, 92, 255, 0.7), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}
.record ::selection {
  background: var(--cyan);
  color: #04050a;
}
.record-name {
  font-weight: 600;
  letter-spacing: -0.02em;
  min-height: 1.2em;
}
:lang(ar) .record-name {
  font-family: 'Readex Pro', sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}
.record-name.is-real {
  display: block;
  background: none;
  color: var(--lime);
  text-shadow: 0 0 24px rgba(182, 255, 59, 0.55);
}
/* The decode: letters scramble, then settle out of a blur. */
.record-name.decoding {
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(34, 230, 255, 0.7);
  animation: unblur 0.8s var(--ease-out);
}
@keyframes unblur {
  from {
    filter: blur(8px);
    opacity: 0.45;
  }
}
.record-top .chip-solid {
  background: var(--violet);
  border-color: var(--violet);
  color: #04050a;
  box-shadow: 0 0 18px -4px var(--violet);
}
.record-rows div {
  border-block-start-color: var(--line);
}
.record-rows dt,
.record-why {
  color: var(--ink-soft);
}
.via {
  color: var(--cyan);
}
.hid {
  color: #ff7ab8;
}
.reason .select {
  background: rgba(13, 17, 36, 0.92);
}
.record-act [data-act='ask'],
.reason-btns [type='submit'] {
  --b-bg: var(--magenta);
  box-shadow: 0 0 0 1px rgba(255, 61, 154, 0.55), 0 10px 30px -10px rgba(255, 61, 154, 0.7);
}
.revealed-note .ic {
  color: var(--lime);
}
.reason-err .ic {
  color: var(--amber);
}
.id-hero .reveal-log li,
.reveal-log li {
  border-color: var(--line);
}
.id-hero .reveal-log li .num {
  color: var(--cyan);
}

/* Sign-in phone in a glowing arch. */
.otp-arch {
  background:
    radial-gradient(circle, rgba(238, 241, 255, 0.16) 1.2px, transparent 1.7px) 0 0 / 18px 18px,
    linear-gradient(180deg, rgba(34, 230, 255, 0.45), rgba(139, 92, 255, 0.2) 55%, rgba(6, 7, 13, 0) 100%);
  box-shadow: inset 0 0 0 1px rgba(34, 230, 255, 0.35), 0 0 80px -20px rgba(34, 230, 255, 0.55);
}
.otp-mark {
  box-shadow: 0 0 22px -6px var(--cyan);
}
.otp-mark.ok {
  background: var(--lime);
  color: #04050a;
  box-shadow: 0 0 26px -4px var(--lime);
}
.otp-err .ic {
  color: var(--amber);
}
.otp-ch button[aria-checked='true'] {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan), 0 0 16px -6px var(--cyan);
}

/* Roles matrix on glass. */
.matrix-wrap {
  background: linear-gradient(160deg, rgba(22, 27, 54, 0.85), rgba(10, 12, 24, 0.85));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 0 70px -36px rgba(34, 230, 255, 0.6), 0 30px 60px -36px rgba(0, 0, 0, 0.9);
}
.matrix th,
.matrix td {
  border-block-start-color: var(--line);
}
.matrix thead th {
  border-block-end-color: var(--cyan);
}
.matrix tbody th {
  font-weight: 500;
  font-size: 0.95rem;
}
:lang(ar) .matrix tbody th {
  font-family: 'Readex Pro', sans-serif;
  font-weight: 600;
}
.matrix tbody tr:hover {
  background: rgba(34, 230, 255, 0.05);
}
.m::before {
  border-color: var(--ink-soft);
}
.m-all::before {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.m-part::before {
  background: linear-gradient(90deg, var(--violet) 50%, transparent 50%);
  border-color: var(--violet);
}
[dir='rtl'] .m-part::before {
  background: linear-gradient(270deg, var(--violet) 50%, transparent 50%);
}
.m-alias::before {
  border-color: var(--magenta);
}
.m-none {
  color: #6c7399;
}

/* Audit. */
.audit {
  border-block-start-color: var(--cyan);
}
.audit li {
  border-block-end-color: var(--line);
}
.audit li:nth-child(5n + 1) .ic {
  color: var(--magenta);
}
.audit li:nth-child(5n + 2) .ic {
  color: var(--lime);
}
.audit li:nth-child(5n + 3) .ic {
  color: #b9a3ff;
}
.audit li:nth-child(5n + 4) .ic {
  color: var(--amber);
}
.audit li:nth-child(5n) .ic {
  color: var(--cyan);
}

@media (prefers-reduced-motion: reduce) {
  .id-screen {
    animation: none;
  }
}
