/* =============================================================
   Deferred (Below-Fold) CSS — L2LegacyWorld Portal
   Loaded asynchronously after first paint via rel="preload".
   Do NOT put topbar, hero, or button styles here.
   ============================================================= */

/* ── Section base ─────────────────────────────────────────── */

section {
  padding: 90px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 42px;
  position: relative;
}

/* Faint warm halo behind every section title */
.section-header::before {
  content: '';
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 460px;
  max-width: 90vw;
  height: 220px;
  background: radial-gradient(ellipse at center, rgba(255, 157, 47, 0.09), transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.section-header h2 {
  font-size: clamp(30px, 4vw, 46px);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Gradient underline accent — visual rhythm for every section */
.section-header h2::after {
  content: '';
  display: block;
  width: 44px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(255, 157, 47, 0.45);
}

.section-header p {
  color: var(--muted);
  max-width: 760px;
  margin: 0 auto;
  font-size: 16px;
}

/* ── Card grid ────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  transition: var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 209, 138, 0.24);
  box-shadow: var(--shadow), 0 0 40px rgba(255, 157, 47, 0.08);
}

/* Header row: icon chip left, badge right */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-icon {
  display: block;
  width: 48px;
  height: 48px;
  padding: 11px;
  flex-shrink: 0;
  color: var(--accent-2);
  background: rgba(255, 157, 47, 0.10);
  border: 1px solid rgba(255, 157, 47, 0.30);
  border-radius: 14px;
  filter: drop-shadow(0 0 8px rgba(255, 157, 47, 0.35));
}

.card-head .card-badge {
  margin-bottom: 0;
}

.card-badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 157, 47, 0.12);
  color: var(--accent-2);
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.card h3 {
  font-size: 24px;
  margin-bottom: 12px;
}

.card p,
.card li {
  color: #d0d0d8;
  font-size: 15px;
}

.card ul {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.card li::before {
  content: '•';
  color: var(--accent);
  font-weight: 900;
  margin-right: 8px;
}

/* ── Info grid ────────────────────────────────────────────── */

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.info-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.info-box h3 {
  font-size: 24px;
  margin-bottom: 16px;
}

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

.info-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-item span:first-child {
  color: #f1f1f4;
  font-weight: 700;
}

.info-item span:last-child {
  color: var(--muted);
  text-align: right;
}

/* ── CTA section ──────────────────────────────────────────── */

.cta-section {
  padding-top: 20px;
}

.cta-box {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 60px 28px;
  background: var(--grad-cta);
  border: 1px solid rgba(255, 157, 47, 0.28);
  box-shadow: var(--shadow), 0 0 56px rgba(255, 157, 47, 0.08);
  text-align: center;
}

.cta-box > * {
  position: relative;
  z-index: 1;
}

.cta-box h2 {
  font-size: clamp(30px, 4vw, 48px);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.cta-box p {
  color: #dadade;
  max-width: 620px;
  margin: 0 auto 28px;
  font-size: 16px;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* ── Gallery grid ─────────────────────────────────────────── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.gallery-card {
  min-height: 240px;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow);
  background-color: var(--bg-soft);
  transition: var(--ease);
}

/* Image lives on ::before so it can zoom on hover */
.gallery-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.5s ease;
  will-change: transform;
}

/* Per-card artwork */
.gallery-grid .gallery-card:nth-child(1)::before {
  background-image: var(--grad-gallery-base), url('../../img/gallery-siege.webp');
}
.gallery-grid .gallery-card:nth-child(2)::before {
  background-image: var(--grad-gallery-base), url('../../img/gallery-olympiad.webp');
}
.gallery-grid .gallery-card:nth-child(3)::before {
  background-image: var(--grad-gallery-base), url('../../img/gallery-boss.webp');
}

.gallery-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 157, 47, 0.30);
  box-shadow: var(--shadow), 0 0 40px rgba(255, 157, 47, 0.10);
}

.gallery-card:hover::before {
  transform: scale(1.06);
}

.gallery-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-gallery-vignette);
}

.gallery-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 22px;
}

