:root {
  --bg: #070d12;
  --surface: #0d151c;
  --surface-2: #131e27;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f3f6f8;
  --muted: #8b9aa6;
  --accent: #22d3ee;
  --accent-ink: #041016;
  --hero-grad: linear-gradient(90deg, #070d12 35%, rgba(7, 13, 18, 0.58) 100%);
}

html[data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: #526071;
  --hero-grad: linear-gradient(90deg, rgba(244, 246, 249, 0.94) 38%, rgba(244, 246, 249, 0.65) 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Navbar — Uncongested Top-Left Brand & Lightweight Scroll */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 30px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.15;
}

.brand-title {
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

/* Compact Right Controls */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn,
.profile-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
}

.icon-btn:hover,
.profile-btn:hover,
.profile-btn.logged-in {
  border-color: var(--accent);
}

.user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Search Bar */
.search-bar {
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
}

.search-bar input {
  flex: 1;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.clear-search-btn {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.search-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Hero */
.hero {
  position: relative;
  padding: 56px 28px;
  background: var(--hero-grad), url("assets/wall1.jpg") center/cover no-repeat;
  border-bottom: 1px solid var(--border);
}

.hero-content {
  max-width: 660px;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 10px;
}

.eyebrow-line {
  width: 36px;
  height: 2px;
  background: var(--accent);
}

.hero-title {
  font-size: clamp(36px, 6vw, 54px);
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 700;
  margin-bottom: 6px;
}

.hero-subtitle .accent {
  color: var(--accent);
}

.hero-desc {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-primary {
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary {
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* Main Grid */
.main-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-width: 0;
}

.featured-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  height: fit-content;
}

.featured-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.featured-nav {
  display: flex;
  gap: 6px;
}

.circle-nav {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.featured-body {
  display: grid;
  grid-template-columns: 115px 1fr;
  gap: 14px;
  align-items: center;
}

.featured-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.featured-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.featured-meta {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 8px;
}

.featured-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.btn-download {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}

/* Collection */
.collection-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.collection-header h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}

.pill.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 16px;
}

.load-more-wrap {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

/* Lightweight Card Containment & Hover for Smooth PC Scrolling */
.wall-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  aspect-ratio: 9 / 16;
  content-visibility: auto;
  contain-intrinsic-size: 175px 310px;
  transition: border-color 0.15s ease;
}

.wall-card:hover {
  border-color: var(--accent);
}

.wall-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wall-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 9, 13, 0.88) 0%, transparent 48%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  color: #f3f6f8;
}

.wall-card-meta {
  min-width: 0;
}

.wall-card-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wall-card-sub {
  display: block;
  font-size: 10px;
  opacity: 0.78;
}

.wall-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.wall-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(13, 21, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f3f6f8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
}

.wall-action-btn:hover,
.wall-action-btn.saved {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
}

/* Custom LUTs & Presets + Before/After Slider */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 16px;
}

.preset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  content-visibility: auto;
  contain-intrinsic-size: 245px 280px;
  transition: border-color 0.15s ease;
}

.preset-card:hover {
  border-color: var(--accent);
}

.ba-stage {
  position: relative;
  height: 112px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  user-select: none;
  touch-action: none;
}

.ba-layer {
  position: absolute;
  inset: 0;
}

.ba-after {
  width: 100%;
  height: 100%;
}

.ba-before-clip {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
  border-right: 2px solid #ffffff;
}

.ba-before-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: saturate(0.45) contrast(0.88) brightness(0.95);
}

.ba-tag {
  position: absolute;
  top: 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(7, 13, 18, 0.78);
  color: #f3f6f8;
  pointer-events: none;
}

.ba-tag-before {
  left: 8px;
}

.ba-tag-after {
  right: 8px;
  color: var(--accent);
}

.preset-format-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(7, 13, 18, 0.82);
  color: #f3f6f8;
  pointer-events: none;
}

.ba-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 3;
}

.ba-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  color: #070d12;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 2;
}

.ba-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.preset-tool {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.preset-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  word-break: break-word;
}

.preset-desc {
  font-size: 12px;
  color: var(--muted);
}

.preset-dl-btn {
  display: inline-block;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.preset-dl-btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.preset-buy-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}

.preset-buy-btn:hover {
  opacity: 0.92;
}

/* Profile / Preferences / About Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 7, 11, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.sheet-card {
  width: 100%;
  max-width: 410px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.account-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--accent);
  overflow: hidden;
  flex-shrink: 0;
}

.sheet-title {
  font-size: 15px;
  font-weight: 700;
}

.sheet-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-pill-btn {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.auth-pill-btn:hover {
  border-color: var(--accent);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-icon.heart {
  color: #f43f5e;
  font-size: 14px;
}

.stat-icon.cloud {
  color: var(--accent);
  font-size: 14px;
}

.stat-num {
  font-size: 18px;
  font-weight: 800;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
}

.panel-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.panel-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text);
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(18px);
  background-color: var(--accent-ink);
}

/* Accent Color Swatches */
.accent-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.accent-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.accent-swatches {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  color: #041016;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.swatch.active {
  border-color: var(--text);
  transform: scale(1.06);
}

.about-copy {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 4px 0;
}

.meta-line span {
  color: var(--muted);
}

.accent-inline {
  color: var(--accent);
}

.status-inline {
  color: #10b981;
}

.sheet-close-btn {
  width: 100%;
  padding: 11px;
  border-radius: 999px;
  border: none;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.sheet-close-btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Mobile Responsive */
@media (max-width: 820px) {
  .navbar {
    flex-wrap: wrap;
    padding: 11px 14px 12px;
    gap: 8px;
  }

  .nav-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: calc(100% - 76px);
  }

  .brand {
    gap: 11px;
  }

  .brand-logo-img {
    width: 28px;
    height: 28px;
  }

  .brand-title {
    font-size: 13.5px;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .nav-link {
    padding: 5px 10px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .nav-right {
    align-self: flex-start;
    padding-top: 2px;
  }

  .search-bar {
    padding: 10px 14px;
  }

  .hero {
    padding: 36px 16px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .main-container {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .wallpaper-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}