/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

.nourio-page {
  --nourio-page-top-space: 2rem;
  --nourio-page-bottom-space: 4rem;

  box-sizing: border-box;
  margin-inline: auto;
  padding-bottom: var(--nourio-page-bottom-space);
  padding-top: var(--nourio-page-top-space);
  width: 100%;
}

.nourio-page--full {
  max-width: none;
}

.nourio-page--wide {
  max-width: 72rem;
}

.nourio-page--standard {
  max-width: 64rem;
}

.nourio-page--reading {
  max-width: 48rem;
}

.nourio-page--narrow {
  max-width: 42rem;
}

.nourio-page--top-none {
  --nourio-page-top-space: 0px;
}

.nourio-page--top-compact {
  --nourio-page-top-space: 0.75rem;
}

.nourio-page--top-standard {
  --nourio-page-top-space: 2rem;
}

.nourio-page--top-spacious {
  --nourio-page-top-space: 3rem;
}

.nourio-page--bottom-none {
  --nourio-page-bottom-space: 0px;
}

.nourio-page--bottom-compact {
  --nourio-page-bottom-space: 2rem;
}

.nourio-page--bottom-standard {
  --nourio-page-bottom-space: 4rem;
}

.nourio-page--bottom-spacious {
  --nourio-page-bottom-space: 6rem;
}

.nourio-page--bottom-fixed-action {
  --nourio-page-bottom-space: 10rem;
}

.nourio-page--gutter-compact {
  padding-inline: 1rem;
}

.nourio-page--gutter-standard {
  padding-inline: 1.25rem;
}

.nourio-page--navigation {
  padding-bottom: 7rem;
}

body[data-native-app="true"] .nourio-page {
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--nourio-page-top-space));
}

body[data-native-tab-bar="true"] .nourio-page {
  padding-bottom: calc(
    var(--nourio-page-bottom-space) +
    max(5.25rem, calc(3.0625rem + env(safe-area-inset-bottom, 0px)))
  );
}

body[data-native-tab-bar="true"] .nourio-page--navigation {
  padding-bottom: max(
    7.25rem,
    calc(5.0625rem + env(safe-area-inset-bottom, 0px))
  );
}

.painting-detail__header,
.painting-detail__page,
.painting-detail__artwork {
  transition-duration: 160ms;
  transition-timing-function: ease;
}

.painting-detail__header {
  transition-property: transform;
}

.painting-detail__page {
  padding-top: 0;
  transition-property: margin-top;
}

.painting-detail__artwork {
  position: sticky;
  top: 4rem;
  z-index: 30;

  display: grid;
  max-width: 72rem;
  margin-inline: auto;
  place-items: center;

  background: var(--color-paper);
  border-top: 3px solid var(--color-paper);
  transition-property: top;
}

.painting-detail__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: var(--painting-current-height, var(--painting-opening-height, 72svh));
  margin-inline: auto;
  object-fit: contain;
}

.painting-detail__artwork-spacer {
  height: var(--painting-current-spacer-height, 0px);
}

.painting-detail[data-header-state="hidden"] .painting-detail__header {
  transform: translateY(-100%);
}

.painting-detail[data-header-state="hidden"] .painting-detail__page {
  margin-top: -4rem;
}

.painting-detail[data-header-state="hidden"] .painting-detail__artwork {
  top: 0;
}

body[data-native-app="true"] .painting-detail__page {
  margin-top: 0;
}

body[data-native-app="true"] .painting-detail {
  --painting-sticky-top-space: calc(
    env(safe-area-inset-top, 0px) +
    0.5rem
  );
}

body[data-native-app="true"] .painting-detail[data-header-state="hidden"] .painting-detail__artwork,
body[data-native-app="true"] .painting-detail__artwork {
  top: var(--painting-sticky-top-space);
}

body[data-native-app="true"] .painting-detail__artwork::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 100%;
  height: calc(var(--painting-sticky-top-space) + 1rem);
  background: var(--color-paper);
  pointer-events: none;
}

.quiz-fixed-action {
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

.meal-amount-input {
  width: 0;
}

.meal-form input[type="date"],
.meal-form input[type="time"],
.meal-form textarea {
  padding-block: 0.75rem;
  line-height: 1.5;
}

/* WebKit date/time controls have intrinsic widths that can escape a narrow grid.
   Size the actual bordered input, including padding, rather than clipping it. */
.meal-form input[type="date"],
.meal-form input[type="time"] {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 3rem;
  appearance: none;
}

.meal-form input::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.meal-form input::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
}

.meal-form [hidden] {
  display: none;
}

.meal-amount-row,
.meal-milk-options {
  container-type: inline-size;
}

@media (min-width: 40rem) {
  .nourio-page--top-compact {
    --nourio-page-top-space: 1rem;
  }

  .nourio-page--top-standard {
    --nourio-page-top-space: 3rem;
  }

  .nourio-page--top-spacious {
    --nourio-page-top-space: 5rem;
  }

  .nourio-page--gutter-compact,
  .nourio-page--gutter-standard {
    padding-inline: 2rem;
  }
}

@media (min-width: 48rem) {
  .nourio-page--navigation {
    padding-bottom: var(--nourio-page-bottom-space);
  }

  body[data-native-tab-bar="true"] .nourio-page--navigation {
    padding-bottom: max(
      7.25rem,
      calc(5.0625rem + env(safe-area-inset-bottom, 0px))
    );
  }
}

.meal-milk-options {
  grid-template-columns: repeat(auto-fit, minmax(min(6rem, 100%), 1fr));
}

@container (max-width: 190px) {
  .meal-milk-option {
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 12px;
  }
}

.turbo-progress-bar {
  height: 3px;
  background-color: var(--color-forest);
}

turbo-frame {
  transition: opacity 150ms ease;
}

turbo-frame[busy] {
  pointer-events: none;
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  turbo-frame {
    transition: none;
  }
}
