/* ==========================================================================
   BASE & COMMON STYLES — SHARED UTILITIES, MODALS, NOTIFICATIONS & TOASTS
   ========================================================================== */

:root {
  --font-fallback: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease-out;
}

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Screen reader accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   PROJECT MODAL (DEEP TECHNICAL DOSSIER)
   ========================================================================== */
.project-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.project-modal-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

.project-modal-dialog {
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4);
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, color 0.3s ease;
  padding: 2.25rem;
}

/* ==========================================================================
   THEME-SPECIFIC MODAL STYLES (Storybook, Biophilic, Swiss)
   ========================================================================== */

/* 1. Theme A: Editorial Storybook Style Modal */
.modal-theme-a .project-modal-dialog {
  background: #f7f4ea;
  color: #231f20;
  border: 2px solid #231f20;
  border-radius: 12px;
  box-shadow: 8px 8px 0px rgba(35, 31, 32, 0.25);
  font-family: 'Newsreader', Georgia, serif;
}

.modal-theme-a .modal-title {
  font-family: 'Newsreader', Georgia, serif;
  color: #231f20;
  font-weight: 700;
  font-size: 1.85rem;
}

.modal-theme-a .modal-client {
  color: #5c5549;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
}

.modal-theme-a .modal-tagline {
  color: #6a6456;
  border-bottom: 1px dashed #d1cbbe;
  font-family: 'Inter', system-ui, sans-serif;
}

.modal-theme-a .modal-badge {
  background: #e9e4d6;
  color: #231f20;
  border: 1px solid #231f20;
  border-radius: 4px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
}

.modal-theme-a .modal-section-title {
  font-family: 'Newsreader', Georgia, serif;
  color: #231f20;
}

.modal-theme-a .modal-highlights-list li {
  color: #2c2829;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.92rem;
}

.modal-theme-a .modal-highlights-list li::before {
  content: "✦";
  color: #231f20;
}

.modal-theme-a .modal-tag {
  background: #f0ebe0;
  color: #231f20;
  border: 1px solid #d1cbbe;
  font-family: 'Inter', system-ui, sans-serif;
}

.modal-theme-a .modal-link-btn {
  background: #231f20;
  color: #f7f4ea;
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
}

.modal-theme-a .modal-close-btn {
  background: #f7f4ea;
  color: #231f20;
  border: 2px solid #231f20;
  border-radius: 6px;
}

/* Theme A Dark Mode Modal */
[data-theme-mode="dark"] .modal-theme-a .project-modal-dialog {
  background: #1c1a17;
  color: #eae5d8;
  border: 2px solid #4a463d;
  box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.6);
}

[data-theme-mode="dark"] .modal-theme-a .modal-title {
  color: #ffffff;
}

[data-theme-mode="dark"] .modal-theme-a .modal-client {
  color: #b0a998;
}

[data-theme-mode="dark"] .modal-theme-a .modal-tagline {
  color: #9c9586;
  border-bottom: 1px dashed #3a3730;
}

[data-theme-mode="dark"] .modal-theme-a .modal-badge {
  background: #292621;
  color: #eae5d8;
  border-color: #575247;
}

[data-theme-mode="dark"] .modal-theme-a .modal-highlights-list li {
  color: #cfc9bb;
}

[data-theme-mode="dark"] .modal-theme-a .modal-highlights-list li::before {
  color: #c9c2b0;
}

[data-theme-mode="dark"] .modal-theme-a .modal-tag {
  background: #25231e;
  color: #eae5d8;
  border-color: #3d3a33;
}

[data-theme-mode="dark"] .modal-theme-a .modal-link-btn {
  background: #eae5d8;
  color: #1c1a17;
}

[data-theme-mode="dark"] .modal-theme-a .modal-close-btn {
  background: #25231e;
  color: #eae5d8;
  border-color: #575247;
}

/* 2. Theme D: Biophilic Flow Style Modal */
.modal-theme-d .project-modal-dialog {
  background: #fcf9f2;
  color: #26382b;
  border: 2px solid #d4e0cf;
  border-radius: 28px;
  box-shadow: 0 25px 50px rgba(77, 114, 86, 0.2);
  font-family: 'Quicksand', 'Nunito', system-ui, sans-serif;
}

.modal-theme-d .modal-title {
  font-family: 'Fraunces', 'Lora', Georgia, serif;
  color: #2d4a35;
  font-weight: 700;
  font-size: 1.85rem;
}

.modal-theme-d .modal-client {
  color: #4d7256;
  font-weight: 700;
}

.modal-theme-d .modal-tagline {
  color: #5a705f;
  border-bottom: 1px solid #e5ede0;
}

.modal-theme-d .modal-badge {
  background: #e5ede0;
  color: #2d4a35;
  border-radius: 999px;
  font-weight: 700;
}

.modal-theme-d .modal-section-title {
  font-family: 'Fraunces', 'Lora', Georgia, serif;
  color: #2d4a35;
}

.modal-theme-d .modal-highlights-list li {
  color: #395240;
  font-size: 0.92rem;
}

.modal-theme-d .modal-highlights-list li::before {
  content: "🌿";
}

.modal-theme-d .modal-tag {
  background: #eef3eb;
  color: #2d4a35;
  border: 1px solid #d4e0cf;
  border-radius: 999px;
}

.modal-theme-d .modal-link-btn {
  background: #4d7256;
  color: #ffffff;
  border-radius: 999px;
  box-shadow: 0 6px 15px rgba(77, 114, 86, 0.3);
}

