/* root.css — The Central Mycelium: Brand DNA, Fonts, Spacing, Shadows, Radius */

/* === Font Faces === */
@font-face {
  font-family: 'Inter';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/inter-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/inter-medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/inter-bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/playfair-bold.woff2') format('woff2');
}

/* === CSS Variables === */
:root {
  /* Brand - Legacy (keep for backward compatibility) */
  --m-forest-green: #1a2e1a;
  --m-leaf-green:   #4f8a46;
  --m-earth-green:  #4a5d4a;
  --m-soft-beige:   #f5f2ed;
  --m-card-bg:      #ffffff;
  --m-border:       #e2e0db;

  /* Health Status */
  --m-health-green: #27ae60;
  --m-health-red:   #e74c3c;
  --m-health-blue:  #3498db;

  /* === Modern Pastoralist Design System === */
  /* Primary Colors */
  --m-primary: #526b4a;
  --m-primary-dim: #465f3e;
  --m-primary-container: #ceebc1;
  --m-on-primary: #ffffff;
  --m-on-primary-container: #405838;
  
  /* Secondary Colors (Terracotta) */
  --m-secondary: #9d4e30;
  --m-secondary-dim: #8e4225;
  --m-secondary-container: #ffdbcf;
  --m-on-secondary: #ffffff;
  --m-on-secondary-container: #863c1f;
  
  /* Tertiary Colors (Earth) */
  --m-tertiary: #6f634b;
  --m-tertiary-dim: #635740;
  --m-tertiary-container: #feecce;
  --m-on-tertiary: #ffffff;
  --m-on-tertiary-container: #635740;
  
  /* Surface Hierarchy (No-Line Rule) */
  --m-surface: #fdffda;
  --m-surface-dim: #e5e3d7;
  --m-surface-bright: #fdffda;
  --m-surface-container-lowest: #ffffff;
  --m-surface-container-low: #fcf9f0;
  --m-surface-container: #f6f4ea;
  --m-surface-container-high: #f0eee3;
  --m-surface-container-highest: #eae8dd;
  --m-surface-variant: #eae8dd;
  
  /* Content Colors */
  --m-on-surface: #383830;
  --m-on-surface-variant: #65655c;
  --m-on-background: #383830;
  --m-background: #fdffda;
  
  /* Outline */
  --m-outline: #828177;
  --m-outline-variant: #bbbaaf;
  
  /* Error Colors */
  --m-error: #ae4025;
  --m-error-dim: #791903;
  --m-error-container: #fd795a;
  --m-on-error: #ffffff;
  --m-on-error-container: #6e1400;
  
  /* Inverse Colors */
  --m-inverse-surface: #0e0e0b;
  --m-inverse-on-surface: #9f9d97;
  --m-inverse-primary: #e2ffd4;
  
  /* Glassmorphism */
  --m-glass-bg: rgba(253, 255, 218, 0.8);
  --m-glass-bg-low: rgba(252, 249, 240, 0.9);
  --m-backdrop-blur: blur(12px);
  
  /* Ambient Shadows (tinted with on-surface #383830) */
  --m-shadow-ambient: 0 12px 32px rgba(56, 56, 48, 0.06);
  --m-shadow-card: 0 8px 30px rgba(0, 0, 0, 0.02);
  --m-shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.04);
  --m-shadow-float: 0 4px 20px rgba(0, 0, 0, 0.01);
  --m-shadow-button: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  
  /* Spacing */
  --m-space-xs:  0.25rem;
  --m-space-sm:  0.5rem;
  --m-space-md:  1rem;
  --m-space-lg:  1.5rem;
  --m-space-xl:  2rem;
  --m-space-2xl: 2.5rem;
  --m-space-3xl: 3rem;

  /* Radius */
  --m-radius-sm:   0.25rem;
  --m-radius-md:   0.375rem;
  --m-radius-lg:   0.5rem;
  --m-radius-xl:   0.75rem;
  --m-radius-2xl:  1rem;
  --m-radius-3xl:  1.5rem;
  --m-radius-full: 9999px;
  
  /* Legacy Shadows (keep for backward compatibility) */
  --m-shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --m-shadow-md:  0 4px 6px rgba(0,0,0,0.1);
  --m-shadow-lg:  0 10px 15px rgba(0,0,0,0.1);
}

