/*
 * ui.css — shared web styles for pages served by the API origin (landing, legal, 404) and a
 * base for /admin and /verify. Tokens follow the union's elections design system
 * (forms/worker-src/DESIGN.md): sage ground, white paper, navy ink, one teal action color,
 * coral for caution only, Alef 400/700, 8px squared buttons, the diamond as the only marker,
 * shadows only on issued objects (the union card) and floating layers. Light only. RTL-first,
 * logical properties everywhere.
 */

@font-face {
  font-family: 'Alef';
  src: url('/static/shared/fonts/Alef-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Alef';
  src: url('/static/shared/fonts/Alef-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy-950: #0c2c39;
  --navy-900: #144659;
  --navy-700: #296a7d;
  --navy-mist: #c7d9dc;
  --teal-700: #255f6c;
  --teal-600: #307681;
  --teal-400: #2d8194;
  --teal-100: #d4e8eb;
  --teal-50: #edf6f7;
  --coral: #e54f2b;
  --coral-ink: #b43a1b;
  --coral-100: #f7cdbf;
  --coral-50: #fdeee9;
  --sage-50: #f3f7f6;
  --sage-100: #e7efec;
  --sage-200: #d3e6e3;
  --paper: #ffffff;
  --line: #d4dfdc;
  --line-2: #b7c7c3;
  --ink: #152a33;
  --ink-2: #41565d;
  --ink-3: #566a71;

  --font: 'Alef', 'Arial Hebrew', Arial, sans-serif;
  --r-card: 14px;
  --r-control: 10px;
  --r-button: 8px;
  --r-pill: 999px;
  --gutter: 24px;
  --shadow-card: 0 1px 2px rgba(12, 44, 57, 0.1), 0 16px 32px -14px rgba(12, 44, 57, 0.4);
  --shadow-overlay: 0 2px 6px rgba(12, 44, 57, 0.12), 0 28px 64px -20px rgba(12, 44, 57, 0.48);
  --focus: 0 0 0 3px rgba(48, 118, 129, 0.22);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--sage-50);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--sage-200);
}

img,
svg {
  display: block;
  max-inline-size: 100%;
}

a {
  color: var(--teal-700);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  color: var(--navy-900);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}

.ltr,
bdi.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
.num {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: -60px;
  z-index: 50;
  background: var(--navy-900);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: var(--r-button);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus {
  inset-block-start: 12px;
}

.shell {
  inline-size: 100%;
  max-inline-size: 1140px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ───────────── diamond marker (from the logo mark) ───────────── */
.diamond {
  display: inline-block;
  inline-size: 8px;
  block-size: 8px;
  border-radius: 1.5px;
  background: var(--teal-600);
  transform: rotate(45deg);
  flex: none;
}
.diamond--navy {
  background: var(--navy-900);
}

/* ───────────── header ───────────── */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-block-end: 1px solid var(--line);
}
.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-block-size: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-button);
}
.brand img {
  block-size: 40px;
  inline-size: auto;
}
.site-nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-nav a {
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: var(--r-control);
  text-decoration: none;
  position: relative;
}
.site-nav a:hover {
  background: var(--sage-100);
  color: var(--navy-900);
}
.site-nav a[aria-current='page'] {
  color: var(--navy-900);
}
.site-nav a[aria-current='page']::after {
  content: '';
  position: absolute;
  inset-inline: 12px;
  inset-block-end: 4px;
  block-size: 2px;
  background: var(--teal-600);
  border-radius: 2px;
}

/* ───────────── buttons ───────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-block-size: 44px;
  padding: 0 20px;
  border-radius: var(--r-button);
  border: 1px solid transparent;
  font: 700 0.9375rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
  white-space: nowrap;
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  inline-size: 20px;
  block-size: 20px;
  flex: none;
}
.btn-lg {
  min-block-size: 50px;
  padding: 0 26px;
}
.btn-primary {
  background: var(--teal-600);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--teal-700);
}
.btn-secondary {
  background: var(--paper);
  color: var(--navy-900);
  border-color: var(--line-2);
}
.btn-secondary:hover {
  background: var(--sage-100);
  border-color: var(--navy-700);
}
.btn[aria-disabled='true'] {
  background: var(--sage-100);
  color: var(--ink-3);
  border-color: var(--line);
  cursor: default;
  pointer-events: none;
}
.btn .btn-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.9;
  margin-block-end: 3px;
}
.btn .btn-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

/* ───────────── tags ───────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  block-size: 26px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: 1px solid var(--line-2);
  color: var(--navy-900);
  font-size: 0.75rem;
  font-weight: 700;
}
.tag .diamond {
  inline-size: 6px;
  block-size: 6px;
}

/* ───────────── caution hatch (drafts) ───────────── */
.hatch {
  background: repeating-linear-gradient(135deg, var(--coral-50) 0 7px, var(--paper) 7px 14px);
  border-block-end: 1px solid var(--coral-100);
  color: var(--coral-ink);
  font-size: 0.875rem;
  font-weight: 700;
}
.hatch .shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-block-size: 40px;
  padding-block: 8px;
}
.hatch svg {
  inline-size: 18px;
  block-size: 18px;
  flex: none;
}

