// Vagabond RPG - Base Styles
// ===========================

// Reset/normalize for Foundry context
.vagabond {
  // Base typography
  font-family: $font-family-body;
  font-size: $font-size-base;
  line-height: $line-height-normal;
  color: var(--color-text-primary);

  // Box sizing
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  // Links
  a {
    color: var(--color-accent-primary);
    text-decoration: none;
    transition: color $transition-fast;

    &:hover {
      color: var(--color-accent-secondary);
      text-decoration: underline;
    }

    @include focus-visible;
  }

  // Headings
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: $font-family-header;
    font-weight: $font-weight-bold;
    line-height: $line-height-tight;
    color: var(--color-text-primary);
    margin: 0 0 $spacing-2 0;
  }

  h1 {
    font-size: $font-size-4xl;
  }
  h2 {
    font-size: $font-size-3xl;
  }
  h3 {
    font-size: $font-size-2xl;
  }
  h4 {
    font-size: $font-size-xl;
  }
  h5 {
    font-size: $font-size-lg;
  }
  h6 {
    font-size: $font-size-base;
  }

  // Paragraphs
  p {
    margin: 0 0 $spacing-4 0;

    &:last-child {
      margin-bottom: 0;
    }
  }

  // Lists
  ul,
  ol {
    margin: 0 0 $spacing-4 0;
    padding-left: $spacing-6;
  }

  li {
    margin-bottom: $spacing-1;
  }

  // Images
  img {
    max-width: 100%;
    height: auto;
  }

  // Tables
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: $spacing-4;
  }

  th,
  td {
    padding: $spacing-2 $spacing-3;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
  }

  th {
    font-weight: $font-weight-semibold;
    background-color: var(--color-bg-secondary);
  }

  // Horizontal rule
  hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: $spacing-4 0;
  }

  // Code
  code {
    font-family: $font-family-mono;
    font-size: $font-size-sm;
    padding: $spacing-1 $spacing-2;
    background-color: var(--color-bg-secondary);
    border-radius: $radius-sm;
  }

  // Blockquote
  blockquote {
    margin: 0 0 $spacing-4 0;
    padding: $spacing-3 $spacing-4;
    border-left: 3px solid var(--color-accent-primary);
    background-color: var(--color-bg-secondary);
    font-style: italic;
  }

  // Selection
  ::selection {
    background-color: var(--color-accent-highlight);
    color: var(--color-text-primary);
  }
}

// Accessibility utilities
.vagabond {
  // Screen reader only (visually hidden but accessible)
  .sr-only {
    @include sr-only;
  }

  // Skip link (visible on focus)
  .skip-link {
    @include sr-only;

    &:focus {
      position: fixed;
      top: $spacing-2;
      left: $spacing-2;
      z-index: $z-tooltip;
      width: auto;
      height: auto;
      padding: $spacing-2 $spacing-4;
      margin: 0;
      overflow: visible;
      clip: auto;
      white-space: normal;
      background-color: var(--color-bg-primary);
      border: 2px solid var(--color-accent-primary);
      border-radius: $radius-md;
      color: var(--color-text-primary);
    }
  }

  // Interactive row styling (for keyboard accessible rows)
  .interactive-row {
    cursor: pointer;
    transition: background-color $transition-fast;

    &:hover {
      background-color: var(--color-bg-highlight);
    }

    &:focus-visible {
      outline: 2px solid var(--color-accent-primary);
      outline-offset: -2px;
      background-color: var(--color-bg-highlight);
    }

    // Active state for touch/click feedback
    &:active {
      background-color: var(--color-bg-tertiary);
    }
  }

  // Ensure reduced motion preference is respected
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

// Foundry sheet wrapper styles
.sheet.vagabond {
  @include custom-scrollbar;
  background: var(--color-bg-primary);
}

// Window header customization
.window-app.vagabond {
  .window-header {
    background: linear-gradient(to bottom, var(--color-bg-secondary), var(--color-bg-tertiary));
    border-bottom: 2px solid var(--color-border-dark);

    .window-title {
      font-family: $font-family-header;
      font-size: $font-size-lg;
      color: var(--color-text-primary);
    }

    .header-button {
      color: var(--color-text-secondary);

      &:hover {
        color: var(--color-text-primary);
      }
    }
  }
}
