/* ═══════════════════════════════════════════════════════════════
   DRAVEST DESIGN SYSTEM v2.0
   
   Unified design language for drawesto.com
   Themes: light | dark | red | colorful | aero
   
   ARCHITECTURE:
   1. Design Tokens (CSS custom properties)
   2. Typography Scale
   3. Spacing & Layout
   4. Component Library
   5. Utilities
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   These are the single source of truth for all visual values.
   themes.css provides the color tokens per theme.
   This file provides layout, typography, and component tokens.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Spacing Scale (4px base) ── */
  --sp-0: 0;
  --sp-1: 0.25rem;   /* 4px */
  --sp-2: 0.5rem;    /* 8px */
  --sp-3: 0.75rem;   /* 12px */
  --sp-4: 1rem;      /* 16px */
  --sp-5: 1.25rem;   /* 20px */
  --sp-6: 1.5rem;    /* 24px */
  --sp-8: 2rem;      /* 32px */
  --sp-10: 2.5rem;   /* 40px */
  --sp-12: 3rem;     /* 48px */
  --sp-16: 4rem;     /* 64px */
  --sp-20: 5rem;     /* 80px */
  --sp-24: 6rem;     /* 96px */

  /* ── Typography Scale ── */
  --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.9375rem; /* 15px */
  --text-md: 1rem;        /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */

  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* ── Border Radius Scale ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ── Shadow Scale ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.08), 0 8px 10px rgba(0,0,0,0.04);

  /* ── Animation Tokens ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ── Z-Index Scale ── */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-offcanvas: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;

  /* ── Container Max Widths ── */
  --container-sm: 540px;
  --container-md: 720px;
  --container-lg: 960px;
  --container-xl: 1140px;
  --container-2xl: 1320px;

  /* ── Semantic Colors (non-themed, always same) ── */
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;
  --color-white: #ffffff;
  --color-black: #000000;
}

/* ═══════════════════════════════════════════════════════════════
   2. TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

/* ── Base ── */
.dw-text-body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Headings ── */
.dw-heading {
  font-family: var(--font-family);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  margin: 0;
}

.dw-heading-1 { font-size: var(--text-4xl); }
.dw-heading-2 { font-size: var(--text-3xl); }
.dw-heading-3 { font-size: var(--text-2xl); }
.dw-heading-4 { font-size: var(--text-xl); }
.dw-heading-5 { font-size: var(--text-lg); }

/* ── Subtitle ── */
.dw-subtitle {
  font-size: var(--text-md);
  font-weight: var(--weight-normal);
  color: var(--muted);
  line-height: var(--leading-relaxed);
}

/* ── Caption / Label ── */
.dw-caption {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ── Link ── */
.dw-link {
  color: var(--drawest-accent);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}
.dw-link:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════
   3. LAYOUT & GRID
   ═══════════════════════════════════════════════════════════════ */

/* ── Page Container ── */
.dw-container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

@media (max-width: 768px) {
  .dw-container { padding: 0 var(--sp-4); }
}

/* ── Section ── */
.dw-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  margin-bottom: var(--sp-8);
  transition: box-shadow var(--duration-normal) ease, border-color var(--duration-normal) ease;
}

.dw-section:hover {
  box-shadow: var(--shadow-lg);
}

.dw-section--flush {
  padding: 0;
  border: none;
  background: transparent;
}

/* ── Section Header ── */
.dw-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 2px solid var(--border);
}

.dw-section-header--accent {
  background: var(--drawest-accent);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: var(--sp-4) var(--sp-6);
  margin: calc(-1 * var(--sp-8)) calc(-1 * var(--sp-8)) var(--sp-6) calc(-1 * var(--sp-8));
}

.dw-section-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.dw-section-header--accent .dw-section-title {
  color: var(--color-white);
}

.dw-section-subtitle {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--sp-1);
}

.dw-section-header--accent .dw-section-subtitle {
  color: rgba(255,255,255,0.8);
}