/* === Tailwind utilities missing from build === */

/* Positioning */
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-50 { z-index: 50; }

/* Display */
.col-span-full { grid-column: 1 / -1; }
.col-span-2 { grid-column: span 2 / span 2; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Spacing - Margin */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

/* Spacing - Padding */
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }

/* Spacing - Gap & Space */
.gap-1 { gap: 0.25rem; }
.gap-6 { gap: 1.5rem; }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }

/* Sizing */
.w-3 { width: 0.75rem; }
.w-20 { width: 5rem; }
.h-3 { height: 0.75rem; }
.h-32 { height: 8rem; }
.h-full { height: 100%; }
.max-h-48 { max-height: 12rem; }
.max-h-\[80vh\] { max-height: 80vh; }
.max-h-\[90vh\] { max-height: 90vh; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.min-w-\[200px\] { min-width: 200px; }

/* Typography */
.text-3xl { font-size: 1.875rem; }
.text-lg { font-size: 1.125rem; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.break-all { word-break: break-all; }
.whitespace-nowrap { white-space: nowrap; }
.underline { text-decoration: underline; }
.hover\:underline:hover { text-decoration: underline; }

/* Colors - Background */
.bg-black { background-color: rgb(0 0 0); }
.bg-opacity-50 { background-color: rgba(0, 0, 0, 0.5); }
.bg-blue-500 { background-color: rgb(59, 130, 246); }
.bg-blue-600 { background-color: rgb(37, 99, 235); }
.bg-blue-100 { background-color: rgb(219, 234, 254); }
.bg-gray-400 { background-color: rgb(156, 163, 175); }
.bg-orange-100 { background-color: rgb(255, 237, 213); }
.bg-orange-500 { background-color: rgb(249, 115, 22); }
.bg-red-50 { background-color: rgb(254, 242, 242); }
.bg-yellow-100 { background-color: rgb(254, 249, 195); }

/* Colors - Text */
.text-blue-600 { color: rgb(37, 99, 235); }
.text-blue-700 { color: rgb(29, 78, 216); }
.text-blue-800 { color: rgb(30, 64, 175); }
.text-gray-400 { color: rgb(156, 163, 175); }
.text-gray-800 { color: rgb(31, 41, 55); }
.text-orange-700 { color: rgb(194, 65, 12); }
.text-red-500 { color: rgb(239, 68, 68); }
.text-yellow-800 { color: rgb(133, 77, 14); }

/* Colors - Borders */
.border-2 { border-width: 2px; }
.border-t { border-top-width: 1px; }
.border-red-200 { border-color: rgb(254, 202, 202); }

/* Hover - Background */
.hover\:bg-blue-600:hover { background-color: rgb(37, 99, 235); }
.hover\:bg-blue-700:hover { background-color: rgb(29, 78, 216); }
.hover\:bg-gray-200:hover { background-color: rgb(229, 231, 235); }
.hover\:bg-gray-300:hover { background-color: rgb(209, 213, 219); }
.hover\:bg-gray-50:hover { background-color: rgb(249, 250, 251); }
.hover\:bg-green-50:hover { background-color: rgb(240, 253, 244); }
.hover\:bg-green-700:hover { background-color: rgb(21, 128, 61); }
.hover\:bg-orange-600:hover { background-color: rgb(234, 88, 12); }
.hover\:bg-red-100:hover { background-color: rgb(254, 226, 226); }

/* Hover - Text */
.hover\:text-gray-700:hover { color: rgb(55, 65, 81); }
.hover\:text-green-600:hover { color: rgb(22, 163, 74); }
.hover\:text-red-800:hover { color: rgb(153, 27, 27); }

/* Hover - Border */
.hover\:border-green-500:hover { border-color: rgb(34, 197, 94); }

/* Hover - Other */
.hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.hover\:ring-2:hover { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
.hover\:ring-green-400:hover { --tw-ring-opacity: 1; --tw-ring-color: rgb(74 222 128 / var(--tw-ring-opacity)); }

/* Active */
.active\:bg-blue-800:active { background-color: rgb(30, 64, 175); }
.active\:bg-green-800:active { background-color: rgb(22, 101, 52); }

/* Focus */
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }
.focus\:ring-0:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
.focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
.focus\:ring-offset-2:focus { --tw-ring-offset-width: 2px; }
.focus\:ring-green-500:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity)); }
.focus\:border-green-500:focus { border-color: rgb(34, 197, 94); }

