
/* --- CSS RESET & VARIABLES (White Aesthetic Theme) --- */
:root {
  /* Soft, warm off-white backgrounds */
  --bg: #f7f5f0; 
  --bg-elevated: rgba(255, 255, 255, 0.85);
  
  /* Dark grey text for readability (high contrast) */
  --fg: #2c2a27; 
  --fg-muted: #6e6b66; 
  
  /* Gold accent (matches well with white) */
  --accent: #c9943e;
  --accent-dark: #a67a2e;
  --accent-glow: rgba(201, 148, 62, 0.08);
  
  /* Pure white cards */
  --card: #ffffff;
  --card-hover: #fafafa;
  
  /* Ultra-subtle borders */
  --border: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(201, 148, 62, 0.25);
  
  /* Soft shadows for depth without harshness */
  --shadow: rgba(0, 0, 0, 0.04);

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 100px; /* Pill shape for nav */
  
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 40px rgba(0, 0, 0, 0.06);
  --shadow-accent: 0 8px 30px rgba(201, 148, 62, 0.15);
  
  --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.2s ease;
}

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

/* --- BASE --- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: url(../assets/bg.jpg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px 60px;
  min-height: 100vh;
}

/* --- NAVBAR (Glassmorphism Pill) --- */
nav {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;

  /* Frosted glass effect */
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(14px);

  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 18px;
  box-shadow: 0 6px 25px rgba(0,0,0,0.06);

  position: sticky;
  top: 16px;
  z-index: 1000;
}

nav h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

nav a {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  padding: 9px 20px;
  border-radius: 50px;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(78, 78, 78, 0.2);
}

nav a:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(201, 148, 62, 0.3);
}

/* --- POEM GRID --- */
.poem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 900px;
  margin-top: 10px;
}

/* --- LOADING & EMPTY STATES --- */
.poem-grid > p {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.poem-grid > p:first-child {
  animation: fade-pulse 3s ease-in-out infinite;
}

@keyframes fade-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

/* --- POEM CARD --- */
.poem-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
  position: relative;
  top: 0; /* Removed top offset for cleaner grid alignment */
}

.poem-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.poem-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: -0.03em;
}

.poem-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--fg-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  white-space: pre-wrap;
}

/* --- CARD ACTIONS --- */
.poem-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.2rem;
  margin-top: 1.4rem;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.view-btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--fg); /* Black button for contrast */
  padding: 10px 24px;
  border-radius: 50px;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.view-btn:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.delete-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  font-family: inherit;
  flex-shrink: 0;
}

.delete-btn:hover {
  background: #fff0f0;
  border-color: #ffcaca;
  color: #d64b4b;
}

/* --- ENTRANCE ANIMATION --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.poem-card {
  animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.poem-card:nth-child(1) { animation-delay: 0.05s; }
.poem-card:nth-child(2) { animation-delay: 0.1s; }
.poem-card:nth-child(3) { animation-delay: 0.15s; }
.poem-card:nth-child(4) { animation-delay: 0.2s; }
.poem-card:nth-child(5) { animation-delay: 0.25s; }
.poem-card:nth-child(6) { animation-delay: 0.3s; }
.poem-card:nth-child(7) { animation-delay: 0.35s; }
.poem-card:nth-child(8) { animation-delay: 0.4s; }

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d1d1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

/* --- SELECTION --- */
::selection {
  background: rgba(201, 148, 62, 0.2); /* Light gold highlight */
  color: var(--fg);
}

/* --- RESPONSIVE --- */
@media (max-width: 640px) {
  body {
    padding: 20px 16px 40px;
  }

  nav {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    top: 16px;
  }

  nav h1 {
    font-size: 1rem;
  }

  nav a {
    font-size: 0.8rem;
    padding: 8px 16px;
  }

  .poem-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .poem-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}