/* ── CSS Variables ─────────────────────────────────── */
:root {
  --cream:  #f5f0e8;
  --bark:   #2b1f0f;
  --moss:   #3d5a3e;
  --sage:   #7a9e7e;
  --amber:  #c8873a;
  --sky:    #6ba3be;
  --mist:   #dce8ec;
  --white:  #ffffff;
  --shadow: rgba(43,31,15,.15);
  --card-w: 300px;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--bark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated background ───────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(107,163,190,.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(61,90,62,.12) 0%, transparent 55%),
    var(--cream);
}

/* ── Header ────────────────────────────────────────── */
header {
  text-align: center;
  padding: 60px 20px 40px;
  position: relative;
}
.header-eyebrow {
  font-size: .7rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 12px;
}
header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.1;
  color: var(--bark);
}
header h1 em { font-style: italic; color: var(--moss); }
header p.tagline {
  margin-top: 14px;
  font-size: .95rem;
  color: var(--sage);
  font-weight: 300;
  max-width: 420px;
  margin-inline: auto;
}
.feather-deco {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 8px;
  animation: sway 4s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes sway {
  0%,100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

/* ── Location Panel ────────────────────────────────── */
#location-panel {
  max-width: 520px;
  margin: 0 auto 40px;
  background: var(--white);
  border: 1px solid rgba(43,31,15,.1);
  border-radius: 20px;
  padding: 32px 36px;
  box-shadow: 0 8px 40px var(--shadow);
}
#location-panel h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  margin-bottom: 8px;
}
#location-panel p {
  font-size: .87rem;
  color: var(--sage);
  margin-bottom: 22px;
  line-height: 1.6;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 24px var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--moss); color: var(--white); }
.btn-secondary { background: var(--mist); color: var(--bark); }
.btn-amber     { background: var(--amber); color: var(--white); }
.btn:disabled  { opacity: .5; pointer-events: none; }

/* ── Divider ───────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--sage); font-size: .8rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1;
  border-top: 1px solid rgba(43,31,15,.12);
}

/* ── Manual Form ───────────────────────────────────── */
.manual-form { display: none; }
.manual-form.visible { display: block; }
.form-row { display: flex; gap: 12px; margin-bottom: 14px; }
.form-row input {
  flex: 1; padding: 11px 16px;
  border: 1px solid rgba(43,31,15,.18);
  border-radius: 12px;
  background: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: var(--bark);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-row input:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(61,90,62,.12);
}
.form-row input::placeholder { color: var(--sage); opacity: .7; }

/* ── Location Status ───────────────────────────────── */
#location-status {
  font-size: .82rem; color: var(--sage);
  margin-top: 14px; min-height: 20px;
  display: flex; align-items: center; gap: 6px;
}

/* ── Main CTA ───────────────────────────────────────── */
#cta-section {
  text-align: center;
  margin: 10px auto 50px;
  max-width: 520px;
  padding: 0 20px;
}
#btn-find-birds {
  font-size: 1.05rem;
  padding: 16px 38px;
  background: var(--bark);
  color: var(--cream);
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  letter-spacing: .02em;
  box-shadow: 0 6px 30px rgba(43,31,15,.25);
  transition: transform .2s, box-shadow .2s, background .2s;
}
#btn-find-birds:hover {
  background: var(--moss);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(61,90,62,.35);
}
#btn-find-birds:disabled { opacity: .45; pointer-events: none; }

/* ── Loading ────────────────────────────────────────── */
#loading {
  display: none;
  text-align: center;
  padding: 60px 20px;
}
.loading-birds {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.loading-birds span {
  font-size: 1.8rem;
  animation: flap .6s ease-in-out infinite alternate;
}
.loading-birds span:nth-child(2) { animation-delay: .15s; }
.loading-birds span:nth-child(3) { animation-delay: .3s; }
@keyframes flap {
  from { transform: translateY(0); }
  to   { transform: translateY(-12px); }
}
#loading p { color: var(--sage); font-size: .92rem; }

/* ── Results Header ────────────────────────────────── */
#results-header {
  display: none;
  text-align: center;
  margin: 0 auto 36px;
  max-width: 700px;
  padding: 0 20px;
}
#results-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}
#results-header p { color: var(--sage); font-size: .88rem; margin-top: 6px; }

/* ── Cards Grid ────────────────────────────────────── */
#cards-container {
  display: none;
  max-width: 1200px;
  margin: 0 auto 60px;
  padding: 0 20px;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 26px;
}
.bird-card {
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform .22s, box-shadow .22s;
  position: relative;
  animation: fadeUp .5s both;
}
.bird-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(43,31,15,.2);
}
@keyframes fadeUp {
  from { opacity:0; transform: translateY(24px); }
  to   { opacity:1; transform: translateY(0); }
}
.bird-card-img {
  width: 100%; height: 190px;
  object-fit: cover;
  display: block;
  background: var(--mist);
}
.bird-card-img-placeholder {
  width: 100%; height: 190px;
  background: linear-gradient(135deg, var(--mist) 0%, #c8dde6 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.bird-card-rank {
  position: absolute; top: 12px; left: 12px;
  background: var(--bark);
  color: var(--cream);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 4px 10px;
  border-radius: 50px;
}
.bird-card-body { padding: 18px 20px 20px; }
.bird-card-body h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  margin-bottom: 3px;
}
.bird-card-body .sci-name {
  font-style: italic;
  font-size: .78rem;
  color: var(--sage);
  margin-bottom: 14px;
}
.bird-meta {
  display: flex; flex-direction: column; gap: 7px;
}
.bird-meta-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .8rem; color: var(--bark);
}
.bird-meta-row .icon {
  font-size: .95rem; flex-shrink: 0; margin-top: 1px;
}
.bird-meta-row .label {
  color: var(--sage); font-weight: 500;
  min-width: 52px; flex-shrink: 0;
}
.bird-meta-row .value { line-height: 1.4; }
.bird-count-badge {
  display: inline-block;
  background: rgba(61,90,62,.1);
  color: var(--moss);
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: .8rem;
}

/* ── Map Section ────────────────────────────────────── */
#map-section {
  display: none;
  max-width: 960px;
  margin: 0 auto 80px;
  padding: 0 20px;
}
#map-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  margin-bottom: 6px;
}
#map-section p { color: var(--sage); font-size: .87rem; margin-bottom: 22px; }
#map-img {
  width: 100%; border-radius: 20px;
  box-shadow: 0 10px 50px var(--shadow);
  display: block;
}
#map-img-placeholder {
  width: 100%; height: 420px;
  background: var(--mist);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: var(--sage);
  border: 2px dashed rgba(43,31,15,.15);
}

/* ── Error ──────────────────────────────────────────── */
.error-box {
  background: #fff0f0; border: 1px solid #ffb3b3;
  border-radius: 12px; padding: 14px 18px;
  font-size: .85rem; color: #c0392b;
  margin: 12px 0;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--sage); border-radius: 4px; }

/* ── Footer ─────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 30px 20px 50px;
  font-size: .78rem;
  color: var(--sage);
}
