/* Base layout */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  background: #000000;
  color: #ffffff;
  font-family: "Work Sans", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-weight: 500;
  overflow: hidden; /* no scroll */
}

/* Headers use Inknut Antiqua Bold */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Inknut Antiqua", serif;
  font-weight: 700;
}

/* Loading screen - first visit only */
.af-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.af-loading-screen.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.af-loading-screen.is-sliding {
  animation: af-zoom-fade-out 0.6s ease-out forwards;
  transition: none; /* Disable transition during animation */
}

.af-loading-screen.is-hidden {
  display: none; /* Completely hide after animation */
}

.af-loading-image {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

@keyframes af-zoom-fade-out {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Fullscreen centered logo */
.af-fullscreen {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

.af-center-logo {
  max-width: min(40vmin, 320px);
  max-height: min(40vmin, 320px);
  display: block;
}

/* Top-right actions */
.af-top-right-actions {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 30;
  transition: opacity 220ms ease;
}

/* Hide top buttons when about page is open */
body.af-about-open .af-top-right-actions {
  opacity: 0;
  pointer-events: none;
}

.af-chip-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.af-chip-button:hover {
  background: #ffffff;
  color: #000000;
  transform: translateY(-1px);
}

.af-chip-button-ghost {
  background: transparent;
}

.af-chip-button-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Flowing border frame using an outline (original "beautiful" version") */
.af-border-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.af-border-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px; /* border thickness */
  background: linear-gradient(
    90deg,
    #ffffff,
    #ffff01,
    #01ffff,
    #01ff01,
    #ff3ffc,
    #fd241f,
    #0000fe,
    #ffffff
  );
  background-size: 400% 400%;
  animation: af-border-flow 12s linear infinite;
  /* Create a hollow center so only the border shows */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* About "page" overlay */
.af-page {
  position: fixed;
  inset: 0;
  z-index: 40; /* Higher than top-right buttons (30) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.96);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  overflow-y: auto; /* Allow scrolling on mobile */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.af-page.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.af-page-inner {
  width: min(960px, 100% - 48px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: #ffffff;
  padding: 20px 0; /* Add padding for scroll spacing */
}

.af-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.af-page-header h1 {
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.af-page-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  font-size: 14px;
  line-height: 1.6;
}

.af-page-block h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.af-founders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.af-founder-card {
  text-align: center;
}

.af-founder-photo {
  width: 160px;
  height: 160px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.af-founder-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.af-founder-card h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.af-founder-card p {
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .af-founders {
    grid-template-columns: 1fr;
  }

  .af-page {
    align-items: flex-start; /* Align to top on mobile for better scrolling */
    padding: 20px 0;
  }

  .af-page-inner {
    width: min(520px, 100% - 32px);
    max-height: none; /* Remove max-height constraint on mobile */
    padding: 20px 0 40px; /* Extra bottom padding for scroll */
  }
}

/* Animation for the flowing effect */
@keyframes af-border-flow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 400% 50%;
  }
}