/**
 * Art Movements Watch Collection - Shared Styles
 * =============================================
 *
 * A collection of 20 watch faces inspired by art history's
 * most influential movements. Each watch operates in real-time.
 *
 * Design System:
 * - Fibonacci-based animation timing
 * - WCAG AAA contrast compliance
 * - 8px spacing grid
 * - GPU-accelerated transforms only
 */

/* ============================================
   CSS Reset & Base
   ============================================ */

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

:root {
  /* Fibonacci timing */
  --duration-89: 89ms;
  --duration-144: 144ms;
  --duration-233: 233ms;
  --duration-377: 377ms;
  --duration-610: 610ms;
  --duration-987: 987ms;
  --duration-1597: 1597ms;

  /* Easing functions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Spacing (8px grid) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Watch sizing */
  --watch-size: clamp(280px, 40vw, 400px);
  --watch-bezel: 8px;

  /* Shared colors */
  --color-void: #0A0A0C;
  --color-gold: #D4AF37;
  --color-silver: #C0C0C0;
  --color-cream: #F5E6D3;
}

/* ============================================
   Watch Container Base
   ============================================ */

.watch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.watch-frame {
  position: relative;
  width: var(--watch-size);
  height: var(--watch-size);
  border-radius: 50%;
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.1),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  padding: var(--watch-bezel);
}

.watch-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #1a1a1a;
}

/* ============================================
   Hand System
   ============================================ */

.hands-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: 50% 100%;
  will-change: transform;
}

.hour-hand {
  width: 6px;
  height: 22%;
  margin-left: -3px;
  background: linear-gradient(to top, #333, #666);
  border-radius: 3px 3px 1px 1px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.minute-hand {
  width: 4px;
  height: 32%;
  margin-left: -2px;
  background: linear-gradient(to top, #333, #888);
  border-radius: 2px 2px 1px 1px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.second-hand {
  width: 2px;
  height: 38%;
  margin-left: -1px;
  background: linear-gradient(to top, #c41e3a, #ff4444);
  border-radius: 1px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.second-hand::after {
  content: '';
  position: absolute;
  bottom: -12%;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 15%;
  background: inherit;
  border-radius: 1px;
}

.center-cap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, #444, #222);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.5),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
  z-index: 10;
}

/* ============================================
   Index Generation
   ============================================ */

.indices {
  position: absolute;
  inset: 0;
}

.index {
  position: absolute;
  left: 50%;
  top: 8%;
  transform-origin: 0 calc(var(--watch-size) / 2 - var(--watch-bezel) - 8%);
}

/* Generate 12 hour indices */
.index:nth-child(1) { transform: translateX(-50%) rotate(0deg); }
.index:nth-child(2) { transform: translateX(-50%) rotate(30deg); }
.index:nth-child(3) { transform: translateX(-50%) rotate(60deg); }
.index:nth-child(4) { transform: translateX(-50%) rotate(90deg); }
.index:nth-child(5) { transform: translateX(-50%) rotate(120deg); }
.index:nth-child(6) { transform: translateX(-50%) rotate(150deg); }
.index:nth-child(7) { transform: translateX(-50%) rotate(180deg); }
.index:nth-child(8) { transform: translateX(-50%) rotate(210deg); }
.index:nth-child(9) { transform: translateX(-50%) rotate(240deg); }
.index:nth-child(10) { transform: translateX(-50%) rotate(270deg); }
.index:nth-child(11) { transform: translateX(-50%) rotate(300deg); }
.index:nth-child(12) { transform: translateX(-50%) rotate(330deg); }

/* ============================================
   Watch Label
   ============================================ */

.watch-label {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

.watch-label h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.watch-label p {
  font-family: var(--font-sans);
  font-size: clamp(0.75rem, 1.2vw, 0.875rem);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================
   Smooth Second Hand Animation
   ============================================ */

.smooth-seconds .second-hand {
  transition: none;
}

.tick-seconds .second-hand {
  transition: transform var(--duration-89) var(--ease-bounce);
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .hand {
    transition: none !important;
  }
}

/* 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;
}

/* ============================================
   Gallery Grid
   ============================================ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
  padding: var(--space-4);
  max-width: 1800px;
  margin: 0 auto;
}

@media (min-width: 1400px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1800px) {
  .gallery-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================
   Page Layout
   ============================================ */

body {
  min-height: 100vh;
  background: var(--color-void);
  color: #fff;
  font-family: var(--font-sans);
  line-height: 1.6;
}

.page-header {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
  background: linear-gradient(135deg, #fff 0%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: rgba(255, 255, 255, 0.6);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   Individual Watch Page Layout
   ============================================ */

.single-watch-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.single-watch-page .watch-frame {
  --watch-size: clamp(320px, 60vw, 500px);
}

.movement-info {
  max-width: 600px;
  text-align: center;
  margin-top: var(--space-6);
  padding: var(--space-4);
}

.movement-info h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin-bottom: var(--space-2);
}

.movement-info .period {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-gold);
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
}

.movement-info .description {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.8;
}

.back-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: color var(--duration-233) var(--ease-smooth);
}

.back-link:hover {
  color: #fff;
}

.back-link::before {
  content: '←';
}
