/*
 * Global baseline styles shared by all Django pages.
 *
 * Order:
 * 1) reset and defaults, 2) typography baseline, 3) disabled controls,
 * 4) app shell regions (main/topbar/footer), 5) responsive topbar fallback.
 */

/* Reset and generic document defaults. */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

/* Honor the native hidden attribute across the project. */
[hidden] {
  display: none !important;
}

/* Body and global layout: makes footer stick to bottom */
body {
  --app-footer-height: 2.5rem;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background: var(--surface-canvas);
  background-attachment: fixed;
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
header, main, footer { margin: 0; padding: 0; }

/* Text selection and inline emphasis helpers. */
::selection {
  background: var(--text-selection-bg);
  color: var(--text-selection);
}

mark,
.text-highlight,
.u-text-highlight {
  color: var(--text-highlight);
  font-weight: 800;
}

mark {
  padding: 0 0.15em;
  background: transparent;
}

/* Headline family contract reused by cross-feature title classes. */
h1,
h2,
h3,
h4,
h5,
h6,
.brand,
.section-title,
.table-heading,
.hero-title,
.filters-sidebar__panel-title,
.provider-package-option__title,
.featured-document-drawer__section-title,
.logistics-load-order-drawer__section-title,
.featured-document-group__title,
.logistics-document-group__title,
.ui-form-section__title,
.ui-submit-standby__title {
  font-family: var(--font-heading);
}

/* Disabled states for native form controls. */
/* Disabled form controls must look intentionally unavailable across the project. */
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):disabled {
  background: linear-gradient(180deg, var(--disabled-bg), #e5e5e5);
  border-color: var(--disabled-border);
  color: var(--disabled-text);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):disabled::placeholder {
  color: var(--disabled-text);
}

:is(input[type="checkbox"], input[type="radio"]):disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.2);
}

/* Main shell area between topbar and footer. */
/* Main content area grows to push footer down */
main.page { flex: 1; min-width: 0; padding: var(--space-md) var(--space-xl) 2.5rem; align-content: center; }

/* Top navigation bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-lg);
  padding: 0.875rem var(--space-xl);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 0.0625rem solid var(--border);
  /* The blur is decorative enhancement only; opacity keeps the bar readable. */
  -webkit-backdrop-filter: blur(0.5rem);
  backdrop-filter: blur(0.5rem);
  box-shadow: var(--shadow-soft);
}
.brand {
  font-weight: 800;
  letter-spacing: 0.0125rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 0.75rem;
  padding: 0.375rem 0.5rem;
}

.brand-logo {
  display: block;
  width: clamp(6rem, 12vw, 10rem);
  height: auto;
  max-height: 3rem;
  object-fit: contain;
}

.brand-logo--default {
  filter: none;
}

.brand-logo--negative,
.brand-logo--mono {
  filter: none;
}

.brand__text {
  color: var(--primary-dark);
  font-size: 0.875rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* Global footer presentation. */
/* Footer pinned at bottom */
.footer {
  min-height: var(--app-footer-height);
  padding: 0.375rem var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: var(--primary-dark);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.0125rem;
}
.footer-icon { font-size: 1rem; }

/* Topbar collapse behaviour for narrow screens. */
@media (max-width: 56.25rem) {
  .topbar { grid-template-columns:1fr; grid-template-rows:auto auto auto; }
}
