:root {
  --paper: #fbf5e6;
  --paper-deep: #f1e5c9;
  --ink: #25352c;
  --muted: #6a6b5e;
  --green: #234f3a;
  --green-2: #5d7f43;
  --leaf: #d9e3bf;
  --sun: #e6b756;
  --white: #fffdf7;
  --line: #ded0ad;
  --shadow: 0 20px 50px rgba(45, 42, 26, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(217, 227, 191, 0.95) 0 130px, transparent 132px),
    radial-gradient(circle at 92% 14%, rgba(230, 183, 86, 0.25) 0 110px, transparent 112px),
    linear-gradient(180deg, #fcf7e9 0%, var(--paper) 48%, #f7ecd5 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(35, 79, 58, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 79, 58, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
}

a {
  color: inherit;
}

.hero,
main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  padding: 22px 0 34px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 26px;
}

.brand {
  display: inline-grid;
  gap: 2px;
  color: var(--green);
  text-decoration: none;
}

.brand span,
.eyebrow {
  font-family: system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand strong {
  font-size: 1.08rem;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 10px;
  font-family: system-ui, sans-serif;
  font-weight: 800;
}

.nav-links a {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
  text-decoration: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
  align-items: center;
  gap: 42px;
  min-height: 430px;
}

.hero-copy {
  position: relative;
  padding: 34px 0 34px 28px;
}

.hero-copy::before {
  position: absolute;
  inset: 8px auto 8px 0;
  width: 7px;
  border-radius: 999px;
  background: var(--green);
  content: "";
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green-2);
}

.hero h1 {
  max-width: 8.8em;
  margin: 0;
  color: var(--green);
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  font-weight: 700;
  line-height: 1.06;
}

.hero-copy > p:last-child {
  max-width: 35em;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 2;
}

.hero-visual {
  position: relative;
  min-height: 400px;
}

.hero-visual::before {
  position: absolute;
  right: 6%;
  bottom: 12%;
  width: 58%;
  aspect-ratio: 1;
  border: 1px solid rgba(35, 79, 58, 0.22);
  border-radius: 50%;
  background: var(--leaf);
  content: "";
}

.hero-photo {
  position: absolute;
  display: block;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.hero-photo-main {
  right: 6%;
  top: 0;
  width: 78%;
  height: 310px;
  border: 10px solid var(--white);
  border-radius: 44% 56% 50% 50% / 50% 44% 56% 50%;
}

.hero-photo-sub {
  left: 0;
  bottom: 10px;
  width: 46%;
  height: 190px;
  border: 8px solid var(--white);
  border-radius: 50%;
}

.hero-note {
  position: absolute;
  right: 0;
  bottom: 34px;
  padding: 12px 18px;
  border-radius: 999px;
  color: var(--green);
  background: var(--sun);
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

main {
  padding-bottom: 56px;
}

.controls {
  position: relative;
  margin-bottom: 34px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  color: var(--green);
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.2;
}

.controls label {
  display: grid;
  gap: 9px;
  font-family: system-ui, sans-serif;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 12px 15px;
  border: 1px solid #c9b989;
  border-radius: 999px;
  color: var(--ink);
  background: #fffaf0;
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(230, 183, 86, 0.35);
  border-color: var(--green-2);
}

.control-group {
  margin-top: 22px;
}

.control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-title {
  margin: 0;
  color: var(--green);
  font-family: system-ui, sans-serif;
  font-weight: 900;
}

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

button,
.links a {
  min-height: 40px;
  border: 1px solid #c5b47f;
  border-radius: 999px;
  font: inherit;
  font-family: system-ui, sans-serif;
  font-weight: 850;
  cursor: pointer;
}

button {
  padding: 8px 15px;
  color: var(--green);
  background: #fffaf0;
}

button:hover,
.links a:hover,
.nav-links a:hover {
  transform: translateY(-1px);
}

button.active {
  border-color: var(--green);
  color: #fffdf7;
  background: var(--green);
}

.theme-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.45fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.theme-form button {
  min-width: 82px;
  background: var(--sun);
  border-color: #c9942e;
  color: #3d2e11;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
}

.theme-chip.has-delete button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.icon-button {
  width: 38px;
  height: 40px;
  padding: 0;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.small-button {
  white-space: nowrap;
}

.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 0 6px;
}

#count {
  margin: 0;
  color: var(--green);
  font-family: system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
}

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

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(196, 180, 127, 0.7);
  border-radius: 28px;
  background: var(--white);
  box-shadow: 0 16px 35px rgba(45, 42, 26, 0.1);
}

