@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --target-yellow: #ffd400;
  --target-yellow-deep: #f3c300;
  --target-red: #ef3340;
  --target-red-deep: #c8102e;
  --target-blue: #149bd7;
  --target-blue-deep: #006eb6;
  --target-black: #111214;
  --target-black-soft: #2c2f33;
  --target-white: #f5f5f0;
  --paper: #ffffff;
  --ink: #141619;
  --muted: #555b62;
  --focus: #006eb6;
  --header-height: 164px;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  font-synthesis: none;
}

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

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--target-black);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: var(--target-white);
  overflow-x: clip;
}

button,
a {
  font: inherit;
}

button,
a,
canvas {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  inset-block-start: 10px;
  inset-inline-start: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--paper);
  background: var(--target-black);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease-out;
}

.skip-link:focus {
  outline: 4px solid var(--target-yellow);
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(116px, 1fr) minmax(320px, 5fr) minmax(116px, 1fr);
  align-items: center;
  width: 100%;
  height: var(--header-height);
  padding: 16px clamp(26px, 6vw, 92px);
  background: var(--paper);
  box-shadow: 0 6px 24px rgb(17 18 20 / 8%);
}

.brand {
  display: grid;
  width: clamp(84px, 7vw, 108px);
  height: 126px;
  place-items: center;
}

.brand--federation {
  justify-self: start;
}

.brand--ministry {
  justify-self: end;
}

.brand__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__fallback {
  display: grid;
  width: 68px;
  height: 68px;
  padding: 6px;
  place-items: center;
  border: 2px solid var(--target-black);
  border-radius: 50%;
  color: var(--target-black);
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.event-heading {
  min-width: 0;
  text-align: center;
}

.event-heading h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.6vw, 2.45rem);
  font-weight: 850;
  line-height: 1.35;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.event-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.45vw, 1.2rem);
  font-weight: 600;
}

.target-stripe {
  position: sticky;
  z-index: 45;
  top: var(--header-height);
  display: grid;
  direction: ltr;
  grid-template-columns: repeat(4, 1fr);
  height: 20px;
  box-shadow: 0 5px 14px rgb(17 18 20 / 12%);
}

.target-stripe span:nth-child(1) { background: var(--target-blue-deep); }
.target-stripe span:nth-child(2) { background: var(--target-red); }
.target-stripe span:nth-child(3) { background: var(--target-yellow); }
.target-stripe span:nth-child(4) { background: var(--target-black); }

.target-field {
  position: relative;
  display: grid;
  min-height: calc(100svh - var(--header-height) - 40px);
  padding: clamp(44px, 7vh, 76px) clamp(24px, 7vw, 108px);
  place-items: center;
  background: #f8f8f6;
}

.target-stripe--footer {
  position: static;
  box-shadow: 0 -5px 14px rgb(17 18 20 / 10%);
}

.document-menu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: min(1040px, 100%);
}

.document-link {
  display: flex;
  direction: ltr;
  min-height: 82px;
  padding: 0;
  align-items: stretch;
  border: 1.5px solid var(--target-black);
  border-radius: 4px;
  outline: none;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 7px 18px rgb(17 18 20 / 7%);
  font-size: clamp(1.12rem, 1.8vw, 1.45rem);
  font-weight: 780;
  line-height: 1.5;
  text-decoration: none;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms ease-out;
  animation: button-arrival 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--item-index) * 45ms + 80ms);
}

.document-link__title {
  display: flex;
  direction: rtl;
  min-width: 0;
  flex: 1;
  padding: 16px 26px;
  align-items: center;
  justify-content: flex-start;
  text-align: right;
  text-wrap: balance;
}

.document-link__number {
  display: grid;
  width: 82px;
  flex: 0 0 82px;
  place-items: center;
  color: var(--paper);
  background: var(--target-blue-deep);
  font-size: 2rem;
  font-weight: 850;
}

.document-link[data-target-color="2"] .document-link__number {
  background: var(--target-red);
}

.document-link[data-target-color="3"] .document-link__number {
  color: var(--target-black);
  background: var(--target-yellow);
}

.document-link[data-target-color="4"] .document-link__number {
  background: var(--target-black);
}

.document-menu__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px;
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  font-size: 1.05rem;
  font-weight: 650;
  text-align: center;
}

.document-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgb(17 18 20 / 13%);
}

.document-link:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgb(17 18 20 / 10%);
}

.document-link:focus-visible,
.toolbar-button:focus-visible,
.error-state a:focus-visible {
  outline: 4px solid var(--paper);
  box-shadow: 0 0 0 8px var(--focus), 0 8px 18px rgb(17 18 20 / 14%);
}

.pdf-workspace {
  min-height: calc(100svh - var(--header-height));
  background: #e6e8ea;
}

.viewer-toolbar {
  position: sticky;
  z-index: 40;
  top: var(--header-height);
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 68px;
  padding: 10px clamp(14px, 3vw, 40px);
  color: var(--paper);
  background: var(--target-black);
  box-shadow: 0 8px 22px rgb(17 18 20 / 22%);
}

.document-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: clamp(0.94rem, 1.5vw, 1.12rem);
  font-weight: 720;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-controls {
  display: flex;
  direction: ltr;
  gap: 6px;
  align-items: center;
}

