/* High Realm Books. One stylesheet, mobile first, light and dark. */

:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --text: #1c1a24;
  --muted: #625d70;
  --border: #e7e1d6;
  --accent: #5b3fd1;
  --accent-text: #ffffff;
  --accent-soft: #efeafe;
  --teal: #0e7c7b;
  --deal: #b8400f;
  --free: #0f7a4f;
  --free-bg: #e3f5ec;
  --shadow: 0 1px 2px rgba(28, 26, 36, .06), 0 4px 16px rgba(28, 26, 36, .06);
  --fantasy-1: #5b3fd1; --fantasy-2: #2a1b6b;
  --scifi-1: #0e7c7b; --scifi-2: #0b2f45;
  --adventure-1: #c2591a; --adventure-2: #5a2410;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13111a;
    --surface: #1c1926;
    --text: #ece9f4;
    --muted: #a7a1b8;
    --border: #2d2939;
    --accent: #a593ff;
    --accent-text: #160f33;
    --accent-soft: #272040;
    --teal: #4fd1c5;
    --deal: #ff9b6a;
    --free: #5ee0a0;
    --free-bg: #173027;
    --shadow: none;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.45rem; margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.12rem; margin: 0.3rem 0 0.1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.lede { font-size: 1.2rem; color: var(--muted); margin-top: 0; }

