/* CTFs page-specific styles (reuses layout.css variables) */

/* HERO */
.ctf-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: 1rem;
  padding: 18px;
  margin-bottom: 14px;
  overflow: hidden;
}

.ctf-hero .hero-text h1 {
  margin: .1rem 0
}

.ctf-hero .hero-text p {
  margin: .2rem 0 0
}

/* Waving "flag" background (subtle) */
.hero-bg {
  position: absolute;
  inset: -20% -10% -30% -10%;
  z-index: -1;
  background:
    repeating-linear-gradient(115deg,
      #6c3cff33 0 18px,
      #a176ff33 18px 36px,
      #6be2ff26 36px 54px,
      transparent 54px 72px);
  filter: blur(18px) contrast(1.05) saturate(1.1);
  opacity: .35;
  transform: skewY(-2deg);
  animation: wave 11s ease-in-out infinite alternate;
}

@keyframes wave {
  0% {
    background-position: 0% 0%
  }

  100% {
    background-position: 130% 40%
  }
}

.hero-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, #ffffff1d, #ffffff0c);
  backdrop-filter: blur(10px) saturate(120%);
}

.hero-search input {
  all: unset;
  color: var(--text);
  width: 26ch;
  max-width: 46vw;
  padding: .45rem .2rem;
}

.hero-search input::placeholder {
  color: #c9c3ec
}

.hero-stats {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .95rem
}

/* AD slot (non-intrusive, width-safe, height-flex) */
.ad-slot {
  margin: 14px 0;
  padding: 8px 10px;
  overflow: hidden;
}

.ad-inner {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.ad-inner img,
.ad-inner iframe,
.ad-inner ins {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.ad-slot:empty {
  display: none
}

/* Upcoming strip */
.upcoming {
  padding: 10px;
  margin: 10px 0
}

.up-head h3 {
  margin: .2rem 0 .5rem
}

.up-list {
  display: flex;
  gap: .6rem;
  overflow: auto;
  padding-bottom: .2rem
}

.up-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #ffffff18, #ffffff0c);
  min-width: 260px;
}

.up-card img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: #160b31
}

.up-card strong {
  display: block
}

.up-card:hover {
  filter: brightness(1.05)
}

/* Grid — 3 per row on desktop */
.ctf-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 980px) {
  .ctf-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media (max-width: 560px) {
  .ctf-grid {
    grid-template-columns: 1fr
  }
}

.ctf-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, #ffffff1f, #ffffff0a);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: .25s transform, .25s filter, .25s box-shadow;
}

.ctf-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.03)
}

/* Enhanced Ribbon (angled with tails) */
.ribbon {
  position: absolute;
  top: 14px;
  left: -12px;
  z-index: 5;
  padding: .35rem .75rem .35rem 1.2rem;
  color: #0a051a;
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .02em;
  background: linear-gradient(135deg, #6be2ff, #a176ff);
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .25);
}

.ribbon::before,
.ribbon::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 14px;
  width: 0;
  height: 0;
  border-style: solid;
}

.ribbon::before {
  border-width: 6px 6px 0 0;
  border-color: #4aaed4 transparent transparent transparent;
  opacity: .7
}

.ribbon::after {
  left: 26px;
  border-width: 6px 6px 0 0;
  border-color: #6e56d6 transparent transparent transparent;
  opacity: .7
}

.ribbon span {
  white-space: nowrap
}

/* "100% Solved" badge — small circular check, bottom-right + tooltip */
.solved-all {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #052115;
  background: linear-gradient(135deg, #5ef3b7, #44d69a);
  border: 1px solid #2bb88355;
  box-shadow: 0 8px 18px rgba(46, 210, 150, .28);
  cursor: default;
  outline: none;
}

/* Tooltip (micro animation) */
.solved-all::after {
  content: attr(data-tip);
  position: absolute;
  right: 36px;
  bottom: 50%;
  transform: translateY(50%) scale(.96);
  transform-origin: 100% 50%;
  background: linear-gradient(180deg, #ffffffee, #ffffffdd);
  color: #0a051a;
  padding: .25rem .5rem;
  border-radius: 8px;
  border: 1px solid #2bb88340;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
  white-space: nowrap;
  font: 600 .82rem/1.2 Inter, ui-sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.solved-all::before {
  content: "";
  position: absolute;
  right: 30px;
  bottom: 50%;
  transform: translateY(50%);
  width: 8px;
  height: 8px;
  border: 1px solid #2bb88340;
  background: linear-gradient(180deg, #ffffffee, #ffffffdd);
  box-shadow: 0 8px 16px rgba(0, 0, 0, .18);
  rotate: 45deg;
  border-left: none;
  border-top: none;
  opacity: 0;
  transition: opacity .18s ease;
}

.solved-all:hover::after,
.solved-all:focus-visible::after {
  opacity: 1;
  transform: translateY(50%) scale(1);
}

.solved-all:hover::before,
.solved-all:focus-visible::before {
  opacity: 1;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

  .solved-all::after,
  .solved-all::before {
    transition: none
  }
}

/* Cover supports 1200x400 landscape (3:1) */
.cover {
  position: relative;
  overflow: hidden;
  background: #12092a
}

.ratio-3x1 {
  aspect-ratio: 3 / 1
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: center/cover no-repeat var(--img);
  filter: saturate(1.05) contrast(1.02);
}

.cover-grad {
  position: absolute;
  inset: auto 0 0 0;
  height: 65%;
  background: linear-gradient(180deg, transparent, #0b0614b5, #0b0614f0);
}

.logo {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #160b31;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
}

/* Love badge: outline vs filled (top-right) */
.love {
  position: absolute;
  right: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .34rem .55rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: .92rem;
  border: 1px solid var(--stroke);
  backdrop-filter: blur(8px);
}

.love span {
  min-width: 2ch;
  text-align: right
}

.love.outline {
  color: #ff7fb0;
  background: #ffffff22
}

.love.loved {
  color: #fff;
  background: linear-gradient(135deg, #ff7fb0, #ff3b8d);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(255, 59, 141, .26)
}

.meta {
  padding: 10px 12px 12px
}

.title {
  font-size: 1.02rem;
  margin: .15rem 0 0
}

/* Empty state */
.empty {
  display: grid;
  place-items: center;
  padding: 26px 0
}

.empty-inner {
  padding: 18px;
  border-radius: 16px;
  text-align: center;
}

.empty h3 {
  margin: .2rem 0 .3rem
}

/* Utility */
.glass {
  background: linear-gradient(180deg, #ffffff20, #ffffff0c);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(120%);
}

/* Tweak hero layout on narrow screens */
@media (max-width: 900px) {
  .ctf-hero {
    grid-template-columns: 1fr
  }

  .hero-search {
    width: 100%
  }

  .hero-search input {
    max-width: 100%
  }
}