/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== VARIABLES ===== */
:root {
  --bg:          #0C0A08;
  --bg-2:        #141210;
  --bg-card:     #1C1814;
  --bg-card-h:   #242018;
  --text:        #F0EBE3;
  --text-2:      #9A8878;
  --text-3:      #5C4E42;
  --amber:       #F59E0B;
  --amber-dim:   rgba(245,158,11,0.10);
  --amber-glow:  rgba(245,158,11,0.22);
  --wood-dark:   #1A1208;
  --wood-mid:    #28190E;
  --wood-light:  #38241A;
  --border:      rgba(255,255,255,0.06);
  --font-disp:   'Playfair Display', 'Noto Sans JP', Georgia, serif;
  --font-body:   'Noto Sans JP', sans-serif;
  --font-mono:   'IBM Plex Mono', monospace;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== BASE ===== */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== NOISE TEXTURE ===== */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}

/* ===== HEADER ===== */
.site-header {
  padding: 36px 48px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(245,158,11,0.05) 0%, transparent 100%);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-icon {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 0 18px rgba(245,158,11,0.45));
  animation: float 4s ease-in-out infinite;
  display: block;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-7px) rotate(2deg); }
}

.site-title {
  font-family: var(--font-disp);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.3px;
}

.site-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.12em;
  margin-top: 3px;
}

.header-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ===== MAIN ===== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 52px 48px 80px;
}

/* ===== LOADING ===== */
.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 48px 0;
}

.loading-icon {
  font-size: 24px;
  display: inline-block;
  animation: flipY 1.6s ease-in-out infinite;
}

@keyframes flipY {
  0%, 100% { transform: rotateY(0deg); }
  50%       { transform: rotateY(180deg); }
}

/* ===== SHELF SECTION ===== */
.shelf {
  margin-bottom: 52px;
  opacity: 0;
  transform: translateY(18px);
  animation: shelfIn 0.5s ease forwards;
}

@keyframes shelfIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ===== SHELF HEADER ===== */
.shelf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.shelf-icon { font-size: 18px; }

.shelf-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.shelf-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-left: auto;
  background: rgba(255,255,255,0.04);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ===== BOOKS ROW ===== */
.books-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 6px 0 18px;
  min-height: 196px;
  align-items: flex-end;
}

/* ===== EMPTY SHELF ===== */
.empty-shelf {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 212px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 4px;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

/* ===== BOOK CARD ===== */
.book-card {
  display: flex;
  width: 154px;
  height: 212px;
  border-radius: 3px 6px 6px 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transform-origin: bottom center;
  transition: transform 0.22s var(--ease-spring),
              box-shadow 0.22s ease;
  opacity: 0;
  animation: bookIn 0.38s ease forwards;
  box-shadow:
    3px 5px 10px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

@keyframes bookIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.book-card:hover {
  transform: translateY(-13px) scale(1.03);
  box-shadow:
    0 22px 42px rgba(0,0,0,0.55),
    0 0 32px var(--amber-glow),
    inset 0 1px 0 rgba(255,255,255,0.07);
}

/* Colored spine on left edge */
.book-spine {
  width: 9px;
  min-width: 9px;
  height: 100%;
  background: var(--book-color, var(--amber));
  flex-shrink: 0;
  position: relative;
}

.book-spine::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.35) 0%, transparent 70%);
}

/* Book cover area */
.book-cover {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 13px 13px;
  overflow: hidden;
}

.book-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 11px;
  transition: transform 0.18s ease;
}

.book-card:hover .book-icon {
  transform: scale(1.18) rotate(5deg);
}

.book-info { flex: 1; }

.book-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 5px;
}

.book-desc {
  font-size: 10.5px;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-footer {
  margin-top: 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.book-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.04em;
}

.book-open {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.05em;
  transition: letter-spacing 0.18s ease;
}

.book-card:hover .book-open {
  letter-spacing: 0.12em;
}

/* ===== SHELF BOARD (木製棚板) ===== */
.shelf-board {
  height: 15px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent, transparent 55px,
      rgba(0,0,0,0.04) 55px, rgba(0,0,0,0.04) 56px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(255,255,255,0.025), rgba(255,255,255,0.025) 1px,
      transparent 1px, transparent 5px
    ),
    linear-gradient(180deg,
      var(--wood-light) 0%,
      var(--wood-mid)   35%,
      var(--wood-dark)  65%,
      var(--wood-mid)   100%
    );
  box-shadow:
    0 7px 18px rgba(0,0,0,0.55),
    0 2px 4px  rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.35);
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 22px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .site-header { padding: 24px 20px; }
  .site-title   { font-size: 22px; }
  .logo-icon    { font-size: 34px; }
  main          { padding: 32px 20px 60px; }
  .book-card    { width: 138px; height: 198px; }
  .books-row    { gap: 10px; }
}

@media (max-width: 480px) {
  .header-date  { display: none; }
  .book-card    { width: 126px; height: 188px; }
  .book-icon    { font-size: 22px; }
}
