:root {
  /* Fluid typography scale (min 320px, max 1200px) */
  --text-sm: clamp(0.875rem, 0.8rem + 0.38vw, 1rem);
  --text-base: clamp(1rem, 0.93rem + 0.38vw, 1.125rem);
  --text-md: clamp(1.125rem, 1.05rem + 0.38vw, 1.25rem);
  --text-lg: clamp(1.25rem, 1.02rem + 1.13vw, 2rem);
  --text-xl: clamp(1.5rem, 1.23rem + 1.35vw, 2.4rem);
  --text-xxl: clamp(1.75rem, 1.37rem + 1.88vw, 3rem);
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  padding: 1rem;
  font-family: "Arvo";
  font-size: var(--text-base);
}

h1 {
  font-size: var(--text-xxl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

body.modal-open {
  overflow: hidden;
}

button {
  border: none;
  background-color: #d5321b;
  color: #eee;
  padding: 1rem 2rem;
  font-size: var(--text-lg);
  font-family: "Arvo";
}

button:hover {
  cursor: pointer;
  background-color: #b62a17;
}

.bold {
  font-weight: bold;
}

.center {
  display: flex;
  justify-content: center;
}

.margin-top-1 {
  margin-top: 1rem;
}

.margin-top-2 {
  margin-top: 2rem;
}

.margin-vertical-1 {
  margin: 1rem 0 1rem 0;
}

.margin-vertical-4 {
  margin: 4rem 0 4rem 0;
}

.content-block {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  padding-top: 1rem;
}

/* flip order for every other instance */
.content-block:nth-of-type(even) {
  grid-template-columns: 1fr 2fr;
}

.content-block:nth-of-type(even) .media {
  order: 2;
}

.content-block:nth-of-type(even) .content {
  order: 1;
}

.content-block img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.content-block .content-block-text {
  font-size: var(--text-lg);
  align-self: center;
}

@media (max-width: 768px) {
  .content-block,
  .content-block:nth-of-type(even) {
    grid-template-columns: 1fr;
  }

  .content-block:nth-of-type(even) .media,
  .content-block:nth-of-type(even) .content {
    order: 0;
  }
}

/* events table styles */
.events {
  text-align: center;
}

.events h3 {
  font-size: var(--text-xl);
}

.events-table {
  border-collapse: collapse;
  font-size: var(--text-lg);
  margin: 0 auto;
}

.events-table td {
  padding: 0.5rem 1rem;
}

.events-table td:first-child {
  text-align: left;
  padding-left: 0;
}

.events-table td:nth-child(2) {
  text-align: center;
}

.events-table td:last-child {
  text-align: right;
  padding-right: 0;
}

/* form styles */
.contact-section {
  margin: 4rem auto;
  max-width: 600px;
  padding: 2rem;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.contact-section h3 {
  font-size: var(--text-lg);
  margin-bottom: 1.5rem;
  text-align: center;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: bold;
  font-size: var(--text-md);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.8rem;
  font-size: var(--text-base);
  border: 1px solid #ccc;
  border-radius: 4px;
}

.contact-form button {
  margin-top: 1rem;
  width: 100%;
}

/* gallery styles */
.gallery-section {
  text-align: center;
}

.gallery-section h3 {
  font-size: var(--text-xl);
  margin-bottom: 2rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(max(350px, calc((100% - 3rem) / 4)), 1fr)
  );
  gap: 1rem;
  align-items: start;
}

.gallery-btn {
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  cursor: pointer;
  overflow: hidden;
  border-radius: 3px;
}

.gallery-btn:hover img {
  opacity: 0.9;
  transform: scale(1.05);
}

.gallery-btn:focus-visible {
  outline: 2px solid #d5321b;
  outline-offset: 2px;
  border-radius: 3px;
}

.gallery-btn img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

/* image modal styles */
.image-modal {
  margin: auto;
  padding: 2rem;
  border: none;
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  background: white;
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.image-modal.show {
  opacity: 1;
  transform: scale(1);
}

.image-modal::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
}

.image-modal.show::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
  .image-modal::backdrop {
    background: rgba(0, 0, 0, 0);
    -webkit-backdrop-filter: blur(5px) opacity(0);
    backdrop-filter: blur(5px) opacity(0);
    transition:
      backdrop-filter 0.3s ease,
      -webkit-backdrop-filter 0.3s ease,
      background 0.3s ease;
  }
  .image-modal.show::backdrop {
    background: rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(5px) opacity(1);
    backdrop-filter: blur(5px) opacity(1);
  }
}

.image-modal img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  object-fit: contain;
}

.modal-close-btn {
  background: transparent;
  color: #333;
  padding: 0.5rem;
  font-size: var(--text-lg);
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #eee;
}

.modal-hint {
  text-align: center;
  margin-top: 1rem;
  color: #666;
  font-size: var(--text-sm);
}

.modal-hint kbd {
  display: inline-block;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: monospace;
}

@media (max-width: 768px) {
  body {
    padding: 0.75rem;
  }

  .gallery {
    grid-template-columns: repeat(auto-fit, minmax(calc(344px - 2rem), 1fr));
  }

  .modal-hint {
    display: none;
  }

  .image-modal {
    padding: 0px;
    max-width: 100vw;
  }
}
