/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  line-height: 1.6;
  color: #2d3748;
  background-color: #f7fafc;
}

/* CSS Variables - アソビューブランドカラー */
:root {
  --asoview-orange: #ff6b35;
  --asoview-yellow: #f7b32b;
  --asoview-blue: #4a90e2;
  --asoview-gray: #f5f5f5;
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --border-radius: 0.5rem;
}

/* Header Styles */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.header-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header-logo {
  display: flex;
  align-items: center; /* 縦方向の中央寄せ */
  justify-content: center; /* 横方向の中央寄せ */
}

.logo-svg {
  height: 2rem;
  width: auto;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  fill: var(--asoview-orange);
  font-family: "Arial", sans-serif;
}

/* Hero Section */
.hero {
  background: var(--white);
  padding: 2rem 0;
}

.hero-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero-content {
  text-align: center;
}

.hero-title {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--gray-600);
}

/* Main Content */
.main-content {
  padding: 1rem 0;
}

.content-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Filters Section */
.filters-section {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.filters-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.filter-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--gray-500);
}

.clear-filters-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.clear-filters-btn:hover {
  color: var(--gray-700);
}

.clear-icon {
  width: 1rem;
  height: 1rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .filters-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.select-wrapper {
  position: relative;
}

.filter-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  background: var(--white);
  font-size: 0.875rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.filter-select:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  border-color: var(--primary-blue);
}

.filter-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  background: var(--white);
  font-size: 0.875rem;
}

.filter-input:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
  border-color: var(--primary-blue);
}

/* Active Filters */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.active-filter-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  font-weight: 500;
}

.active-filter-keyword {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.active-filter-month {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.active-filter-prefecture {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Events Section */
.events-section {
  margin-top: 1rem;
}

.events-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* Event Card */
.event-card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: all 0.2s ease-in-out;
  animation: fadeInOpacity 0.35s ease-out;
}
.event-card:hover { box-shadow: var(--shadow-md); }

/* すべての画面幅で“スマホレイアウト（縦並び）”に統一 */
.event-card-content {
  display: flex;
  flex-direction: column; /* ← 常に縦並び */
}

.event-content-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* 画像は上部・横幅100%・高さ12remを共通に */
.event-image-container {
  position: relative;
  width: 100%;
  height: 12rem;
  flex-shrink: 0;
}
.event-image {
  width: 100%;
  height: 100%;
  object-fit: contain;       /* スマホと同じ：全体を見せる */
  background-color: #f0f0f0; /* 余白が気になりにくい背景 */
}
.event-image-fallback {
  width: 100%;
  height: 100%;
  background-color: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 0.875rem;
}


/* 本文は共通で可変高さ */
.event-content {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* タイトル・詳細など（従来どおり） */
.event-title {
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.95rem;
}
.event-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}
.event-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.event-detail-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.event-venue-text {
  line-height: 1.25;
  word-break: break-word;   /* PCでも折り返し可（スマホと同じ） */
}

/* CTAの余白もスマホと同じに */
.event-cta {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
}
.event-cta-btn {
  background-color: #f44336;
  color: var(--white);
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.2s;
  text-decoration: none;
}
.event-cta-btn:hover { background-color: #f44336; }
.event-cta-icon { width: 1rem; height: 1rem; }

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem 0;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.no-results-icon {
  font-size: 3.75rem;
  margin-bottom: 1rem;
}

.no-results-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}

.no-results-text {
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

.clear-all-btn {
  background-color: var(--primary-blue);
  color: var(--white);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.clear-all-btn:hover {
  background-color: var(--primary-blue-hover);
}

/* Footer */
.footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 1.5rem 0;
  margin-top: 2rem;
}

.footer-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-content {
  text-align: center;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* Scroll to Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary-blue);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: background-color 0.2s, opacity 0.2s ease, visibility 0s linear 0.2s;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.scroll-top-btn:hover {
  background-color: var(--primary-blue-hover);
}

.scroll-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Loading */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--gray-200);
  border-top: 2px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeInOpacity {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 639px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .content-container {
    padding: 0 0.75rem;
  }

  .filters-section {
    margin: 0 -0.25rem 1rem;
  }
}

/* Performance Optimization */
.event-image {
  will-change: auto;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles */
button:focus,
select:focus,
input:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .event-card {
    border: 2px solid var(--gray-900);
  }

  .event-cta-btn {
    border: 2px solid var(--white);
  }
}