/* Coffee Door & Meo-woo — shared picture-book foundation */
:root {
  --hill: #d4e595;
  --hill-soft: #eef5d2;
  --leaf: #97b020;
  --leaf-ink: #5c7412;
  --leaf-deep: #3c4d0c;
  --ink: #2f3a12;
  --ink-soft: #5b6640;
  --page: #ffffff;
  --line: #e3ebc4;
  --dot: #f0902a;
  --dress: #f2b6c9;

  --tier-ambient: #a65a17;
  --tier-chilled: #2f6aa8;
  --tier-frozen: #24406b;

  --font-display: "Huninn", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-story: "LXGW WenKai TC", "Kaiti TC", "DFKai-SB", serif;
  --font-ui: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;

  --radius: 18px;
  --tabbar-h: 68px;
  --shadow: 0 8px 22px rgba(47, 58, 18, 0.12);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--hill);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
}

::selection {
  background: var(--hill);
  color: var(--leaf-deep);
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--leaf-ink);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--dot);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Top bar ---------- */
.mw-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--hill);
}
.mw-wordmark {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--leaf-deep);
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
/* the shop's illustration as a little sign beside the name (decorative) */
.mw-wordmark::before {
  content: "";
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff url("../images/brand/meowoo-illustration.jpg") 42% 78% / 150% no-repeat;
  box-shadow:
    0 0 0 2px #fff,
    0 2px 6px rgba(47, 58, 18, 0.18);
}
.mw-wordmark small {
  display: block;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}
.mw-top-nav {
  display: none;
}

/* ---------- Bottom tab bar (mobile) ---------- */
.mw-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(var(--tabs, 5), 1fr); /* 商品／預購 can be switched off in the admin */
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--page);
  border-top: 2px solid var(--hill);
}
.mw-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  min-height: 48px;
}
.mw-tab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mw-tab[aria-current="page"] {
  color: var(--leaf-ink);
  font-weight: 700;
}
.mw-tab[aria-current="page"] svg {
  stroke-width: 2.3;
}
.mw-tab:active {
  background: var(--hill-soft);
}
.mw-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--dot);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.mw-badge[hidden] {
  display: none;
}

/* ---------- Buttons & chips ---------- */
.mw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--leaf-ink);
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(60, 77, 12, 0.22);
  transition: transform 0.2s var(--ease-out), background-color 0.2s;
}
.mw-btn:hover {
  background: var(--leaf-deep);
}
.mw-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 8px rgba(60, 77, 12, 0.22);
}
.mw-btn[disabled],
.mw-btn[aria-disabled="true"] {
  background: #c9cfb4;
  color: #4b5232;
  box-shadow: none;
  cursor: not-allowed;
}
.mw-btn--quiet {
  background: var(--hill-soft);
  color: var(--leaf-deep);
  box-shadow: none;
}
.mw-btn--quiet:hover {
  background: var(--hill);
}

.mw-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 12px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--ink-soft);
  line-height: 1.7;
}
.mw-chip--ambient {
  background: var(--tier-ambient);
}
.mw-chip--chilled {
  background: var(--tier-chilled);
}
.mw-chip--frozen {
  background: var(--tier-frozen);
}
.mw-chip--status {
  background: var(--hill);
  color: var(--leaf-deep);
}

