/* ===== Pet Me Coffee – Menu sách lật ===== */
:root {
  --green-950: #0b2219;
  --green-900: #0f2c20;
  --green-800: #173d2c;
  --green-600: #2c6b4a;
  --cream: #f4efe2;
  --red: #e2472f;
  --yellow: #f6c444;
  --top-h: 64px;
  --font-title: 'Playfair Display', Georgia, serif;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  overflow-x: clip;
  margin: 0; font-family: var(--font-body); color: #fff; line-height: 1.55;
  background: var(--green-900);
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--top-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 clamp(14px, 4vw, 48px);
  background: rgba(11, 34, 25, .96); backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-title); font-size: 1.3rem; }
.brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--yellow); }
.brand b { color: var(--yellow); }
.topnav { margin-left: auto; display: flex; gap: 4px; }
.topnav a { text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: .95rem; opacity: .9; }
.topnav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.btn-call {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  background: var(--yellow); color: var(--green-950); font-weight: 700;
  padding: 9px 16px; border-radius: 999px; font-size: .95rem;
}
.btn-call svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Book ---------- */
.menu-book {
  padding: 14px 12px 30px;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(44,107,74,.55), transparent 70%),
    linear-gradient(180deg, var(--green-800), var(--green-900));
  scroll-margin-top: var(--top-h);
}
.book-stage {
  display: flex; justify-content: center; align-items: center;
  perspective: 3000px; overflow: hidden; padding: 4px 0 8px;
}
.book {
  position: relative;
  /* rộng tối đa theo chiều ngang và chiều cao màn hình */
  width: min(96vw, 1440px, calc((100vh - var(--top-h) - 104px) * 1.413));
  aspect-ratio: 1752 / 1240;
  transform-style: preserve-3d;
  user-select: none; -webkit-user-select: none;
  cursor: pointer;
}
.book.single {
  width: min(94vw, 560px, calc((100vh - var(--top-h) - 170px) * .7065));
  aspect-ratio: 876 / 1240;
}


.pg {
  position: absolute; top: 0; height: 100%; width: 50%;
  background-color: #f4efe2; background-repeat: no-repeat; background-size: 200% 100%;
}
.book.single .pg { width: 100%; }
.pg.L { left: 0; background-position: left center; border-radius: 6px 0 0 6px; }
.pg.R { left: 50%; background-position: right center; border-radius: 0 6px 6px 0; }
.book.single .pg.R, .book.single .pg.L { left: 0; border-radius: 6px; }
.book.single .pg.L { background-position: left center; }
.book.single .pg.R { background-position: right center; }

/* bóng gáy sách */
.pg.L::after, .pg.R::after { content: ''; position: absolute; top: 0; bottom: 0; width: 12%; pointer-events: none; }
.pg.L::after { right: 0; width: 6%; background: linear-gradient(to left, rgba(0,0,0,.10), transparent); }
.pg.R::after { left: 0; width: 6%; background: linear-gradient(to right, rgba(0,0,0,.08), transparent); }
.book.single .pg::after { display: none; }

.leaf {
  position: absolute; top: 0; left: 50%; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.45,.05,.25,1);
}
.book.single .leaf { left: 0; width: 100%; }
.leaf.flipped { transform: rotateY(-180deg); }
/* mobile: trang lật nghiêng rồi mờ dần, không nằm lại bên trái */
.book.single .leaf { transition: transform .75s cubic-bezier(.45,.05,.25,1), opacity .75s ease-in; }
.book.single .leaf.flipped { transform: rotateY(-100deg); opacity: 0; pointer-events: none; }
.book.single .leaf .pg.back { display: none; }
.leaf .pg { left: 0 !important; width: 100% !important; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf .pg.back { transform: rotateY(180deg); }
.leaf .pg.blank { background: linear-gradient(90deg, #e8e1cf, #f6f1e4); }
/* ánh sáng khi lật */
.leaf .pg::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .45s;
  background: linear-gradient(90deg, rgba(0,0,0,.08), rgba(255,255,255,.10) 60%, rgba(0,0,0,0));
}
.leaf.turning .pg::before { opacity: 1; }
.leaf.turning .pg { outline: 1px solid rgba(0,0,0,.06); }

/* Controls */
.book-controls { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 4px; }
.ctrl {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08); color: #fff; font-size: 1.4rem; line-height: 1;
  display: grid; place-items: center; transition: background .2s;
}
.ctrl:hover { background: rgba(255,255,255,.2); }
.ctrl:disabled { opacity: .35; cursor: default; }
.ctrl.zoom { background: var(--yellow); color: var(--green-950); border: 0; margin-left: 6px; }
.ctrl.zoom svg { width: 22px; fill: currentColor; }
.page-num { min-width: 86px; text-align: center; font-weight: 600; letter-spacing: .04em; }
.book-hint { text-align: center; font-size: .82rem; opacity: .6; margin: 6px 0 12px; }

.thumbs {
  display: flex; gap: 8px; overflow-x: auto; max-width: 1440px; margin: 0 auto;
  padding: 6px 4px 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.3) transparent;
}
.thumbs button {
  flex: 0 0 auto; width: 112px; padding: 0; border: 2px solid transparent; border-radius: 6px;
  overflow: hidden; background: none; opacity: .6; transition: opacity .2s, border-color .2s, transform .2s;
}
.thumbs button:hover { opacity: 1; transform: translateY(-2px); }
.thumbs button.active { opacity: 1; border-color: var(--yellow); }
.thumbs img { width: 100%; aspect-ratio: 1.413; object-fit: cover; }

