@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/geist-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/readex-pro-arabic-wght-normal.woff2") format("woff2"); font-weight: 160 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --ground: #e8e9f3;
  --paper: #ffffff;
  --ink: #0e1020;
  --muted: #5e6178;
  --line: #d3d5e4;
  --violet: #5b3fe0;
  --teal: #0b8f9c;
  --ember: #e8532b;
  --ok: #0a7f57;
  --bad: #c8261d;
  --caution: #b26b00;
  --shadow: 0 1px 0 var(--line), 0 24px 40px -28px rgb(14 16 32 / 0.45);
  --display: "Bricolage Grotesque", "Geist", "Readex Pro", system-ui, sans-serif;
  --ui: "Geist", "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Readex Pro", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0b0c16;
    --paper: #151728;
    --ink: #eceefb;
    --muted: #9a9db8;
    --line: #262942;
    --violet: #9d8bff;
    --teal: #3cc8d6;
    --ember: #ff7a52;
    --ok: #3dd6a0;
    --bad: #ff6b5e;
    --caution: #f2a93b;
    --shadow: 0 1px 0 var(--line), 0 24px 40px -28px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --ground: #0b0c16;
    --paper: #151728;
    --ink: #eceefb;
    --muted: #9a9db8;
    --line: #262942;
    --violet: #9d8bff;
    --teal: #3cc8d6;
    --ember: #ff7a52;
    --ok: #3dd6a0;
    --bad: #ff6b5e;
    --caution: #f2a93b;
    --shadow: 0 1px 0 var(--line), 0 24px 40px -28px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 14.5px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; padding: 16px 20px 12px; }
.brand { margin: 0; font: 700 20px/1 var(--display); letter-spacing: -0.03em; }
.brand i { color: var(--ember); font-style: normal; }
.bar-meta { color: var(--muted); font-size: 12.5px; }
.purpose { flex: 1; margin: 0; font-size: 15px; font-weight: 500; }

.split { display: grid; gap: 16px; padding: 0 20px 20px; }

.pane-head, .card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pane-head h2 { margin: 0; font: 700 18px/1 var(--display); letter-spacing: -0.02em; }
.head-actions { display: flex; align-items: center; gap: 10px; }

.left {
  display: flex; flex-direction: column; gap: 12px; min-height: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 18px;
}

/* Token field: a transparent textarea over a colored mirror */
.field { position: relative; flex: 1; min-height: 180px; border-radius: 14px; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.mirror, .field textarea {
  position: absolute; inset: 0; margin: 0; width: 100%; height: 100%;
  padding: 14px 16px; border: 0; border-radius: 14px;
  font: 400 14px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all;
}
.mirror { overflow: hidden; pointer-events: none; color: var(--ink); }
.mirror .h { color: var(--violet); }
.mirror .p { color: var(--teal); }
.mirror .s { color: var(--ember); }
.mirror .dot { color: var(--muted); }
.field textarea {
  resize: none; background: transparent; color: transparent; caret-color: var(--ink);
  overflow: auto; scrollbar-width: none;
}
.field textarea::-webkit-scrollbar { display: none; }
.field textarea::placeholder { color: var(--muted); font-family: var(--ui); font-size: 14.5px; }
.field textarea::selection { background: color-mix(in srgb, var(--violet) 30%, transparent); color: transparent; }
.field textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 10px; }
.seg button {
  font: 500 12.5px/1 var(--ui); padding: 8px 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.link { font: 500 12.5px/1 var(--ui); background: none; border: 0; padding: 6px 2px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; cursor: pointer; }
.link:hover { color: var(--ink); text-decoration-color: currentColor; }

.error { margin: 0; color: var(--bad); font-weight: 500; }
.note { margin: 0; color: var(--muted); font-size: 12.5px; }

.right { min-height: 0; }
.ghost {
  display: grid; gap: 4px; align-content: center; height: 100%; min-height: 220px; margin: 0; padding: 32px;
  border: 2px dashed var(--line); border-radius: 22px; color: var(--muted);
}
.ghost-word { font: 800 clamp(32px, 4.5vw, 56px)/1 var(--display); letter-spacing: -0.04em; opacity: 0.55; }

.result { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 16px; height: 100%; }

/* Ticket */
.ticket {
  --state: var(--ok);
  display: grid; grid-template-columns: 1fr minmax(190px, 240px);
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow);
}
.ticket[data-state="expired"], .ticket[data-state="unsafe"] { --state: var(--bad); }
.ticket[data-state="not-yet-valid"], .ticket[data-state="no-expiry"] { --state: var(--caution); }

