/* Hatches feed font size */
@import url('/static/css/base.v1.css'); 

#hatch-feed {
  font-size: 1.2rem;
}

/* --- Rich hatch cards --- */
.hatch-card {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-card);
  overflow: hidden;
  color: white;
  border: 1.5px solid rgba(var(--hatch-rgb), 0.5);
  background: var(--glass-bg);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  -webkit-text-stroke: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  contain: layout paint;
  transform: translateZ(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hatch-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(var(--hatch-rgb), 0.35) 0%,
    rgba(var(--hatch-rgb), 0.1) 100%
  );
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

.hatch-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.hatch-card > * {
  position: relative;
  z-index: 2;
}

.hatch-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--hatch-rgb), 0.8);
  box-shadow:
    0 0 20px rgba(var(--hatch-rgb), 0.4),
    0 12px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

/* --- Content inside cards --- */
.hatch-content {
  flex: 1;
  min-width: 0;
  font-weight: bold;
}

.hatch-title {
  font-size: 1.6rem;
  font-weight: bolder;
  margin-bottom: 6px;
  color: white;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.8),
    0 0 12px rgba(var(--hatch-rgb), 0.35);
  -webkit-text-stroke: 0;
}

.hatch-content > div:not(.hatch-title):not(.hatch-time) {
  opacity: 0.85;
  font-size: 1.05rem;
}

.hatch-meta {
  margin-top: 4px;
}

.hatch-time {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  opacity: 0.75;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  letter-spacing: 0.3px;
}

.hatch-content img,
.hatch-icon {
  height: 1.2em;
  width: 1.2em;
  vertical-align: middle;
  margin-right: 4px;
  object-fit: contain;
  -webkit-text-stroke: 0;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

/* --- Animations --- */
@keyframes hatch-pop {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    filter: brightness(1.8);
  }
  50% {
    opacity: 1;
    transform: translateY(4px) scale(1.04);
    filter: brightness(1.2);
  }
  70% {
    transform: translateY(-2px) scale(0.99);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

.hatch-card.live {
  animation: hatch-pop var(--transition-slow);
}

@keyframes xl-pulse {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(var(--hatch-rgb), 0.3),
      0 0 0 0 rgba(var(--hatch-rgb), 0.4),
      inset 0 1px 0 rgba(255,255,255,0.2);
    border-color: rgba(var(--hatch-rgb), 0.55);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 24px rgba(var(--hatch-rgb), 0.6),
      0 0 48px rgba(var(--hatch-rgb), 0.25),
      inset 0 1px 0 rgba(255,255,255,0.2);
    border-color: rgba(var(--hatch-rgb), 0.9);
    filter: brightness(1.08);
  }
}

.hatch-card.xl {
  animation: xl-pulse 2s ease-in-out infinite;
}

.hatch-card.live.xl {
  animation:
    hatch-pop var(--transition-slow),
    xl-pulse 2s var(--transition-slow) infinite;
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.hatch-card.live .shimmer-overlay {
  position: absolute;
  inset: -25%;
  background:
    linear-gradient(
      120deg,
      transparent 20%,
      rgba(var(--hatch-rgb), 0.7),
      rgba(255, 255, 255, 0.3),
      rgba(var(--hatch-rgb), 0.7),
      transparent 80%
    );
  background-size: 200% 100%;
  mix-blend-mode: screen;
  opacity: 0.9;
  animation: shimmer 600ms cubic-bezier(.2, .9, .2, 1);
  pointer-events: none;
  z-index: 3;
  border-radius: inherit;
}

/* --- Pet image --- */
.hatch-image {
  width: clamp(80px, 20vw, 160px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  filter:
    drop-shadow(0 0 12px rgba(var(--hatch-rgb), 0.4))
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  transition: transform var(--transition-fast);
}

.hatch-card:hover .hatch-image {
  transform: scale(1.03);
}

/* --- Extra navigation (only hatches page) --- */
.nav-right {
  top: 16px;
  right: 18px;
  display: flex;
  align-items: center;
}

.redirect-icon {
  width: clamp(36px, 4vw, 48px);
  height: clamp(36px, 4vw, 48px);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.redirect-icon:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px var(--hover-accent));
}

/* --- Toolbar --- */
.hatch-toolbar {
  max-width: 720px;
  margin: 0 auto 20px auto;
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: center;
  flex-wrap: wrap;
}

.hatch-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.hatch-field > span {
  font-size: 0.85rem;
  opacity: 0.85;
  letter-spacing: 0.2px;
  padding-left: 4px;
}

.hatch-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 44px;
  box-sizing: border-box;
  padding: 8px 34px 8px 14px;
  border-radius: var(--radius-control);
  border: 2px solid var(--accent);
  background:
    linear-gradient(45deg, transparent 50%, #c9d6ea 50%) calc(100% - 14px) 55% / 6px 6px no-repeat,
    linear-gradient(135deg, #c9d6ea 50%, transparent 50%) calc(100% - 9px) 55% / 6px 6px no-repeat,
    var(--glass-bg);
  color: white;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: bolder;
  line-height: 1.1;
  cursor: pointer;
  outline: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.hatch-field select:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 8px var(--hover-accent);
}

.hatch-field select:focus-visible {
  border-color: #9eb8dc;
  box-shadow: 0 0 0 3px rgba(158, 184, 220, 0.25);
}

.hatch-field select option {
  color: #fff;
  background: #2b3646;
}

#sort-dir {
  height: 44px;
  border-radius: var(--radius-control);
  border: 2px solid var(--accent);
  background: var(--glass-bg);
  color: white;
  font-size: 1rem;
  font-weight: normal;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  min-width: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#sort-dir:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 8px var(--hover-accent);
}

/* --- Responsive (hatches only) --- */
@media (max-width: 520px) {
  .hatch-image {
    width: 80px;
    padding: 4px;
    border-radius: 12px;
  }

  .hatch-title {
    font-size: 1.2rem;
  }

  h1 {
    font-size: 2rem;
  }

  .hatch-toolbar {
    gap: 8px;
    align-items: stretch;
  }

  .hatch-field {
    min-width: 0;
    flex: 1 1 160px;
  }

  #sort-dir {
    flex: 0 0 56px;
    align-self: end;
  }
}

/* --- Reduced motion (hatches only) --- */
@media (prefers-reduced-motion: reduce) {
  .hatch-card,
  .hatch-card.live,
  .hatch-card.xl,
  .hatch-card.live.xl {
    animation: none;
    transition: none;
  }

  .hatch-card.live .shimmer-overlay,
  .hatch-card.live::after {
    animation: none;
    opacity: 0;
  }

  .hatch-card:hover {
    transform: none;
  }
}
