/* 
  ========================================================================
  PEACE WORLD - GLOBAL STYLESHEET (base.css)
  ========================================================================
  
  DESIGN POW RATIONALE (Palette Choice):
  For "Peace World", we avoid standard terracotta/cream. Instead, we use:
  - Base: Peace Sand (#f6f4eb) — A warm, non-stark paper-and-ink tone that evokes traditional literature.
  - Primary Accent: Peace Teal (#427c73) — Represents tranquil, flowing waters of reconciliation.
  - Secondary Accent: Peace Olive (#727d53) — Symbolizes the historical olive branch of truce and land fertility.
  - Contrast Pop: Peace Clay (#c87a53) — A soft, earth-toned terracotta-tint representing shared clay of human creation.
  - Text: Slate (#334155) — Providing high-contrast, soft readability resembling charcoal ink.
  
  TYPOGRAPHY SCALE:
  - Display Font: "Outfit" (Modern, approachable, peaceful geometric sans)
  - Body Font: "Inter" (Highly legible, crisp neutral sans)
  - Pashto Font: "Vazirmatn" (Elegant, well-spaced Arabic/Pashto typeface ensuring baseline harmony)
  - Mono: "JetBrains Mono" (For metadata, technical elements)
  
  SIGNATURE DESIGN ELEMENT:
  - "The Peaceful Branch Divider": A custom divider with a subtle centered organic olive leaf motif.
  - "The Parchment Card Hover": Cards lift with a gentle skew, an elegant double shadow, and a transition to an ink-stroke border.
*/

/* --- CSS Reset and Variables --- */
:root {
  --color-sand: #f6f4eb;
  --color-sand-dark: #ebe7d8;
  --color-teal: #427c73;
  --color-teal-dark: #33625a;
  --color-teal-light: #daebe9;
  --color-olive: #727d53;
  --color-clay: #c87a53;
  --color-slate: #334155;
  --color-white: #ffffff;
}

/* Base resets & scroll behavior */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--color-slate);
  background-color: var(--color-sand);
}

/* --- RTL (Right-to-Left) Overrides --- */
[dir="rtl"] {
  font-family: 'Vazirmatn', 'Inter', system-ui, sans-serif !important;
}

[dir="rtl"] .font-display,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4 {
  font-family: 'Vazirmatn', sans-serif !important;
  letter-spacing: normal !important;
}

/* Handle logical mirrors for spacing */
.margin-start-auto {
  margin-inline-start: auto;
}
.margin-end-auto {
  margin-inline-end: auto;
}

/* --- Typographical Hierarchy --- */
.font-display {
  font-family: 'Outfit', sans-serif;
}

/* --- Signature Divider Motif --- */
.peace-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem 0;
  opacity: 0.8;
}

.peace-divider::before,
.peace-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-teal), transparent);
}

.peace-divider-leaf {
  margin: 0 1rem;
  color: var(--color-olive);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: waveLeaf 6s ease-in-out infinite alternate;
}

@keyframes waveLeaf {
  0% { transform: rotate(-5deg); }
  100% { transform: rotate(5deg); }
}

/* --- Tasteful Transitions & Animations --- */
.transition-all-custom {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page load fade-in */
.fade-in-load {
  animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Card Parchment Hover Effect */
.card-parchment {
  background-color: var(--color-white);
  border: 1px solid var(--color-sand-dark);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease;
}

.card-parchment:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 12px 24px -10px rgba(66, 124, 115, 0.15), 
              0 4px 12px -5px rgba(114, 125, 83, 0.1);
  border-color: var(--color-teal);
}

/* Card action icon buttons (used on card footers) – global so all card views
   (Books, Articles, Poems, Peace, Peace News, Quotes) share the same compact round buttons */
.card-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid var(--color-sand-dark);
  background-color: var(--color-white);
  color: var(--color-slate);
  transition: all 0.2s ease;
  cursor: pointer;
}

.card-action-icon-btn:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
  background-color: var(--color-teal-light);
  transform: translateY(-2px);
}

.card-action-icon-btn.heart-toggle-btn:hover {
  border-color: var(--color-clay);
  color: var(--color-clay);
  background-color: rgba(200, 122, 83, 0.1);
}

.card-action-icon-btn.edit-toggle-btn:hover {
  border-color: var(--color-olive);
  color: var(--color-olive);
  background-color: rgba(114, 125, 83, 0.1);
}

/* Card footer action row – allow graceful wrapping on narrow cards */
.card-parchment .border-t {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-parchment h1{
  font-size: 2rem;
  font-weight: bold;
}

/* ===== Pagination (shared) ===== */
nav[aria-label="Pagination"] a,
nav[aria-label="Pagination"] span {
  font-family: 'Inter', system-ui, sans-serif;
  min-width: 2.5rem;
  text-align: center;
}

nav[aria-label="Pagination"] a:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

nav[aria-label="Pagination"] .bg-peace-600 {
  background-color: var(--color-teal, #427c73);
}

[dir="rtl"] nav[aria-label="Pagination"] a {
  font-family: 'Vazirmatn', 'Inter', sans-serif;
}

/* Form Styling variables */
.form-input-focus {
  transition: all 0.2s ease;
}
.form-input-focus:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(66, 124, 115, 0.15);
}

/* Utility visibility classes for language switching */
[lang="en"] .lang-ps,
[lang="ps"] .lang-en {
  display: none !important;
}

/* Delete Modal – custom colors and transitions */
#deleteModal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#deleteModal.active {
    opacity: 1;
    pointer-events: auto;
}
#deleteModal .relative {
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#deleteModal.active .relative {
    transform: scale(1);
}
#deleteModal .absolute.inset-0 {
    cursor: pointer;
}

/* Clay color utilities – if not in Tailwind */
.bg-clay-50 {
    background-color: #f8ede8; /* light clay */
}
.bg-clay-600 {
    background-color: #c87a53; /* main clay */
}
.bg-clay-600:hover {
    background-color: #b56a47; /* darker clay */
}
.text-clay-600 {
    color: #c87a53;
}
.border-peace-200 {
    border-color: #ebe7d8;
}
.bg-peace-50 {
    background-color: #f6f4eb;
}

/* Keyboard focus state accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-clay) !important;
  outline-offset: 2px !important;
}

/* Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