/* ---------- Animals gallery ---------- */
.animals { background: var(--cream); color: #1d2a23; padding: 46px 0 0; scroll-margin-top: var(--top-h); }
.animals h2 { font-family: var(--font-title); color: var(--green-800); text-align: center; font-size: clamp(1.7rem, 3.5vw, 2.5rem); margin: 0; padding: 0 16px; }
.animals .sub { text-align: center; color: #5b6a61; margin: 6px 0 24px; padding: 0 16px; }
.gal-big { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 2px; }
.gal-strip { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.gal-item { position: relative; overflow: hidden; border: 0; padding: 0; background: #ddd; cursor: zoom-in; }
.gal-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.gal-item:hover img { transform: scale(1.06); }
.gal-item span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; color: #fff; font-size: .85rem; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); opacity: 0; transition: opacity .3s; text-align: left;
}
.gal-item:hover span { opacity: 1; }
.gal-big .gal-item { height: clamp(220px, 28vw, 520px); }
.gal-strip .gal-item { height: clamp(110px, 11vw, 160px); flex: 1 1 auto; }
.gal-strip .gal-item img { width: auto; min-width: 100%; }

/* ---------- Footer ---------- */
.footer { background: var(--green-950); padding: 44px clamp(16px, 5vw, 64px) 20px; scroll-margin-top: var(--top-h); }
.footer-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 32px; align-items: start; }
.f-brand img { border-radius: 50%; border: 2px solid var(--yellow); margin-bottom: 12px; }
.f-brand p { opacity: .8; margin: 0 0 14px; font-size: .95rem; }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a { text-decoration: none; padding: 6px 14px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; font-size: .88rem; }
.socials a:hover { background: #fff; color: var(--green-950); }
.f-info { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: .95rem; }
.f-info li { display: flex; gap: 10px; }
.f-info a { color: var(--yellow); text-decoration: none; }
.f-map { border-radius: 14px; overflow: hidden; aspect-ratio: 16/10; background: var(--green-800); }
.f-map iframe { width: 100%; height: 100%; border: 0; }
.copy { text-align: center; opacity: .55; font-size: .85rem; margin: 30px 0 0; }

/* ---------- Floating panel ---------- */
.fab {
  position: fixed; right: 10px; bottom: 16px; z-index: 60;
  background: #fff; color: #1d2a23; border-radius: 10px; padding: 8px 4px 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70px;
}
.fab a { display: flex; flex-direction: column; align-items: center; text-decoration: none; font-size: .66rem; font-weight: 600; gap: 3px; }
.ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-style: normal; color: #fff; }
.ic svg { width: 20px; fill: #fff; }
.ic-map { background: #34a853; }
.ic-zalo { background: #0068ff; font-size: .7rem; font-weight: 800; }
.ic-mess { background: linear-gradient(135deg, #00b2ff, #a033ff); }
.fab button { border: 0; background: none; padding: 0; width: 36px; height: 28px; display: grid; place-items: center; }
.fab button svg { width: 30px; fill: var(--green-800); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5,18,12,.95); display: flex; align-items: center; justify-content: center; }
.lb-body { max-width: 96vw; max-height: 92vh; overflow: auto; text-align: center; }
.lb-body img { max-width: 96vw; max-height: 86vh; margin: 0 auto; border-radius: 6px; cursor: zoom-in; }
.lb-body img.zoomed { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.lb-body p { margin: 8px 0 0; opacity: .8; font-size: .9rem; }
.lb-close { position: fixed; top: 10px; right: 14px; background: none; border: 0; color: #fff; font-size: 2.6rem; line-height: 1; z-index: 2; }
.lb-nav { position: fixed; top: 50%; translate: 0 -50%; width: 50px; height: 50px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 2rem; z-index: 2; }
.lb-prev { left: 12px; } .lb-next { right: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .topnav { display: none; }
  .btn-call { margin-left: auto; }
  .footer-inner { grid-template-columns: 1fr; }
  .gal-big { grid-template-columns: 1fr 1fr; }
  .gal-big .gal-item:last-child { grid-column: span 2; }
}
@media (max-width: 600px) {
  :root { --top-h: 58px; }
  .brand { font-size: 1.12rem; }
  .brand img { width: 38px; height: 38px; }
  .btn-call span { display: none; }
  .btn-call { padding: 10px; }
  .menu-book { padding: 16px 0 26px; }
  .ctrl { width: 42px; height: 42px; }
  #first, #last { display: none; }
  .book-hint { display: none; }
  .book-controls { margin-top: 4px; }
  .thumbs button { width: 84px; }
  .gal-big .gal-item { height: 46vw; }
  .gal-strip .gal-item { height: 26vw; }
  .fab { width: 60px; right: 6px; bottom: 10px; }
  .ic { width: 32px; height: 32px; }
  .fab a { font-size: .58rem; }
  .lb-nav { top: auto; bottom: 16px; translate: none; }
  .lb-prev { left: 28%; } .lb-next { right: 28%; }
}
@media (prefers-reduced-motion: reduce) { .leaf { transition-duration: .01s; } html { scroll-behavior: auto; } }