.card:nth-child(3n + 2) {
  transform: translateY(16px);
}

.media {
  position: relative;
  padding: 12px 12px 0;
}

.card img,
.image-fallback {
  width: 100%;
  height: 230px;
  border-radius: 22px;
}

.card img {
  display: block;
  object-fit: cover;
  background: var(--paper-deep);
}

.image-fallback {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--green);
  background:
    linear-gradient(135deg, rgba(93, 127, 67, 0.16) 0 25%, transparent 25% 50%, rgba(93, 127, 67, 0.16) 50% 75%, transparent 75%),
    var(--paper-deep);
  background-size: 30px 30px;
}

.image-fallback span {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.9);
  font-size: 30px;
  font-weight: 900;
}

.image-fallback strong {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.9);
}

.favorite-button {
  position: absolute;
  top: 22px;
  right: 22px;
  display: grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  color: var(--green);
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  font-size: 24px;
}

.favorite-button.active {
  color: #513500;
  background: var(--sun);
}

.card-body {
  padding: 18px 20px 22px;
}

.category {
  display: inline-flex;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--leaf);
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
}

.card-body h2 {
  margin: 12px 0 10px;
  color: var(--green);
  font-size: 1.35rem;
  line-height: 1.45;
}

.card-body p {
  line-height: 1.85;
}

.card-body > p:not(.category):not(.address) {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.address {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: #536052;
  font-family: system-ui, sans-serif;
  font-size: 0.86rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  color: #fffdf7;
  background: var(--green);
  text-decoration: none;
}

.links a:nth-child(2) {
  color: var(--green);
  background: var(--leaf);
}

.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: auto;
  }

  .hero-copy {
    padding-bottom: 10px;
  }

  .hero-visual {
    min-height: 330px;
  }

  .hero-photo-main {
    width: 82%;
    height: 255px;
  }

  .hero-photo-sub {
    width: 42%;
    height: 150px;
  }

  .theme-form {
    grid-template-columns: 1fr;
  }

  .card:nth-child(3n + 2) {
    transform: none;
  }
}

@media (max-width: 640px) {
  .hero,
  main {
    width: min(100% - 28px, 1120px);
  }

  .hero {
    padding-top: 14px;
  }

  .site-nav {
    align-items: flex-start;
    padding-bottom: 18px;
  }

  .nav-links {
    gap: 6px;
  }

  .nav-links a {
    padding: 7px 10px;
    font-size: 0.82rem;
  }

  .hero-copy {
    padding-left: 18px;
  }

  .hero h1 {
    font-size: 2.8rem;
  }

  .hero-copy > p:last-child {
    font-size: 0.98rem;
    line-height: 1.85;
  }

  .hero-visual {
    min-height: 260px;
  }

  .hero-photo-main {
    right: 0;
    width: 88%;
    height: 210px;
    border-width: 7px;
  }

  .hero-photo-sub {
    width: 44%;
    height: 124px;
    border-width: 6px;
  }

  .hero-note {
    right: 0;
    bottom: 12px;
    padding: 9px 13px;
  }

  .controls {
    padding: 18px;
    border-radius: 22px;
  }

  .section-heading,
  .result-heading,
  .control-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .buttons button {
    width: 100%;
  }

  .theme-chip {
    width: 100%;
  }

  .theme-chip button:first-child {
    flex: 1;
  }

  .theme-chip .icon-button {
    flex: 0 0 38px;
    width: 38px;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .card img,
  .image-fallback {
    height: 210px;
  }

  .links {
    display: grid;
  }
}
