/* Kisah Nabi - Desain Jaman Nabi */
/* Color palette: earthy, parchment, sand, terracotta, deep green */
:root {
  --parchment: #fdf6e3;
  --parchment-dark: #f5e6c8;
  --sand: #e8d5b7;
  --terracotta: #c66b3d;
  --terracotta-dark: #a0522d;
  --deep-green: #2d5a27;
  --deep-green-light: #3a7a32;
  --ink-dark: #1a1a1a;
  --ink-brown: #3d2b1f;
  --gold-accent: #d4a537;
  --gold-light: #e8c56d;
  --shadow-deep: rgba(29, 18, 8, 0.4);
  --text-main: #2c1e12;
  --text-light: #4a3a2a;
  --border-color: #c9b896;
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--parchment);
  color: var(--text-main);
  line-height: 1.7;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    radial-gradient(ellipse at 20% 30%, rgba(139, 119, 89, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(160, 130, 90, 0.06) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

.decorative-border {
  position: relative;
}
.decorative-border::before,
.decorative-border::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-accent), transparent);
}
.decorative-border::before { top: -10px; }
.decorative-border::after { bottom: -10px; }

.corner-decoration {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid var(--gold-accent);
  opacity: 0.6;
}
.corner-decoration.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.corner-decoration.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.corner-decoration.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; border-radius: 0 0 0 8px; }
.corner-decoration.br { bottom: -2px; right: -2px; border-left: none; border-top: none; border-radius: 0 0 8px 0; }

header {
  background: linear-gradient(180deg, var(--ink-brown) 0%, var(--ink-dark) 100%);
  padding: 2.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20,50 Q50,20 80,50 Q50,80 20,50' fill='none' stroke='%23d4a537' stroke-width='0.5' opacity='0.1'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
header h1 {
  font-family: 'Georgia', serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--parchment);
  text-shadow: 2px 2px 4px var(--shadow-deep);
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
}
header .subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--gold-light);
  margin-top: 0.5rem;
  font-style: italic;
  letter-spacing: 0.1em;
  position: relative;
  z-index: 1;
}
header .bismillah {
  font-family: 'Amiri', 'Traditional Arabic', serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--gold-accent);
  margin: 1rem 0;
  position: relative;
  z-index: 1;
  direction: rtl;
}

nav {
  background: var(--terracotta);
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px var(--shadow-deep);
}
nav a {
  color: var(--parchment);
  text-decoration: none;
  margin: 0 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color 0.3s, transform 0.2s;
  display: inline-block;
}
nav a:hover {
  color: var(--gold-light);
  transform: translateY(-2px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.category-card {
  background: var(--parchment-dark);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.category-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(212, 165, 55, 0.05) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s;
}
.category-card:hover::before { opacity: 1; }
.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 16px 32px var(--shadow-deep);
  border-color: var(--gold-accent);
}
.category-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 1px solid var(--gold-accent);
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.category-card:hover::after { opacity: 0.5; }

.category-icon {
  font-size: 3.5rem;
  text-align: center;
  margin-bottom: 1rem;
  filter: drop-shadow(2px 4px 6px var(--shadow-deep));
  position: relative;
  z-index: 1;
}
.category-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--ink-brown);
  text-align: center;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.3);
}
.category-desc {
  font-size: 0.95rem;
  color: var(--text-light);
  text-align: center;
  flex-grow: 1;
  position: relative;
  z-index: 1;
  line-height: 1.6;
}
.category-badge {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.4rem 1rem;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: var(--parchment);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  align-self: center;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px var(--shadow-deep);
}

.category-header {
  text-align: center;
  padding: 3rem 1.5rem;
  margin-bottom: 2rem;
  position: relative;
  background: linear-gradient(135deg, var(--parchment-dark) 0%, var(--sand) 100%);
  border-radius: 16px;
  border: 2px solid var(--border-color);
}
.category-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--ink-brown);
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.4);
}
.category-header .arabic-title {
  font-family: 'Amiri', 'Traditional Arabic', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  color: var(--deep-green);
  margin: 1rem 0;
  direction: rtl;
}
.category-header .desc {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.8;
}

