@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

:root {
  --ink: #17241c;
  --muted: #687069;
  --paper: #f3f0e8;
  --panel: #e9e6dc;
  --line: #cecfc5;
  --acid: #d9ff43;
  --white: #fffef8;
  --radius: 3px;
  font-family: "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.site-header {
  height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 91%, transparent);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 35px; height: 35px; display: grid; place-items: center;
  border-radius: 50%; background: var(--ink); color: var(--acid);
  font: 500 19px/1 "DM Mono", monospace;
}
.brand-name { font: 500 21px/1 "DM Mono", monospace; letter-spacing: -.04em; }
.brand-note { margin: 0 0 0 24px; padding-left: 24px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.filter-toggle {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
}
.filter-toggle svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }

main { padding: 0 clamp(20px, 4vw, 64px); }
.intro {
  min-height: 410px;
  padding: 88px 0 74px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .5fr);
  align-items: end;
  gap: 40px;
  border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 17px; font: 500 11px/1 "DM Mono", monospace; letter-spacing: .16em; color: var(--muted); }
h1 { margin: 0; max-width: 880px; font-size: clamp(48px, 7vw, 104px); line-height: .98; letter-spacing: -.065em; font-weight: 500; }
.intro-copy { margin: 0; max-width: 340px; color: var(--muted); font-size: 13px; line-height: 2; }

