/* books.everythingsings.art — reading-first styles.
   Dark default, light via prefers-color-scheme. Zero JS. */

:root {
  --bg: #0d0d0d;
  --bg-soft: #141414;
  --fg: #e8e8e8;
  --fg-muted: #a0a0a0;
  --fg-faint: #6a6a6a;
  --rule: #2a2a2a;
  --link: #e8e8e8;
  --link-hover: #ffffff;
  --accent: #d4b483;

  --serif: "Iowan Old Style", "Charter", "Source Serif Pro", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 38rem; /* ~65 chars of body copy */
  --measure-wide: 56rem;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafaf7;
    --bg-soft: #f0eee8;
    --fg: #1a1a1a;
    --fg-muted: #555;
    --fg-faint: #8a8a8a;
    --rule: #d8d4ca;
    --link: #1a1a1a;
    --link-hover: #000;
    --accent: #7b5d34;
  }
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
a:hover { color: var(--link-hover); text-decoration-color: var(--accent); }

/* ------- Index page ------- */

.site-header { margin-bottom: var(--space-5); max-width: var(--measure); }

/* ---- Parallax hero with the generative-art image ----
   The image lives on a dedicated layer so we can use background-attachment:fixed
   for parallax without losing the local-positioning we want elsewhere. iOS
   Safari treats fixed as scroll, which is a fine fallback. */
.site-hero {
  position: relative;
  width: 100%;
  min-height: 64vh;
  max-height: 720px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  margin: 0;
  border-bottom: 1px solid var(--rule);
}
.site-hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("/header.jpg");
  background-size: cover;
  background-position: center 28%;
  background-attachment: fixed;
  background-color: #0a0a0a;
  /* Fade the bottom so the title sits on something readable. */
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, rgba(0,0,0,0.55) 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, rgba(0,0,0,0.55) 100%);
}
.site-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: var(--space-5) var(--space-3) var(--space-4);
  color: #f4f0e6;
}
/* Frosted-glass card so the title and era list stay readable over any image. */
.hero-card {
  display: inline-block;
  max-width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(15, 15, 18, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
/* Browsers without backdrop-filter (older Firefox) get a more opaque panel. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .hero-card { background: rgba(15, 15, 18, 0.78); }
}
.site-hero-content .site-title {
  color: #fff;
  margin: 0 0 var(--space-3);
  font-size: 3rem;
  letter-spacing: -0.02em;
}

.hero-updated {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--sans);
  font-size: 0.85rem;
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  color: #e8e4d8;
}
.hero-updated-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.hero-updated-date { color: #fff; font-weight: 500; }

/* ---- Index-only: image extends behind the entire page, with the main
   column sitting on a darker frosted-glass card. The image is atmospheric,
   so we lock the index page to dark tokens regardless of OS color-scheme. */
body[itemtype$="Blog"] {
  --fg: #ece8db;
  --fg-muted: #b0aca0;
  --fg-faint: #807c70;
  --bg-soft: rgba(255, 255, 255, 0.04);
  --rule: rgba(255, 255, 255, 0.1);
  --link: #f0ecdf;
  --link-hover: #ffffff;
  background: transparent;
  color: var(--fg);
}
body[itemtype$="Blog"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("/header.jpg");
  background-size: cover;
  background-position: center 28%;
  background-color: #0a0a0a;
}
/* Hero's image layer becomes a soft top vignette over the body image. */
body[itemtype$="Blog"] .site-hero-bg {
  background-image: linear-gradient(to bottom,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0.2) 55%,
    rgba(0, 0, 0, 0) 100%);
  background-color: transparent;
  background-attachment: scroll;
  mask: none;
  -webkit-mask: none;
}
body[itemtype$="Blog"] .site-hero { border-bottom: none; }

body[itemtype$="Blog"] .container {
  background: rgba(8, 8, 10, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  /* Pull the card upward so it overlaps the hero edge for cohesion. */
  margin-top: calc(-1 * var(--space-3));
  position: relative;
  z-index: 1;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body[itemtype$="Blog"] .container { background: rgba(8, 8, 10, 0.88); }
}

.era-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.2rem;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.era-list dt {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  align-self: baseline;
}
.era-list dd {
  margin: 0;
  color: #e8e4d8;
  align-self: baseline;
}
.era-list em {
  font-style: italic;
  opacity: 0.85;
}

@media (max-width: 520px) {
  .site-hero { min-height: 56vh; }
  .site-hero-content { padding: var(--space-4) var(--space-2) var(--space-3); }
  .site-hero-content .site-title { font-size: 2.25rem; }
  .era-list { font-size: 0.875rem; gap: 0.3rem 0.8rem; }
  .hero-card { padding: var(--space-2) var(--space-3); display: block; }
  /* iOS already falls back to scroll, but make it explicit for any other
     mobile browser where fixed feels janky. */
  .site-hero-bg { background-attachment: scroll; }
}
@media (prefers-reduced-motion: reduce) {
  .site-hero-bg { background-attachment: scroll; }
}
.site-title { font-size: 2.5rem; margin: 0 0 var(--space-2); font-weight: 700; letter-spacing: -0.02em; }
.site-subtitle { color: var(--fg-muted); font-style: italic; margin: 0 0 var(--space-3); }
.site-nav { font-family: var(--sans); font-size: 0.9rem; display: flex; gap: var(--space-3); }
.site-nav.top-nav { margin-bottom: var(--space-4); }

.kindle-callout {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--sans);
}
.kc-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  margin: 0 0 var(--space-1);
}
.kc-body {
  margin: 0 0 var(--space-2);
  font-size: 0.95rem;
  color: var(--fg-muted);
}
.kc-cta {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.kc-cta:hover { color: var(--link-hover); }

.entries {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}
.entry { border-bottom: 1px solid var(--rule); }
.entry-link {
  display: grid;
  grid-template-columns: 4ch 1fr auto;
  grid-template-areas:
    "num title date"
    "num author author"
    "num preview preview";
  gap: 0.25rem 1rem;
  padding: var(--space-2) var(--space-1);
  text-decoration: none;
  color: var(--fg);
  align-items: baseline;
}
.entry-link:hover { background: var(--bg-soft); }
.entry-link:hover .entry-title { color: var(--accent); }

.entry-num {
  grid-area: num;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-faint);
  align-self: start;
  padding-top: 0.2rem;
}
.entry-title {
  grid-area: title;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}
