/* ==========================================================================
   HidRyx — camp closing announcement & CTF winners
   Loaded after hidryx.css and division.css. Uses the shared HidRyx tokens so
   it follows both colour modes and the active division accent.
   ========================================================================== */

.hx-closing {
  padding-block: clamp(1.25rem, 0.75rem + 2vw, 2.5rem) 0;
  direction: rtl;
}

.hx-closing-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.8fr);
  gap: clamp(1.25rem, 0.5rem + 3vw, 2.75rem);
  align-items: stretch;
  overflow: hidden;
  padding: clamp(1.4rem, 0.8rem + 2.4vw, 2.75rem);
  border: 1px solid color-mix(in srgb, var(--hx-accent) 42%, var(--hx-border));
  border-radius: 12px;
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--hx-accent) 30%, transparent), transparent 38%),
    radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--hx-div-accent, #22d3ee) 22%, transparent), transparent 44%),
    linear-gradient(145deg, color-mix(in srgb, var(--hx-deep) 72%, #05030a), var(--hx-surface) 64%);
  box-shadow: var(--hx-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hx-closing-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.5) 0,
    rgba(255, 255, 255, 0.5) 1px,
    transparent 1px,
    transparent 11px
  );
}

.hx-closing-card > * {
  position: relative;
  z-index: 1;
}

.hx-closing-main {
  min-width: 0;
}

.hx-closing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--bs-font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hx-div-accent-2, #8be9f7);
}

.hx-closing-eyebrow::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #69d69b;
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, #69d69b 22%, transparent);
}

.hx-closing-title {
  margin: 0.55rem 0 0.9rem;
  font-size: clamp(1.45rem, 1rem + 2vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--hx-text);
  text-transform: none;
}

.hx-closing-title .hx-en {
  color: var(--hx-div-accent-2, #8be9f7);
  font-family: "Space Grotesk", "IBM Plex Sans Arabic", system-ui, sans-serif;
  direction: ltr;
  unicode-bidi: isolate;
  text-transform: none;
}

.hx-closing-lead {
  max-width: 62ch;
  margin: 0 0 1rem;
  color: var(--hx-soft);
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.08rem);
  line-height: 1.85;
}

.hx-closing-lead .hx-en {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.hx-closing-points {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1.4rem;
  padding: 0;
  list-style: none;
}

.hx-closing-points li {
  position: relative;
  padding-inline-start: 1.5rem;
  color: var(--hx-soft);
  font-size: 0.95rem;
  line-height: 1.7;
}

.hx-closing-points li::before {
  content: "✓";
  position: absolute;
  inset-inline-start: 0;
  top: 0.05rem;
  color: #69d69b;
  font-weight: 700;
}

.hx-closing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1rem;
}