/* Effects */
.cursor-pointer { cursor: pointer; }
.opacity-25 { opacity: 0.25; }
.opacity-60 { opacity: 0.6; }
.opacity-75 { opacity: 0.75; }
.overflow-x-auto { overflow-x: auto; }
.object-cover { object-fit: cover; }
.rounded-t-xl { border-top-left-radius: 0.75rem; border-top-right-radius: 0.75rem; }
.divide-y > :not([hidden]) ~ :not([hidden]) { border-top-width: 1px; }
.rotate-90 { transform: rotate(90deg); }
.rotate-0 { transform: rotate(0deg); }
.hidden { display: none; }

/* Transitions */
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-shadow { transition-property: box-shadow; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

/* Animation */
.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Modern Pastoralist Design System Utilities
   ============================================ */

/* Surface Background Colors */
.bg-surface { background-color: var(--m-surface); }
.bg-surface-dim { background-color: var(--m-surface-dim); }
.bg-surface-container-lowest { background-color: var(--m-surface-container-lowest); }
.bg-surface-container-low { background-color: var(--m-surface-container-low); }
.bg-surface-container { background-color: var(--m-surface-container); }
.bg-surface-container-high { background-color: var(--m-surface-container-high); }
.bg-surface-container-highest { background-color: var(--m-surface-container-highest); }
.bg-surface-variant { background-color: var(--m-surface-variant); }
.bg-background { background-color: var(--m-background); }

/* Primary Colors */
.bg-primary { background-color: var(--m-primary); }
.bg-primary-dim { background-color: var(--m-primary-dim); }
.bg-primary-container { background-color: var(--m-primary-container); }
.text-primary { color: var(--m-primary); }
.text-on-primary { color: var(--m-on-primary); }
.text-on-primary-container { color: var(--m-on-primary-container); }

/* Secondary Colors (Terracotta) */
.bg-secondary { background-color: var(--m-secondary); }
.bg-secondary-dim { background-color: var(--m-secondary-dim); }
.bg-secondary-container { background-color: var(--m-secondary-container); }
.text-secondary { color: var(--m-secondary); }
.text-on-secondary { color: var(--m-on-secondary); }
.text-on-secondary-container { color: var(--m-on-secondary-container); }

/* Tertiary Colors (Earth) */
.bg-tertiary { background-color: var(--m-tertiary); }
.bg-tertiary-dim { background-color: var(--m-tertiary-dim); }
.bg-tertiary-container { background-color: var(--m-tertiary-container); }
.text-tertiary { color: var(--m-tertiary); }
.text-on-tertiary { color: var(--m-on-tertiary); }
.text-on-tertiary-container { color: var(--m-on-tertiary-container); }

/* Content Colors */
.text-on-surface { color: var(--m-on-surface); }
.text-on-surface-variant { color: var(--m-on-surface-variant); }
.text-on-background { color: var(--m-on-background); }

/* Outline Colors */
.border-outline { border-color: var(--m-outline); }
.border-outline-variant { border-color: var(--m-outline-variant); }

/* Error Colors */
.bg-error { background-color: var(--m-error); }
.bg-error-container { background-color: var(--m-error-container); }
.text-error { color: var(--m-error); }
.text-on-error { color: var(--m-on-error); }

/* Glassmorphism */
.backdrop-blur-md { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.backdrop-blur-xl { backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.bg-glass { background-color: var(--m-glass-bg); }
.bg-glass-low { background-color: var(--m-glass-bg-low); }

/* Extended Border Radius */
.rounded-xl { border-radius: var(--m-radius-xl); }
.rounded-2xl { border-radius: var(--m-radius-2xl); }
.rounded-3xl { border-radius: var(--m-radius-3xl); }
.rounded-full { border-radius: var(--m-radius-full); }

/* Modern Shadows */
.shadow-card { box-shadow: var(--m-shadow-card); }
.shadow-card-hover { box-shadow: var(--m-shadow-card-hover); }
.shadow-ambient { box-shadow: var(--m-shadow-ambient); }
.shadow-float { box-shadow: var(--m-shadow-float); }

/* Hover States - Modern Pastoralist */
.hover\:bg-surface-container-low:hover { background-color: var(--m-surface-container-low); }
.hover\:bg-surface-container-highest:hover { background-color: var(--m-surface-container-highest); }
.hover\:bg-primary:hover { background-color: var(--m-primary); }
.hover\:bg-primary-container:hover { background-color: var(--m-primary-container); }
.hover\:text-primary:hover { color: var(--m-primary); }
.hover\:shadow-card-hover:hover { box-shadow: var(--m-shadow-card-hover); }

/* Focus States */
.focus\:bg-surface-container-lowest:focus { background-color: var(--m-surface-container-lowest); }
.focus\:ring-primary:focus { --tw-ring-color: var(--m-primary); }

/* Active States */
.active\:scale-95:active { transform: scale(0.95); }
.active\:scale-98:active { transform: scale(0.98); }

/* Line Height */
.leading-relaxed { line-height: 1.625; }
.leading-tight { line-height: 1.25; }

/* Line Clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Navigation Pills */
.nav-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  transition: all 0.3s ease-in-out;
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-pill:hover {
  background-color: var(--m-surface-container-highest);
  border-color: rgba(56, 56, 48, 0.05);
  color: var(--m-on-surface);
}

.nav-pill-active {
  background-color: var(--m-surface-container-lowest);
  box-shadow: var(--m-shadow-sm);
  border-color: rgba(56, 56, 48, 0.05);
  color: var(--m-primary);
  font-weight: 600;
}

/* Ensure SVG icons display properly in nav */
.nav-pill svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  min-width: 1.25rem;
  min-height: 1.25rem;
}

/* Force SVG visibility in buttons */
button svg {
  display: inline-block;
  vertical-align: middle;
}

/* === Shared Page Headers (Modern Pastoralist) === */
.entity-header {
  display: flex;
  flex-direction: column;
  gap: var(--m-space-lg);
  margin-bottom: var(--m-space-xl);
}

@media (min-width: 768px) {
  .entity-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.entity-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--m-on-surface);
  line-height: 1.2;
  margin-bottom: var(--m-space-xs);
}

.entity-description {
  font-size: 0.9375rem;
  color: var(--m-on-surface-variant);
  line-height: 1.6;
  max-width: 36rem;
}

/* Navigation icon sizing */
.h-5 {
  height: 1.25rem;
}

.h-6 {
  height: 1.5rem;
}

.h-12 {
  height: 3rem;
}

.w-5 {
  width: 1.25rem;
}

.w-6 {
  width: 1.5rem;
}

.w-12 {
  width: 3rem;
}

/* Background Utilities */
.bg-surface { background-color: var(--m-surface); }

/* Responsive: sm (≥640px) */
@media (min-width: 640px) {
  .sm\:hidden { display: none !important; }
  .sm\:block { display: block !important; }
  .sm\:items-center { align-items: center; }
  .sm\:max-w-md { max-width: 28rem; }
  .sm\:rounded-lg { border-radius: 0.5rem; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Responsive: md (≥768px) */
@media (min-width: 768px) {
  .md\:flex { display: flex !important; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Responsive: lg (≥1024px) */
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:flex-row { flex-direction: row; }
  .lg\:w-1\/4 { width: 25%; }
  .lg\:w-3\/4 { width: 75%; }
  .lg\:flex { display: flex !important; }
  .lg\:hidden { display: none !important; }
  .lg\:block { display: block !important; }
}
