:root {
  --bg: #1a0f0a;
  --card: #1a1111;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #ff8c42;
  --content-max: min(1100px, 94vw);
  --nav-height: 4rem; /* ~64px */
  --nav-height-expanded: 7.75rem; /* ~124px */
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: linear-gradient(145deg, #0b0a0a, #1a0f0a 45%, #0b0a0a);
  color: var(--text);
  padding-top: calc(var(--nav-height-expanded) + 0.75rem); /* room for expanded bar */
  position: relative;
}
a { color: inherit; text-decoration: none; }
.page-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(239, 68, 68, 0.12), transparent 35%), linear-gradient(145deg, #0b0a0a, #1a0f0a 45%, #0b0a0a);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.45) saturate(0.9);
  transition: opacity 800ms ease;
  z-index: -5;
  pointer-events: none;
}
.page-bg.is-hidden { opacity: 0; }
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: #1a1111;
  backdrop-filter: blur(6px);
  border-top: 4px solid rgba(255, 140, 66, 0.6);
  border-bottom: 4px solid rgba(255, 140, 66, 0.6);
  height: var(--nav-height);
  transition: height 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
}
.topbar:hover {
  height: var(--nav-height-expanded);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.topbar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 1.25rem);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: padding 200ms ease;
}
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  position: relative;
  padding-right: 1rem;
}
.brand-row::after {
  content: "▼";
  position: absolute;
  right: clamp(1rem, 3vw, 1.25rem);
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: rgba(255, 140, 66, 0.95);
  text-shadow: 0 0 6px rgba(255, 140, 66, 0.55);
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms ease;
  pointer-events: none;
  line-height: 1;
  opacity: 1;
  visibility: visible;
}
.topbar:hover .brand-row::after {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateY(-4px);
}
.logo {
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.logo:hover {
  opacity: 0.85;
}
.logo-icon {
  width: calc(var(--nav-height) - 20px);
  height: calc(var(--nav-height) - 20px);
  object-fit: contain;
  display: block;
  padding: 10px 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.65rem, 1.8vw, 0.9rem);
  height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  transition: height 180ms ease, opacity 180ms ease, padding 180ms ease;
}
.topbar:hover .nav-links {
  height: clamp(2.6rem, 4vw, 3rem);
  opacity: 1;
  padding: 0.5rem 0 0.75rem;
}
.nav-links a {
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
  color: var(--muted);
  font-weight: 600;
  transition: color 150ms ease, background 150ms ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-links a:hover {
  color: var(--text);
  background: rgba(239, 68, 68, 0.08);
}
main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(2.25rem, 5vw, 3rem) clamp(1rem, 4vw, 1.75rem) clamp(4rem, 8vw, 5.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vw, 2.25rem);
}
.hero {
  position: relative;
  overflow: hidden;
  background: url("img/mainpage/cards/banneranim.webp") center/cover no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: clamp(1.5rem, 3vw, 1.75rem);
  min-height: clamp(260px, 50vh, 420px);
  border-radius: 1.125rem;
  z-index: 2;
  background-color: #1a0f0a;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(220, 38, 38, 0.08));
  z-index: 1;
  pointer-events: none;
}
.hero-bg {
  position: absolute;
  inset: -2%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.7) saturate(0.95);
  transition: opacity 800ms ease;
  z-index: 0;
}
.hero-bg.is-hidden {
  opacity: 0;
}
.hero-content {
  position: relative;
  z-index: 3;
}
main,
footer,
.grid,
.card {
  position: relative;
  z-index: 2;
}
.hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.9rem, 3vw, 2.3rem);
  letter-spacing: -0.04em;
}
.hero p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  max-width: 45ch;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(0.9rem, 2vw, 1.25rem);
}
.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.9rem;
  padding: clamp(1rem, 2.4vw, 1.25rem);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  transition: transform 150ms ease, border-color 150ms ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(239, 68, 68, 0.35);
}
.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}
.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.divider {
  position: relative;
  z-index: 2;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  margin: clamp(4rem, 8vw, 6rem) 0;
  padding: clamp(3rem, 6vw, 5rem) clamp(1rem, 4vw, 1.75rem);
  text-align: center;
  background: #1a1111;
  border-top: 4px solid rgba(255, 140, 66, 0.4);
  border-bottom: 4px solid rgba(255, 140, 66, 0.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.divider h2 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 4px 20px rgba(255, 140, 66, 0.3);
}
footer {
  text-align: center;
  color: var(--muted);
  padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(3rem, 6vw, 3.5rem);
  font-size: 0.9rem;
}

@media (max-width: 720px), (max-height: 720px) and (orientation: portrait) {
  body {
    padding-top: calc(var(--nav-height-expanded) + 0.75rem);
  }
  .topbar {
    height: var(--nav-height);
  }
  .topbar:hover,
  .topbar.is-expanded {
    height: auto;
    min-height: var(--nav-height-expanded);
  }
  .topbar .nav-links {
    height: 0;
    opacity: 0;
    padding: 0;
    flex-wrap: wrap;
  }
  .topbar:hover .nav-links,
  .topbar.is-expanded .nav-links {
    height: auto;
    opacity: 1;
    padding: 0.5rem 0 0.75rem;
  }
}

