/* Shared look of every page on m.mat3s.cz: big, bright, tappable by a small child. */

:root {
  --ink: #2b2340;
  --ink-soft: #6b6385;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 28px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, #fff6c9 0 9rem, transparent 9.1rem),
    radial-gradient(circle at 88% 92%, #ffe0ec 0 14rem, transparent 14.1rem),
    linear-gradient(180deg, #d9f1ff 0%, #f3fbff 45%, #fff8ec 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Clouds drifting across the sky. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.sky span {
  position: absolute;
  left: -30vw;
  width: 9rem;
  height: 3rem;
  border-radius: 3rem;
  background: #fff;
  opacity: .85;
  animation: cloud 70s linear infinite;
}
.sky span::before,
.sky span::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.sky span::before { width: 4rem; height: 4rem; top: -2rem; left: 1.4rem; }
.sky span::after { width: 3rem; height: 3rem; top: -1.3rem; left: 4.4rem; }
.sky span:nth-child(1) { top: 9%; animation-delay: -10s; }
.sky span:nth-child(2) { top: 38%; transform: scale(.7); animation-duration: 95s; animation-delay: -60s; }
.sky span:nth-child(3) { top: 70%; transform: scale(1.2); animation-duration: 85s; animation-delay: -35s; }

@keyframes cloud { to { left: 110vw; } }

main {
  width: min(1100px, 100% - 2rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vh, 3.5rem) 0 3rem;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 5vh, 3rem);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.05;
}
h1 .wave { display: inline-block; animation: wave 2.4s ease-in-out infinite; transform-origin: 70% 80%; }

@keyframes wave {
  0%, 60%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(16deg); }
  20%, 40% { transform: rotate(-8deg); }
}

/* Big round "home" button. */
.home {
  flex: none;
  display: grid;
  place-items: center;
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 0 #c9dbe8, 0 10px 24px rgba(43, 35, 64, .12);
  font-size: 2rem;
  text-decoration: none;
  transition: transform .15s;
}
.home:active { transform: translateY(4px); box-shadow: 0 2px 0 #c9dbe8; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: clamp(1rem, 2.5vw, 1.6rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.tile {
  --c: #ffd166;
  --shade: color-mix(in srgb, var(--c) 72%, #000);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  height: 100%;
  min-height: 210px;
  padding: 1.6rem 1.2rem 1.4rem;
  border-radius: var(--radius);
  background: var(--c);
  box-shadow: 0 8px 0 var(--shade), 0 16px 28px rgba(43, 35, 64, .14);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-3px) rotate(-.6deg); }
.tile:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--shade), 0 4px 10px rgba(43, 35, 64, .14); }
.tile:focus-visible { outline: 5px solid var(--ink); outline-offset: 4px; }

.tile .emoji {
  font-size: clamp(4rem, 12vw, 5.5rem);
  line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .08));
}
.tile:hover .emoji { animation: bounce .6s ease; }

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-12px) scale(1.08); }
  70% { transform: translateY(2px) scale(.97); }
}

/* Picture from the book page. */
.pic {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  border: 4px solid rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .5);
  transition: transform .2s ease;
}
.tile:hover .pic { transform: scale(1.03) rotate(.6deg); }

.tile .name {
  font-size: clamp(1.25rem, 3.4vw, 1.55rem);
  font-weight: 800;
  line-height: 1.2;
}

.tile .num {
  position: absolute;
  z-index: 1;
  top: .9rem;
  left: .9rem;
  display: grid;
  place-items: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 .5rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, .6);
  font-weight: 800;
  font-size: 1rem;
}

/* A bigger tile for the main hub. */
.tile.big { min-height: 300px; }
.tile.big .emoji { font-size: clamp(6rem, 18vw, 8rem); }
.tile.big .name { font-size: clamp(1.6rem, 4.5vw, 2.1rem); }

/* Phones: two columns, so more songs fit on one screen. */
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: .9rem; }
  .tile { min-height: 165px; padding: 1.4rem .7rem 1.1rem; gap: .5rem; border-radius: 22px; }
  .tile .emoji { font-size: 3.6rem; }
  .pic { border-radius: 14px; border-width: 3px; }
  .tile .name { font-size: 1.05rem; }
  .tile .num { top: .6rem; left: .6rem; min-width: 1.8rem; height: 1.8rem; font-size: .85rem; }
  .tile.big { grid-column: 1 / -1; min-height: 240px; }
  .home { width: 3.4rem; height: 3.4rem; font-size: 1.6rem; }
}

.empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  font-size: 1.3rem;
  color: var(--ink-soft);
}

footer {
  padding: 0 1rem 2rem;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-soft);
}
footer a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
