@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Raleway:wght@700&display=swap');

:root {
  --bg-color: #0e1b2b;
  --bg-gradient: linear-gradient(to bottom, #0e1b2b, #43648a);
  --border-width: 2px;
  --text-color: #ffffff;
  --header-bg: #ffffff;
  --footer-bg: #000000;
  --accent-color: #f5a623;
  --primary-blue: transparent;
  --border-color: #ffffff;
  --card-bg: #121f30;
  --card-text-color: #ffffff;
  --card-link-color: #4dc2eb;
  --news-header-color: #000000;
  --card-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-color);
}

/* ---------- Header ---------- */
.header {
  background-color: var(--header-bg);
  height: 70px;
  display: flex;
  align-items: center;
  padding-left: 20px;
  padding-right: 20px;
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
}

.header-logo img {
  width: 200px;
  height: auto;
  display: block;
}

/* ---------- Layout Settings ---------- */
.wrap, .footer-inner {
  max-width: 1582px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding-left: 20px;
  padding-right: 20px;
}

.main-content {
  max-width: 1582px;
  margin: 0 auto;
  padding: 35px 20px 20px 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 14px;
}

/* ---------- Sections & Titles ---------- */
.intro-section {
  grid-column: 1 / -1;
  margin-bottom: 12px;
}

.top-intro-text {
  margin-top: 0;
  margin-bottom: 16px;
  max-width: none;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--text-color);
}

.main-banners, .past-contests {
  display: contents;
}

/* ---------- Card Items Container ---------- */
.banner-item {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  color: var(--card-text-color);
  border: var(--border-width) solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
  max-width: none;
  height: auto;
  align-self: start;
  position: relative;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s ease;
}

/* ---------- Status Badges ---------- */
.contest-status {
  position: absolute;
  top: -10px;
  left: -4px;
  z-index: 2;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 4px;
  line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.contest-status--ongoing {
  background-color: #f5c542;
  color: #1a1a1a;
}
.contest-status--ended {
  background-color: #d4c4a8;
  color: #2b2b2b;
}

/* ---------- Typography & Text Content ---------- */
.banner-title {
  padding-right: 0;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.03rem;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  color: var(--card-link-color);
  font-weight: bold;
  text-decoration: none;
}

.banner-title img {
  max-width: 100%;
  max-height: 100px;
  height: auto;
  object-fit: contain;
}

.banner-desc {
  color: var(--card-text-color);
  margin-top: 1em;
  margin-bottom: 0;
  font-size: 1.05rem;
  height: 3.2em;
}
.banner-desc p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

/* ---------- Images ---------- */
.banner-link {
  margin-bottom: 0.6em;
  height: auto;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: transform 0.3s, box-shadow 0.3s;
}
.banner-link:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}
.banner-link img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-width: none;
  object-fit: cover;
  display: block;
}

/* ---------- News Section ---------- */
.news-section {
  padding: 0 10px 10px 10px;
  margin-top: 1.5em;
  margin-bottom: 12px;
  height: 230px;
  display: flex;
  flex-direction: column;
  background-color: var(--primary-blue);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
}

.news-header {
  display: block;
  background-color: var(--accent-color);
  color: var(--news-header-color);
  padding: 5px 10px;
  font-weight: bold;
  font-family: 'Raleway', sans-serif;
  margin-bottom: 7px;
}

.news-placeholder {
  flex: 1;
  min-height: 0;
}
.news-placeholder p {
  margin: 0;
}
.news-placeholder .topic-box {
  margin-top: 0;
  height: 100%;
}
.news-placeholder .news-main {
  height: 100%;
  overflow-y: scroll;
  padding-right: 4px;
}
.topic-box {
  background: transparent;
  padding: 0;
  max-width: none;
}

.news-block {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 6px 0;
  font-size: 0.76rem;
}
.news-block dt {
  width: 105px;
  font-weight: bold;
  color: var(--card-text-color);
  flex-shrink: 0;
}
.news-block dd {
  margin: 0;
  flex-grow: 1;
}
.news-block a {
  text-decoration: underline;
  color: var(--card-link-color);
}
.news-block:nth-child(n + 6) {
  display: none;
}

/* ---------- Footer ---------- */
.footer {
  width: 100%;
  margin-top: auto;
  background-color: var(--footer-bg);
  text-align: center;
  border-top: var(--border-width) solid var(--border-color);
  padding: 20px 0;
  font-size: 0.8rem;
  color: #ffffff;
}

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 1200px) {
  body {
    overflow: auto;
  }
  .main-content {
    min-height: 0;
    display: block;
    padding-top: 10px;
    padding-bottom: 0;
  }
  .main-banners {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
  }
  .past-contests {
    display: block;
    margin-top: 20px;
    margin-bottom: 60px;
  }
}

@media (max-width: 768px) {
  .header {
    height: 66px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .wrap, .footer-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
  .main-content {
    padding-left: 16px;
    padding-right: 16px;
  }
  .header-logo img {
    width: 160px;
  }
  .top-intro-text {
    margin-bottom: 24px;
  }
  .main-banners {
    flex-direction: column;
    margin-bottom: 30px;
    gap: 24px;
  }
  .past-contests {
    margin-top: 36px;
    margin-bottom: 42px;
  }
  .news-block {
    flex-direction: column;
    gap: 2px;
  }
}
