:root {
  --green: #1f8f4b;
  --white: #f4f5f7;
  --red: #d1333d;
  --ink: #07121c;
  --panel: #0d1f30cc;
  --line: #ffffff1f;
  --text: #f6f8fb;
  --muted: #c2ccda;
  --accent: #ffd166;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  color: var(--text);
  background: var(--ink);
  position: relative;
  direction: rtl;
}

.flag-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    to bottom,
    #16663a 0%,
    #16663a 33.333%,
    #dfe5ec 33.333%,
    #dfe5ec 66.666%,
    #9c1f2c 66.666%,
    #9c1f2c 100%
  );
}

.flag-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, #ffffff12, transparent 40%),
    radial-gradient(circle at 80% 60%, #0000002d, transparent 45%),
    repeating-linear-gradient(
      125deg,
      transparent 0 16px,
      #ffffff0a 16px 17px
    );
}

.flag-logo {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("./img/logo/Lion_and_sun.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(60vmin, 620px);
  opacity: 1;
  filter: drop-shadow(0 0 22px #00000080);
}

.page {
  width: min(1080px, 92%);
  margin: 0 auto;
  padding: 36px 0 48px;
  display: grid;
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(6px);
  padding: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.02em;
  font-size: 0.75rem;
  text-transform: none;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

h2 {
  font-size: clamp(1.15rem, 2.6vw, 1.65rem);
}

.hero-copy,
.section-head p {
  color: var(--muted);
  margin: 8px 0 0;
  max-width: 72ch;
}

.section-head {
  margin-bottom: 14px;
}

.app-card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: center;
}

.app-logo {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid #ffffff30;
  background: #ffffff0f;
  padding: 8px;
}

.app-card-content {
  display: grid;
  gap: 10px;
}

.app-title {
  font-size: clamp(1.05rem, 2.1vw, 1.35rem);
}

.app-details {
  border: 1px solid #ffffff25;
  border-radius: 12px;
  background: #ffffff08;
  padding: 8px 10px;
}

.app-details summary {
  cursor: pointer;
  color: #f2f6fd;
  font-weight: 700;
  list-style: none;
}

.app-details summary::-webkit-details-marker {
  display: none;
}

.app-details summary::before {
  content: "▸";
  margin-left: 8px;
  display: inline-block;
  transition: transform 140ms ease;
}

.app-details[open] summary::before {
  transform: rotate(90deg);
}

.verifier-copy {
  margin: 8px 0 0;
  color: #dbe8f8;
  line-height: 1.8;
  font-size: 0.92rem;
}

.hash-label {
  margin: 10px 0 6px;
  font-size: 0.84rem;
  color: #e4ecf9;
}

.hash-box {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ffffff2d;
  background: #081522;
  color: #f5f8ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  word-break: break-all;
  user-select: all;
}

.download-apk-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #0b1f31;
  background: #ffd166;
  border: 1px solid #ffe2a6;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.88rem;
  transition: transform 140ms ease, background-color 140ms ease;
}

.app-card .download-apk-btn {
  justify-self: start;
}

.download-apk-btn:hover,
.download-apk-btn:focus-visible {
  background: #ffe1a0;
  transform: translateY(-1px);
  outline: none;
}

.scan-status {
  margin-top: 8px;
  font-size: 0.84rem;
  color: #f8e6a4;
}

.scan-status.ok {
  color: #d6f6de;
}

.scan-status.warn {
  color: #ffd5d5;
}

.logo-focus-spacer {
  height: clamp(140px, 24vh, 280px);
}

.attached-stack {
  display: grid;
  gap: 0;
}

.attached-stack .app-card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.attached-stack .news-card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.hub-button {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: #11283e;
  border: 1px solid #ffffff24;
  border-radius: 12px;
  padding: 12px;
  transition: transform 140ms ease, background-color 140ms ease;
}

.hub-button:hover,
.hub-button:focus-visible {
  transform: translateY(-2px);
  background: #18334f;
  outline: none;
}

.hub-button strong {
  display: block;
  font-size: 1rem;
}

.hub-button span {
  font-size: 0.82rem;
  color: var(--muted);
}

.hub-button-disabled {
  background: #2a2e34;
  border-color: #3b3f46;
  color: #9ca3af;
  cursor: not-allowed;
  pointer-events: none;
}

.hub-button-disabled span {
  color: #7f8794;
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  align-items: center;
  border: 1px solid #ffffff1a;
  border-radius: 14px;
  padding: 12px;
  background: #0a1a2b99;
}

.news-item h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.news-item h3 a {
  color: #ffffff;
  text-decoration: none;
}

.news-item h3 a:hover,
.news-item h3 a:focus-visible {
  text-decoration: underline;
}

.news-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.news-meta {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #dce6f6;
}

.qr {
  width: 170px;
  height: 170px;
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
  cursor: pointer;
  transition: transform 120ms ease;
}

.qr:hover,
.qr:focus-visible {
  transform: scale(1.02);
}

.root-ca-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ffffff2a;
  display: grid;
  gap: 8px;
}

.root-ca-title {
  font-size: 1rem;
}

.root-ca-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.root-ca-qr-link {
  display: inline-block;
  width: fit-content;
}

.root-ca-qr {
  width: 180px;
  height: 180px;
  object-fit: cover;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #ffffff30;
  padding: 4px;
  transition: transform 120ms ease;
}

.root-ca-qr:hover,
.root-ca-qr:focus-visible {
  transform: scale(1.02);
}

@media (max-width: 700px) {
  .flag-logo {
    background-size: min(80vmin, 420px);
    opacity: 1;
  }

  .page {
    padding-top: 22px;
  }

  .card {
    padding: 16px;
  }

  .download-apk-btn {
    width: 100%;
    justify-content: center;
  }

  .app-card {
    grid-template-columns: 1fr;
    text-align: center;
    border-top: 1px solid var(--line);
  }

  .app-logo {
    margin: 0 auto;
  }

  .app-card .download-apk-btn {
    justify-self: stretch;
  }

  .app-details {
    padding: 8px;
  }

  .logo-focus-spacer {
    height: clamp(90px, 14vh, 140px);
  }

  .news-item {
    grid-template-columns: 1fr;
  }

  .qr {
    width: min(72vw, 230px);
    height: min(72vw, 230px);
    margin: 0 auto;
  }

  .root-ca-qr {
    width: min(68vw, 220px);
    height: min(68vw, 220px);
  }
}