.story-card {
  background: var(--parchment-dark);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem;
  margin: 2rem auto;
  max-width: 800px;
  position: relative;
  box-shadow: 0 8px 24px var(--shadow-deep);
}
.story-card::before {
  content: '';
  position: absolute;
  top: 10px; left: 10px; right: 10px; bottom: 10px;
  border: 1px dashed var(--gold-accent);
  border-radius: 8px;
  opacity: 0.4;
  pointer-events: none;
}
.story-title {
  font-size: 1.8rem;
  color: var(--ink-brown);
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}
.story-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-accent), transparent);
  margin: 0.75rem auto 0;
}
.story-content {
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text-main);
  position: relative;
  z-index: 1;
}
.story-content p {
  margin-bottom: 1.25rem;
  text-align: justify;
}
.story-content .arabic-phrase {
  font-family: 'Amiri', 'Traditional Arabic', serif;
  font-size: 1.2rem;
  color: var(--deep-green);
  text-align: center;
  margin: 1.5rem 0;
  direction: rtl;
  line-height: 2.5;
}
.story-content .lesson {
  background: linear-gradient(135deg, rgba(45, 90, 39, 0.1), rgba(45, 90, 39, 0.05));
  border-right: 4px solid var(--deep-green);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  position: relative;
  z-index: 1;
}
.story-content .lesson::before {
  content: '💎 Hikmah: ';
  font-weight: bold;
  color: var(--deep-green);
  font-style: normal;
}

[data-theme="adam"] { --theme-primary: #8b6914; --theme-bg: #fef9e7; --theme-accent: #d4a537; }
[data-theme="idris"] { --theme-primary: #2c6f8a; --theme-bg: #e8f4f8; --theme-accent: #3aa8d0; }
[data-theme="nuh"] { --theme-primary: #1a5276; --theme-bg: #ebf5fb; --theme-accent: #2e86c1; }
[data-theme="hud"] { --theme-primary: #7d6608; --theme-bg: #fef5e7; --theme-accent: #f39c12; }
[data-theme="saleh"] { --theme-primary: #5d6d7e; --theme-bg: #f2f3f4; --theme-accent: #85929e; }
[data-theme="ibrahim"] { --theme-primary: #b8860b; --theme-bg: #fef9e7; --theme-accent: #f1c40f; }
[data-theme="luth"] { --theme-primary: #7b241c; --theme-bg: #fdedec; --theme-accent: #e74c3c; }
[data-theme="ismail"] { --theme-primary: #873600; --theme-bg: #fef5e7; --theme-accent: #e67e22; }
[data-theme="ishaq"] { --theme-primary: #6c3483; --theme-bg: #f5eef8; --theme-accent: #9b59b6; }
[data-theme="yaqub"] { --theme-primary: #1b4f72; --theme-bg: #ebf5fb; --theme-accent: #3498db; }
[data-theme="yusuf"] { --theme-primary: #6c3483; --theme-bg: #f5eef8; --theme-accent: #9b59b6; }
[data-theme="ayub"] { --theme-primary: #5d6d7e; --theme-bg: #f2f3f4; --theme-accent: #85929e; }
[data-theme="syuab"] { --theme-primary: #148f77; --theme-bg: #e8f8f5; --theme-accent: #1abc9c; }
[data-theme="musa"] { --theme-primary: #1a5276; --theme-bg: #ebf5fb; --theme-accent: #2e86c1; }
[data-theme="harun"] { --theme-primary: #2c6f8a; --theme-bg: #e8f4f8; --theme-accent: #3aa8d0; }
[data-theme="daud"] { --theme-primary: #b8860b; --theme-bg: #fef9e7; --theme-accent: #f1c40f; }
[data-theme="sulaiman"] { --theme-primary: #b8860b; --theme-bg: #fef9e7; --theme-accent: #f1c40f; }
[data-theme="ilyas"] { --theme-primary: #148f77; --theme-bg: #e8f8f5; --theme-accent: #1abc9c; }
[data-theme="yunus"] { --theme-primary: #1a5276; --theme-bg: #ebf5fb; --theme-accent: #2e86c1; }
[data-theme="isa"] { --theme-primary: #2c6f8a; --theme-bg: #e8f4f8; --theme-accent: #3aa8d0; }
[data-theme="muhammad"] { --theme-primary: #2d5a27; --theme-bg: #e8f5e9; --theme-accent: #4caf50; }

footer {
  background: var(--ink-dark);
  color: var(--gold-light);
  text-align: center;
  padding: 2rem;
  margin-top: 3rem;
  font-size: 0.9rem;
}
footer .quran-ref {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--gold-accent);
  margin: 1rem 0;
  direction: rtl;
}

@media (max-width: 768px) {
  .categories-grid {
    grid-template-columns: 1fr;
  }
  .category-card { min-height: auto; }
  .story-card { padding: 1.5rem; }
  header { padding: 1.5rem 1rem; }
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--parchment); }
::-webkit-scrollbar-thumb { background: var(--terracotta); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--terracotta-dark); }

@media print {
  header, nav, footer, .category-badge { display: none; }
  body { background: white; }
  .story-card { box-shadow: none; border: 1px solid #ccc; }
}