.hx-closing-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--hx-tap, 2.75rem);
  padding: 0.6rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--hx-div-accent, #22d3ee) 60%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--hx-div-accent, #22d3ee) 16%, transparent);
  color: var(--hx-div-accent-2, #8be9f7);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.hx-closing-btn:hover,
.hx-closing-btn:focus-visible {
  border-color: var(--hx-div-accent, #22d3ee);
  background: color-mix(in srgb, var(--hx-div-accent, #22d3ee) 28%, transparent);
  transform: translateY(-1px);
}

.hx-closing-btn:focus-visible {
  outline: 2px solid var(--hx-div-accent-2, #8be9f7);
  outline-offset: 3px;
}

.hx-closing-date {
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--hx-muted);
}

.hx-closing-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  padding: clamp(1rem, 0.6rem + 1.6vw, 1.5rem);
  border: 1px solid color-mix(in srgb, var(--hx-div-accent, #22d3ee) 32%, var(--hx-border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--hx-bg) 58%, transparent);
  font-family: var(--bs-font-monospace);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--hx-soft);
}

.hx-closing-status {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.45rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid color-mix(in srgb, #69d69b 45%, transparent);
  border-radius: 999px;
  color: #8ff0b8;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hx-closing-status::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #69d69b;
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, #69d69b 20%, transparent);
}

.hx-closing-trophy {
  width: 2.6rem;
  height: 2.6rem;
  color: #f5c451;
  filter: drop-shadow(0 0 12px color-mix(in srgb, #f5c451 35%, transparent));
}

.hx-closing-meta {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.hx-closing-meta div {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr);
  gap: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid color-mix(in srgb, var(--hx-border) 80%, transparent);
}

.hx-closing-meta dt {
  margin: 0;
  color: var(--hx-muted);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hx-closing-meta dd {
  margin: 0;
  color: var(--hx-text);
  font-size: 0.76rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.hx-winners {
  padding-block: clamp(1.5rem, 1rem + 2.4vw, 3rem);
  direction: rtl;
}

.hx-winners-head {
  max-width: 58rem;
  margin: 0 auto clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
  text-align: center;
}

.hx-winners-eyebrow {
  display: inline-block;
  font-family: var(--bs-font-monospace);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hx-div-accent-2, #8be9f7);
}

.hx-winners-title {
  margin: 0.5rem 0 0.7rem;
  font-size: clamp(1.6rem, 1.1rem + 2.4vw, 2.8rem);
  line-height: 1.2;
  color: var(--hx-text);
  text-transform: none;
}

.hx-winners-title .hx-en {
  color: var(--hx-div-accent-2, #8be9f7);
  direction: ltr;
  unicode-bidi: isolate;
  text-transform: none;
}

.hx-winners-sub {
  max-width: 52ch;
  margin: 0 auto;
  color: var(--hx-soft);
  font-size: clamp(0.92rem, 0.88rem + 0.2vw, 1.02rem);
  line-height: 1.8;
}

.hx-winners-sub .hx-en {
  direction: ltr;
  unicode-bidi: isolate;
}

.hx-winners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: clamp(1rem, 0.6rem + 1.6vw, 1.75rem);
  align-items: stretch;
}

.hx-division-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  padding: clamp(1.1rem, 0.7rem + 1.4vw, 1.65rem);
  border: 1px solid var(--hx-border);
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--hx-card-accent) 16%, transparent), transparent 42%),
    var(--hx-surface);
  box-shadow: var(--hx-shadow);
}

.hx-division-card--onsite {
  --hx-card-accent: #22d3ee;
  --hx-card-accent-2: #8be9f7;
}

.hx-division-card--online {
  --hx-card-accent: #c084fc;
  --hx-card-accent-2: #e9d5ff;
}

.hx-division-card.is-current {
  border-color: color-mix(in srgb, var(--hx-card-accent) 55%, var(--hx-border));
  box-shadow: var(--hx-shadow), 0 0 0 1px color-mix(in srgb, var(--hx-card-accent) 45%, transparent);
}

.hx-division-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid color-mix(in srgb, var(--hx-card-accent) 24%, var(--hx-border));
}

.hx-division-tag {
  display: inline-block;
  font-family: var(--bs-font-monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--hx-card-accent-2);
}

.hx-division-card-head h3 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  color: var(--hx-text);
}

.hx-current-badge {
  flex: none;
  align-self: flex-start;
  padding: 0.25rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--hx-card-accent) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--hx-card-accent) 14%, transparent);
  color: var(--hx-card-accent-2);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hx-podium {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hx-winner {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--hx-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--hx-bg) 35%, var(--hx-surface));
}

