/**
 * CSS Fallbacks
 * 
 * This file provides fallbacks for advanced CSS features used in the site.
 * Include this file before the main CSS to ensure fallbacks load first.
 */

/* No CSS variables support - set directly through classes */
.no-cssvar {
  /* Default light theme colors */
  --black: #101010;
  --dark-grey: #494949;
  --mid-grey: #888888;
  --line-grey: #BEBEBE;
  --mini-grey: #E5E5E5;
  --tiny-grey: #F5F5F5;
  --white: #FFFFFF;

  --light-bg: #FFFFFF;
  --light-color: #101010;

  --dark-bg: rgb(13, 17, 23);
  --dark-color: rgb(240, 246, 252);

  --transition-time: 0.2s;
  --main-padding: 2rem;
  --text-width: 75ch;
  --content-width: 1728px;
  --notification-bar-height: 0px;
}

/* Fallback for browsers without font-variation-settings support */
.no-variable-fonts :is(h1, h2, h3, h4, h5, h6):not(article h2, article h3, article h4, article h5, article h6) {
  font-family: 'OPS documenta grotesk', Helvetica, Arial, sans-serif;
}

.no-variable-fonts .archiv :is(h1, h2, h3, h4, h5, h6):not(article h2, article h3, article h4, article h5, article h6),
.no-variable-fonts li.archiv {
  font-family: 'OPS documenta geometric', Helvetica, Arial, sans-serif;
}

.no-variable-fonts .friends :is(h1, h2, h3, h4, h5, h6):not(article h2, article h3, article h4, article h5, article h6),
.no-variable-fonts li.friends {
  font-family: 'OPS documenta humanist', Helvetica, Arial, sans-serif;
}

/* Basic Grid Fallbacks */
.no-cssgrid {
  /* Remove grid gaps */
  --grid-gap: 0;
}

.no-cssgrid .page-layout,
.no-cssgrid .full-width {
  display: block;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--main-padding);
}

.no-cssgrid .inset-content,
.no-cssgrid .content,
.no-cssgrid .popout,
.no-cssgrid .full {
  width: 100%;
  margin-bottom: var(--main-padding);
}

/* Fallbacks for color-scheme and prefers-color-scheme */
.no-color-scheme {
  background-color: #FFFFFF;
  color: #101010;
}

.no-color-scheme .dark-theme {
  background-color: rgb(13, 17, 23);
  color: rgb(240, 246, 252);
}

/* Fallback for dialog element */
.no-dialog .video-caption-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.95);
  overflow: auto;
  display: none;
}

.no-dialog .video-caption-dialog.open {
  display: block;
}

.no-dialog .dialog-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.no-dialog .dialog-backdrop.open {
  display: block;
}

/* Fallback for clip-path: none */
.no-clippath .full-width {
  overflow: hidden;
}

/* Fallback for aspect-ratio */
.no-aspect-ratio .overview img {
  height: 0;
  padding-bottom: 80%; /* 4/5 aspect ratio */
  position: relative;
}

.no-aspect-ratio a.overview:is(.exhibition, .event, .documenta-exhibition) img {
  padding-bottom: 141.4%; /* 1/1.414 aspect ratio */
}

.no-aspect-ratio a.overview.article img {
  padding-bottom: 66.67%; /* 2/3 aspect ratio */
}

.no-aspect-ratio a:is(.article, .exhibition).overview.landscape img {
  padding-bottom: 66.67%; /* 2/3 aspect ratio */
}

.no-aspect-ratio a.article.overview.portrait img {
  padding-bottom: 150%; /* 3/2 aspect ratio */
}

/* Fallback for backdrop-filter */
.no-backdrop-filter .sticky.navigation {
  background-color: rgba(255, 255, 255, 0.9);
}

.dark-mode.no-backdrop-filter .sticky.navigation {
  background-color: rgba(13, 17, 23, 0.9);
}

/* Feature detection script to add classes to the HTML element */
/* 
<script>
(function() {
  var html = document.documentElement;
  
  // Test for CSS variables support
  if (!window.CSS || !window.CSS.supports || !window.CSS.supports('--a', '0')) {
    html.classList.add('no-cssvar');
  }
  
  // Test for CSS Grid support
  if (!window.CSS || !window.CSS.supports || 
      !(window.CSS.supports('display', 'grid') || 
        window.CSS.supports('display', '-ms-grid'))) {
    html.classList.add('no-cssgrid');
  }
  
  // Test for variable fonts support
  if (!window.CSS || !window.CSS.supports || 
      !window.CSS.supports('font-variation-settings', '"wght" 400')) {
    html.classList.add('no-variable-fonts');
  }
  
  // Test for dialog element support
  if (!('open' in document.createElement('dialog'))) {
    html.classList.add('no-dialog');
  }
  
  // Test for clip-path support
  if (!window.CSS || !window.CSS.supports || 
      !window.CSS.supports('clip-path', 'inset(0)')) {
    html.classList.add('no-clippath');
  }
  
  // Test for aspect-ratio support
  if (!window.CSS || !window.CSS.supports || 
      !window.CSS.supports('aspect-ratio', '1/1')) {
    html.classList.add('no-aspect-ratio');
  }
  
  // Test for backdrop-filter support
  if (!window.CSS || !window.CSS.supports || 
      !(window.CSS.supports('backdrop-filter', 'blur(1px)') || 
        window.CSS.supports('-webkit-backdrop-filter', 'blur(1px)'))) {
    html.classList.add('no-backdrop-filter');
  }
  
  // Test for color-scheme support
  if (!window.CSS || !window.CSS.supports || 
      !window.CSS.supports('color-scheme', 'light dark')) {
    html.classList.add('no-color-scheme');
  }
})();
</script>
*/
