/* ===== Variables ===== */
:root {
  --color-primary: #c41230;
  --color-text: #333;
  --border-color: #ccc;
  --header-height: 80px;
  --footer-height: 40px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --font-size-small: 0.875rem;
  --font-size-base: 1rem;
  --font-size-large: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: var(--color-text);
}
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ===== Header ===== */
header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 8px 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* About page header specific styles */
.about-page header {
  justify-content: space-between;
}

/* Make sure the header on about page has proper spacing */
header .header-left {
  display: flex;
  align-items: center;
}

header .header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sfhr-logo {
  width: 120px;
}
.header-center {
  flex: 1;
  text-align: center;
}
.donation-counter {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
}
.header-right {
  display: flex;
  gap: 8px;
}
.header-button {
  background: var(--color-primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
}
.header-button:hover {
  background: #a30f28;
}

/* ===== Sponsors Grid ===== */
main {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#sponsors-container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 1fr;
  grid-auto-flow: dense;
  gap: 0;
  width: 100%;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  max-height: calc(100vh - var(--header-height) - var(--footer-height));
  overflow: hidden;
}

/* ===== Sponsor Tile ===== */
.sponsor-wrapper {
  position: relative;
  border: 1px solid var(--border-color);
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  min-width: 0;
  min-height: 0;
}
.sponsor-wrapper:hover {
  transform: scale(1.02);
  transition: transform 0.2s ease;
}

/* ===== Flip Card ===== */
.sponsor-card {
  width: 100%;
  height: 100%;
  perspective: 800px;
  position: relative;
}
.card-inner {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  position: relative;
}
.card-inner.is-flipped {
  transform: rotateY(180deg);
}
.card-front,
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: #fff;
}

.card-front {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back {
  transform: rotateY(180deg);
  padding: var(--spacing-md);
  overflow-y: auto;
}

/* ===== Logo ===== */
.sponsor-logo {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* ===== Back Content ===== */
.card-back dl {
  width: 100%;
}

.card-back dt {
  color: var(--color-primary);
  font-weight: 600;
  margin-top: var(--spacing-sm);
}

.card-back dd {
  margin-bottom: var(--spacing-sm);
  word-wrap: break-word;
}

/* ===== About Page Styles ===== */
.about-content {
  flex: 1;
  padding: var(--spacing-lg);
  overflow-y: auto;
}

.about-container {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: var(--spacing-lg);
}

.about-container h1,
.about-container h2 {
  color: var(--color-primary);
  margin-bottom: var(--spacing-md);
}

.about-text {
  line-height: 1.6;
}

.about-text p {
  margin-bottom: var(--spacing-md);
}

.about-text h3 {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
}

/* ===== Footer ===== */
footer {
  flex: none;
  text-align: center;
  padding: 8px;
  background: #fff;
  color: #666;
  font-size: 0.875rem;
  height: var(--footer-height);
}

/* ===== Mobile Header Layout ===== */
/* New mobile header layout with bigger logo */
.mobile-header {
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  height: 100px; /* Reduced height for the header */
}

/* Logo styling - make it bigger and position it on the left */
.mobile-header-logo {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.mobile-header-logo .sfhr-logo {
  width: 110px;
  height: auto;
}

/* Top row with buttons - positioned higher */
.mobile-header-buttons {
  position: absolute;
  top: 15px; /* Adjusted position */
  right: 0;
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

/* Bottom row with counter - positioned closer to buttons */
.mobile-header-counter {
  position: absolute;
  bottom: 15px; /* Adjusted position to be closer to buttons */
  right: 0;
  text-align: right;
}

/* ===== Media Queries ===== */
@media (max-width: 768px) {
  :root {
    --header-height: 100px; /* Reduced height */
    --mobile-header-height: 100px; /* Reduced height */
  }

  header {
    height: var(--header-height);
    padding: var(--spacing-sm);
    position: relative;
  }

  /* Mobile adjustments for about page */
  .about-page header {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .about-page .header-left {
    margin-bottom: 0;
  }

  .about-page .header-right {
    display: flex;
    gap: 4px;
  }

  .about-page .header-right .header-button {
    padding: 4px 8px;
    font-size: 0.85rem;
  }

  /* Mobile-specific button styles */
  .mobile-header-buttons .header-button {
    padding: 4px 8px;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  /* Mobile-specific main content */
  main {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile-specific sponsor styles */
  .mobile-sponsor {
    width: 100%;
    border: 2px solid var(--border-color);
    margin-bottom: 2px;
    border-radius: 4px;
  }

  /* Add tap highlight for better mobile feedback */
  .sponsor-card {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }

  /* Ensure logos display well on mobile */
  .sponsor-logo {
    max-width: 85%;
    max-height: 85%;
  }
}

@media (max-width: 480px) {
  :root {
    --mobile-header-height: 100px; /* Reduced height */
  }

  .about-page .header-right {
    flex-direction: row;
    width: auto;
  }

  .about-page .header-right .header-button {
    width: auto;
  }

  .about-content {
    padding: var(--spacing-sm);
  }

  .about-container {
    padding: var(--spacing-sm);
  }

  /* Even smaller buttons on very small screens */
  .mobile-header-buttons .header-button {
    padding: 3px 6px;
    font-size: 0.8rem;
  }

  /* Adjust logo size for very small screens but keep it relatively large */
  .mobile-header-logo .sfhr-logo {
    width: 90px;
  }
}