/* ───────────── home hero ───────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--sage-100);
  border-block-end: 1px solid var(--line);
}
.hero::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-end: -8%;
  inline-size: 70%;
  background: url('/static/shared/guilloche.svg') center / cover no-repeat;
  opacity: 0.13;
  pointer-events: none;
}
.hero .shell {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
  padding-block: 64px 72px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--teal-700);
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0 0 18px;
}
.hero h1 {
  font-size: 2.75rem;
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-inline-size: 18ch;
}
.hero h1 em {
  font-style: normal;
  color: var(--teal-700);
}
.lede {
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.75;
  max-inline-size: 52ch;
  margin: 18px 0 30px;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-note {
  margin: 16px 0 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

/* ───────────── the union card (the one issued object) ───────────── */
.card-stage {
  position: relative;
  inline-size: 100%;
  max-inline-size: 440px;
  margin-inline: auto;
  perspective: 1200px;
}
.union-card {
  --band: var(--teal-600);
  position: relative;
  container-type: inline-size;
  aspect-ratio: 85.6 / 53.98;
  inline-size: 100%;
  border-radius: var(--r-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  color: var(--navy-900);
  transform: rotate(-4deg);
  transition: transform 0.45s var(--ease-out);
  isolation: isolate;
}
.union-card--ghost {
  position: absolute;
  inset: 0;
  transform: rotate(3deg) translate(-2%, 3%);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  opacity: 0.9;
}
.card-stage:hover .union-card:not(.union-card--ghost) {
  transform: rotate(-1.5deg) translateY(-4px);
}
.uc-print {
  position: absolute;
  inset: 0;
  background: url('/static/shared/guilloche.svg') center / cover no-repeat;
  opacity: 0.26;
  z-index: -1;
}
.uc-band {
  display: flex;
  align-items: center;
  gap: 3cqi;
  block-size: 19%;
  padding-inline: 4.5cqi;
  background: var(--band);
  color: var(--paper);
}
.uc-logo-tile {
  display: grid;
  place-items: center;
  inline-size: 11cqi;
  aspect-ratio: 1;
  border-radius: 1.6cqi;
  background: var(--paper);
  flex: none;
}
.uc-logo-tile img {
  inline-size: 78%;
}
.uc-union {
  font-size: 4.2cqi;
  font-weight: 700;
  line-height: 1.1;
}
.uc-kind {
  margin-inline-start: auto;
  font-size: 3.3cqi;
  font-weight: 700;
  opacity: 0.92;
}
.uc-body {
  display: flex;
  gap: 4.5cqi;
  block-size: 60%;
  padding: 4cqi 4.5cqi 3cqi;
}
.uc-photo {
  flex: none;
  block-size: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 1.8cqi;
  background: var(--sage-100);
  overflow: hidden;
  display: grid;
  place-items: end center;
}
.uc-photo img {
  inline-size: 96%;
  block-size: auto;
  object-fit: contain;
}
.uc-fields {
  display: grid;
  align-content: start;
  gap: 1.9cqi;
  margin: 0;
  min-inline-size: 0;
  flex: 1;
}
.uc-fields dt {
  font-size: 2.5cqi;
  color: var(--ink-3);
  font-weight: 700;
  line-height: 1.2;
}
.uc-fields dd {
  margin: 0;
  font-size: 3.5cqi;
  color: var(--ink-2);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uc-fields .uc-name {
  font-size: 5.6cqi;
  font-weight: 700;
  color: var(--navy-900);
}
.uc-chip {
  flex: none;
  inline-size: 11cqi;
  align-self: center;
  color: var(--teal-700);
}
.uc-foot {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  block-size: 21%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3cqi;
  padding-inline: 4.5cqi;
  background: rgba(255, 255, 255, 0.72);
  border-block-start: 1px solid var(--line);
}
.uc-number {
  font-size: 4.1cqi;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
.uc-role {
  display: inline-flex;
  align-items: center;
  gap: 1.8cqi;
  font-size: 3.2cqi;
  font-weight: 700;
  color: var(--teal-700);
}
.uc-role .diamond {
  inline-size: 1.7cqi;
  block-size: 1.7cqi;
}

/* ───────────── notice sheet (rows divided by hairlines, no boxes) ───────────── */
.section {
  padding-block: 56px;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block-end: 8px;
}
.section-head h2 {
  font-size: 1.4375rem;
  line-height: 1.2;
}
.section-sub {
  color: var(--ink-2);
  margin: 0 0 12px;
  max-inline-size: 62ch;
}
.sheet {
  max-inline-size: 880px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.sheet > li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 18px;
  padding-block: 28px;
  border-block-end: 1px solid var(--line);
}
.sheet > li:first-child {
  border-block-start: 1px solid var(--line);
}
.sheet .ico {
  inline-size: 44px;
  block-size: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-control);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--teal-700);
}
.sheet .ico svg {
  inline-size: 22px;
  block-size: 22px;
}
.sheet h3 {
  font-size: 1.1875rem;
  line-height: 1.3;
  margin-block-end: 4px;
}
.sheet p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.75;
  max-inline-size: 62ch;
}

