/* Homepage: hero scene, quickstart prompt, "who it's for", stats, recent listings. */

:root {
  /* owl palette */
  --o-ink: #0B1224;
  --o-deep: #172E6E;
  --o-navy: #1E3A8A;
  --o-blue: #2563EB;
  --o-mid: #3B82F6;
  --o-sky: #60A5FA;
  --o-light: #93C5FD;
  --o-frost: #BFDBFE;
  --o-pale: #DBEAFE;
  --o-white: #F8FBFF;
  --serif: "Fraunces", Georgia, serif;
}

/* Header stays hidden until the hero scrolls away. */
body.home .header {
  position: fixed;
  inset: 0 0 auto 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
body.home .header.show { transform: none; }
body.home .main { padding: 0; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: min(860px, 100vh);
  overflow: hidden;
  background: linear-gradient(180deg, #E4EEFD 0%, #F1F6FE 45%, #FAFBFE 100%);
}
.hero .scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1320px;
  margin: 0 auto;
  padding: 120px 32px 96px;
  display: grid;
  grid-template-columns: 1fr minmax(0, 540px);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  color: var(--o-ink);
}
.hero h1 em { font-style: normal; color: var(--o-blue); }
.hero-lede {
  font-size: 18px;
  color: var(--ink-secondary);
  max-width: 540px;
  text-wrap: pretty;
}

/* quickstart */
.qs { margin-top: 36px; max-width: 540px; }
.qs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qs-label {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.qs-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font: 600 14px "Inter", sans-serif;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 6px 16px -6px rgba(37, 99, 235, 0.6);
  transition: background 0.15s, transform 0.15s;
}
.qs-copy:hover { background: var(--accent-hover); }
.qs-copy:active { transform: translateY(1px); }
.qs-copy.done {
  background: var(--success);
  box-shadow: 0 6px 16px -6px rgba(22, 163, 74, 0.6);
}
.qs-copy svg { width: 16px; height: 16px; }
.qs-prompt {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px -24px rgba(30, 58, 138, 0.35);
}
.qs-prompt pre {
  font: 400 13.5px/1.65 "JetBrains Mono", ui-monospace, monospace;
  color: #1f2937;
  padding: 16px 18px 18px;
  white-space: pre-wrap;
  word-break: break-word;
}
.qs-prompt .hl { color: var(--o-blue); }
.hero-links { margin-top: 18px; display: flex; gap: 20px; font-size: 14px; }
.hero-links a { color: var(--ink-secondary); text-decoration: none; font-weight: 500; }
.hero-links a:hover { color: var(--ink); }

/* ---------- who it's for ---------- */
.who { background: var(--surface); border-top: 1px solid var(--border); }
.who-inner { padding-top: 80px; padding-bottom: 72px; }
.who h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 3.6vw, 42px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
  color: var(--o-ink);
}
.who-lede { color: var(--ink-secondary); font-size: 17px; }
.uses {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}
.use {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 24px 28px;
  background: linear-gradient(180deg, #F7FAFF 0%, #fff 60%);
}
.use-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-subtle);
  color: var(--o-blue);
  margin-bottom: 18px;
}
.use-icon svg, .notfor-icon svg { width: 22px; height: 22px; }
.use h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.use p { font-size: 15px; color: var(--ink-secondary); line-height: 1.6; }
.notfor {
  margin-top: 28px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 24px;
  border-radius: 14px;
  background: #FAFAF9;
  border: 1px dashed #d6d3d1;
}
.notfor-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #F5F5F4;
  color: #57534e;
}
.notfor-icon svg { width: 18px; height: 18px; }
.notfor h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.notfor p { font-size: 14.5px; color: var(--ink-secondary); line-height: 1.6; max-width: 860px; }