.toolbar-group {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
}

.toolbar-button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  color: var(--paper);
  background: rgb(255 255 255 / 12%);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms ease-out, transform 160ms ease-out;
}

.toolbar-button:hover:not(:disabled) {
  background: rgb(255 255 255 / 22%);
  transform: translateY(-1px);
}

.toolbar-button:disabled,
.toolbar-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.38;
}

.toolbar-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.toolbar-button--back {
  gap: 7px;
  padding: 0 14px;
  color: var(--target-black);
  background: var(--target-yellow);
  font-weight: 750;
}

.toolbar-button--back:hover {
  background: #ffe15c;
}

.toolbar-button--icon {
  padding: 0;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  margin: 0 2px;
  background: rgb(255 255 255 / 24%);
}

.page-indicator,
.zoom-indicator {
  min-width: 76px;
  color: var(--paper);
  font-size: 0.82rem;
  font-weight: 650;
  text-align: center;
}

.zoom-indicator {
  min-width: 52px;
}

.pdf-stage {
  display: grid;
  min-height: calc(100svh - var(--header-height) - 68px);
  padding: clamp(20px, 4vw, 48px);
  place-items: start center;
  overflow: auto;
  direction: ltr;
}

#pdf-canvas {
  max-width: none;
  background: var(--paper);
  box-shadow: 0 14px 42px rgb(17 18 20 / 22%);
}

.loading-state,
.error-state {
  direction: rtl;
  display: grid;
  min-height: 260px;
  padding: 36px;
  place-items: center;
  align-content: center;
  gap: 20px;
  color: var(--ink);
  text-align: center;
}

.loading-state[hidden],
.error-state[hidden] {
  display: none;
}

.loading-state__target {
  width: 62px;
  height: 62px;
  border: 11px solid var(--target-blue);
  border-top-color: var(--target-red);
  border-right-color: var(--target-yellow);
  border-radius: 50%;
  animation: loading-spin 900ms linear infinite;
}

.error-state strong {
  font-size: 1.18rem;
}

.error-state a {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  color: var(--paper);
  background: var(--target-black);
  font-weight: 700;
  text-decoration: none;
}

@keyframes button-arrival {
  from {
    transform: translateY(18px);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes loading-spin {
  to { transform: rotate(1turn); }
}

@media (max-width: 980px) {
  .viewer-toolbar {
    grid-template-columns: auto 1fr;
  }

  .document-title {
    grid-column: 2;
    grid-row: 1;
  }

  .toolbar-controls {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 2px;
  }
}

@media (max-width: 700px) {
  :root {
    --header-height: 92px;
  }

  .site-header {
    grid-template-columns: 60px minmax(0, 1fr) 60px;
    padding: 8px 10px;
  }

  .brand {
    width: 54px;
    height: 66px;
  }

  .brand__fallback {
    width: 50px;
    height: 50px;
    padding: 4px;
    border-width: 1.5px;
    font-size: 0.58rem;
  }

  .event-heading h1 {
    font-size: clamp(0.88rem, 4vw, 1.12rem);
    line-height: 1.45;
  }

  .event-heading p {
    margin-top: 2px;
    font-size: 0.75rem;
  }

  .target-field {
    min-height: calc(100svh - var(--header-height) - 24px);
    padding: 28px 16px 40px;
    align-items: start;
  }

  .target-stripe {
    top: var(--header-height);
    height: 12px;
  }

  .document-menu {
    gap: 10px;
    width: min(100%, 480px);
  }

  .document-link {
    min-height: 66px;
    font-size: 0.94rem;
    box-shadow: 0 5px 13px rgb(17 18 20 / 8%);
  }

  .document-link__title {
    padding: 12px 14px;
  }

  .document-link__number {
    width: 58px;
    flex-basis: 58px;
    font-size: 1.55rem;
  }

  .viewer-toolbar {
    gap: 8px 12px;
    min-height: 0;
    padding: 8px 10px;
  }

  .toolbar-button--back {
    padding: 0 10px;
  }

  .document-title {
    font-size: 0.86rem;
  }

  .toolbar-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 6px;
    width: 100%;
    padding-top: 0;
  }

  .toolbar-group:first-child {
    justify-self: end;
  }

  .toolbar-group:nth-of-type(2) {
    justify-self: start;
  }

  .toolbar-divider {
    display: none;
  }

  .page-indicator {
    min-width: 96px;
  }

  .zoom-indicator {
    min-width: 48px;
  }

  .pdf-stage {
    min-height: calc(100svh - var(--header-height) - 112px);
    padding: 16px 10px 30px;
  }
}

@media (max-width: 400px) {
  .site-header {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    padding-inline: 6px;
  }

  .brand {
    width: 46px;
    height: 60px;
  }

  .event-heading h1 {
    font-size: 0.84rem;
  }

  .toolbar-button {
    min-width: 44px;
  }

  .toolbar-button--back span {
    display: none;
  }
}

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

@media print {
  .site-header,
  .viewer-toolbar {
    display: none;
  }

  .pdf-stage {
    padding: 0;
    background: white;
  }

  #pdf-canvas {
    max-width: 100%;
    box-shadow: none;
  }
}