/* ---------- Footer ---------- */
.mw-footer {
  margin-top: 56px;
  padding: 36px 20px calc(28px + var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  background: var(--hill);
  color: var(--ink);
}
.mw-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}
.mw-footer h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--leaf-deep);
}
.mw-social {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mw-social a,
.mw-social button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 99px;
  border: 0;
  background: var(--page);
  color: var(--leaf-deep);
  font: 700 15px var(--font-ui);
  text-decoration: none;
  cursor: pointer;
}
.mw-social svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.mw-footer small {
  color: var(--ink-soft);
  font-size: 13px;
}
/* the shop's illustration in a wooden frame, hung on the footer wall */
.mw-footer-frame {
  position: relative;
  justify-self: center;
  width: min(170px, 48vw);
  margin: 18px 0 4px;
  padding: 9px;
  border-radius: 6px;
  background: linear-gradient(135deg, #b98149, #9a6a37 42%, #b5804a 68%, #8f6232);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 10px 18px rgba(47, 58, 18, 0.22);
  transform: rotate(-2deg);
  transform-origin: 50% -18px;
  transition: transform 0.6s var(--ease-out);
}
.mw-footer-frame::before {
  /* the string and nail it hangs from */
  content: "";
  position: absolute;
  left: 50%;
  top: -22px;
  width: 92px;
  height: 26px;
  transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 26'%3E%3Cpath d='M6 25 46 5 86 25' fill='none' stroke='%236b4a2a' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='46' cy='5' r='3.6' fill='%237a7262'/%3E%3Ccircle cx='45' cy='4' r='1.2' fill='%23c9c2b0'/%3E%3C/svg%3E") center / contain no-repeat;
}
.mw-footer-frame img {
  display: block;
  width: 100%;
  height: auto;
  padding: 7px;
  border-radius: 2px;
  background: #fbf6ea; /* the mat */
  box-shadow: inset 0 1px 4px rgba(60, 40, 20, 0.25);
}
.mw-footer-frame:hover {
  transform: rotate(0deg);
}
@media (prefers-reduced-motion: reduce) {
  .mw-footer-frame {
    transition: none;
  }
}

/* ---------- Contact dialog ---------- */
.mw-dialog {
  width: min(520px, calc(100% - 32px));
  border: 0;
  border-radius: 24px;
  padding: 24px 20px;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.mw-dialog::backdrop {
  background: rgba(47, 58, 18, 0.45);
}
.mw-dialog h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  color: var(--leaf-deep);
  margin-bottom: 4px;
}
.mw-field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}
.mw-field label {
  font-weight: 700;
  font-size: 15px;
}
.mw-field input,
.mw-field textarea {
  font: 17px var(--font-ui);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  caret-color: var(--leaf-ink);
}
.mw-field input:focus,
.mw-field textarea:focus {
  outline: none;
  border-color: var(--leaf-ink);
}
.mw-field input::placeholder,
.mw-field textarea::placeholder {
  color: #6a7350;
}
.mw-form-msg {
  margin-top: 12px;
  font-weight: 700;
}
.mw-form-msg--error {
  color: #b3261e;
}
.mw-form-msg--ok {
  color: var(--leaf-ink);
}
.mw-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}
.mw-dialog-actions .mw-btn {
  min-height: 50px;
  font-size: 18px;
}

/* ---------- Desktop: top nav replaces tab bar ---------- */
@media (min-width: 900px) {
  .mw-footer {
    padding-bottom: 28px;
  }
  .mw-tabbar {
    display: none;
  }
  .mw-top {
    padding: 14px max(24px, calc((100% - 1080px) / 2));
  }
  .mw-wordmark {
    font-size: 24px;
  }
  .mw-wordmark::before {
    width: 46px;
    height: 46px;
  }
  .mw-top-nav {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .mw-top-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 99px;
    color: var(--leaf-deep);
    text-decoration: none;
    font-weight: 700;
  }
  .mw-top-nav a:hover {
    background: rgba(255, 255, 255, 0.6);
  }
  .mw-top-nav a[aria-current="page"] {
    background: var(--page);
  }
  .mw-top-nav .mw-badge {
    top: 2px;
    left: auto;
    right: -2px;
  }
  .mw-footer-inner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 36px;
  }
  .mw-footer-frame {
    width: 150px;
    margin: 14px 0 0;
  }
}

/* ---------- Toast: a small note that slides up (e.g. 已放進購物車) ---------- */
.mw-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 14px 12px 20px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  box-shadow: var(--shadow);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.35s;
}
.mw-toast.is-on {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.mw-toast a,
.mw-toast button {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 99px;
  background: var(--hill);
  color: var(--leaf-deep);
  font: 700 15px var(--font-ui);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
@media (min-width: 900px) {
  .mw-toast {
    bottom: 28px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mw-toast {
    transition: none;
  }
}

/* ---------- Member pages (login / signup / reset): the shop's guest book ---------- */
.mw-auth {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 0;
  display: grid;
  gap: 20px;
}
.mw-auth-art {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}
.mw-auth-art [data-mascot] {
  width: 120px;
}
.mw-auth-art p {
  font-family: var(--font-story);
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 20em;
}
.mw-auth-card {
  padding: 26px 20px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: var(--page);
}
.mw-auth-card h1 {
  font-family: var(--font-story);
  font-weight: 700;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.2;
}
.mw-auth-card .lead {
  margin-top: 6px;
  color: var(--ink-soft);
}
.mw-auth form {
  display: grid;
  gap: 4px;
}
.mw-auth .mw-field:first-of-type {
  margin-top: 18px;
}
.mw-pw {
  position: relative;
  display: grid;
}
.mw-pw input {
  padding-right: 76px;
}
.mw-pw button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--hill-soft);
  color: var(--leaf-deep);
  font: 700 14px var(--font-ui);
  cursor: pointer;
}
.mw-auth .mw-btn {
  width: 100%;
  margin-top: 18px;
}
.mw-line-btn {
  background: #00873c;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}
.mw-line-btn:hover {
  background: #00803a;
}
.mw-line-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}
.mw-line-btn[disabled] {
  background: #c9cfb4;
}
.mw-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.mw-or::before,
.mw-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.mw-or + .mw-btn {
  margin-top: 12px;
}
.mw-auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 18px;
  font-weight: 700;
}
.mw-auth-links a,
.mw-auth-links button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--leaf-ink);
  font: 700 16px var(--font-ui);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.mw-auth-msg {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
}
.mw-auth-msg.is-error {
  background: #fbe9e7;
  color: #b3261e;
}
.mw-auth-msg.is-ok {
  background: var(--hill-soft);
  color: var(--leaf-deep);
}
@media (min-width: 900px) {
  .mw-auth {
    grid-template-columns: 1fr 440px;
    align-items: center;
    gap: 56px;
    padding-top: 56px;
    min-height: calc(100vh - 72px - 220px);
  }
  .mw-auth-art [data-mascot] {
    width: 240px;
  }
  .mw-auth-art p {
    font-size: 22px;
  }
  .mw-auth-card {
    padding: 34px 32px;
  }
}

