:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%;
  line-height: 1.6;
  color: #1d1d1d;
  background-color: #f7f3e8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #f7f3e8;
  color: #1d1d1d;
}

.hero,
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  padding-top: 32px;
  padding-bottom: 18px;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-left {
  flex: 1 1 auto;
}

.hero-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.search-label {
  display: block;
}

.hero-right #search {
  width: 220px;
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 12px;
}

.hero-right button {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #888;
  background: #ffffff;
  color: #1d1d1d;
  font-weight: 700;
  min-height: 42px;
  cursor: pointer;
}

.hero-right button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(47,111,78,0.12);
  border-color: #2f6f4e;
}

.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.hero h1 {
  margin: 0.4rem 0 0.6rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.hero p {
  margin: 0;
  max-width: 54rem;
  color: #3b3b3b;
}

.eyebrow {
  margin: 0 0 0.75rem;
  display: inline-block;
  color: #2f6f4e;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.88rem;
}

.controls {
  background: #fffaf0;
  border: 1px solid #eadfca;
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 20px;
  display: grid;
  gap: 18px;
}

.control-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.controls label {
  display: grid;
  gap: 10px;
  font-weight: 700;
  flex: 1 1 320px;
}

.helper-text {
  margin: 0;
  color: #4a4a4a;
  font-size: 0.95rem;
}

input {
  width: 100%;
  font: inherit;
  padding: 14px 16px;
  border: 1px solid #a8a29e;
  border-radius: 16px;
  background: #ffffff;
  color: #1d1d1d;
  min-height: 48px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus-visible {
  outline: none;
  border-color: #2f6f4e;
  box-shadow: 0 0 0 4px rgba(47, 111, 78, 0.14);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

button {
  appearance: none;
  border: 1px solid #888;
  background: #ffffff;
  color: #1d1d1d;
  padding: 12px 18px;
  min-width: 140px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  border-color: #2f6f4e;
  outline: none;
  box-shadow: 0 0 0 4px rgba(47, 111, 78, 0.12);
}

button.active {
  background: #2f6f4e;
  color: white;
  border-color: #2f6f4e;
}

button:not(.active) {
  background: #ffffff;
}

#count {
  margin: 0 0 18px;
  font-weight: 700;
  font-size: 1rem;
  color: #3b3b3b;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: #ddd;
  display: block;
}

.placeholder-image {
  width: 100%;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg,#efefef,#f7f7f7);
  color: #6b6b6b;
  font-weight: 700;
  font-size: 1rem;
}

.placeholder-image::after {
  content: "No image";
}

.card-body {
  padding: 24px;
  flex: 1 1 auto;
}

.card-front {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-front h2 {
  margin: 0;
  font-size: 1.1rem;
  text-align: center;
}

.card-details {
  display: none;
  padding: 14px 18px 22px;
}

.card.expanded .card-details {
  display: block;
}

.card-toggle {
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 18px;
  text-align: center;
  font-weight: 700;
  border-top: 1px solid #f0ece5;
  cursor: pointer;
}

.card-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(47,111,78,0.08);
}

.category {
  margin: 0 0 10px;
  color: #2f6f4e;
  font-weight: 700;
}

.card-body h2 {
  margin: 0 0 14px;
  font-size: 1.4rem;
  line-height: 1.2;
}

.card-body p {
  margin: 0;
  color: #424242;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  background: #edf7f1;
  color: #2f6f4e;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 700;
  transition: background-color 0.2s ease;
}

.links button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  background: #fff4f0;
  color: #d0702f;
  border: 1px solid #d0702f;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.links a:hover,
.links a:focus-visible {
  background: #d8f1e4;
  outline: none;
}

.links button:hover,
.links button:focus-visible {
  background: #f7ded3;
  outline: none;
}

.links button.active {
  background: #d0702f;
  color: white;
  border-color: #d0702f;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  color: white;
  background: #d0702f;
  border-radius: 999px;
  font-weight: 700;
}

.no-results {
  background: #fffef7;
  border: 1px solid #eadfca;
  border-radius: 24px;
  padding: 20px;
  color: #444;
  font-weight: 700;
}

@media (max-width: 768px) {
  .hero,
  main {
    padding: 18px;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-right {
    width: 100%;
    margin-top: 12px;
    justify-content: flex-start;
    gap: 8px;
  }

  .hero-right #search {
    width: 100%;
    min-width: 0;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
  }

  .buttons {
    justify-content: center;
  }

  button {
    flex: 1 1 45%;
    min-width: 0;
  }

  .links {
    flex-direction: column;
  }

  .card img {
    height: 220px;
  }
  .placeholder-image {
    height: 220px;
  }
}

@media (max-width: 520px) {
  .hero,
  main {
    padding: 14px;
  }

  .controls {
    padding: 16px;
  }

  .buttons {
    gap: 10px;
  }

  button {
    width: 100%;
  }

  .card-body {
    padding: 16px;
  }

  .links a {
    width: 100%;
  }
}

/* 背景上に薄いオーバーレイを入れてテキスト可読性を保つ */
.hero {
  background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0.85));
  border-radius: 8px;
}