/* ───────────── document pages (legal) ───────────── */
.doc-head {
  background: var(--paper);
  border-block-end: 1px solid var(--line);
}
.doc-head .shell {
  padding-block: 40px 32px;
}
.crumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-block-end: 12px;
}
.crumbs a {
  color: var(--ink-3);
}
.doc-head h1 {
  font-size: 1.75rem;
  line-height: 1.2;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 16px;
}
.doc {
  max-inline-size: 880px;
  padding-block: 40px 64px;
}
.doc h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1875rem;
  line-height: 1.3;
  margin-block: 36px 10px;
}
.doc h2::before {
  content: '';
  inline-size: 8px;
  block-size: 8px;
  border-radius: 1.5px;
  background: var(--teal-600);
  transform: rotate(45deg);
  flex: none;
}
.doc p,
.doc li {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--ink);
  max-inline-size: 68ch;
}
.doc p {
  margin: 0 0 12px;
}
.doc ul {
  margin: 0 0 12px;
  padding-inline-start: 22px;
}
.doc li {
  margin-block-end: 6px;
}
.doc li::marker {
  color: var(--teal-600);
}
.doc .placeholder {
  background: var(--coral-50);
  color: var(--coral-ink);
  border-radius: 4px;
  padding: 0 4px;
  font-weight: 700;
}
.kv {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  overflow: hidden;
  background: var(--paper);
  margin-block: 12px 18px;
  max-inline-size: 68ch;
}
.kv > div {
  display: contents;
}
.kv dt,
.kv dd {
  margin: 0;
  padding: 12px 14px;
  border-block-end: 1px solid var(--line);
  font-size: 0.9375rem;
}
.kv dt {
  background: var(--sage-50);
  color: var(--ink-2);
  font-weight: 700;
  font-size: 0.875rem;
}
.kv > div:last-child dt,
.kv > div:last-child dd {
  border-block-end: 0;
}
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0 !important;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  align-items: start;
  margin-block-end: 14px;
}
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border: 1.5px solid var(--navy-900);
  border-radius: var(--r-button);
  color: var(--navy-900);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--r-control);
  padding: 14px 16px;
  margin-block: 16px;
  color: var(--teal-700);
  font-size: 0.9375rem;
  line-height: 1.6;
  max-inline-size: 68ch;
}

/* ───────────── 404 ───────────── */
.lost {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: center;
  padding-block: 72px;
  max-inline-size: 880px;
}
.lost img {
  inline-size: 180px;
}
.lost h1 {
  font-size: 1.75rem;
  margin-block-end: 10px;
}
.lost p {
  color: var(--ink-2);
  margin: 0 0 22px;
}

/* ───────────── footer ───────────── */
.site-footer {
  background: var(--navy-950);
  color: var(--navy-mist);
  font-size: 0.875rem;
}
.site-footer .shell {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
  padding-block: 44px 28px;
}
.site-footer img {
  block-size: 44px;
  inline-size: auto;
  margin-block-end: 12px;
}
.site-footer h2 {
  color: var(--paper);
  font-size: 0.875rem;
  margin-block-end: 10px;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.site-footer a {
  color: var(--paper);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}
.site-footer .fine {
  grid-column: 1 / -1;
  border-block-start: 1px solid rgba(199, 217, 220, 0.2);
  padding-block-start: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8125rem;
}

/* ───────────── responsive ───────────── */
@media (max-width: 900px) {
  .hero .shell {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-block: 40px 56px;
  }
  .hero .card-col {
    order: -1;
    padding-inline: 14px;
  }
  .card-stage {
    max-inline-size: 340px;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .site-footer .shell {
    grid-template-columns: 1fr 1fr;
  }
  .site-footer .about {
    grid-column: 1 / -1;
  }
}
@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }
  .brand img {
    block-size: 34px;
  }
  .site-nav {
    display: none;
  }
  .doc-head h1 {
    font-size: 1.4375rem;
  }
  .kv {
    grid-template-columns: 1fr;
  }
  .kv dt {
    border-block-end: 0;
    padding-block-end: 2px;
  }
  .lost {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-block: 48px;
  }
  .lost img {
    inline-size: 120px;
  }
  .cta-row .btn {
    flex: 1 1 100%;
  }
  .site-footer .shell {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .sheet > li {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .hatch {
    display: none;
  }
  body {
    background: #fff;
  }
}
