/* ==========================================
   SHARED STYLES — The Editorial Atelier
   ========================================== */

/* --- Dark mode overrides --- */
html.dark body { background-color: #1a1c1c; color: #e2e2e2; }
html.dark header { background: rgba(26,28,28,0.9) !important; }
html.dark .bg-white, html.dark .bg-surface-container-lowest { background-color: #2c2c2c !important; }
html.dark .bg-surface-container-low { background-color: #252626 !important; }
html.dark .bg-surface-container-high { background-color: #333535 !important; }
html.dark .bg-surface { background-color: #1a1c1c !important; }
html.dark .text-primary, html.dark .text-on-surface, html.dark .text-zinc-900 { color: #e2e2e2 !important; }
html.dark .text-on-surface-variant, html.dark .text-zinc-500 { color: #949393 !important; }
html.dark .border-outline-variant\/10, html.dark .border-outline-variant\/20, html.dark .border-outline-variant\/30 { border-color: rgba(255,255,255,0.08) !important; }
html.dark .bg-zinc-100, html.dark .border-surface-container-high { border-color: #333535 !important; background-color: #333535 !important; }
html.dark input, html.dark textarea, html.dark select { background-color: #252626 !important; border-color: #444748 !important; color: #e2e2e2 !important; }
html.dark .shadow-sm, html.dark [class*="shadow-["] { box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important; }
html.dark #sidebar-drawer { background: #1a1c1c; }
html.dark #sidebar-drawer nav a { color: #c4c7c7; }
html.dark #sidebar-drawer nav a:hover { background: #2c2c2c; color: #e2e2e2; }
html.dark #sidebar-drawer nav a.active-page { color: #e9c176; background: rgba(119,90,25,0.15); }
html.dark #sidebar-drawer header { border-color: #333535; }
html.dark #modal-box { background: #2c2c2c; }
html.dark #modal-title { color: #e2e2e2; }
html.dark #modal-body { color: #c4c7c7; }
html.dark nav[class*="fixed bottom"] { background: rgba(26,28,28,0.95) !important; }

/* --- Dark mode toggle button --- */
#dark-mode-toggle {
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s;
  display: flex;
  align-items: center;
}
#dark-mode-toggle:hover { background: rgba(119,90,25,0.15); }

/* --- Active nav link --- */
nav a.active-page {
  color: #775a19 !important;
  font-weight: 600;
}
nav .mobile-active {
  color: #d97706 !important;
}
nav .mobile-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- Sidebar Drawer --- */
#sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}
#sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 280px;
  background: #ffffff;
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 0;
  box-shadow: 8px 0 32px rgba(26,28,28,0.10);
}
#sidebar-drawer.open {
  transform: translateX(0);
}
#sidebar-drawer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e8e8e8;
}
#sidebar-drawer nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #444748;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  border-radius: 0;
}
#sidebar-drawer nav a:hover {
  background: #f3f3f3;
  color: #171818;
}
#sidebar-drawer nav a.active-page {
  color: #775a19;
  background: #fff8ec;
}
#sidebar-drawer nav a .material-symbols-outlined {
  font-size: 20px;
  color: inherit;
}

/* --- Modal --- */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26,28,28,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}
#modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
#modal-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 32px 80px rgba(26,28,28,0.14);
  position: relative;
}
#modal-backdrop.open #modal-box {
  transform: translateY(0) scale(1);
}
#modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  cursor: pointer;
  color: #747878;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
}
#modal-close:hover { color: #171818; }
#modal-title {
  font-family: 'Noto Serif', serif;
  font-style: italic;
  font-size: 1.4rem;
  margin-bottom: 20px;
  padding-right: 32px;
}
#modal-body { color: #444748; font-size: 0.9rem; line-height: 1.6; }

/* --- Toast notification --- */
#toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #171818;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 400;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Scroll-in animation --- */
.animate-in {
  animation: fadeSlideUp 0.4s ease both;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg, #f3f3f3 25%, #e8e8e8 50%, #f3f3f3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
html.dark .skeleton {
  background: linear-gradient(90deg, #2c2c2c 25%, #333535 50%, #2c2c2c 75%);
  background-size: 200% 100%;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* --- Page transition --- */
main {
  animation: pageIn 0.3s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Success checkmark animation --- */
.success-check {
  animation: checkPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes checkPop {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Mobile sticky CTA bar --- */
#mobile-cta-bar {
  position: fixed;
  bottom: 72px;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  padding: 12px 16px;
  z-index: 45;
  border-top: 1px solid #e8e8e8;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
#mobile-cta-bar.visible { transform: translateY(0); }
html.dark #mobile-cta-bar {
  background: rgba(26,28,28,0.95);
  border-color: #333535;
}

/* --- Horizontal scroll hint --- */
.scroll-hint::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, #f9f9f9);
  pointer-events: none;
  z-index: 5;
}
html.dark .scroll-hint::after {
  background: linear-gradient(to right, transparent, #1a1c1c);
}
