:root {
  --italy-green: #009246;
  --italy-green-deep: #006b34;
  --italy-white: #f5f7f4;
  --italy-red: #ce2b37;
  --italy-red-deep: #9e1f28;
  --ink: #f4f7f2;
  --ink-muted: rgba(244, 247, 242, 0.72);
  --panel: rgba(8, 12, 10, 0.78);
  --line: rgba(245, 247, 244, 0.18);
  --gold: #d4b56a;
  --radius: 16px;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Manrope", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: #050705;
  line-height: 1.55;
}

/* --- Slideshow --- */
.slideshow {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: #050705;
}

.slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.4s ease, transform 8s ease;
}

.slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.slideshow-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      105deg,
      rgba(0, 146, 70, 0.42) 0%,
      rgba(8, 10, 9, 0.55) 34%,
      rgba(8, 10, 9, 0.55) 66%,
      rgba(206, 43, 55, 0.42) 100%
    ),
    linear-gradient(180deg, rgba(5, 7, 5, 0.35) 0%, rgba(5, 7, 5, 0.72) 55%, rgba(5, 7, 5, 0.92) 100%);
}

.tricolor-bar {
  display: none;
}

.server-badge {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem 0.45rem 0.45rem;
  border: 1px solid rgba(245, 247, 244, 0.2);
  background: rgba(5, 8, 6, 0.72);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  animation: fadeIn 0.8s ease both;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

a.server-badge:hover,
a.server-badge:focus-visible {
  border-color: rgba(212, 181, 106, 0.55);
  transform: translateY(-1px);
  outline: none;
}

.top-nav {
  position: fixed;
  top: 1.1rem;
  left: 1.1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  max-width: calc(100vw - 10rem);
}

.nav-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(245, 247, 244, 0.22);
  background: rgba(5, 8, 6, 0.78);
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.nav-home:hover,
.nav-home:focus-visible {
  border-color: rgba(212, 181, 106, 0.55);
  transform: translateY(-1px);
  outline: none;
}

.nav-home img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nav-link,
.auth-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 247, 244, 0.2);
  background: rgba(5, 8, 6, 0.72);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-link[hidden],
.auth-chip[hidden],
[hidden] {
  display: none !important;
}

.nav-link.is-active {
  border-color: rgba(0, 146, 70, 0.7);
  color: #7ddea8;
}

.auth-btn {
  cursor: pointer;
  font: inherit;
}