/* ── Grid System ── */
.dw-grid {
  display: grid;
  gap: var(--sp-6);
}

.dw-grid-2 { grid-template-columns: repeat(2, 1fr); }
.dw-grid-3 { grid-template-columns: repeat(3, 1fr); }
.dw-grid-4 { grid-template-columns: repeat(4, 1fr); }
.dw-grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

@media (max-width: 992px) {
  .dw-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .dw-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
  .dw-grid-2, .dw-grid-3, .dw-grid-4 { grid-template-columns: 1fr; }
}

/* ── Flex Utilities ── */
.dw-flex { display: flex; }
.dw-flex-col { flex-direction: column; }
.dw-flex-wrap { flex-wrap: wrap; }
.dw-items-center { align-items: center; }
.dw-items-start { align-items: flex-start; }
.dw-items-end { align-items: flex-end; }
.dw-justify-between { justify-content: space-between; }
.dw-justify-center { justify-content: center; }
.dw-gap-1 { gap: var(--sp-1); }
.dw-gap-2 { gap: var(--sp-2); }
.dw-gap-3 { gap: var(--sp-3); }
.dw-gap-4 { gap: var(--sp-4); }
.dw-gap-6 { gap: var(--sp-6); }
.dw-gap-8 { gap: var(--sp-8); }

/* ═══════════════════════════════════════════════════════════════
   4. COMPONENTS
   ═══════════════════════════════════════════════════════════════ */

/* ── 4.1 Card ── */
.dw-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) ease;
}

.dw-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--drawest-accent);
}

.dw-card__image {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.dw-card__body {
  padding: var(--sp-4);
}

.dw-card__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin: 0 0 var(--sp-1) 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dw-card__meta {
  font-size: var(--text-xs);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.dw-card__footer {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── 4.2 Button ── */
.dw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.dw-btn:focus-visible {
  outline: 2px solid var(--drawest-accent);
  outline-offset: 2px;
}

.dw-btn--primary {
  background: var(--drawest-accent);
  color: var(--color-white);
  border-color: var(--drawest-accent);
}

.dw-btn--primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

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

.dw-btn--secondary:hover {
  background: var(--hover);
  border-color: var(--drawest-accent);
}

.dw-btn--ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: var(--sp-2) var(--sp-3);
}

.dw-btn--ghost:hover {
  color: var(--drawest-accent);
  background: var(--hover);
}

.dw-btn--sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.dw-btn--lg {
  padding: var(--sp-3) var(--sp-8);
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.dw-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.dw-btn--icon.dw-btn--sm {
  width: 32px;
  height: 32px;
}

/* ── 4.3 Badge ── */
.dw-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  line-height: 1.6;
}

.dw-badge--accent {
  background: var(--drawest-accent);
  color: var(--color-white);
}

.dw-badge--muted {
  background: var(--badge-bg);
  color: var(--muted);
}

.dw-badge--success {
  background: rgba(16,185,129,0.12);
  color: var(--color-success);
}

.dw-badge--danger {
  background: rgba(239,68,68,0.12);
  color: var(--color-danger);
}

.dw-badge--warning {
  background: rgba(245,158,11,0.12);
  color: var(--color-warning);
}

/* ── 4.4 Avatar ── */
.dw-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.dw-avatar--sm { width: 28px; height: 28px; }
.dw-avatar--md { width: 48px; height: 48px; }
.dw-avatar--lg { width: 64px; height: 64px; }
.dw-avatar--xl { width: 96px; height: 96px; border-width: 3px; }

/* ── 4.5 Input / Form ── */
.dw-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

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

.dw-input:focus {
  border-color: var(--drawest-accent);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
}

.dw-input--search {
  padding-left: var(--sp-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--sp-3) center;
}

.dw-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.dw-form-group {
  margin-bottom: var(--sp-5);
}

/* ── 4.6 Tabs ── */
.dw-tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dw-tab {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

.dw-tab:hover {
  color: var(--text);
}

.dw-tab.active {
  color: var(--drawest-accent);
  border-bottom-color: var(--drawest-accent);
}

/* ── 4.7 Pagination ── */
.dw-pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  justify-content: center;
  margin-top: var(--sp-8);
}

.dw-page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-fast) ease;
}