.modal-theme-d .modal-close-btn {
  background: #e5ede0;
  color: #2d4a35;
  border: 1px solid #d4e0cf;
  border-radius: 50%;
}

/* Theme D Dark Mode Modal */
[data-theme-mode="dark"] .modal-theme-d .project-modal-dialog {
  background: #16221a;
  color: #f0f5ee;
  border: 2px solid #233428;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

[data-theme-mode="dark"] .modal-theme-d .modal-title {
  color: #cbe0d0;
}

[data-theme-mode="dark"] .modal-theme-d .modal-client {
  color: #9eb88d;
}

[data-theme-mode="dark"] .modal-theme-d .modal-tagline {
  color: #9cb2a0;
  border-bottom: 1px solid #233428;
}

[data-theme-mode="dark"] .modal-theme-d .modal-badge {
  background: #24382b;
  color: #cbe0d0;
}

[data-theme-mode="dark"] .modal-theme-d .modal-section-title {
  color: #cbe0d0;
}

[data-theme-mode="dark"] .modal-theme-d .modal-highlights-list li {
  color: #c8dacb;
}

[data-theme-mode="dark"] .modal-theme-d .modal-tag {
  background: #1d2d23;
  color: #cbe0d0;
  border-color: #2b3e30;
}

[data-theme-mode="dark"] .modal-theme-d .modal-link-btn {
  background: #5b8766;
  color: #ffffff;
}

[data-theme-mode="dark"] .modal-theme-d .modal-close-btn {
  background: #1d2d23;
  color: #cbe0d0;
  border-color: #2b3e30;
}

/* 3. Theme E: Swiss Modernist Architectural Modal */
.modal-theme-e .project-modal-dialog {
  background: #ffffff;
  color: #000000;
  border: 3px solid #000000;
  border-radius: 0px;
  box-shadow: 10px 10px 0px #000000;
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

.modal-theme-e .modal-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: #000000;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 1.85rem;
}

.modal-theme-e .modal-client {
  color: #000000;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-theme-e .modal-tagline {
  color: #444444;
  border-bottom: 2px solid #000000;
  font-size: 0.95rem;
}

.modal-theme-e .modal-badge {
  background: #f0f0f0;
  color: #000000;
  border: 1px solid #000000;
  border-radius: 0px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
}

.modal-theme-e .modal-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: #000000;
  text-transform: uppercase;
}

.modal-theme-e .modal-highlights-list li {
  color: #111111;
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-theme-e .modal-highlights-list li::before {
  content: "▪";
  color: #000000;
}

.modal-theme-e .modal-tag {
  background: #f7f7f7;
  color: #000000;
  border: 1px solid #000000;
  border-radius: 0px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.modal-theme-e .modal-link-btn {
  background: #000000;
  color: #ffffff;
  border-radius: 0px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.modal-theme-e .modal-close-btn {
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  border-radius: 0px;
}

/* Theme E Dark Mode Modal */
[data-theme-mode="dark"] .modal-theme-e .project-modal-dialog {
  background: #0d0d0d;
  color: #f2f2f2;
  border: 3px solid #ffffff;
  box-shadow: 10px 10px 0px #333333;
}

[data-theme-mode="dark"] .modal-theme-e .modal-title {
  color: #ffffff;
}

[data-theme-mode="dark"] .modal-theme-e .modal-client {
  color: #cccccc;
}

[data-theme-mode="dark"] .modal-theme-e .modal-tagline {
  color: #aaaaaa;
  border-bottom: 2px solid #333333;
}

[data-theme-mode="dark"] .modal-theme-e .modal-badge {
  background: #1f1f1f;
  color: #ffffff;
  border-color: #555555;
}

[data-theme-mode="dark"] .modal-theme-e .modal-section-title {
  color: #ffffff;
}

[data-theme-mode="dark"] .modal-theme-e .modal-highlights-list li {
  color: #dddddd;
}

[data-theme-mode="dark"] .modal-theme-e .modal-highlights-list li::before {
  color: #ffffff;
}

[data-theme-mode="dark"] .modal-theme-e .modal-tag {
  background: #1a1a1a;
  color: #ffffff;
  border-color: #444444;
}

[data-theme-mode="dark"] .modal-theme-e .modal-link-btn {
  background: #ffffff;
  color: #000000;
}

[data-theme-mode="dark"] .modal-theme-e .modal-close-btn {
  background: #0d0d0d;
  color: #ffffff;
  border-color: #ffffff;
}

.project-modal-backdrop.is-active .project-modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.modal-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.modal-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.modal-badge.category {
  background: #e0f2fe;
  color: #0369a1;
}

.modal-badge.metrics {
  background: #fef3c7;
  color: #92400e;
}

.modal-badge.period {
  background: #f1f5f9;
  color: #64748b;
}

.modal-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.modal-client {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2563eb;
  margin-bottom: 0.75rem;
}

.modal-tagline {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.modal-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-highlights-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.modal-highlights-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
}

.modal-highlights-list li::before {
  content: "🛡️";
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-size: 0.85rem;
}

.modal-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.modal-tag {
  background: #f1f5f9;
  color: #1e293b;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
}

.modal-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
}

.modal-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #2563eb;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.modal-link-btn:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 99999;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  pointer-events: none;
}

.toast-notification.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   THEME SWITCHING TRANSITION OVERLAY
   ========================================================================== */
.theme-switch-curtain {
  position: fixed;
  inset: 0;
  background: #0b0f19;
  z-index: 99980;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}

.theme-switch-curtain.is-active {
  opacity: 0.9;
}
