/**
 * Base Stylesheet
 * Polish Literary E-commerce Platform
 * Sophisticated, Literary, Warm, Refined
 */

/* ========================================
   VARIABLES
   ======================================== */

:root {
  /* Color Palette - Literary & Sophisticated */
  --color-background: #FAF8F5;        /* Soft Cream - Paper-like */
  --color-surface: #FFFFFF;            /* Pure White - Cards */
  --color-text: #1A2B3C;               /* Deep Navy - Primary Text */
  --color-text-muted: #5A6A7A;         /* Muted Navy - Secondary Text */
  --color-primary: #1A2B3C;            /* Deep Navy - Brand */
  --color-primary-hover: #2A3B4C;      /* Lighter Navy */
  --color-secondary: #C4B5A0;          /* Warm Beige - Accents */
  --color-secondary-light: #E8E0D5;    /* Light Beige - Borders */
  --color-success: #2D5A4A;            /* Deep Forest - Scholarly */
  --color-warning: #B8860B;            /* Dark Goldenrod - Literary */
  --color-danger: #8B3A3A;             /* Deep Brick - Refined Error */
  --color-neutral-100: #F5F3F0;
  --color-neutral-200: #E8E4DF;
  --color-neutral-300: #D4CFC7;
  --color-neutral-400: #A69F94;
  --color-neutral-500: #7A7369;
  --color-neutral-600: #5C564E;
  --color-neutral-700: #3E3A34;
  --color-neutral-800: #2A2723;
  --color-neutral-900: #1A1815;

  /* Typography - Literary Hierarchy */
  --font-serif: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --text-xs: 0.75rem;      /* 12px - Captions */
  --text-sm: 0.875rem;     /* 14px - Small text */
  --text-base: 1rem;       /* 16px - Body */
  --text-lg: 1.125rem;     /* 18px - Lead */
  --text-xl: 1.25rem;      /* 20px - H4 */
  --text-2xl: 1.5rem;      /* 24px - H3 */
  --text-3xl: 1.875rem;    /* 30px - H2 */
  --text-4xl: 2.25rem;     /* 36px - H1 */
  --text-5xl: 3rem;        /* 48px - Display */
  
  --line-height-tight: 1.2;
  --line-height-snug: 1.4;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* Spacing Scale - Generous Literary Spacing */
  --space-0: 0;
  --space-1: 0.25rem;      /* 4px */
  --space-2: 0.5rem;       /* 8px */
  --space-3: 0.75rem;      /* 12px */
  --space-4: 1rem;         /* 16px */
  --space-5: 1.25rem;      /* 20px */
  --space-6: 1.5rem;       /* 24px */
  --space-8: 2rem;         /* 32px */
  --space-10: 2.5rem;      /* 40px */
  --space-12: 3rem;        /* 48px */
  --space-16: 4rem;        /* 64px */
  --space-20: 5rem;        /* 80px */
  --space-24: 6rem;        /* 96px */

  /* Layout */
  --radius-sm: 0.125rem;   /* 2px - Subtle */
  --radius-md: 0.25rem;    /* 4px - Standard */
  --radius-lg: 0.5rem;     /* 8px - Cards */
  --radius-xl: 1rem;       /* 16px - Large components */
  
  /* Shadows - Soft Literary Ambience */
  --shadow-sm: 0 1px 2px 0 rgba(26, 43, 60, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(26, 43, 60, 0.08), 0 2px 4px -1px rgba(26, 43, 60, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(26, 43, 60, 0.1), 0 4px 6px -2px rgba(26, 43, 60, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(26, 43, 60, 0.1), 0 10px 10px -5px rgba(26, 43, 60, 0.04);
  --shadow-book: 2px 4px 8px rgba(26, 43, 60, 0.15);  /* Special for book covers */

  /* Transitions - Refined Movement */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-popover: 400;
  --z-tooltip: 500;
}

/* ========================================
   RESET & NORMALIZE
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  line-height: var(--line-height-normal);
}

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

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

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

ul,
ol {
  list-style: none;
}

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

@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;
  }
}

/* ========================================
   BASE STYLES
   ======================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-background);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); text-transform: uppercase; letter-spacing: 0.05em; }

p {
  margin-bottom: var(--space-4);
  /* Optimal reading width */
}

/* Links */
a {
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection {
  background-color: var(--color-secondary-light);
  color: var(--color-text);
}

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

/* Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

@media (min-width: 640px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* Flex Utilities */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Grid Utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }

/* Screen Reader Only */
.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;
}

/* ========================================
   COMPONENTS
   ======================================== */

/* Buttons - Refined Literary Style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
  border: 1px solid transparent;
}

.btn:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button Variants */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-background)!important;
  border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-secondary-light);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-neutral-100);
  border-color: var(--color-secondary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-neutral-100);
}

/* Inputs - Clean Scholarly Forms */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-secondary-light);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input::placeholder {
  color: var(--color-text-muted);
}

.input:hover {
  border-color: var(--color-secondary);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 43, 60, 0.1);
}

.input:disabled {
  background-color: var(--color-neutral-100);
  cursor: not-allowed;
}

/* Cards - Sophisticated Book Presentation */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-secondary-light);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-book {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-book);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-book:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Focus Visible Global */
:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-background);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}