.dw-page-link:hover {
  background: var(--hover);
  border-color: var(--drawest-accent);
  color: var(--drawest-accent);
}

.dw-page-link.active {
  background: var(--drawest-accent);
  border-color: var(--drawest-accent);
  color: var(--color-white);
}

/* ── 4.8 Tags / Chips ── */
.dw-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--muted);
  background: var(--badge-bg);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  text-decoration: none;
}

.dw-tag:hover {
  color: var(--drawest-accent);
  border-color: var(--drawest-accent);
}

.dw-tag.active {
  background: var(--drawest-accent);
  color: var(--color-white);
  border-color: var(--drawest-accent);
}

/* ── 4.9 Stat Card ── */
.dw-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  text-align: center;
  transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out);
}

.dw-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.dw-stat__value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--drawest-accent);
  line-height: 1;
  margin-bottom: var(--sp-1);
}

.dw-stat__label {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-weight: var(--weight-medium);
}

/* ── 4.10 Hero Banner ── */
.dw-hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--sp-8);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.dw-hero__image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}

.dw-hero__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--sp-10) var(--sp-8) var(--sp-8);
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  color: var(--color-white);
}

.dw-hero__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  margin: 0 0 var(--sp-2) 0;
}

.dw-hero__desc {
  font-size: var(--text-base);
  opacity: 0.85;
  max-width: 600px;
  line-height: var(--leading-relaxed);
}

@media (max-width: 768px) {
  .dw-hero__image { height: 250px; }
  .dw-hero__overlay { padding: var(--sp-6) var(--sp-4) var(--sp-4); }
  .dw-hero__title { font-size: var(--text-2xl); }
}

/* ── 4.11 Empty State ── */
.dw-empty {
  text-align: center;
  padding: var(--sp-16) var(--sp-8);
  color: var(--muted);
}

.dw-empty__icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: 0.4;
}

.dw-empty__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.dw-empty__desc {
  font-size: var(--text-sm);
  max-width: 400px;
  margin: 0 auto;
}

/* ── 4.12 List Item ── */
.dw-list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-fast) ease;
}

.dw-list-item:last-child {
  border-bottom: none;
}

.dw-list-item:hover {
  background: var(--hover);
}

.dw-list-item__content {
  flex: 1;
  min-width: 0;
}

.dw-list-item__title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dw-list-item__meta {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 2px;
}

.dw-list-item__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* ── 4.13 Rating Stars ── */
.dw-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.dw-rating__star {
  color: #d1d5db;
  font-size: 1.1rem;
  cursor: pointer;
  transition: color var(--duration-fast) ease, transform var(--duration-fast) ease;
}

.dw-rating__star:hover {
  transform: scale(1.15);
}

.dw-rating__star.active {
  color: #facc15;
}

/* ── 4.14 Divider ── */
.dw-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

/* ── 4.15 Tooltip ── */
.dw-tooltip {
  position: relative;
}

.dw-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-white);
  background: var(--text);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease;
  z-index: var(--z-tooltip);
}

.dw-tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ═══════════════════════════════════════════════════════════════
   5. PAGE-SPECIFIC PATTERNS
   ═══════════════════════════════════════════════════════════════ */

/* ── Homepage: Featured Flow ── */
.dw-featured {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-2);
  scrollbar-width: none;
}

.dw-featured::-webkit-scrollbar { display: none; }

.dw-featured .dw-card {
  flex: 0 0 200px;
  scroll-snap-align: start;
}

@media (max-width: 768px) {
  .dw-featured .dw-card { flex: 0 0 150px; }
}

/* ── Homepage: Ranking List ── */
.dw-ranking {
  counter-reset: ranking;
}