/* ---------- The cast talking: a small bubble over a mascot (site.js chatter()) ---------- */
.mw-say {
  --shift: 0px;
  display: none; /* takes no room until it talks (see .is-shown) */
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% - 6px);
  width: max-content;
  max-width: min(250px, calc(100vw - 24px)); /* short lines stay on one row */
  padding: 8px 13px;
  border-radius: 14px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-story);
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(calc(-50% + var(--shift)), 6px);
  transition:
    opacity 0.25s var(--ease-out),
    transform 0.25s var(--ease-out);
  pointer-events: none;
}
.mw-say::after {
  content: "";
  position: absolute;
  left: calc(50% - var(--shift));
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: var(--page);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 3px 0;
}
.mw-say.is-shown {
  display: block;
}
.mw-say.is-on {
  opacity: 1;
  transform: translate(calc(-50% + var(--shift)), 0);
}
/* no room above (under the top bar): talk below the cat, tail pointing up */
.mw-say.is-below {
  bottom: auto;
  top: calc(100% - 6px);
}
.mw-say.is-below::after {
  bottom: auto;
  top: -6px;
  border-radius: 3px 0 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .mw-say {
    transition: none;
  }
}

/* ---------- Phones: the floating cat companion (site.js pal()) ----------
   Hidden at the side; .is-in brings it out to talk, then it slips away. */
.mw-pal {
  position: fixed;
  z-index: 45; /* under the top bar, buy bar, tab bar and toasts */
  top: clamp(140px, 50vh, calc(100vh - 330px));
  width: 112px;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(47, 58, 18, 0.14));
  transition: transform 0.45s var(--ease-out);
}
.mw-pal img {
  display: block;
  width: 100%;
  height: auto;
}
.mw-pal--left {
  left: 0;
  transform: translateX(-110%);
}
.mw-pal--right {
  right: 0;
  transform: translateX(110%);
}
.mw-pal.is-in {
  transform: none;
  pointer-events: auto;
}
@media (min-width: 900px) {
  .mw-pal {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mw-pal {
    transition: none;
  }
}

/* hidden trap field on contact forms: people never see it, form-filling bots do */
.mw-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- 真實 (real) cat art: a painted picture plus an eyes-closed frame for blinking ----------
   site.js drawCat() puts it in the same 240×294 box the comic SVGs use, so every spot keeps its size. */
.cat-frame {
  display: grid;
  place-items: end center;
  width: 100%;
  aspect-ratio: 240 / 294;
  min-height: 0; /* keep the comic box size even though the painting inside is taller */
}
.cat-real {
  position: relative;
  height: 100%;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: 2 / 3;
  transform-origin: 60% 94%;
  animation: cat-real-breathe 6.8s ease-in-out infinite;
}
/* lying down: a landscape painting resting on the bottom of the same box */
.cat-real.is-wide {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  transform-origin: 50% 92%;
}
.cat-real img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
.cat-real .cat-real-blink {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  clip-path: var(--blink-clip);
  animation: cat-real-blink var(--blink-every, 8.6s) steps(1, end) infinite;
}
@keyframes cat-real-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.003, 1.006); }
}
@keyframes cat-real-blink {
  0%, 41%, 43.4%, 100% { opacity: 0; }
  41.1%, 43.3% { opacity: 1; }
}
.is-paused .cat-real,
.is-paused .cat-real-blink {
  animation-play-state: paused;
}
@media (prefers-reduced-motion: reduce) {
  .cat-real { animation: none; }
  .cat-real .cat-real-blink { animation: none; opacity: 0; }
}

/* ---------- a part of the shop that 饅頭媽 switched off (site.js closedPage) ---------- */
body.mw-closed main {
  display: none;
}
.mw-closed-note {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 56px;
  text-align: center;
}
.mw-closed-note [data-mascot] {
  width: 150px;
}
.mw-closed-note h1 {
  font-family: var(--font-story);
  font-weight: 700;
  font-size: clamp(26px, 7vw, 34px);
  line-height: 1.3;
  color: var(--ink);
}
.mw-closed-note p {
  font-family: var(--font-story);
  font-size: 18px;
  line-height: 1.8;
  color: var(--ink-soft);
}
.mw-closed-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
