/* Modern CSS Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Root and body setup */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--pf-color-bg);
  color: var(--pf-color-text);
  font-family: var(--pf-font-sans);
  font-size: var(--pf-text-base);
  line-height: var(--pf-leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color var(--pf-med) var(--pf-ease), color var(--pf-med) var(--pf-ease);
}

/* Typography reset */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--pf-font-bold);
  line-height: var(--pf-leading-tight);
  color: var(--pf-color-text);
}

p {
  margin: 0;
  line-height: var(--pf-leading-normal);
}

/* List reset */
ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Link reset */
a {
  color: inherit;
  text-decoration: none;
}

/* Button reset */
button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

/* Form element reset */
input, textarea, select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* Image reset */
img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ===== ACCESSIBILITY ===== */

/* Focus management */
:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--pf-focus-ring);
  border-radius: var(--pf-radius-sm);
}

/* Ensure focus is visible on interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--pf-focus-ring);
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--pf-color-bg);
  color: var(--pf-color-text);
  padding: var(--pf-space-sm) var(--pf-space-md);
  border-radius: var(--pf-radius-sm);
  text-decoration: none;
  font-weight: var(--pf-font-medium);
  z-index: 1000;
  transition: top var(--pf-fast) var(--pf-ease);
}

.skip-link:focus {
  top: 6px;
}

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

/* ===== LAYOUT UTILITIES ===== */

/* Container system */
.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--pf-space-lg);
  width: 100%;
}

.container-sm {
  max-width: 640px;
}

.container-md {
  max-width: 768px;
}

.container-lg {
  max-width: 1024px;
}

.container-xl {
  max-width: 1280px;
}

/* Section spacing */
.section {
  padding-block: var(--pf-space-2xl);
}

.section-sm {
  padding-block: var(--pf-space-xl);
}

.section-lg {
  padding-block: 4rem;
}

/* Alternate section styling */
.section.alt {
  background: var(--pf-color-surface);
  border-block: 1px solid var(--pf-border);
}

/* Grid system */
.grid {
  display: grid;
  gap: var(--pf-space-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Flexbox utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

/* Row layout */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pf-space-md);
}

/* Gap utilities */
.gap-xs { gap: var(--pf-space-xs); }
.gap-sm { gap: var(--pf-space-sm); }
.gap-md { gap: var(--pf-space-md); }
.gap-lg { gap: var(--pf-space-lg); }
.gap-xl { gap: var(--pf-space-xl); }

/* ===== TEXT UTILITIES ===== */

/* Text colors */
.text-muted {
  color: var(--pf-color-text-muted);
}

.text-subtle {
  color: var(--pf-color-text-subtle);
}

.text-accent {
  color: var(--pf-accent);
}

.text-success {
  color: var(--pf-success);
}

.text-warning {
  color: var(--pf-warning);
}

.text-danger {
  color: var(--pf-danger);
}

.text-info {
  color: var(--pf-info);
}

/* Common subtitle pattern used in auth and landing pages */
.section-subtitle {
  color: var(--pf-color-text-muted);
  margin-bottom: var(--pf-space-xl);
  font-size: var(--pf-text-lg);
}

/* Text sizes */
.text-xs { font-size: var(--pf-text-xs); }
.text-sm { font-size: var(--pf-text-sm); }
.text-base { font-size: var(--pf-text-base); }
.text-lg { font-size: var(--pf-text-lg); }
.text-xl { font-size: var(--pf-text-xl); }
.text-2xl { font-size: var(--pf-text-2xl); }
.text-3xl { font-size: var(--pf-text-3xl); }
.text-4xl { font-size: var(--pf-text-4xl); }

/* Font weights */
.font-normal { font-weight: var(--pf-font-normal); }
.font-medium { font-weight: var(--pf-font-medium); }
.font-semibold { font-weight: var(--pf-font-semibold); }
.font-bold { font-weight: var(--pf-font-bold); }
.font-extrabold { font-weight: var(--pf-font-extrabold); }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ===== SPACING UTILITIES ===== */

/* Margin utilities */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mt-xs { margin-top: var(--pf-space-xs); }
.mt-sm { margin-top: var(--pf-space-sm); }
.mt-md { margin-top: var(--pf-space-md); }
.mt-lg { margin-top: var(--pf-space-lg); }
.mt-xl { margin-top: var(--pf-space-xl); }
.mb-xs { margin-bottom: var(--pf-space-xs); }
.mb-sm { margin-bottom: var(--pf-space-sm); }
.mb-md { margin-bottom: var(--pf-space-md); }
.mb-lg { margin-bottom: var(--pf-space-lg); }
.mb-xl { margin-bottom: var(--pf-space-xl); }

/* Padding utilities */
.p-0 { padding: 0; }
.p-xs { padding: var(--pf-space-xs); }
.p-sm { padding: var(--pf-space-sm); }
.p-md { padding: var(--pf-space-md); }
.p-lg { padding: var(--pf-space-lg); }
.p-xl { padding: var(--pf-space-xl); }

/* Width utilities */
.w-full { width: 100%; }

/* ===== RESPONSIVE UTILITIES ===== */

/* Mobile-first responsive breakpoints */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .sm\:text-lg { font-size: var(--pf-text-lg); }
  .sm\:text-xl { font-size: var(--pf-text-xl); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:text-xl { font-size: var(--pf-text-xl); }
  .md\:text-2xl { font-size: var(--pf-text-2xl); }
  .md\:text-3xl { font-size: var(--pf-text-3xl); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:text-2xl { font-size: var(--pf-text-2xl); }
  .lg\:text-3xl { font-size: var(--pf-text-3xl); }
  .lg\:text-4xl { font-size: var(--pf-text-4xl); }
}

/* ===== INTERACTION UTILITIES ===== */

/* Hover lift effect */
.lift {
  transition: transform var(--pf-med) var(--pf-ease), box-shadow var(--pf-med) var(--pf-ease);
}

.lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--pf-shadow-hover);
}

/* Interactive states */
.interactive {
  cursor: pointer;
  transition: all var(--pf-fast) var(--pf-ease);
}

.interactive:hover {
  background-color: var(--pf-color-hover);
}

.interactive:active {
  background-color: var(--pf-color-active);
}

/* Back arrow utility (login/beta pages) */
.back-arrow {
  position: absolute;
  top: var(--pf-space-lg);
  left: var(--pf-space-lg);
  color: var(--pf-color-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--pf-space-xs);
  z-index: 10;
  transition: color var(--pf-fast) var(--pf-ease);
}

.back-arrow:hover { color: var(--pf-accent); }

/* Disabled state */
.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== VISIBILITY UTILITIES ===== */

/* Inline page title with subtitle utility */
.page-title-inline {
  display: inline-flex;
  align-items: baseline;
  gap: var(--pf-space-xs);
  flex-wrap: nowrap;
}

.page-title-inline .page-title { margin: 0; }

.page-title-inline .page-subtitle {
  margin: 0;
  color: var(--pf-color-text-muted);
  font-weight: var(--pf-font-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(60vw, 720px);
}

.hidden {
  display: none;
}

.invisible {
  visibility: hidden;
}

.visible {
  visibility: visible;
}

/* ===== PRINT STYLES ===== */

@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
}