:root {
  color-scheme: light;
  --paper: #f4ebd9;
  --cream: #fff8eb;
  --ink: #49352d;
  --sage: #c7cb9e;
  --blue: #435c76;
  --line: #bda286;
  --grain: url("assets/paper-grain.png");
  --display: Georgia, "Times New Roman", serif;
  --body: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--grain), var(--paper);
  color: var(--ink);
  font: 500 16px/1.45 var(--body);
}
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid #994836; outline-offset: 4px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.shell { width: min(912px, calc(100% - 40px)); margin-inline: auto; }
.masthead { background: var(--grain), var(--cream); border-bottom: 1px solid #d0bda5; }
.masthead-inner { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 700 23px/1 var(--display); letter-spacing: -.04em; }
.brand img { transform: rotate(-9deg); }
.edition { font-size: 13px; color: #655146; }
main { padding-block: clamp(22px, 5dvh, 53px) 40px; }
h1 { margin-bottom: 12px; font: 700 clamp(34px, 5vw, 50px)/1.1 var(--display); letter-spacing: -.045em; }
.garden {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px 12px 15px 13px / 13px 16px 12px 15px;
  box-shadow: 0 3px 0 #e2caa6, 0 5px 0 #c9b08b;
}
.scene {
  position: relative;
  isolation: isolate;
  aspect-ratio: 2.2 / 1;
  background: #dedcb3 url("assets/garden.jpg") center 49% / cover no-repeat;
}
.pig, .shadow { position: absolute; left: 52%; transform: translateX(-50%); }
.pig {
  width: min(52%, 290px);
  aspect-ratio: 1;
  bottom: 6%;
  background: url("assets/pig-poses.png") left top / 200% 100% no-repeat;
}
.shadow {
  width: min(32%, 188px);
  height: 3.5%;
  bottom: 15%;
  border-radius: 50%;
  background: #75674c32;
  filter: blur(3px);
}
.speech {
  position: absolute;
  top: 7%;
  left: 45%;
  max-width: min(64%, 280px);
  transform: translateX(-50%) rotate(-2deg);
  padding: 9px 13px;
  border-radius: 13px 16px 12px 10px;
  background: var(--grain), var(--cream);
  box-shadow: 0 2px 6px #5d48252c;
  font: italic 700 clamp(15px, 2.2vw, 18px)/1.2 var(--display);
}
.speech::after {
  position: absolute;
  bottom: -5px;
  left: 17px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: var(--cream);
  content: "";
}
.flying-coin {
  display: none;
  position: absolute;
  left: 43%;
  top: 62%;
  width: 34px;
  aspect-ratio: 1;
  background: url("assets/coin.png") center / contain no-repeat;
  pointer-events: none;
}
.garden[data-fed] .pig {
  background-position: right top;
  animation: hop .55s ease-out both;
}
.garden[data-fed] .flying-coin {
  display: block;
  animation: toss .45s ease-out both;
}
@keyframes hop {
  0%, 100% { transform: translate(-50%, 0); }
  38% { transform: translate(-50%, -8%); }
}
@keyframes toss {
  0% { opacity: 0; transform: translate(-250%, 180%) rotate(-70deg); }
  25% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(0, -65%) scale(.55); }
}
.garden-bed {
  position: relative;
  min-height: 100px;
  padding: 16px clamp(14px, 3vw, 28px);
  background: var(--grain), #f7edd7;
}
.garden-bed::before {
  position: absolute;
  inset: -1px 0 auto;
  height: 11px;
  background: radial-gradient(circle at 50% -2px, var(--sage) 0 7px, #a7a878 7.5px 8.5px, transparent 9px) 0 0 / 15px 11px repeat-x;
  content: "";
}
.feed {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.feed p { color: #655146; }
button {
  min-height: 46px;
  padding: 7px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: none;
  border: 1px solid #304963;
  border-radius: 9px 12px 8px 10px;
  background: var(--grain), var(--blue);
  color: #fff8eb;
  box-shadow: 0 2px 0 #304259;
  cursor: pointer;
  font: 700 15px/1.2 var(--body);
}
button:hover { background: var(--grain), #304963; }
.sticker {
  display: flex;
  width: fit-content;
  min-height: 68px;
  padding: 7px 17px 7px 10px;
  align-items: center;
  gap: 11px;
  border: 1px dashed #ae8c5c;
  border-radius: 8px 11px 9px 12px;
  background: var(--grain), #f5e3b3;
}
.sticker h3 { font: 700 22px/1.18 var(--display); }
.sticker p { font-size: 13px; }

@media (max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .scene { aspect-ratio: 4 / 3; }
  .pig { bottom: 9%; width: 57%; }
  .shadow { bottom: 17%; width: 39%; }
  .speech { top: 8%; left: 48%; }
  .flying-coin { width: 26px; }
  .feed { min-height: 78px; }
  .feed p { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .garden[data-fed] .pig { animation: none; }
  .garden[data-fed] .flying-coin { display: none; }
}

body { min-height:100dvh; padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.demo-actor { position:absolute; width:min(52%,290px); aspect-ratio:1; left:52%; bottom:6%; transform:translateX(-50%); }
.demo-actor .pig { width:100%; bottom:0; left:50%; }
.demo-actor .shadow { width:66%; bottom:9%; left:50%; }
.demo-actor .speech { top:auto; bottom:87%; left:37%; width:max-content; max-width:min(220px,46vw); }
.speech::after { left:48%; }
#find-detail { max-width:min(330px,88vw); padding:22px; text-align:center; border:1px solid var(--line); border-radius:14px; background:var(--grain),var(--cream); color:var(--ink); }
#find-detail button { margin-top:15px; }
#find-detail::backdrop { background:#49352d55; }
#find-toast { background:var(--cream); color:var(--ink); border-color:var(--line); }
@media(max-width:740px) {
  .scene { aspect-ratio:4/5; background-image:url('assets/garden-portrait-6894cbd62fb0.jpg'); }
  .demo-actor { left:57.5%; width:43%; bottom:14.4%; }
  #give-coin:disabled { opacity:.6; }
  @media(prefers-reduced-motion:no-preference) {
    #find-toast { animation:arrive .28s ease-out; }
    @keyframes arrive { from { opacity:0; translate:0 12px; } }
  }
}

.unlock-link { text-align:center; margin:18px 0 30px; }
.unlock-link a { color:var(--ink); text-underline-offset:3px; padding-block:8px; }