.nav-auth {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.user-menu {
  position: relative;
}

.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem 0.25rem 0.25rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 247, 244, 0.2);
  background: rgba(5, 8, 6, 0.72);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.user-menu-drop {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 140px;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(245, 247, 244, 0.18);
  background: rgba(6, 10, 8, 0.95);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

.user-menu-drop button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

.user-menu-drop button:hover {
  background: rgba(206, 43, 55, 0.2);
}

.login-gate {
  text-align: center;
  padding: 1.5rem 0.5rem 0.5rem;
  color: var(--ink-muted);
}

.login-gate .cta {
  margin-top: 1rem;
}

.bypass-login {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(245, 247, 244, 0.12);
  text-align: left;
}

.bypass-hint {
  margin: 0 0 0.85rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.bypass-form {
  display: grid;
  gap: 0.75rem;
}

.bypass-form label {
  display: grid;
  gap: 0.35rem;
}

.bypass-form input {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(5, 10, 8, 0.75);
  color: var(--ink);
  font: inherit;
}

.bypass-form .cta {
  margin-top: 0.25rem;
  justify-self: start;
}

input[readonly] {
  opacity: 0.85;
  cursor: default;
}

.staff-inline {
  margin-top: 0;
}

.apply.archive-page {
  width: min(1280px, calc(100% - 2rem));
  transition: width 0.25s ease;
}

.apply.archive-page:not(:has(.archive-layout.is-open)) {
  width: min(760px, calc(100% - 2rem));
}

.inline-filters {
  margin-bottom: 1rem;
}

.app-row.static-row {
  cursor: default;
}

.server-badge img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.server-badge span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  padding-right: 0.25rem;
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 5.5rem 1.5rem 5rem;
  animation: rise 0.9s ease-out both;
}

.hero-flags,
.flag,
.flag-mini,
.intro-flag,
.footer-flags {
  display: none !important;
}

.brand-logo {
  width: clamp(7.5rem, 16vw, 10rem);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(245, 247, 244, 0.12);
  animation: fadeIn 0.9s ease both;
}

body.archive-mode .hero {
  display: none !important;
}

body.archive-mode .archive-page {
  margin-top: 5.5rem;
  min-height: calc(100vh - 7rem);
}

.archive-intro {
  display: grid;
  justify-items: start;
  gap: 0.35rem;
}

.archive-flag {
  width: 3.2rem;
  height: auto;
  border-radius: 3px;
  margin-bottom: 0.55rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.archive-intro h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.6rem, 13vw, 7.4rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 0.92;
  color: var(--italy-white);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 0 40px rgba(0, 146, 70, 0.35),
    0 0 70px rgba(206, 43, 55, 0.2);
  animation: brandPulse 5s ease-in-out infinite alternate;
}

.motto {
  margin: 1rem 0 0;
  font-family: var(--font-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: rgba(245, 247, 244, 0.88);
}

.tagline {
  max-width: 34rem;
  margin: 1.15rem 0 2.1rem;
  color: var(--ink-muted);
  font-size: 1.05rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.7rem;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(90deg, var(--italy-green), var(--italy-white), var(--italy-red)) border-box;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.86rem;
  transition: transform 0.2s ease, background 0.2s ease, filter 0.2s ease;
}

.cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  background:
    linear-gradient(rgba(0, 107, 52, 0.85), rgba(158, 31, 40, 0.85)) padding-box,
    linear-gradient(90deg, var(--italy-green), var(--italy-white), var(--italy-red)) border-box;
}

/* --- Form --- */
.apply {
  position: relative;
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto 4rem;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: rise 0.8s ease-out 0.15s both;
}

.apply::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(0, 146, 70, 0.7),
    rgba(245, 247, 244, 0.15),
    rgba(206, 43, 55, 0.7)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.intro {
  margin-bottom: 1.75rem;
}

.intro-flag {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.intro h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro p {
  margin: 0;
  color: var(--ink-muted);
}

fieldset {
  margin: 0 0 1.6rem;
  padding: 0;
  border: none;
}

legend {
  margin-bottom: 0.9rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7ddea8;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.1rem;
}

label {
  display: grid;
  gap: 0.4rem;
}

label.full {
  grid-column: 1 / -1;
}

label span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
}

label.has-warning span::before {
  content: "! ";
  color: #ffb4b8;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(245, 247, 244, 0.18);
  border-radius: 10px;
  background: rgba(5, 10, 8, 0.72);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 146, 70, 0.85);
  box-shadow: 0 0 0 3px rgba(0, 146, 70, 0.22);
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: rgba(206, 43, 55, 0.9);
  box-shadow: 0 0 0 3px rgba(206, 43, 55, 0.22);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

button[type="submit"] {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 0.95rem 1.5rem;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--italy-green-deep), var(--italy-red-deep));
  color: var(--italy-white);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button[type="submit"]:disabled {
  opacity: 0.65;
  cursor: wait;
}

.status {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.95rem;
  white-space: pre-line;
}

.status.error {
  background: rgba(206, 43, 55, 0.16);
  border: 1px solid rgba(206, 43, 55, 0.45);
  color: #f3b4b8;
}

.success {
  text-align: center;
  padding: 2rem 0.5rem;
  animation: rise 0.5s ease-out both;
}

.success h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7ddea8;
}

.success p {
  margin: 0;
  color: var(--ink-muted);
}

.footer {
  padding: 1.5rem 1rem 2.5rem;
  text-align: center;
  color: rgba(244, 247, 242, 0.55);
  font-size: 0.85rem;
}

.footer-flags {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.flag-mini {
  width: 22px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes brandPulse {
  from {
    text-shadow:
      0 2px 0 rgba(0, 0, 0, 0.35),
      0 0 28px rgba(0, 146, 70, 0.22),
      0 0 50px rgba(206, 43, 55, 0.12);
  }
  to {
    text-shadow:
      0 2px 0 rgba(0, 0, 0, 0.35),
      0 0 48px rgba(0, 146, 70, 0.4),
      0 0 80px rgba(206, 43, 55, 0.28);
  }
}

@keyframes flagWave {
  0%,
  100% {
    transform: rotate(-2deg) translateY(0);
  }
  50% {
    transform: rotate(2deg) translateY(-2px);
  }
}

@media (max-width: 640px) {
  .top-nav {
    top: 0.75rem;
    left: 0.65rem;
    max-width: calc(100vw - 7.5rem);
    gap: 0.35rem;
  }

  .nav-link,
  .auth-chip {
    padding: 0.4rem 0.65rem;
    font-size: 0.72rem;
  }

  .nav-home {
    width: 2.25rem;
    height: 2.25rem;
  }

  .server-badge {
    top: 0.85rem;
    right: 0.75rem;
    padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  }

  .server-badge img {
    width: 28px;
    height: 28px;
  }

  .server-badge span {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
  }

  .apply {
    padding: 1.35rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  button[type="submit"] {
    width: 100%;
  }
}
