/* =====================================================================
   assets/css/proiecte.css – design of the PROJECTS page (proiecte/).
   Load it AFTER assets/css/buburuze.css.
   The cards are built by assets/js/site.js (viewSchool) from data/projects.js.
   Every card is a ladybug of another color: red, yellow, orange, pink, blue (then they repeat).
   ===================================================================== */

.page-list main { max-width: 1040px; margin: 0 auto; padding: 34px 20px 140px; }   /* bottom: room for the grass */

/* ---------- Title of the page ---------- */
.page-head { text-align: center; margin: 4px 0 26px; }
.page-head .breadcrumb { justify-content: center; }
.page-title {
  margin: 0; outline: none;
  font-size: clamp(2.1rem, 6vw, 3.1rem); line-height: 1.05; font-weight: 800;
  color: var(--red);
  text-shadow: 3px 3px 0 #fff, 5px 5px 0 rgba(42, 31, 31, 0.10);
}
.page-sub { margin: 8px 0 0; font-weight: 700; font-size: 1.08rem; color: var(--muted); }

/* ---------- Search (shown only when there are many projects) ---------- */
.toolbar { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 auto 14px; max-width: 560px; }
.search {
  width: 100%; padding: 12px 22px 12px 48px; border-radius: 999px;
  border: 3px solid #fff; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b5b55' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 18px center / 20px;
  box-shadow: 0 6px 18px rgba(42, 31, 31, 0.08);
  font-family: inherit; font-size: 1.05rem; font-weight: 700; color: var(--ink);
}
.search:focus-visible { outline: none; border-color: var(--red); }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.filter-btn {
  font-family: inherit; font-size: 0.95rem; font-weight: 800; cursor: pointer;
  padding: 7px 16px; border-radius: 999px; border: 0;
  background: #fff; color: var(--red-dark); box-shadow: 0 3px 10px rgba(42, 31, 31, 0.08);
}
.filter-btn[aria-pressed="true"] { background: var(--red); color: #fff; }
.filter-btn:focus-visible { outline: 4px solid #ffb703; outline-offset: 2px; }
.filter-count { opacity: 0.75; }
.result-count { text-align: center; margin: 0 0 18px; font-weight: 800; color: var(--muted); }
.result-count:empty { display: none; }

/* ---------- Project cards ---------- */
.grid-projects {
  display: grid; gap: 30px 24px;
  grid-template-columns: repeat(auto-fit, minmax(270px, 310px));
  justify-content: center;
  padding-top: 8px;
}
.project-card {
  --accent: var(--red); --accent-dark: var(--red-dark); --spot: var(--ink); --on-accent: #fff;
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 22px 22px; text-align: center;
  background: #fff; border-radius: 30px;
  box-shadow: 0 10px 28px rgba(42, 31, 31, 0.12);
  transition: transform 0.18s, box-shadow 0.18s;
}
.project-card:nth-child(5n+2) { --accent: #f2b81f; --accent-dark: #a77600; --on-accent: var(--ink); }
.project-card:nth-child(5n+3) { --accent: #f07f2a; --accent-dark: #b4530c; --spot: #fff4dc; }
.project-card:nth-child(5n+4) { --accent: #f2709c; --accent-dark: #b3285a; --spot: #8f1746; }
.project-card:nth-child(5n+5) { --accent: #3f97d8; --accent-dark: #1f6aa3; --spot: #fff; }

/* the top of the card: a ladybug shell with spots and the line between the wings */
.project-shell {
  position: relative; align-self: stretch;
  height: 96px; margin: 0 -22px 0;
  border-radius: 30px 30px 50% 50% / 30px 30px 26px 26px;
  background:
    radial-gradient(circle at 16% 34%, var(--spot) 0 11px, transparent 12px),
    radial-gradient(circle at 28% 74%, var(--spot) 0 8px, transparent 9px),
    radial-gradient(circle at 84% 30%, var(--spot) 0 12px, transparent 13px),
    radial-gradient(circle at 73% 76%, var(--spot) 0 8px, transparent 9px),
    radial-gradient(circle at 96% 80%, var(--spot) 0 7px, transparent 8px),
    radial-gradient(circle at 4% 82%, var(--spot) 0 6px, transparent 7px),
    linear-gradient(90deg, transparent calc(50% - 1.5px), rgba(42, 31, 31, 0.55) calc(50% - 1.5px), rgba(42, 31, 31, 0.55) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.25) 0, transparent 50%),
    var(--accent);
}
/* the round icon (Bubu or an emoji), half over the shell */
.project-badge {
  position: relative; z-index: 1;
  width: 92px; height: 92px; margin-top: -50px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 5px var(--accent), 0 8px 16px rgba(42, 31, 31, 0.15);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.project-icon { width: 84%; height: 84%; object-fit: contain; }
.project-emoji { font-size: 2.8rem; line-height: 1; }
.project-title { margin: 6px 0 0; font-size: 1.5rem; font-weight: 800; line-height: 1.15; color: var(--ink); }
.project-desc { margin: 0; font-weight: 600; color: var(--muted); line-height: 1.5; }
.project-coordinators {
  margin: 4px 0 0; padding: 8px 14px; border-radius: 16px;
  background: #fbf5ee; font-size: 0.88rem; font-weight: 600; color: var(--muted); line-height: 1.45;
}
.project-label { display: block; font-weight: 800; color: var(--ink); }
.project-actions { margin-top: auto; padding-top: 10px; }

/* ---------- Other shapes of cards ("box" in data/projects.js) ----------
   .project-body holds the badge + texts. For the ladybug it is "display: contents" (as if it
   were not there); the other shapes use it as the screen / the paper / the label. */
.project-body { display: contents; }
.project-card:not(.project-card--ladybug) .project-body {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  align-self: stretch; flex: 1; position: relative;
}
.project-card:not(.project-card--ladybug) .project-badge { margin-top: 0; }

/* --- computer: a monitor with a window bar, a green power light and a stand --- */
.project-card--computer { background: none; box-shadow: none; border-radius: 0; padding: 0 0 46px; }
.project-card--computer .project-body {
  padding: 44px 20px 22px;
  background: linear-gradient(180deg, #e6f5ff 0%, #fff 55%);
  border: 14px solid #2f3445; border-bottom-width: 30px; border-radius: 24px;
  box-shadow: 0 12px 28px rgba(42, 31, 31, 0.18);
}
/* the bar of the window, with the three colored buttons */
.project-card--computer .project-body::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 28px;
  border-radius: 10px 10px 0 0;
  background:
    radial-gradient(circle at 16px 50%, #ff5f57 0 5px, transparent 6px),
    radial-gradient(circle at 34px 50%, #ffbd2e 0 5px, transparent 6px),
    radial-gradient(circle at 52px 50%, #28c840 0 5px, transparent 6px),
    #cfe6f7;
}
/* the power light, in the bottom frame */
.project-card--computer .project-body::after {
  content: ""; position: absolute; left: 50%; bottom: -19px; width: 9px; height: 9px; margin-left: -4px;
  border-radius: 50%; background: #6cdc6c; box-shadow: 0 0 6px #6cdc6c;
}
/* the neck of the stand ... */
.project-card--computer .project-shell {
  position: absolute; left: 50%; bottom: 12px; width: 76px; height: 36px; margin: 0;
  transform: translateX(-50%); border-radius: 0;
  background: linear-gradient(180deg, #232735, #3b4154);
  clip-path: polygon(24% 0, 76% 0, 88% 100%, 12% 100%);
}
/* ... and its foot */
.project-card--computer::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 160px; height: 14px; margin-left: -80px;
  border-radius: 10px 10px 6px 6px; background: #2f3445;
  box-shadow: 0 6px 12px rgba(42, 31, 31, 0.18);
}

/* --- notebook (caiet): lined paper with a red margin and a spiral on top --- */
.project-card--notebook {
  padding: 0 22px 22px 44px; border-radius: 10px 10px 18px 18px;
  background:
    linear-gradient(90deg, transparent 32px, #f28b8b 32px 34px, transparent 34px),
    repeating-linear-gradient(180deg, transparent 0 27px, #cfe2f3 27px 28px) 0 40px / 100% calc(100% - 40px) no-repeat,
    #fff;
  border-top: 12px solid var(--accent);
  box-shadow: 4px 5px 0 #f3ece2, 8px 10px 0 #e9e0d3, 0 14px 28px rgba(42, 31, 31, 0.14);
}
.project-card--notebook .project-shell {
  height: 34px; margin: -22px -22px 8px -44px; border-radius: 0;
  background:
    radial-gradient(ellipse 4px 13px at 50% 55%, transparent 0 2px, #8d96a0 2.5px 4px, transparent 4.5px) 6px 0 / 24px 34px repeat-x,
    radial-gradient(circle at 50% 80%, #e9e0d3 0 4px, transparent 4.5px) 6px 0 / 24px 34px repeat-x;
}

/* --- book (carte): a hard cover with a spine, the pages seen on the right, a cream label --- */
.project-card--book {
  padding: 22px 22px 22px 46px; border-radius: 8px 22px 22px 8px;
  background:
    radial-gradient(circle at 80% 12%, rgba(255, 255, 255, 0.28) 0, transparent 45%),
    var(--accent);
  box-shadow:
    5px 4px 0 -1px #fffaf0, 6px 5px 0 -1px #e3d6c0,
    10px 8px 0 -2px #fffaf0, 11px 9px 0 -2px #e3d6c0,
    0 16px 28px rgba(42, 31, 31, 0.18);
}
/* the spine with two golden bands */
.project-card--book .project-shell {
  position: absolute; left: 0; top: 0; bottom: 0; width: 26px; height: auto; margin: 0;
  border-radius: 8px 0 0 8px;
  background:
    linear-gradient(180deg, transparent 34px, #ffd23f 34px 40px, transparent 40px calc(100% - 40px), #ffd23f calc(100% - 40px) calc(100% - 34px), transparent calc(100% - 34px)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.12));
}
.project-card--book .project-body {
  padding: 20px 16px 20px; border-radius: 18px; background: #fffaf0;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.7), 0 6px 14px rgba(0, 0, 0, 0.15);
}

/* --- frame (tablou): a golden wooden frame hanging on a nail --- */
.project-card--frame {
  margin-top: 44px; padding: 22px; border-radius: 6px;
  background: #fffdf7;
  border: 18px solid #c08a3a;
  box-shadow: inset 0 0 0 3px #7d5016, inset 0 0 0 8px #f3dca6,
    0 0 0 3px #7d5016, 0 14px 28px rgba(42, 31, 31, 0.2);
  transform-origin: 50% -40px;
}
/* the string and the nail */
.project-card--frame .project-shell {
  position: absolute; left: 50%; top: -62px; width: 120px; height: 48px; margin: 0;
  transform: translateX(-50%); border-radius: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 1.5px), #7d5016 calc(50% - 1.5px) calc(50% + 1px), transparent calc(50% + 1px)) left / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1.5px), #7d5016 calc(50% - 1.5px) calc(50% + 1px), transparent calc(50% + 1px)) right / 50% 100% no-repeat;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 0;
  font-family: inherit; font-size: 1.05rem; font-weight: 800; text-decoration: none;
  background: var(--accent, var(--red)); color: var(--on-accent, #fff);
  box-shadow: 0 5px 0 var(--accent-dark, var(--red-dark));
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn::after { content: "➜"; transition: transform 0.15s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-dark, var(--red-dark)); }
.btn:focus-visible { outline: 4px solid #ffb703; outline-offset: 4px; }
.btn.disabled { background: #eee6de; color: var(--muted); box-shadow: none; cursor: not-allowed; }
.btn.disabled::after { content: none; }

/* ---------- Messages (no projects yet, nothing found) ---------- */
.empty {
  max-width: 520px; margin: 10px auto; padding: 26px 24px; text-align: center;
  background: #fff; border-radius: 26px; box-shadow: 0 8px 22px rgba(42, 31, 31, 0.10);
  font-weight: 800; color: var(--muted);
}
.empty::before { content: "🐞"; display: block; font-size: 2.4rem; margin-bottom: 6px; }

/* ---------- Ladybugs on the shapes ----------
   Small ladybugs (drawn by assets/js/buburuze.js) sit on every shape: on the edge of the monitor,
   on the paper of the notebook, on the cover of the book, on the frame of the picture.
   They wiggle only while the mouse is on the card (transform only: cheap). */
.project-bug {
  position: absolute; z-index: 2; display: block;
  width: var(--s, 30px); height: var(--s, 30px); transform: rotate(var(--r, 0deg));
  pointer-events: none;
}
.project-bug svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* computer: one climbs on the top edge, one sits on the foot, one on the screen bar;
   the window bar is called "buburuze" and the screen has soft ladybug spots */
.project-card--computer .pb1 { --s: 38px; --r: 100deg; right: 34px; top: -20px; }
.project-card--computer .pb2 { --s: 26px; --r: -15deg; left: calc(50% + 46px); bottom: 6px; }
.project-card--computer .pb3 { --s: 22px; --r: 80deg;  left: 30px; top: 46px; }
.project-card--computer .project-body {
  background:
    radial-gradient(circle at 88% 30%, rgba(214, 47, 47, 0.10) 0 14px, transparent 15px),
    radial-gradient(circle at 94% 78%, rgba(214, 47, 47, 0.08) 0 10px, transparent 11px),
    radial-gradient(circle at 6% 86%, rgba(214, 47, 47, 0.08) 0 12px, transparent 13px),
    linear-gradient(180deg, #e6f5ff 0%, #fff 55%);
}
.project-card--computer .project-body::before {
  content: "🐞 buburuze"; display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800; color: #4b6a85; letter-spacing: 0.02em;
}

/* notebook: a ladybug sticker on the margin, one on the paper, one on the spiral */
.project-card--notebook .pb1 { --s: 34px; --r: -20deg; left: 6px;  top: 60px; }
.project-card--notebook .pb2 { --s: 26px; --r: 140deg; right: 14px; bottom: 16px; }
.project-card--notebook .pb3 { --s: 24px; --r: 75deg;  right: 40px; top: -12px; }

/* book: ladybugs walking on the cover; the spine has a tiny ladybug drawn with spots */
.project-card--book .pb1 { --s: 34px; --r: 30deg;   right: 6px;  top: 2px; }
.project-card--book .pb2 { --s: 30px; --r: -150deg; left: 30px; bottom: 0; }
.project-card--book .pb3 { --s: 24px; --r: 200deg;  right: 26px; bottom: 2px; }

/* frame: one sits on the nail, two crawl on the frame */
.project-card--frame .pb1 { --s: 30px; --r: 0deg;    left: calc(50% - 15px); top: -84px; }
.project-card--frame .pb2 { --s: 32px; --r: -40deg;  left: -24px; top: -24px; }
.project-card--frame .pb3 { --s: 26px; --r: 130deg;  right: -22px; bottom: 30%; }

/* ---------- Wide screens: small horizontal cards ----------
   Two cards per row (one on tablets); the round icon on the left, the texts on the right.
   (On phones they stay vertical, there is no room.) */
@media (min-width: 760px) {
  .grid-projects { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 44px 34px; }
  .grid-projects .project-card .project-body {
    display: grid; grid-template-columns: 84px minmax(0, 1fr);
    column-gap: 18px; row-gap: 4px; align-items: start; align-content: center; text-align: left;
  }
  .grid-projects .project-card .project-body > * { grid-column: 2; justify-self: start; }
  .grid-projects .project-card .project-badge {
    grid-column: 1; grid-row: 1 / span 4; align-self: center;
    width: 84px; height: 84px; margin: 0;
  }
  .project-card .project-title { margin: 0; font-size: 1.25rem; }
  .project-card .project-desc { font-size: 0.92rem; line-height: 1.4; }
  .project-card .project-coordinators { text-align: left; margin-top: 2px; padding: 5px 10px; font-size: 0.8rem; border-radius: 12px; }
  .project-card .project-label { display: inline; }
  .project-card .project-actions { margin-top: 4px; padding-top: 2px; }
  .project-card .btn { padding: 7px 16px; font-size: 0.95rem; box-shadow: 0 4px 0 var(--accent-dark); }

  /* the ladybug: the shell goes on the left, the icon half over it */
  .project-card--ladybug { flex-direction: row; align-items: stretch; padding: 0; }
  .project-card--ladybug .project-shell {
    width: 96px; height: auto; margin: 0; flex: none;
    border-radius: 30px 50% 50% 30px / 30px 50% 50% 30px;
    background:
      radial-gradient(circle at 30% 18%, var(--spot) 0 9px, transparent 10px),
      radial-gradient(circle at 72% 30%, var(--spot) 0 7px, transparent 8px),
      radial-gradient(circle at 26% 80%, var(--spot) 0 10px, transparent 11px),
      radial-gradient(circle at 70% 72%, var(--spot) 0 7px, transparent 8px),
      linear-gradient(180deg, transparent calc(50% - 1.5px), rgba(42, 31, 31, 0.55) calc(50% - 1.5px), rgba(42, 31, 31, 0.55) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
      radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.25) 0, transparent 50%),
      var(--accent);
  }
  .grid-projects .project-card--ladybug .project-body {
    flex: 1; grid-template-columns: 42px minmax(0, 1fr);
    padding: 18px 20px 18px 0;
  }
  .grid-projects .project-card--ladybug .project-badge { margin-left: -42px; }

  /* smaller frames, paper and covers */
  .project-card--computer { padding-bottom: 36px; }
  .grid-projects .project-card--computer .project-body { padding: 38px 20px 16px; border-width: 11px 11px 24px; border-radius: 20px; }
  .project-card--computer .project-body::before { height: 24px; }
  .project-card--computer .project-body::after { bottom: -16px; }
  .project-card--computer .project-shell { width: 60px; height: 28px; bottom: 9px; }
  .project-card--computer::after { width: 130px; height: 11px; margin-left: -65px; }
  .project-card--notebook { padding: 0 18px 16px 42px; }
  .project-card--notebook .project-shell { margin: -16px -18px 6px -42px; height: 30px; }
  .project-card--book { padding: 14px 16px 14px 40px; }
  .grid-projects .project-card--book .project-body { padding: 14px 14px; }
  .project-card--frame { margin-top: 40px; padding: 14px; border-width: 14px; }
}

/* ---------- Mouse effects ----------
   Only on computers with a mouse: on phones and tablets a tap would leave the card "lifted"
   (stuck hover) after coming back to the page. */
@media (hover: hover) {
  .project-card:hover { transform: translateY(-6px) rotate(-0.6deg); box-shadow: 0 18px 34px rgba(42, 31, 31, 0.16); }
  .project-card--computer:hover { box-shadow: none; transform: translateY(-6px); }
  .project-card--book:hover { box-shadow:
      5px 4px 0 -1px #fffaf0, 6px 5px 0 -1px #e3d6c0,
      10px 8px 0 -2px #fffaf0, 11px 9px 0 -2px #e3d6c0,
      0 20px 34px rgba(42, 31, 31, 0.2); }
  .project-card--frame:hover { transform: rotate(1.5deg); box-shadow: inset 0 0 0 3px #7d5016, inset 0 0 0 8px #f3dca6,
      0 0 0 3px #7d5016, 0 18px 32px rgba(42, 31, 31, 0.22); }
  .btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--accent-dark, var(--red-dark)); }
  .btn:hover::after { transform: translateX(3px); }
  .project-card:hover .project-bug svg { animation: wiggle 1.2s ease-in-out infinite; }
  .project-card:hover .project-bug.pb2 svg { animation-delay: -0.5s; }
}
.btn { -webkit-tap-highlight-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  .project-card, .project-card:hover { transition: none; }
}

@media (max-width: 600px) {
  .page-list main { padding: 18px 16px 120px; }
  .grid-projects { grid-template-columns: minmax(0, 1fr); }
  .project-title { font-size: 1.35rem; }
}
@media (max-width: 360px) {           /* very small phones: thinner frames, a bit more room for the text */
  .project-card { padding: 0 16px 18px; }
  .project-shell { margin: 0 -16px; }
  .project-card--computer { padding: 0 0 46px; }
  .project-card--computer .project-body { padding: 40px 14px 18px; border-width: 10px 10px 26px; }
  .project-card--notebook { padding: 0 14px 18px 40px; }
  .project-card--notebook .project-shell { margin: -22px -14px 8px -40px; }
  .project-card--book { padding: 18px 14px 18px 40px; }
  .project-card--frame { padding: 16px; border-width: 14px; }
  .project-badge { width: 80px; height: 80px; }
}
