/* Shared defaults. Screen-specific layout rules live beside their components. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 80px;
}

body {
  line-height: 1.5;
}

:root {
  color-scheme: light;
}

.dark {
  color-scheme: dark;
}

:where(a) {
  color: var(--color-foreground);
  text-underline-offset: 0.2em;
}

:where(button, input, select, textarea, summary) {
  font: inherit;
}

:where(button, input[type='submit'], summary) {
  min-height: 48px;
  touch-action: manipulation;
}

:where(input:not([type='checkbox']):not([type='radio']):not([type='hidden']), select, textarea) {
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-background-secondary);
  color: var(--color-foreground);
  font-size: 1rem;
}

:where(textarea) {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
}

:where(input[type='checkbox'], input[type='radio']) {
  width: 22px;
  height: 22px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

:where(button, input, select, textarea):disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

:is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--color-foreground);
  outline-offset: 3px;
}

:where(h1, h2, h3, p, dd, legend) {
  overflow-wrap: anywhere;
}

:where(h1, h2, h3) {
  line-height: 1.25;
}

:where(fieldset, form, article, section) {
  min-width: 0;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1200;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--color-background-secondary);
  color: var(--color-foreground);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.field_with_errors {
  display: contents;
}

.field_with_errors :is(input, select, textarea) {
  border: 2px solid var(--color-red);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body .main-container {
    padding: 0;
  }

  .skip-link {
    display: none;
  }
}