.main { padding: 22px 26px 20px; min-width: 0; }
.eyebrow { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.word-wrap { margin: 0; overflow: hidden; padding-bottom: 0.08em; }
.word { display: inline-block; color: var(--state); font: 800 clamp(44px, 5.6vw, 80px)/0.95 var(--display); letter-spacing: -0.05em; }
.countdown { margin: 10px 0 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.num { font: 500 clamp(22px, 2.6vw, 30px)/1 var(--mono); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cap { color: var(--muted); }
.times { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.times dt { color: var(--muted); }
.times dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-word; }

.stub { position: relative; padding: 22px 22px 18px; border-inline-start: 2px dashed var(--line); min-width: 0; }
.stub::before, .stub::after { content: ""; position: absolute; inset-inline-start: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--ground); }
.stub::before { top: -12px; }
.stub::after { bottom: -12px; }
.stub-head { display: flex; justify-content: space-between; align-items: baseline; }

.tag { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.t-header { color: var(--violet); }
.t-payload { color: var(--teal); }
.t-sig { color: var(--ember); margin-top: 16px; }
.mini { margin: 0; display: grid; gap: 6px; }
.mini div { display: grid; grid-template-columns: 40px 1fr; gap: 8px; font: 400 12.5px/1.4 var(--mono); }
.mini dt { color: var(--muted); }
.mini dd { margin: 0; word-break: break-word; }
.sig { margin: 0; font: 400 12px/1.5 var(--mono); color: var(--muted); word-break: break-all; }

/* Payload + findings */
.lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; min-height: 0; }
.card { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; }
.card-head { margin-bottom: 8px; }
.card-head .tag { margin: 0; }
.count { margin-inline-start: 4px; font: 500 12px var(--mono); color: var(--muted); letter-spacing: 0; }

.claims, .findings { margin: 0; padding: 0; overflow: auto; min-height: 0; flex: 1; }
.claims > div { display: grid; grid-template-columns: minmax(80px, 30%) 1fr; gap: 4px 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.claims dt { font: 600 13px/1.4 var(--mono); word-break: break-word; }
.claims dt small { display: block; margin-top: 2px; font: 400 11.5px/1.35 var(--ui); color: var(--muted); }
.claims dd { margin: 0; font: 400 13px/1.45 var(--mono); word-break: break-word; }
.claims dd .rel { display: block; color: var(--muted); font-size: 11.5px; }
.claims pre { margin: 0; font: inherit; white-space: pre-wrap; direction: ltr; text-align: left; }

.findings { list-style: none; }
.findings li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.findings .lvl { font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.findings li[data-level="critical"] .lvl { color: var(--bad); }
.findings li[data-level="warn"] .lvl { color: var(--caution); }
.findings li[data-level="info"] .lvl { color: var(--muted); }
.findings li.none { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .word.in { animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.2, 1); }
  @keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
}

/* One screen, no page scroll, on desktop-sized windows */
@media (min-width: 900px) and (min-height: 560px) {
  .app { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .split { grid-template-columns: minmax(320px, 5fr) 7fr; min-height: 0; }
}

@media (max-width: 899px), (max-height: 559px) {
  .lower { grid-template-columns: 1fr; }
  .claims, .findings { overflow: visible; }
  .result { height: auto; }
}

@media (max-width: 640px) {
  .bar, .split { padding-inline: 14px; }
  .purpose { flex-basis: 100%; order: 3; }
  .left { padding: 14px; }
  .ticket { grid-template-columns: 1fr; }
  .main { padding: 22px 20px 20px; }
  .stub { border-inline-start: 0; border-top: 2px dashed var(--line); padding: 22px 20px 18px; }
  .stub::before, .stub::after { top: -13px; bottom: auto; }
  .stub::before { inset-inline-start: -12px; }
  .stub::after { inset-inline-start: auto; inset-inline-end: -12px; }
  .claims > div { grid-template-columns: 1fr; }
}

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--display); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--muted); line-height: 1.6; }

/* Arabic page: letter spacing breaks the joins between Arabic letters, and its glyphs need more height */
:lang(ar) :is(.word, .ghost-word, .pane-head h2, .eyebrow, .tag, .findings .lvl, .faq h2) { letter-spacing: 0; }
:lang(ar) .word { line-height: 1.3; }
:lang(ar) .ghost-word { line-height: 1.4; }
/* The token field stays left to right; only its hint reads right to left */
[dir="rtl"] .field textarea::placeholder { direction: rtl; text-align: right; }
.lang { margin-inline-start: 10px; font-weight: 600; color: var(--ink); unicode-bidi: isolate; } /* its own run, or it sticks to the link before it on the Arabic page */

/* Light/dark button (theme.js): follows the device until the visitor picks */
.theme { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-inline-start: 8px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; vertical-align: middle; }
.theme:hover { background: var(--line); }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .sun, .theme[data-dark="true"] .moon { display: none; }
.theme[data-dark="true"] .sun { display: block; }
