/* how.css  -  Owner: Hadeel (هديل)
   Interactive BB84 explanation page. */

body.how-page { height: auto; min-height: 100%; background: var(--bg); }
.how-page .rep-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.how-page .rep-bar .spacer { flex: 1; }
.how { max-width: 1040px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.how-hero { text-align: center; padding: 26px 16px; border-radius: 22px; color: #fff;
  background: radial-gradient(600px 300px at 80% 0%, #6366f1 0%, transparent 60%), radial-gradient(500px 300px at 10% 100%, #0ea5a4 0%, transparent 55%), #0b1020; }
.how-hero h1 { margin: 0 0 6px; font-size: 30px; }
.how-hero p { margin: 0; color: #c7d2fe; }
.how-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.how-controls .eve-switch { flex: 1; min-width: 240px; margin: 0; background: var(--surface); border: 1px solid var(--line); }
.how-controls .toggle input:checked + span { background: #f43f5e; }
.how-stage { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.steps button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-weight: 700; color: var(--text-3); cursor: pointer; }
.steps button.done { border-color: var(--q); color: var(--q); }
.steps button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-card { min-height: 104px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); animation: pop .25s ease-out; }
.step-card h2 { margin: 0 0 6px; font-size: 19px; }
.step-card p { margin: 0; color: var(--text-2); }
.step-card p + p { margin-top: 6px; }
.table-wrap { overflow-x: auto; }
.qtable { width: 100%; border-collapse: separate; border-spacing: 4px; direction: ltr; font-family: var(--mono); }
.qtable th { font-family: var(--font); font-size: 12.5px; color: var(--text-3); text-align: start; white-space: nowrap; padding: 0 8px 0 0; font-weight: 600; }
[dir="rtl"] .qtable th { text-align: right; }
.qtable td { width: 40px; height: 40px; text-align: center; border-radius: 10px; background: var(--surface-2); font-weight: 700; font-size: 16px; animation: cell .35s ease-out both; animation-delay: var(--d); transition: opacity .3s, background .3s; }
@keyframes cell { from { opacity: 0; transform: translateY(6px) scale(.9); } }
.qtable tr.alice td { background: color-mix(in srgb, #6366f1 14%, var(--surface)); }
.qtable tr.bob td { background: color-mix(in srgb, #0ea5a4 14%, var(--surface)); }
.qtable tr.eve td { background: color-mix(in srgb, #f43f5e 10%, var(--surface)); }
.qtable tr.photons td { background: transparent; }
.ph { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; background: #6366f1; box-shadow: 0 0 12px #6366f1; font-size: 17px; animation: fly-in .6s ease-out both; animation-delay: inherit; }
.ph.diag { background: #0ea5a4; box-shadow: 0 0 12px #0ea5a4; }
@keyframes fly-in { from { transform: translateX(-30px); opacity: 0; } }
.qtable td.bad { background: #f43f5e !important; color: #fff; }
.qtable td.err { background: var(--danger) !important; color: #fff; }
.qtable td.yes { color: var(--q); } .qtable td.no { color: var(--danger); }
.qtable td.dim { opacity: .3; }
.qtable tr.key td { background: var(--q-soft); color: var(--q); }
.qtable tr.key td.dim { opacity: 0; }
.result { padding: 14px 16px; border-radius: 16px; display: flex; flex-direction: column; gap: 8px; animation: pop .25s ease-out; }
.result:empty { display: none; }
.result.good { background: var(--q-soft); color: var(--q); }
.result.bad { background: var(--danger-soft); color: var(--danger); }
.meter { position: relative; height: 12px; border-radius: 99px; background: var(--surface); overflow: hidden; direction: ltr; }
.meter .fill { height: 100%; border-radius: inherit; background: currentColor; transition: width .6s; }
.meter .limit { position: absolute; top: -2px; bottom: -2px; left: 36.7%; width: 3px; background: #f59e0b; }
.nums { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; font-family: var(--mono); color: var(--text); }
.final { padding: 8px 12px; border-radius: 10px; background: var(--surface); color: var(--text); word-break: break-all; direction: ltr; text-align: left; }
.nav-row { display: flex; justify-content: space-between; gap: 10px; }
.how-note { text-align: center; font-size: 13.5px; }
@media (max-width: 640px) {
  .how-hero h1 { font-size: 23px; }
  .qtable td { width: 30px; height: 32px; font-size: 14px; border-radius: 8px; }
  .ph { width: 26px; height: 26px; font-size: 14px; }
  .how-page .rep-bar .brand { display: none; }
}
