/* =====================================================================
   assets/css/home.css – design of the HOME page (clasa buburuzelor).
   Load it AFTER assets/css/buburuze.css (colors, ladybugs, footer are there).
   ===================================================================== */

/* ---------- Hero: Bubu + title ---------- */
.hero {
  position: relative; z-index: 2;
  text-align: center;
  padding: clamp(10px, 4vh, 48px) 20px 6px;
  max-width: 760px;
}
/* the sizes follow the HEIGHT of the screen too, so Bubu, the title and the whole book
   fit on the screen without scrolling (also on small laptops) */
.hero-photo {
  --photo: clamp(64px, 14vh, 150px);
  width: var(--photo); height: var(--photo); margin: 0 auto;
  border-width: clamp(4px, 0.8vh, 8px);
  border-radius: 50%;
  background: #fff;
  border: 8px solid #fff;
  box-shadow: 0 0 0 6px var(--red), 0 14px 30px rgba(168, 31, 34, 0.25);
  display: flex; align-items: center; justify-content: center;
  animation: bob 4s ease-in-out infinite;
}
.hero-photo { overflow: hidden; }
.hero-photo img { width: 92%; height: 92%; object-fit: contain; }
.hero-hello {
  margin: clamp(6px, 2.4vh, 26px) 0 0;
  font-family: "Baloo 2", "Nunito", sans-serif; font-weight: 600;
  font-size: clamp(1.05rem, 2.6vh, 1.35rem); color: var(--muted);
}
.hero-title {
  margin: -6px 0 10px;
  font-family: "Baloo 2", "Nunito", sans-serif; font-weight: 800;
  font-size: clamp(2rem, min(7vw, 7.5vh), 4rem); line-height: 1.05;
  color: var(--red);
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(42, 31, 31, 0.12);
}
/* ---------- The "Proiecte" button: a book with ladybugs on the cover ----------
   .book__pages  the paper block behind the cover (seen on the right and at the bottom)
   .book__cover  bright green cover with colored confetti dots, a cream frame, the label and the ladybugs
   .book__bug    small ladybugs, drawn by assets/js/buburuze.js (data-bug = kind of ladybug)
   On hover the cover opens a little, on click it opens wide (assets/js/home-book.js adds .is-opening
   and plays the sounds). Only "transform" transitions: cheap for the computer. */
