/* Copyright 2022-2026 Password Generator. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0 OR MIT
 *
 * Base Styles - Reset & Typography
 */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  line-height: 1.5;
  tab-size: 4;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  /* Center content vertically and horizontally */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Required for ethereal background pseudo-elements */
  position: relative;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* ============================================
 * Typography
 * ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
}

h2 {
  font-size: var(--font-size-2xl);
}

h3 {
  font-size: var(--font-size-xl);
}

h4 {
  font-size: var(--font-size-lg);
}

p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

small {
  font-size: var(--font-size-sm);
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--bg-secondary);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ============================================
 * Links
 * ============================================ */
a {
  color: var(--interactive-default);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--interactive-hover);
}

a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* ============================================
 * Selection
 * ============================================ */
::selection {
  background-color: var(--brand-primary);
  color: var(--bg-primary);
}

/* ============================================
 * Focus Visible - WCAG 2.2 AAA compliant
 * ============================================ */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(255, 107, 157, 0.25);
}

/* Enhanced focus for dark mode to ensure visibility */
[data-theme="dark"] :focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(255, 107, 157, 0.3);
}

/* Enhanced focus for light mode */
[data-theme="light"] :focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(209, 70, 113, 0.2);
}

/* ============================================
 * Scrollbar (Webkit)
 * ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
 * Reduced Motion
 * ============================================ */
@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;
  }
}