.entry-author {
  grid-area: author;
  font-style: italic;
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.entry-date {
  grid-area: date;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--fg-faint);
  white-space: nowrap;
}

/* Inline preview revealed after a deliberate hover (or keyboard focus).
   The 600ms delay keeps casual mouse traversal from triggering every entry;
   the transition snaps closed instantly on un-hover so the page settles. */
.entry-preview {
  grid-area: preview;
  font-size: 0.9rem;
  color: var(--fg-muted);
  font-style: italic;
  line-height: 1.55;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  transition: max-height 0.4s ease, opacity 0.25s ease, margin-top 0.3s ease;
}
.entry-link:hover .entry-preview,
.entry-link:focus-visible .entry-preview {
  max-height: 7em;
  opacity: 0.85;
  margin-top: 0.4rem;
  transition-delay: 0.6s;
}
@media (max-width: 520px) {
  .entry-preview { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .entry-preview { transition: none; }
  .entry-link:hover .entry-preview { transition-delay: 0s; }
}

@media (max-width: 520px) {
  .entry-link {
    grid-template-columns: 4ch 1fr;
    grid-template-areas:
      "num title"
      "num author"
      "num date"
      "num preview";
  }
  .entry-date { font-size: 0.8rem; }
}

.site-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
  color: var(--fg-faint);
  font-family: var(--sans);
  font-size: 0.85rem;
}

/* ------- Review page ------- */

.review {
  max-width: var(--measure);
  margin: 0 auto;
}
.review-header { margin-bottom: var(--space-4); }
.review-number {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-faint);
  margin: 0 0 var(--space-1);
  letter-spacing: 0.05em;
}
.review-title {
  font-size: 2.25rem;
  line-height: 1.15;
  margin: 0 0 var(--space-1);
  letter-spacing: -0.01em;
  font-weight: 700;
}
.review-author {
  font-style: italic;
  color: var(--fg-muted);
  margin: 0 0 var(--space-2);
  font-size: 1.1rem;
}
.review-meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--fg-faint);
  margin: 0 0 var(--space-3);
}
.review-meta time { color: var(--fg-muted); }
.review-meta .external { color: var(--fg-muted); }

.review-cover {
  display: block;
  max-width: 240px;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  margin: var(--space-3) 0;
}

.review-body {
  font-size: 1.1rem;
  line-height: 1.7;
}
.review-body p { margin: 0 0 var(--space-3); }
.review-body p:first-of-type::first-letter {
  font-size: 3.4rem;
  float: left;
  line-height: 0.9;
  padding: 0.3rem 0.5rem 0 0;
  font-weight: 700;
  color: var(--accent);
}
.review-body a { color: var(--accent); }
.review-body em { color: var(--fg-muted); }

.review-nav {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-family: var(--sans);
}
.review-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--fg);
  padding: var(--space-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  max-width: 48%;
}
.review-nav a:hover { background: var(--bg-soft); border-color: var(--accent); }
.review-nav .next { text-align: right; }
.review-nav .dir { font-size: 0.8rem; color: var(--fg-faint); }
.review-nav .t { font-weight: 600; font-size: 0.95rem; }

@media (max-width: 520px) {
  .review-title { font-size: 1.8rem; }
  .review-body { font-size: 1.05rem; }
  .container { padding: var(--space-3) var(--space-2); }
}