.dw-ranking__item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-fast) ease;
  counter-increment: ranking;
}

.dw-ranking__item:hover {
  background: var(--hover);
}

.dw-ranking__item:last-child { border-bottom: none; }

.dw-ranking__number {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  color: var(--muted);
  min-width: 32px;
  text-align: center;
}

.dw-ranking__item:nth-child(1) .dw-ranking__number { color: #facc15; }
.dw-ranking__item:nth-child(2) .dw-ranking__number { color: #94a3b8; }
.dw-ranking__item:nth-child(3) .dw-ranking__number { color: #cd7f32; }

.dw-ranking__image {
  width: 48px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.dw-ranking__info {
  flex: 1;
  min-width: 0;
}

.dw-ranking__title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dw-ranking__meta {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 2px;
}

/* ── Homepage: Latest Updates Row ── */
.dw-update-item {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-fast) ease;
}

.dw-update-item:last-child { border-bottom: none; }
.dw-update-item:hover { background: var(--hover); }

.dw-update-item__cover {
  width: 56px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.dw-update-item__content {
  flex: 1;
  min-width: 0;
}

.dw-update-item__title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dw-update-item__chapters {
  font-size: var(--text-xs);
  color: var(--muted);
}

.dw-update-item__time {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
}

/* ── Series Detail ── */
.dw-series-hero {
  display: flex;
  gap: var(--sp-8);
  padding: var(--sp-8);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: var(--sp-8);
}

.dw-series-hero__cover {
  width: 240px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dw-series-hero__cover img {
  width: 100%;
  height: auto;
  display: block;
}

.dw-series-hero__info {
  flex: 1;
  min-width: 0;
}

.dw-series-hero__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  margin-bottom: var(--sp-3);
}

@media (max-width: 768px) {
  .dw-series-hero { flex-direction: column; padding: var(--sp-4); }
  .dw-series-hero__cover { width: 100%; max-width: 200px; margin: 0 auto; }
}

/* ── Profile ── */
.dw-profile-header {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-8);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: var(--sp-8);
}

.dw-profile-header__avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.dw-profile-header__info {
  flex: 1;
  min-width: 0;
}

.dw-profile-header__name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  margin-bottom: var(--sp-1);
}

.dw-profile-header__bio {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: var(--leading-relaxed);
}

@media (max-width: 768px) {
  .dw-profile-header { flex-direction: column; text-align: center; padding: var(--sp-6); }
}

/* ── Footer (Unified) ── */
.dw-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: var(--sp-16) 0 var(--sp-8);
  margin-top: var(--sp-16);
}

.dw-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-10);
  margin-bottom: var(--sp-10);
}

@media (max-width: 768px) {
  .dw-footer__grid { grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
}

@media (max-width: 480px) {
  .dw-footer__grid { grid-template-columns: 1fr; }
}

.dw-footer__brand {
  max-width: 320px;
}

.dw-footer__brand-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  margin-bottom: var(--sp-3);
}

.dw-footer__brand-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--sp-4);
}

.dw-footer__section-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--sp-4);
}

.dw-footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dw-footer__links li {
  margin-bottom: var(--sp-2);
}

.dw-footer__links a {
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.dw-footer__links a:hover {
  color: var(--drawest-accent);
}

.dw-footer__bottom {
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--muted);
}

@media (max-width: 768px) {
  .dw-footer__bottom { flex-direction: column; gap: var(--sp-2); text-align: center; }
}

/* ═══════════════════════════════════════════════════════════════
   6. UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.dw-text-center { text-align: center; }
.dw-text-left { text-align: left; }
.dw-text-right { text-align: right; }

.dw-text-muted { color: var(--muted); }
.dw-text-accent { color: var(--drawest-accent); }
.dw-text-success { color: var(--color-success); }
.dw-text-danger { color: var(--color-danger); }

.dw-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dw-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── Selection ── */
::selection {
  background: rgba(13,110,253,0.15);
  color: var(--text);
}