/* ---------- stats + recent ---------- */
.home-stats { border-top: 1px solid var(--border); background: var(--surface); }
.home-stats-inner {
  padding-top: 28px;
  padding-bottom: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.home-stats .stat-value { font-size: 28px; letter-spacing: -0.02em; }
.home-recent { padding-top: 48px; padding-bottom: 72px; }

/* ---------- owl animation ---------- */
#owl { cursor: pointer; }
#owl-body { transform-box: fill-box; transform-origin: 50% 100%; }
.wing { transform-box: view-box; }
#wing-l { transform-origin: 84px 248px; }
#wing-r { transform-origin: 316px 248px; }
#head { transform-origin: 200px 250px; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lid { transform-box: fill-box; transform-origin: 50% 0%; transform: scaleY(0); }
.blink .lid { animation: owl-blink 0.18s ease-in-out; }
@keyframes owl-blink { 0%, 100% { transform: scaleY(0); } 50% { transform: scaleY(1); } }

/* landing: fly in from the upper left, flapping, then settle */
#owl-fly { animation: owl-land 1.9s cubic-bezier(0.25, 0.8, 0.3, 1) both; }
@keyframes owl-land {
  0% { transform: translate(-260px, -320px) rotate(-10deg); }
  70% { transform: translate(0, -6px) rotate(2deg); }
  82% { transform: translate(0, 4px) rotate(0); }
  100% { transform: translate(0, 0); }
}
.flapping #wing-l { animation: owl-flap-l 0.26s ease-in-out infinite alternate; }
.flapping #wing-r { animation: owl-flap-r 0.26s ease-in-out infinite alternate; }
@keyframes owl-flap-l { from { transform: rotate(8deg); } to { transform: rotate(78deg); } }
@keyframes owl-flap-r { from { transform: rotate(-8deg); } to { transform: rotate(-78deg); } }
.settle #owl-body { animation: owl-squash 0.7s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes owl-squash {
  0% { transform: scale(1.04, 0.93); }
  60% { transform: scale(0.98, 1.03); }
  100% { transform: scale(1, 1); }
}
.idle #owl-body { animation: owl-breathe 4.2s ease-in-out infinite; }
@keyframes owl-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.004, 1.007); } }
.ruffle #wing-l { animation: owl-ruffle-l 0.9s ease-in-out; }
.ruffle #wing-r { animation: owl-ruffle-r 0.9s ease-in-out; }
@keyframes owl-ruffle-l {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(22deg); }
  40% { transform: rotate(4deg); }
  60% { transform: rotate(14deg); }
}
@keyframes owl-ruffle-r {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-22deg); }
  40% { transform: rotate(-4deg); }
  60% { transform: rotate(-14deg); }
}
.leaf-sway {
  transform-box: view-box; /* transform-origin is set per leaf, at its stem */
  animation: leaf-sway 5s ease-in-out infinite;
}
@keyframes leaf-sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(4deg); } }

/* happy: after "Copy prompt" the owl closes its eyes in a "^ ^", hops with a flap, and sparkles */
.smile { opacity: 0; transition: opacity 0.12s; }
.happy .smile { opacity: 1; }
.spark { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; }
/* the branch shadow shrinks and fades while the owl is in the air */
#owl-shadow { transform-box: fill-box; transform-origin: 50% 50%; animation: shadow-land 1.9s cubic-bezier(0.25, 0.8, 0.3, 1) both; }
@keyframes shadow-land {
  0% { opacity: 0; transform: scale(0.4); }
  70% { opacity: 0.1; transform: scale(0.95); }
  100% { opacity: 0.12; transform: scale(1); }
}
/* keep shadow-land in the list so it isn't restarted when .hop is added or removed */
#owl-shadow.hop {
  animation: shadow-land 1.9s cubic-bezier(0.25, 0.8, 0.3, 1) both, shadow-hop 0.9s cubic-bezier(0.3, 0.7, 0.4, 1);
}
@keyframes shadow-hop {
  0%, 55%, 86%, 100% { opacity: 0.12; transform: scale(1); }
  30% { opacity: 0.04; transform: scale(0.72); }
  72% { opacity: 0.08; transform: scale(0.88); }
}
#owl.happy { animation: owl-hop 0.9s cubic-bezier(0.3, 0.7, 0.4, 1); }
@keyframes owl-hop {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-34px); }
  55% { transform: translateY(0); }
  72% { transform: translateY(-12px); }
  86% { transform: translateY(0); }
}
#owl.happy #wing-l { animation: owl-flap-l 0.15s ease-in-out 4 alternate; }
#owl.happy #wing-r { animation: owl-flap-r 0.15s ease-in-out 4 alternate; }
#owl.happy .spark { animation: owl-spark 0.9s ease-out both; }
#owl.happy #owl-joy > g:nth-child(2n) .spark { animation-delay: 0.12s; }
#owl.happy #owl-joy > g:nth-child(3n) .spark { animation-delay: 0.24s; }
@keyframes owl-spark {
  0% { opacity: 0; transform: translateY(12px) scale(0.2) rotate(0); }
  35% { opacity: 1; transform: translateY(-6px) scale(1.15) rotate(20deg); }
  100% { opacity: 0; transform: translateY(-26px) scale(0.6) rotate(45deg); }
}

@media (prefers-reduced-motion: reduce) {
  #owl-fly, .flapping .wing, .idle #owl-body, .leaf-sway, .settle #owl-body, .ruffle .wing,
  #owl.happy, #owl.happy .wing, #owl.happy .spark, #owl-shadow, #owl-shadow.hop {
    animation: none !important;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { min-height: 0; }
  .hero .scene { position: relative; height: 380px; }
  .hero-inner { grid-template-columns: 1fr; padding: 0 16px 56px; margin-top: -24px; }
  .hero-inner > .hero-spacer { display: none; }
  .uses { grid-template-columns: 1fr; }
  .who-inner { padding-top: 56px; padding-bottom: 48px; }
  .notfor { padding: 18px; }
  .home-stats-inner { gap: 12px; padding-top: 20px; padding-bottom: 20px; }
  .home-stats .stat-value { font-size: 22px; }
}
@media (max-width: 480px) {
  .home-stats .stat-label { font-size: 12px; }
}