.wrap { max-width: 66rem; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 42rem; }
main { padding-bottom: 2rem; }
main > :first-child { margin-top: 1.5rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem; z-index: 10; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.8rem; padding-bottom: 0.8rem; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand .logo img { display: block; height: 2.1rem; width: auto; flex: none; }
.brand-small { font-size: 1rem; }
.brand-small .logo img { height: 1.6rem; }
.site-header nav { display: flex; gap: 0.3rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem; }
.site-header nav a { flex: none; padding: 0.3rem 0.7rem; border-radius: 999px; color: var(--text); text-decoration: none; font-size: 0.95rem; }
.site-header nav a:hover { background: var(--accent-soft); color: var(--accent); }
@media (min-width: 760px) { .site-header nav { margin: 0; padding: 0; } }

.site-footer { margin-top: 3rem; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--border); font-size: 0.875rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer .brand { color: var(--text); margin-bottom: 0.25rem; }

/* Home */
.hero {
  margin: 1.5rem 0 1rem;
  padding: 2rem 1.25rem;
  border-radius: 1.25rem;
  color: #f4f1ff;
  background:
    radial-gradient(ellipse 40% 60% at 85% 40%, rgba(20, 184, 166, .45), transparent 70%),
    radial-gradient(ellipse 50% 80% at 80% 50%, rgba(124, 92, 255, .55), transparent 70%),
    linear-gradient(135deg, #1d1446, #2b1d6b 55%, #0f3a4a);
}
.hero h1 { color: #ffffff; max-width: 20ch; }
.hero .lede { color: #d9d2ff; }
.hero .subhead { font-family: var(--serif); font-size: clamp(1.25rem, 4vw, 1.6rem); color: #8ff0e4; margin: -0.2rem 0 1rem; }
.hero p { max-width: 38rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; font-weight: 600; color: #8ff0e4; margin: 0; }
.cta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0 0; }
.hero .button { background: #ffffff; color: #2b1d6b; }
.hero-signup { max-width: 30rem; margin: 1.25rem 0 0.5rem; }
.hero-signup .kit-row { margin-top: 0; }
.hero-signup .kit-input { border-color: transparent; }
.hero-signup .kit-message { color: #ffffff; }
.hero-signup-note { font-size: 0.85rem; color: #d9d2ff; margin: 0.4rem 0 0; }
.hero-signup-note a { color: #ffffff; }
.hero .button-ghost { background: transparent; color: #ffffff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); }
@media (min-width: 760px) { .hero { padding: 3rem 2.5rem; } }

.genre-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 1rem 0; }
.genre-tile { display: flex; flex-direction: column; justify-content: flex-end; min-height: 5.5rem; padding: 0.8rem; border-radius: 0.9rem; color: #ffffff; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.genre-tile small { font-family: var(--sans); font-weight: 400; font-size: 0.8rem; opacity: 0.85; }
.tile-fantasy { background: linear-gradient(150deg, var(--fantasy-1), var(--fantasy-2)); }
.tile-sci-fi { background: linear-gradient(150deg, var(--scifi-1), var(--scifi-2)); }
.tile-adventure { background: linear-gradient(150deg, var(--adventure-1), var(--adventure-2)); }
.more { margin-top: 1rem; font-weight: 600; }
.author-teaser { border-top: 1px solid var(--border); margin-top: 2.5rem; }

/* Buttons and chips */
.button { display: inline-block; padding: 0.65rem 1.1rem; border-radius: 0.6rem; background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600; }
.button:hover { filter: brightness(1.08); }
.chip { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-decoration: none; letter-spacing: 0.02em; color: #ffffff; }
.chip-fantasy { background: var(--fantasy-1); }
.chip-sci-fi { background: var(--scifi-1); }
.chip-adventure { background: var(--adventure-1); }

/* Deal lists */
.sort-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1rem; font-size: 0.95rem; }
.sort-bar[hidden] { display: none; }
.sort-bar select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.35rem 0.5rem; }
.check { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.check input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: 0.9rem; padding: 0.9rem; box-shadow: var(--shadow); }
.card[hidden], .card.filtered { display: none; }
.card-cover { display: block; text-decoration: none; }
.card-body { min-width: 0; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0.15rem 0 0; }
.series { color: var(--muted); font-size: 0.85rem; margin: 0; }
.author { color: var(--muted); font-size: 0.92rem; }
.deal-line { font-size: 0.95rem; }
.blurb { font-size: 0.93rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.price { font-weight: 700; color: var(--deal); }
.price-free { color: var(--free); background: var(--free-bg); padding: 0 0.4rem; border-radius: 0.3rem; }
.checked { font-size: 0.85em; }

.pick-badge { display: inline-block; padding: 0 0.5rem; border-radius: 0.3rem; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.our-rating { color: #d99a06; letter-spacing: 0.05em; margin-left: 0.4rem; }
.take { margin: 0.8rem 0; padding: 0.2rem 1rem; border-left: 3px solid var(--accent); font-style: italic; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0; }
.tag { padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.tag:hover { border-color: var(--accent); color: var(--accent); }

/* Shelf strip: a row of covers */
.shelf { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 1rem 0.8rem; }
.shelf a { display: block; color: var(--text); text-decoration: none; }
.shelf a:hover .shelf-title { color: var(--accent); }
.shelf-title { display: block; margin-top: 0.4rem; font-family: var(--serif); font-weight: 700; font-size: 0.92rem; line-height: 1.25; }
.shelf-author { display: block; color: var(--muted); font-size: 0.8rem; }

/* Series carousel: the whole series in a scrolling row */
.carousel { list-style: none; padding: 0.25rem 0.25rem 0.75rem; margin: 0; display: flex; gap: 0.9rem; overflow-x: auto; scroll-snap-type: x proximity; }
.carousel li { flex: 0 0 7rem; scroll-snap-align: start; }
.carousel a { display: block; color: var(--text); text-decoration: none; }
.carousel a:hover .shelf-title { color: var(--accent); }
.carousel .current .cover { outline: 3px solid var(--accent); outline-offset: 3px; }
.series-num { display: block; margin-top: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Covers */
.cover { display: block; width: 100%; aspect-ratio: 2 / 3; height: auto; object-fit: cover; border-radius: 0.35rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); background: var(--border); }
.cover-large { max-width: 9rem; }
@media (min-width: 640px) { .cover-large { max-width: 13rem; } }
.cover-placeholder { display: flex; flex-direction: column; justify-content: space-between; padding: 0.5rem; color: #ffffff; overflow: hidden; background: linear-gradient(160deg, var(--fantasy-1), var(--fantasy-2)); }
.cover-sci-fi { background: linear-gradient(160deg, var(--scifi-1), var(--scifi-2)); }
.cover-adventure { background: linear-gradient(160deg, var(--adventure-1), var(--adventure-2)); }
.ph-title { font-family: var(--serif); font-weight: 700; font-size: 0.72rem; line-height: 1.15; }
.ph-author { font-size: 0.55rem; opacity: 0.85; }
.cover-large .ph-title { font-size: 1.3rem; }
.cover-large .ph-author { font-size: 0.85rem; }
.cover-large.cover-placeholder { padding: 1rem; }

/* Book page */
.crumbs { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; }
.book { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .book { grid-template-columns: 13rem 1fr; gap: 2rem; } }
.book h1 { margin-top: 0.5rem; }
.byline { color: var(--muted); margin: 0.2rem 0 0.8rem; }
.deal { font-size: 1.2rem; margin-bottom: 0.2rem; }
.ended { border-left: 3px solid var(--deal); padding: 0.5rem 0.75rem; background: var(--surface); }
.buy { margin: 1.5rem 0; }
.buy .button { margin: 0 0.5rem 0.5rem 0; }
.disclosure-note { font-size: 0.85rem; color: var(--muted); }

/* Signup */
.signup { max-width: 42rem; background: var(--accent-soft); border-radius: 1rem; padding: 1.25rem; margin: 2.5rem 0; }
.signup h2 { margin-top: 0; }
.signup-options { padding-left: 1.2rem; margin: 0.5rem 0; }
.kit-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.kit-input { flex: 1 1 14rem; min-width: 0; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.6rem 0.75rem; }
.kit-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.kit-submit { border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.kit-submit:disabled { opacity: 0.6; cursor: default; }
.kit-message { margin: 0.5rem 0 0; min-height: 1.2em; }
.kit-message.kit-error { color: #c0392b; }
.note-headline { font-weight: 700; margin: 0.4rem 0 0.2rem; }
.note-meta { font-size: 0.9rem; color: var(--muted); margin: 0.3rem 0 0; }
.date-chip { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.signup-placeholder, .form-placeholder { border: 2px dashed var(--accent); border-radius: 0.6rem; padding: 1rem; text-align: center; color: var(--muted); }

/* Prose pages, guides, archives */
.prose h2 { margin-top: 2rem; }
.prose li { margin: 0.3rem 0; }
.prose blockquote { margin: 1.2rem 0; padding: 0.2rem 1rem; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.link-list { padding-left: 1.2rem; }
.link-list li { margin: 0.4rem 0; }
.guide-list { list-style: none; padding: 0; }
.guide-item { border-bottom: 1px solid var(--border); padding: 0.5rem 0 1rem; }
.guide-item h2 { margin: 0.5rem 0 0.25rem; font-size: 1.3rem; }
.guide-item p { margin: 0.2rem 0; }