.gallery-content h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.gallery-content p {
  color: #dbdbe1;
  font-size: 14px;
  margin: 0;
}

/* ── News grid ────────────────────────────────────────────── */

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.news-card {
  padding: 26px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--ease);
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 209, 138, 0.22);
  box-shadow: var(--shadow), 0 0 32px rgba(255, 157, 47, 0.07);
}

.news-date {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.news-card h3 {
  font-size: 22px;
  margin-bottom: 10px;
}

.news-card p {
  color: #d4d4dc;
  font-size: 15px;
  margin-bottom: 18px;
}

.news-link {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 14px;
}

.news-link:hover {
  color: #fff;
}

/* ── Vote toplist buttons ─────────────────────────────────── */

.vote-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 14px 26px;
  border-radius: 14px;
  background: rgba(255, 157, 47, 0.07);
  border: 1px solid var(--border-accent);
  color: #f1f1f5;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.3px;
  transition: var(--ease);
}

.vote-btn .vote-arrow {
  color: var(--live);
  font-size: 13px;
}

.vote-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 157, 47, 0.13);
  border-color: rgba(255, 157, 47, 0.55);
  box-shadow: 0 0 24px rgba(255, 157, 47, 0.15);
}

/* ── Footer ───────────────────────────────────────────────── */

.footer {
  margin-top: 90px;
  border-top: none;
  position: relative;
  background: rgba(0, 0, 0, 0.22);
}

/* Gradient hairline instead of flat border */
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 157, 47, 0.45), transparent);
}

.footer-inner {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 20px 0;
}

.footer small {
  color: #9ea0aa;
  font-size: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: #9ea0aa;
  font-size: 14px;
  transition: var(--ease);
}

.footer-links a:hover {
  color: var(--accent-2);
}

/* ── Ambient background — slow drifting glow orbs ────────── */

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.amb-orb {
  position: absolute;
  border-radius: 50%;
}

.amb-orb--a {
  width: 900px;
  height: 900px;
  background: radial-gradient(circle, rgba(255, 157, 47, 0.08) 0%, transparent 65%);
  top: 10%;
  left: -25%;
  animation: amb-a 44s ease-in-out infinite alternate;
  will-change: transform;
}

.amb-orb--b {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(190, 70, 20, 0.07) 0%, transparent 65%);
  bottom: 8%;
  right: -18%;
  animation: amb-b 52s ease-in-out infinite alternate;
  will-change: transform;
}

.amb-orb--c {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, rgba(255, 209, 138, 0.055) 0%, transparent 65%);
  top: 50%;
  left: 38%;
  animation: amb-c 60s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes amb-a {
  from { transform: translate(0, 0); }
  to   { transform: translate(110px, 85px); }
}

@keyframes amb-b {
  from { transform: translate(0, 0); }
  to   { transform: translate(-90px, -105px); }
}

@keyframes amb-c {
  from { transform: translate(0, 0); }
  to   { transform: translate(-65px, 95px); }
}

/* ── Film grain — subtle cinematic texture over everything ── */

.film-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ── Responsive (below-fold breakpoints) ──────────────────── */

/* Tablet: two columns instead of one stretched column */
@media (max-width: 1024px) {
  .cards,
  .gallery-grid,
  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* odd item count: let the last card span the full row */
  .cards > article:last-child:nth-child(odd),
  .gallery-grid > article:last-child:nth-child(odd),
  .news-grid > article:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Small tablet / large phone: single column */
@media (max-width: 640px) {
  .cards,
  .gallery-grid,
  .news-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  section {
    padding: 60px 0;
  }

  .cta-box {
    padding: 40px 20px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  section { padding: 44px 0; }
  .section-eyebrow { font-size: 11px; }
  .section-title { font-size: clamp(20px, 6vw, 28px); }
  .card { padding: 20px 16px; }
  .cta-box { padding: 28px 16px; }
  .footer-inner { gap: 20px; }
  .footer-col { width: 100%; }
  .info-grid { gap: 14px; }
  .gallery-item { border-radius: 12px; }
}