.hx-winner--1 {
  border-color: color-mix(in srgb, #f5c451 55%, var(--hx-border));
  background:
    linear-gradient(115deg, color-mix(in srgb, #f5c451 16%, transparent), transparent 62%),
    color-mix(in srgb, var(--hx-bg) 30%, var(--hx-surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, #f5c451 22%, transparent);
}

.hx-winner--2 {
  border-color: color-mix(in srgb, #c0c7d2 42%, var(--hx-border));
}

.hx-winner--3 {
  border-color: color-mix(in srgb, #d08a5a 42%, var(--hx-border));
}

.hx-winner-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid var(--hx-border);
  border-radius: 50%;
  font-family: var(--bs-font-monospace);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hx-muted);
}

.hx-winner--1 .hx-winner-rank {
  border-color: color-mix(in srgb, #f5c451 65%, transparent);
  background: color-mix(in srgb, #f5c451 12%, transparent);
  color: #f5c451;
}

.hx-winner--2 .hx-winner-rank {
  border-color: color-mix(in srgb, #c0c7d2 55%, transparent);
  color: #c0c7d2;
}

.hx-winner--3 .hx-winner-rank {
  border-color: color-mix(in srgb, #d08a5a 55%, transparent);
  color: #d08a5a;
}

.hx-winner-medal {
  display: inline-flex;
  color: var(--hx-muted);
}

.hx-winner--1 .hx-winner-medal {
  color: #f5c451;
  filter: drop-shadow(0 0 8px color-mix(in srgb, #f5c451 35%, transparent));
}

.hx-winner--2 .hx-winner-medal {
  color: #c0c7d2;
}

.hx-winner--3 .hx-winner-medal {
  color: #d08a5a;
}

.hx-winner-info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.hx-winner-place {
  color: var(--hx-muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hx-winner-name {
  color: var(--hx-text);
  font-family: "Space Grotesk", "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.18rem);
  font-weight: 600;
  text-transform: none;
  overflow-wrap: anywhere;
}

.hx-winner--1 .hx-winner-name {
  color: #ffe6a3;
  font-size: clamp(1.12rem, 1rem + 0.5vw, 1.35rem);
}

.hx-winners-note {
  max-width: 62ch;
  margin: clamp(1.25rem, 0.8rem + 1.6vw, 2rem) auto 0;
  color: var(--hx-muted);
  font-size: 0.88rem;
  line-height: 1.75;
  text-align: center;
}

.hx-nav-link-winners {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid color-mix(in srgb, var(--hx-accent) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--hx-accent) 12%, transparent);
  padding-inline: 0.75rem;
  color: var(--hx-text);
}

.hx-nav-link-winners:hover,
.hx-nav-link-winners:focus-visible {
  border-color: var(--hx-accent);
  background: color-mix(in srgb, var(--hx-accent) 22%, transparent);
  color: var(--hx-text);
}

.hx-nav-link-winners i {
  color: #f5c451;
}

[data-bs-theme="light"] .hx-closing-title .hx-en,
[data-bs-theme="light"] .hx-winners-title .hx-en,
[data-bs-theme="light"] .hx-winners-eyebrow,
[data-bs-theme="light"] .hx-closing-eyebrow {
  color: #6b2fa6;
}

[data-bs-theme="light"] .hx-closing-status {
  border-color: color-mix(in srgb, #1f8a52 45%, transparent);
  color: #17663d;
}

[data-bs-theme="light"] .hx-closing-btn {
  color: #0b5c6b;
  border-color: color-mix(in srgb, #0b7f92 45%, transparent);
  background: color-mix(in srgb, #22d3ee 14%, transparent);
}

[data-bs-theme="light"] .hx-winner--1 .hx-winner-name {
  color: #7a5300;
}

[data-bs-theme="light"] .hx-winner--1 .hx-winner-rank,
[data-bs-theme="light"] .hx-winner--1 .hx-winner-medal {
  color: #8a6100;
}

[data-bs-theme="light"] .hx-winner--2 .hx-winner-rank,
[data-bs-theme="light"] .hx-winner--2 .hx-winner-medal {
  color: #5b6472;
}

[data-bs-theme="light"] .hx-winner--3 .hx-winner-rank,
[data-bs-theme="light"] .hx-winner--3 .hx-winner-medal {
  color: #8a4f22;
}

[data-bs-theme="light"] .hx-division-card--onsite {
  --hx-card-accent: #0891b2;
  --hx-card-accent-2: #0e7490;
}

[data-bs-theme="light"] .hx-division-card--online {
  --hx-card-accent: #7c3aed;
  --hx-card-accent-2: #6b2fa6;
}

@media (max-width: 991.98px) {
  .hx-closing-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .hx-closing-aside {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "status trophy"
      "meta meta";
    align-items: center;
    gap: 0.75rem 1rem;
  }

  .hx-closing-status {
    grid-area: status;
  }

  .hx-closing-trophy {
    grid-area: trophy;
    justify-self: end;
  }

  .hx-closing-meta {
    grid-area: meta;
  }
}

@media (max-width: 575.98px) {
  .hx-closing {
    padding-block-start: 1rem;
  }

  .hx-closing-title {
    font-size: clamp(1.35rem, 1.1rem + 2vw, 1.7rem);
  }

  .hx-closing-meta div {
    grid-template-columns: 4.6rem minmax(0, 1fr);
  }

  .hx-winner {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
  }

  .hx-winner-rank {
    display: none;
  }

  .hx-winner--1 .hx-winner-name {
    font-size: 1.05rem;
  }

  .hx-winners-title {
    font-size: clamp(1.4rem, 1.1rem + 2vw, 1.75rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hx-closing-btn {
    transition: none;
  }

  .hx-closing-btn:hover,
  .hx-closing-btn:focus-visible {
    transform: none;
  }
}