.search-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(180px, .3fr) minmax(210px, .32fr) 210px;
  align-items: end;
  gap: 14px;
  padding: 28px;
  margin-top: 28px;
  background: var(--ink);
  color: var(--white);
  transition: opacity .2s, transform .2s, max-height .35s, padding .35s, margin .35s;
  max-height: 220px;
}
.search-panel.is-collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; opacity: 0; transform: translateY(-8px); overflow: hidden; pointer-events: none; }
.search-panel label { display: block; margin-bottom: 9px; font: 500 10px/1 "DM Mono", monospace; letter-spacing: .12em; color: #aeb8af; }
.place-input-wrap { position: relative; }
.place-input-wrap > svg { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 19px; fill: none; stroke: var(--ink); stroke-width: 1.6; z-index: 1; }
.search-panel input, .search-panel select {
  width: 100%; height: 54px; border: 0; border-radius: var(--radius); background: var(--white); color: var(--ink); outline: none; font-size: 14px;
}
.search-panel input { padding: 0 48px 0 48px; }
.search-panel select { padding: 0 40px 0 16px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 24px, calc(100% - 13px) 24px; background-size: 5px 5px; background-repeat: no-repeat; }
.search-panel input:focus, .search-panel select:focus { box-shadow: 0 0 0 3px var(--acid); }
.clear-place { position: absolute; right: 10px; top: 50%; translate: 0 -50%; border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; background: transparent; font-size: 23px; font-weight: 300; }
.field-hint { margin: 8px 0 0; color: #8e998f; font-size: 10px; }
.suggestions { position: absolute; z-index: 30; left: 28px; right: 28px; top: 91px; background: var(--white); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 12px 32px rgb(0 0 0 / .2); }
.suggestion { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; background: transparent; border: 0; border-bottom: 1px solid #e4e4dc; text-align: left; cursor: pointer; font-size: 13px; }
.suggestion:last-child { border: 0; }
.suggestion:hover, .suggestion:focus { background: #eef5d4; outline: none; }
.suggestion small { color: var(--muted); font: 400 10px "DM Mono", monospace; }
.search-button { height: 54px; padding: 0 18px 0 22px; border: 0; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; background: var(--acid); color: var(--ink); font-weight: 700; cursor: pointer; }
.search-button:hover { filter: brightness(.95); }
.search-button svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.results { padding: 88px 0 100px; }
.results-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 34px; }
.results h2 { margin: 0; font-size: clamp(28px, 4vw, 45px); letter-spacing: -.05em; line-height: 1; font-weight: 500; }
.result-count { font: 500 clamp(26px, 4vw, 52px)/1 "DM Mono", monospace; letter-spacing: -.06em; }
.result-count small { font-size: 9px; letter-spacing: .12em; color: var(--muted); }
.status { min-height: 0; }
.status:not(:empty) { padding: 44px 0; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.observation-card { position: relative; aspect-ratio: 1 / 1.06; padding: 0; border: 0; background: #dedfd8; cursor: zoom-in; overflow: hidden; }
.observation-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.22,.61,.36,1), filter .3s; }
.observation-card:hover img, .observation-card:focus img { transform: scale(1.035); filter: brightness(.88); }
.observation-card:focus-visible { outline: 4px solid var(--acid); outline-offset: -4px; }
.observation-card::after { content: "見る ↗"; position: absolute; right: 12px; bottom: 12px; padding: 7px 9px; background: var(--acid); color: var(--ink); font: 500 10px "DM Mono", monospace; opacity: 0; translate: 0 5px; transition: .2s; }
.observation-card:hover::after, .observation-card:focus::after { opacity: 1; translate: 0; }
.skeleton { aspect-ratio: 1 / 1.06; background: linear-gradient(100deg, #e3e1d8 20%, #efede6 40%, #e3e1d8 60%); background-size: 200% 100%; animation: shine 1.25s infinite linear; }
@keyframes shine { to { background-position: -200% 0; } }
.load-more-wrap { display: flex; justify-content: center; padding-top: 42px; }
.load-more { min-width: 210px; height: 54px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--ink); background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; }
.load-more:hover { background: var(--ink); color: var(--white); }

footer { margin: 0 clamp(20px, 4vw, 64px); padding: 28px 0 42px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 10px; }
footer p { margin: 0; }

.observation-dialog { width: min(1180px, calc(100vw - 36px)); height: min(780px, calc(100dvh - 36px)); padding: 0; border: 0; background: var(--paper); color: var(--ink); overflow: hidden; }
.observation-dialog::backdrop { background: rgb(10 18 12 / .78); backdrop-filter: blur(8px); }
.dialog-close { position: absolute; right: 14px; top: 14px; z-index: 4; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--paper); cursor: pointer; font-size: 26px; line-height: 1; box-shadow: 0 3px 18px rgb(0 0 0 / .16); }
.dialog-layout { display: grid; grid-template-columns: 1.18fr .82fr; height: 100%; }
.dialog-photo-wrap { position: relative; min-height: 0; background: #101511; display: grid; place-items: center; overflow: hidden; }
.dialog-photo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.photo-nav { position: absolute; top: 50%; translate: 0 -50%; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgb(243 240 232 / .9); cursor: pointer; }
.photo-nav.prev { left: 14px; }.photo-nav.next { right: 14px; }
.photo-index { position: absolute; bottom: 14px; right: 14px; padding: 6px 9px; background: rgb(10 15 11 / .72); color: white; font: 400 10px "DM Mono", monospace; }
.dialog-info { padding: 54px 42px 36px; overflow-y: auto; }
.dialog-title-row { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.dialog-title-row h2 { margin: 0; font-size: 30px; letter-spacing: -.05em; font-weight: 500; }
.inat-id { font: 400 10px "DM Mono", monospace; color: var(--muted); }
.metadata { margin: 32px 0; border-top: 1px solid var(--line); }
.metadata > div { display: grid; grid-template-columns: 82px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.metadata dt { color: var(--muted); font-size: 10px; }.metadata dd { margin: 0; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.map-wrap { position: relative; aspect-ratio: 16 / 8.2; overflow: hidden; background: #d5d9d0; }
.map-wrap iframe { width: 100%; height: 100%; border: 0; filter: saturate(.7) contrast(.95); }
.map-badge { position: absolute; left: 10px; top: 10px; padding: 6px 8px; background: var(--ink); color: var(--white); font: 400 9px "DM Mono", monospace; }
.attribution { margin: 11px 0 20px; min-height: 15px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.inat-link { height: 49px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; background: var(--acid); text-decoration: none; font-size: 12px; font-weight: 700; }

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; min-height: 390px; }
  .search-panel { grid-template-columns: 1fr 1fr; max-height: 420px; }
  .search-button { grid-column: 1 / -1; }
  .suggestions { left: 28px; right: 28px; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .dialog-layout { grid-template-columns: 1fr 1fr; }
  .dialog-info { padding: 54px 26px 30px; }
}

@media (max-width: 640px) {
  .site-header { height: 64px; }
  .brand-note { display: none; }
  .intro { padding: 64px 0 54px; min-height: 340px; }
  h1 { font-size: clamp(43px, 14vw, 70px); }
  .intro-copy { font-size: 12px; }
  .search-panel { grid-template-columns: 1fr; padding: 20px; max-height: 420px; }
  .search-button { grid-column: auto; }
  .suggestions { left: 20px; right: 20px; top: 82px; }
  .results { padding: 64px 0 72px; }
  .results-head { align-items: start; }
  .result-count { font-size: 24px; }
  .result-count small { display: block; margin-top: 5px; text-align: right; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .observation-card { aspect-ratio: 1; }
  footer { flex-direction: column; }
  .observation-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; }
  .dialog-layout { display: block; overflow-y: auto; }
  .dialog-photo-wrap { height: 58dvh; }
  .dialog-info { overflow: visible; padding: 34px 20px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