.home main {
  max-width: 900px;
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: clamp(20px, 5vw, 64px);
  padding: clamp(10px, 4vh, 44px) 20px clamp(80px, 13vh, 130px);   /* bottom: room for the grass */
}
.book {
  --w: 270px; --h: 340px;
  position: relative; display: block;
  width: var(--w); height: var(--h);
  text-decoration: none; color: var(--ink);
  perspective: 1200px;
  transition: transform 0.2s;
}
.book { -webkit-tap-highlight-color: transparent; }
.book:active { transform: translateY(2px); }
.book:focus-visible { outline: 5px solid #ffb703; outline-offset: 10px; border-radius: 12px; }

.book__pages {
  position: absolute; left: 6px; top: 8px; right: -12px; bottom: -10px;
  border-radius: 10px 20px 20px 10px;
  background:
    repeating-linear-gradient(0deg, #fffaf0 0 3px, #eadfca 3px 4px);
  box-shadow: 0 18px 30px rgba(42, 31, 31, 0.25);
}
.book__cover {
  position: absolute; inset: 0;
  border-radius: 12px 22px 22px 12px;
  background:
    /* soft light in the upper corner */
    radial-gradient(circle at 78% 14%, rgba(255, 255, 255, 0.35) 0, transparent 42%),
    /* colored confetti dots */
    radial-gradient(circle, #ffd23f 0 5px, transparent 6px) 18px 22px / 92px 86px,
    radial-gradient(circle, #ff8fb1 0 4px, transparent 5px) 62px 58px / 92px 86px,
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 0 3px, transparent 4px) 40px 4px / 92px 86px,
    radial-gradient(circle, #7fd3ff 0 3.5px, transparent 4.5px) 84px 40px / 92px 86px,
    linear-gradient(160deg, #6cc24a 0%, #49a83c 55%, #378f34 100%);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12), 0 6px 0 #2a6f2c;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}
/* only with a mouse: on phones and tablets the tap opens the book wide right away (.is-opening),
   and a "stuck" hover would leave it half open when coming back with the Back button */
@media (hover: hover) {
  .book:hover { transform: translateY(-6px) rotate(-1.5deg); }
  .book:hover .book__cover { transform: rotateY(-24deg); }
}
/* when the book is clicked: the cover opens wide (before going to the next page) */
.book.is-opening .book__cover { transform: rotateY(-155deg); transition: transform 0.7s cubic-bezier(0.3, 0.6, 0.3, 1); }
.book.is-opening { transform: translateY(-6px); }
/* the label and the ladybugs are not seen from behind when the cover opens wide */
.book__cover > * { backface-visibility: hidden; }
/* a cream frame with rounded corners, like on a picture book */
.book__cover::before {
  content: ""; position: absolute; inset: 10px; border-radius: 10px 16px 16px 10px;
  border: 3px solid rgba(255, 250, 240, 0.75);
  pointer-events: none;
}
/* a small rainbow in the bottom-right corner */
.book__cover::after {
  content: ""; position: absolute; right: 16px; bottom: 16px; width: 64px; height: 32px;
  border-radius: 64px 64px 0 0; opacity: 0.9;
  background: radial-gradient(circle at 50% 100%,
    transparent 0 14px, #7fd3ff 14px 18px, #6cdc6c 18px 22px, #ffd23f 22px 26px, #ff9f43 26px 29px, #ff5e5e 29px 32px, transparent 32px);
  pointer-events: none;
}

.book__label {
  position: absolute; left: 26px; right: 26px; top: 50%; transform: translateY(-50%) rotate(-2deg);
  z-index: 1;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 16px 10px 14px;
  background: #fffaf0; border-radius: 22px;
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px #ffd23f, 0 10px 18px rgba(0, 0, 0, 0.22);
}
.book__title {
  font-family: "Baloo 2", "Nunito", sans-serif; font-weight: 800;
  font-size: 2.6rem; line-height: 1; color: var(--red);
  text-shadow: 2px 2px 0 #ffe3e0;
}
.book__note { margin-top: 4px; font-weight: 800; font-size: 0.95rem; color: var(--muted); }
.book__cta {
  margin-top: 10px; padding: 5px 16px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 3px 0 var(--red-dark);
}

/* the ladybugs on the cover */
.book__bug { position: absolute; z-index: 2; display: block; width: var(--s); height: var(--s); transform: rotate(var(--r)); }
.book__bug svg { display: block; width: 100%; height: 100%; overflow: visible; }
.book__bug.b1 { --s: 46px; --r: 25deg;   left: 26px;  top: 22px; }
.book__bug.b2 { --s: 34px; --r: -30deg;  right: 22px; top: 52px; }
.book__bug.b3 { --s: 40px; --r: 160deg;  left: 30px;  bottom: 26px; }
.book__bug.b4 { --s: 30px; --r: -120deg; right: 34px; bottom: 62px; }
.book__bug.b5 { --s: 26px; --r: 70deg;   left: 128px; top: 30px; }
.book__bug.b6 { --s: 24px; --r: 200deg;  left: 150px; bottom: 16px; }
/* the ladybugs move a little only while the mouse is on the book */
@media (hover: hover) {
  .book:hover .book__bug svg { animation: wiggle 1.2s ease-in-out infinite; }
  .book:hover .book__bug.b2 svg, .book:hover .book__bug.b5 svg { animation-delay: -0.6s; }
}

@media (prefers-reduced-motion: reduce) {
  .book, .book__cover, .book.is-opening .book__cover { transition: none; }
}

/* the book gets smaller on screens that are not very tall ("zoom" also shrinks the room it takes) */
.book { zoom: 1.3; }
@media (max-height: 900px) { .book { zoom: 1.1; } }
@media (max-height: 780px) { .book { zoom: 0.95; } }
@media (max-height: 680px) { .book { zoom: 0.84; } }
@media (max-height: 580px) { .book { zoom: 0.68; } }

/* ---------- Phones ---------- */
@media (max-width: 600px) {
  .hero-photo { --photo: clamp(64px, 12vh, 120px); }
  .book { --w: 240px; --h: 300px; }
  .book__title { font-size: 2.2rem; }
  .book__bug.b5 { left: 112px; }
  .book__bug.b6 { left: 130px; }
}
@media (max-width: 360px) {           /* very small phones */
  .hero { padding-left: 12px; padding-right: 12px; }
  .book { --w: 220px; --h: 280px; }
  .book__label { left: 20px; right: 20px; }
  .book__title { font-size: 2rem; }
  .book__bug.b5 { left: 100px; }
  .book__bug.b6 { left: 118px; }
}

/* ---------- Phones turned sideways (landscape): Bubu and the title on the left, the book on the right,
   so everything fits on the short screen without scrolling ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  body.home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    align-items: center;
  }
  .home .hero { grid-column: 1; grid-row: 1; justify-self: end; padding: 16px 12px 70px 20px; }
  .home main { grid-column: 2; grid-row: 1; justify-content: flex-start; padding: 16px 20px 70px 12px; }
  .home .site-footer { grid-column: 1 / -1; grid-row: 2; }
  .hero-photo { --photo: clamp(56px, 22vh, 110px); }
  .hero-title { font-size: clamp(1.8rem, 5vw, 2.6rem); }
}
