/* renewal.css — Immersive Shelf Design */
:root {
  --bg: #fdfdfd;
  --text: #1a1a1a;
  --grid-gap: 1px;
  --cell-min-w: 160px;
  --font: 'Helvetica Neue', Arial, sans-serif;
  --accent: #333;
}

* {
  box-sizing: border-box;
}

*:focus {
  outline: none !important;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font); /* Changed from shorthand 'font' */
  font-size: 14px; /* Explicitly set font-size */
  line-height: 1.4; /* Retained line-height */
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Main Container */
.r-main {
  width: 100vw;
  min-height: 100vh;
}

/* 
  Immersive Grid 
  - Full width
  - Dense packing
*/
/* Dash Grid Reference (Image 3) */
.r-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cell-min-w), 1fr));
  gap: var(--grid-gap);
  padding: var(--grid-gap); 
  background: #ffffff;
}

/* Grid Cell / Card */
.r-card {
  position: relative;
  background: #fff;
  aspect-ratio: 1 / 1.45;
  overflow: hidden;
  transition: z-index 0s 0.3s;
  cursor: pointer;
  border: 1px dashed rgba(0,0,0,0.1); 
  
  /* Entrance Animation */
  opacity: 0;
  animation: r-card-in 0.6s cubic-bezier(0.2, 0, 0.2, 1) forwards;
  
  transition: z-index 0s 0.3s, border-color 0.3s ease;
}

@keyframes r-card-in {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.r-card:hover {
  z-index: 100;
  transition: z-index 0s 0s;
  border-style: solid;
  border-color: rgba(0,0,0,0.2);
}

/* Inner Frame for Image */
.r-coverFrame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
  background: #fff;
}

/* Cart State */
.r-card.is-in-cart {
  border-color: #000;
}

.r-card.is-in-cart .r-coverFrame {
  background: #999;
}

.r-card:hover .r-coverFrame {
  transform: scale(0.95); /* Shrink slightly to make room for overlay */
}

.r-coverFrame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: saturate(0.95);
  transition: filter 0.3s;
  box-shadow: 2px 4px 12px rgba(0,0,0,0.1); 
}

.r-card:hover img {
  filter: saturate(1.1);
  box-shadow: 5px 10px 25px rgba(0,0,0,0.15);
}

/* Title Overlay (appears on hover) */
.r-meta {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.r-card:hover .r-meta {
  opacity: 1;
}

.r-meta__content {
  margin-bottom: 20px;
}

.r-meta__text {
  font-weight: 700;
  font-size: 13px;
  color: #000;
  margin-bottom: 6px;
  line-height: 1.3;
  word-break: keep-all; /* Changed to keep-all for Korean text */
  overflow-wrap: break-word;
}
.r-meta__author {
  font-size: 13px;
  color: #666;
  word-break: keep-all; /* Changed to keep-all */
  overflow-wrap: break-word;
}

/* Actions in Overlay */
.r-meta__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.r-meta__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #333;
}

.r-meta__btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.r-meta__btn:hover {
  background: #000;
  border-color: #000;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.r-meta__btn.is-active {
  background: #000;
  color: #fff;
  border-color: #000;
}

/* Loading State */
.r-loading {
  padding: 40px;
  text-align: center;
  color: #999;
  font-family: monospace;
}

/* Floating UI */
.r-ui {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 99px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.r-ui__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.r-ui__nav {
  display: flex;
  gap: 10px;
}

.r-ui__link {
  font-size: 12px;
  color: #555;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.r-ui__link:hover {
  color: #000;
  border-color: #000;
}

/* Responsive */
@media (max-width: 600px) {
  :root {
    --cell-min-w: 120px;
  }
  .r-ui {
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
    width: max-content;
  }
}
