/* =====================================================================
   assets/css/buburuze.css – the parts SHARED by the pages of the class site:
   colors, the meadow background, the breadcrumb (its first step is Bubu, the way home),
   the footer with grass and the ladybugs (drawn by assets/js/buburuze.js).
   Every page loads this file first, then its own file:
     home page      -> assets/css/home.css
     projects page  -> assets/css/proiecte.css
   ===================================================================== */

:root {
  --bg-sky: #fff8ea;
  --bg-meadow: #e3f4d2;
  --grass: #7cc35a;
  --grass-dark: #4f9a37;
  --red: #d62f2f;
  --red-dark: #a81f22;
  --ink: #2a1f1f;
  --muted: #6b5b55;
  --card: #ffffff;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;   /* iPhone: the text does not grow by itself when the phone is turned sideways */
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;   /* phones: the real height of the screen, without the address bar of the browser */
  display: flex; flex-direction: column; align-items: center;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 214, 102, 0.45) 0, transparent 30%),
    radial-gradient(circle at 88% 30%, rgba(255, 168, 168, 0.30) 0, transparent 28%),
    linear-gradient(180deg, var(--bg-sky) 0%, var(--bg-sky) 45%, var(--bg-meadow) 100%);
  overflow-x: hidden;
  position: relative;
}
a:focus-visible { outline: 5px solid #ffb703; outline-offset: 4px; }
/* phones and tablets: no gray/blue box flashing over the links and the ladybugs when they are tapped
   (they have their own animations) */
a, .bug, .card { -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: "Baloo 2", "Nunito", sans-serif; }
main { position: relative; z-index: 2; flex: 1; width: 100%; }
main:focus { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Breadcrumb (Acasă › Proiecte › ...) ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 800; font-size: 0.95rem; margin: 0 0 6px; }
.breadcrumb a { color: var(--red-dark); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb > span:not(.sep) { color: var(--muted); }   /* the current page and the steps without a link */
.breadcrumb .sep { color: var(--muted); opacity: 0.6; }
/* the first step: Bubu in a round frame + "Acasă" (the pages have no header, this is the way back home) */
.breadcrumb a.crumb-home {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  background: #fff; box-shadow: 0 4px 12px rgba(42, 31, 31, 0.10);
  transition: transform 0.15s;
}
.breadcrumb a.crumb-home:hover { text-decoration: none; }
.crumb-home img {
  width: 40px; height: 40px; border-radius: 50%; padding: 2px;
  background: #fff; box-shadow: 0 0 0 3px var(--red); object-fit: contain;
  transition: transform 0.15s;
}
/* the hover effects only on computers with a mouse: on phones and tablets a tap would leave them "stuck" */
@media (hover: hover) {
  .breadcrumb a.crumb-home:hover { transform: scale(1.05); }
  .breadcrumb a.crumb-home:hover span { text-decoration: underline; }
  .breadcrumb a.crumb-home:hover img { transform: rotate(-10deg); }
}
.breadcrumb a.crumb-home:active { transform: scale(0.97); }

/* ---------- Footer with grass ----------
   The grass images are drawn by tools/genereaza-iarba.py (run it again to change them):
     .grass         iarba-spate.svg  dense grass with a few flowers, behind the walking ladybugs
     .grass::after  iarba-fata.svg   a few tufts in front of them, so they walk THROUGH the grass */
/* the grass stands on a dark green strip of "soil" with the class, the teacher, the school and the year */
.site-footer {
  position: relative; z-index: 1;
  width: 100%; margin-top: auto;
  background: #3a7d2a;             /* the same color as the ground at the bottom of iarba-spate.svg */
}
.footer-info {
  position: relative; z-index: 4;
  margin: 0; padding: 10px 16px 14px;
  display: flex; flex-wrap: wrap; justify-content: center; column-gap: 10px; row-gap: 2px;
  text-align: center; font-size: 0.92rem; font-weight: 700; line-height: 1.4; color: #fff;
}
.footer-info span + span::before { content: "•"; margin-right: 10px; opacity: 0.7; }
.grass {
  z-index: 3;
  position: absolute; left: 0; right: 0; bottom: 100%; height: 110px;   /* sits on top of the strip */
  background: url("../img/iarba-spate.svg") repeat-x left bottom / 640px 110px;
  pointer-events: none;
}
.grass::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 60px; z-index: 2;
  background: url("../img/iarba-fata.svg") repeat-x 130px bottom / 520px 60px;
  pointer-events: none;
}
.grass .bug { z-index: 1; }

/* =====================================================================
   Ladybugs (drawn by assets/js/buburuze.js)
   Each .bug is positioned with --x, --y (percent of the page), --size, --rot.
   ===================================================================== */
.bugs { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.bug {
  position: absolute;
  left: var(--x); top: var(--y);
  width: var(--size); height: var(--size);
  transform: rotate(var(--rot));
  pointer-events: auto; cursor: pointer;
  transition: transform 0.3s;
}
.bug[hidden] { display: none; }
.bug svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bug .legs { animation: legs 0.5s steps(2) infinite; transform-origin: 50px 55px; animation-play-state: paused; }
.bug--crawl .legs { animation-play-state: running; }
@media (hover: hover) {
  .bug:hover { transform: rotate(var(--rot)) scale(1.15); }
  .bug:hover .legs { animation-play-state: running; }
}

/* a gentle wiggle, so the page feels alive */
.bug--wiggle svg { animation: wiggle 3.5s ease-in-out infinite; animation-delay: var(--delay, 0s); will-change: transform; }

/* crawling across the grass, from left to right
   (moved with "transform", which the graphics card does by itself; animating "left" made the browser
   recompute the page layout on every frame) */
.bug--crawl {
  top: auto; bottom: var(--bottom, 0px); left: -80px;
  animation: crawl var(--dur, 40s) linear infinite; animation-delay: var(--delay, 0s);
  will-change: transform;
}
.bug--crawl svg { transform: rotate(90deg); }

/* a click makes the ladybug fly away, then it comes back */
.bug.is-flying { animation: fly 2.4s ease-in-out forwards; pointer-events: none; }
.bug.is-flying .wings { opacity: 1; }
.bug .wings, [data-bug] .wings { opacity: 0; transition: opacity 0.2s; }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 45% { transform: rotate(0); } 50% { transform: rotate(-8deg); } 55% { transform: rotate(8deg); } 60% { transform: rotate(0); } }
@keyframes legs { from { transform: scaleX(1); } to { transform: scaleX(0.9); } }
@keyframes crawl { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 160px)); } }
@keyframes fly {
  0%   { transform: rotate(var(--rot)) translate(0, 0) scale(1); opacity: 1; }
  60%  { transform: rotate(var(--rot)) translate(40px, -260px) scale(1.4); opacity: 1; }
  80%  { transform: rotate(var(--rot)) translate(60px, -420px) scale(0.6); opacity: 0; }
  81%  { transform: rotate(var(--rot)) translate(0, 0) scale(0.2); opacity: 0; }
  100% { transform: rotate(var(--rot)) translate(0, 0) scale(1); opacity: 1; }
}

/* ---------- Phones ---------- */
@media (max-width: 600px) {
  /* the class, the teacher, the school and the year one under the other (without the dots, which
     would otherwise end up at the start of a line) */
  .footer-info { flex-direction: column; align-items: center; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .footer-info span + span::before { content: none; }
  .grass { height: 84px; background-size: 489px 84px; }
  .grass::after { height: 48px; background-size: 416px 48px; }
  .bug--desktop { display: none; }
}

/* ---------- Phones turned sideways (landscape): the screen is short, so lower grass
   and a smaller footer text that stays on one line ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .grass { height: 70px; background-size: 407px 70px; }
  .grass::after { height: 40px; background-size: 347px 40px; }
  .footer-info { font-size: 0.82rem; padding: 6px 16px 8px; column-gap: 22px; }
  .footer-info span + span::before { content: none; }   /* no dots: they would end up at the start of a line */
  .bug--desktop { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .bug--crawl { display: none; }
}
@media print {
  .bugs, .grass, .breadcrumb { display: none; }
  body { background: #fff; }
}
