/* ==========================================================================
   Wrench-Studio · Stylesheet
   Mysterious Dark + Arabic / Islamic motifs
   ========================================================================== */

/* ----- Reset & base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Cormorant Garamond", "Cinzel", "Times New Roman",
               "Noto Serif TC", "PingFang TC", "Microsoft JhengHei",
               serif;
  font-size: 16px;
  line-height: 1.6;
  color: #d4b87a;
  background-color: #0a0e1a;
  background-image:
    /* Warm gold glow in the corners */
    radial-gradient(ellipse at 15% 20%, rgba(201, 169, 97, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(201, 169, 97, 0.06) 0%, transparent 55%),
    /* 8-pointed star pattern (Khatim) at very low opacity */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='%23c9a961' stroke-width='0.5' opacity='0.08'><path d='M60 0 L62 58 L120 60 L62 62 L60 120 L58 62 L0 60 L58 58 Z'/><path d='M60 20 L63 57 L100 60 L63 63 L60 100 L57 63 L20 60 L57 57 Z' transform='rotate(45 60 60)'/></g></svg>");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }

/* ----- Container ----- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.7);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid rgba(201, 169, 97, 0.15);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e8c97c;
}
.brand-mark {
  display: inline-block;
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
  transition: transform 0.6s cubic-bezier(0.5, 1.5, 0.4, 1), filter 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(244, 213, 118, 0.3));
}
.brand:hover .brand-mark {
  transform: rotate(360deg);
  filter: drop-shadow(0 0 14px rgba(244, 213, 118, 0.6));
}
.brand-name { font-feature-settings: "tnum"; }

/* ----- Auth area ----- */
.auth-area { position: relative; }
.login-wrap, .user-wrap { position: relative; }

.login-btn, .user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 4px;
  background: transparent;
  color: #d4b87a;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  border: 1px solid rgba(201, 169, 97, 0.4);
  transition: all 0.25s ease;
}
.login-btn:hover, .user-btn:hover {
  background: rgba(201, 169, 97, 0.1);
  border-color: #c9a961;
  color: #f4d576;
  box-shadow: 0 0 20px rgba(201, 169, 97, 0.15);
}
.login-btn:active, .user-btn:active { transform: scale(0.97); }
.chevron { opacity: 0.7; transition: transform 0.3s ease; }
[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.user-btn {
  padding: 4px 12px 4px 4px;
  border-color: rgba(201, 169, 97, 0.3);
}
.user-btn:hover { background: rgba(201, 169, 97, 0.08); }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a961, #8b6f2f);
  color: #0a0e1a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid rgba(244, 213, 118, 0.4);
}
.user-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.05em;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Dropdowns ----- */
.login-dropdown, .user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: rgba(15, 20, 35, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 169, 97, 0.25);
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(201, 169, 97, 0.08);
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 200;
}
.login-dropdown[data-open="true"],
.user-dropdown[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.login-dropdown[hidden], .user-dropdown[hidden] { display: none; }

.login-option, .user-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 14px;
  color: #d4b87a;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
}
.login-option:hover, .user-option:hover {
  background: rgba(201, 169, 97, 0.08);
  color: #f4d576;
}
.provider-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: brightness(1.1);
}
.login-dropdown-foot {
  padding: 8px 12px 4px;
  font-size: 11px;
  color: #6b5d3a;
  border-top: 1px solid rgba(201, 169, 97, 0.12);
  margin-top: 4px;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.user-info { padding: 10px 12px; }
.user-info-name { font-size: 14px; font-weight: 600; color: #f4d576; letter-spacing: 0.05em; }
.user-info-email { font-size: 12px; color: #8b7d4f; margin-top: 2px; word-break: break-all; }
.user-dropdown-divider { height: 1px; background: rgba(201, 169, 97, 0.12); margin: 4px 0; }

/* ----- Login status ----- */
.login-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #8b7d4f;
  padding: 8px 14px;
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(201, 169, 97, 0.2);
  border-top-color: #f4d576;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Hero
   ========================================================================== */
.site-main {
  display: flex;
  flex-direction: column;
  position: relative;
}
.hero {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-image: url("/assets/images/hero-bg-islamic-sm.avif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
@media (min-width: 600px) {
  .hero {
    background-image: url("/assets/images/hero-bg-islamic.avif");
  }
}
/* WebP fallback for browsers without AVIF support */
@supports not (background-image: url("hero-bg-islamic.avif")) {
  .hero {
    background-image: url("/assets/images/hero-bg-islamic-sm.webp");
  }
}
@media (min-width: 600px) {
  @supports not (background-image: url("hero-bg-islamic.avif")) {
    .hero {
      background-image: url("/assets/images/hero-bg-islamic.webp");
    }
  }
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(10, 14, 26, 0.5) 0%, rgba(10, 14, 26, 0.85) 100%),
    linear-gradient(to bottom, rgba(10, 14, 26, 0.4), rgba(10, 14, 26, 0.6));
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.06em;
  margin: 0;
  color: #f4d576;
  text-shadow:
    0 0 40px rgba(244, 213, 118, 0.4),
    0 0 80px rgba(244, 213, 118, 0.15);
  animation: glow 4s ease-in-out infinite alternate;
}
@keyframes glow {
  from {
    text-shadow:
      0 0 40px rgba(244, 213, 118, 0.4),
      0 0 80px rgba(244, 213, 118, 0.15);
  }
  to {
    text-shadow:
      0 0 50px rgba(244, 213, 118, 0.6),
      0 0 100px rgba(244, 213, 118, 0.22);
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid rgba(201, 169, 97, 0.12);
  padding: 24px 0;
  background: rgba(5, 8, 16, 0.5);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-inner p {
  margin: 0;
  font-size: 13px;
  color: #8b7d4f;
  letter-spacing: 0.05em;
}
.footer-meta a {
  text-decoration: none;
  border-bottom: 1px dotted rgba(201, 169, 97, 0.4);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.footer-meta a:hover { color: #f4d576; border-color: #c9a961; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
  .header-inner { height: 56px; }
  .hero { padding: 60px 0; }
  .user-name { display: none; }
  .login-btn, .user-btn { padding: 8px 12px; }
  .login-dropdown, .user-dropdown { min-width: 220px; }
  .hero::before, .hero::after { width: 60px; }
}

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