/* MAGGie Pro Reading Store — lightweight standalone storefront for maggie-pro.store */
:root {
  --brand-1: #667eea;
  --brand-2: #764ba2;
  --surface: #fff;
  --surface-2: #f7f8fc;
  --text: #1a1a2e;
  --text-soft: #4a4a68;
  --text-faint: #7a7a96;
  --border: #e2e4ef;
  --radius-sm: 10px;
  --radius-md: 14px;
  --shadow-md: 0 8px 28px rgba(30, 30, 60, 0.1);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}
[data-theme="dark"] {
  --surface: #12121f;
  --surface-2: #1a1a2e;
  --text: #eef0ff;
  --text-soft: #b8b8d0;
  --text-faint: #8888a8;
  --border: #2e2e48;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-1) 6%, var(--surface)) 0%, var(--surface) 240px);
  line-height: 1.55;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.faint { color: var(--text-faint); }
.muted { color: var(--text-soft); }
.mt-4 { margin-top: 1.5rem; }

.store-nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.store-nav__inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.store-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; color: var(--text); text-decoration: none;
}
.store-brand small { font-weight: 600; color: var(--text-faint); margin-left: 4px; }
.store-brand__mark { font-size: 1.4rem; }
.store-nav__links { display: flex; gap: 16px; flex-wrap: wrap; }
.store-nav__links a { color: var(--brand-1); font-weight: 700; text-decoration: none; font-size: .92rem; }
.store-nav__links a:hover { text-decoration: underline; }

.store-hero { padding: 48px 0 24px; }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand-1) 14%, transparent);
  color: var(--brand-1); margin-bottom: 12px;
}
.store-hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0 0 12px; line-height: 1.15; }
.lead { font-size: 1.05rem; color: var(--text-soft); max-width: 62ch; margin: 0 0 20px; }

.affiliate-banner {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand-2) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-2) 30%, var(--border));
  font-size: .9rem; color: var(--text-soft);
}

.section { padding: 24px 0 56px; }

.store-toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start;
  justify-content: space-between; margin-bottom: 16px;
}
.store-toolbar__right { display: flex; gap: 12px; flex-wrap: wrap; }
.store-select { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; }
.store-select select {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}

.store-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.dim-chip {
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-soft); font: inherit; font-weight: 700; font-size: .82rem;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dim-chip:hover { border-color: var(--chip-color, var(--brand-1)); }
.dim-chip.is-active {
  background: color-mix(in srgb, var(--chip-color, var(--brand-1)) 16%, transparent);
  border-color: var(--chip-color, var(--brand-1));
  color: var(--chip-color, var(--brand-1));
}

.book-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.book-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--dim-color, var(--brand-1));
  border-radius: var(--radius-sm); padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .18s, transform .18s;
}
.book-card:hover, .book-card:focus-within {
  box-shadow: var(--shadow-md); transform: translateY(-2px);
}

.book-card__top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.book-card__title-wrap { flex: 1; min-width: 0; }
.book-card__title {
  margin: 0; font-size: 1.02rem; font-weight: 800; line-height: 1.3;
  cursor: help;
}
.book-card__author { margin: 4px 0 0; font-size: .88rem; color: var(--text-faint); }

.level-pill {
  flex-shrink: 0; font-size: .68rem; font-weight: 800; letter-spacing: .03em;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--dim-color, var(--brand-1)) 12%, transparent);
  color: var(--dim-color, var(--brand-1));
  border: 1px solid color-mix(in srgb, var(--dim-color, var(--brand-1)) 35%, transparent);
}

.dim-label {
  font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--dim-color, var(--brand-1));
}
.book-card__why { font-size: .86rem; color: var(--text-soft); margin: 0; }

.book-card__actions { margin-top: auto; padding-top: 8px; }
.book-card__buy {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: .88rem; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  padding: 10px 16px; border-radius: 999px;
}
.book-card__buy:hover { opacity: .92; }
.book-card__buy small { font-weight: 600; opacity: .85; }

/* What you will learn — flyover tooltip */
.learn-fly {
  position: relative;
  display: inline;
}
.learn-fly__tip {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 80;
  width: min(320px, 86vw); text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--dim-color, var(--brand-2));
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: 14px 16px; font-size: .84rem; font-weight: 400; line-height: 1.5;
  color: var(--text); pointer-events: none; opacity: 0; visibility: hidden;
  transform: translateY(4px); transition: opacity .15s, transform .15s, visibility .15s;
}
.learn-fly__tip::before {
  content: "What you will learn";
  display: block; font-weight: 800; font-size: .72rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--dim-color, var(--brand-2));
  margin-bottom: 8px;
}
.learn-fly__tip ul { margin: 0; padding-left: 18px; }
.learn-fly__tip li { margin-bottom: 6px; }
.learn-fly__tip li:last-child { margin-bottom: 0; }

.book-card:hover .learn-fly__tip,
.learn-fly:focus-within .learn-fly__tip,
.learn-fly.is-open .learn-fly__tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.store-count { margin: 0 0 12px; font-size: .88rem; }

.store-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px; font-size: .88rem; color: var(--text-soft);
}
.store-footer a { color: var(--brand-1); }

@media (max-width: 640px) {
  .store-toolbar { flex-direction: column; }
  .learn-fly__tip {
    position: fixed; left: 16px; right: 16px; width: auto; top: auto; bottom: 16px;
    max-height: 45vh; overflow-y: auto;
  }
}
