:root {
  --bg: #101012;
  --bg-elev: #16161a;
  --bg-card: #1a1a1f;
  --border: #26262c;
  --border-soft: #1f1f25;
  --text: #c9ced4;
  --text-dim: #8f959d;
  --text-muted: #6b7078;
  --accent: #E53A3B;
  --accent-soft: #ff5a5b;
  --tag-bg: #232228;
  --tag-text: #999999;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Lora', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image:
    radial-gradient(circle at 25% 30%, rgba(200,85,61,0.08), transparent 50%),
    radial-gradient(circle at 75% 70%, rgba(120,90,200,0.05), transparent 50%);
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-soft); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(16,16,18,0.78);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a {
  color: var(--text-dim);
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  color: var(--accent) !important;
}

/* ---------- Main ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 2;
}

/* ---------- Book Hero ---------- */
.book-hero {
  padding: 100px 0 110px;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
}
.book-hero::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(229,58,59,0.10) 0%, rgba(229,58,59,0) 65%);
  pointer-events: none;
  z-index: 0;
}
.book-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.book-cover-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}
.book-cover-glow {
  position: absolute;
  inset: -10% -8% -6% -8%;
  background: radial-gradient(circle, rgba(229,58,59,0.35) 0%, rgba(229,58,59,0) 70%);
  filter: blur(40px);
  z-index: 0;
}
.book-cover {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 320px;
  border-radius: 4px;
  box-shadow:
    0 30px 60px -20px rgba(0,0,0,0.7),
    0 18px 36px -18px rgba(229,58,59,0.35),
    0 0 0 1px rgba(255,255,255,0.04);
  transform: perspective(1200px) rotateY(-6deg) rotateX(2deg);
  transition: transform .5s ease;
}
.book-cover:hover {
  transform: perspective(1200px) rotateY(-2deg) rotateX(1deg) translateY(-4px);
}
.accent-eyebrow { color: var(--accent); }
.book-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(48px, 6.5vw, 78px);
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: #cfd4da;
  margin: 22px 0 28px;
}
.book-title em {
  font-style: normal;
  color: var(--accent);
  font-weight: 500;
}
.book-lede {
  font-size: 21px;
  line-height: 1.55;
  color: var(--text);
  max-width: 520px;
  font-style: normal;
  margin-bottom: 36px;
}
.book-meta {
  margin-top: 28px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- Hero ---------- */
.hero {
  padding: 120px 0 100px;
  border-bottom: 1px solid var(--border-soft);
}
.secondary-hero { padding: 90px 0 80px; }
.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(56px, 9vw, 92px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  color: #cfd4da;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.lede {
  font-size: 24px;
  line-height: 1.5;
  color: var(--text);
  max-width: 600px;
  font-style: normal;
  font-weight: 400;
  margin-bottom: 40px;
}
.accent { color: var(--accent); font-style: normal; }

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 6px;
  transition: all .15s ease;
  letter-spacing: .01em;
}
.btn.primary {
  background: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: var(--accent-soft);
  color: #fff;
  transform: translateY(-1px);
}
.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn.ghost:hover {
  color: var(--text);
  border-color: #3a3a42;
}
.btn.large { padding: 16px 32px; font-size: 15px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 5px 11px;
  border-radius: 999px;
  letter-spacing: .01em;
}
.tag.inline { font-size: 11px; padding: 3px 9px; }

/* ---------- Sections ---------- */
.section { padding: 80px 0; border-bottom: 1px solid var(--border-soft); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 48px;
}
.section h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.01em;
  color: #cfd4da;
}
.section-link {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}
.section-link:hover { color: var(--accent); }

/* ---------- Posts ---------- */
.posts { display: flex; flex-direction: column; gap: 56px; }

/* Homepage preview cards: lead-image thumbnail + text */
.post--card { display: flex; gap: 26px; align-items: flex-start; }
.post--card .post-body { flex: 1; min-width: 0; }
.post-thumb {
  flex: 0 0 180px;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
}
.post-thumb img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.post-thumb:hover img { transform: scale(1.04); }
.post-thumb--placeholder {
  height: 122px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 38%, rgba(229,58,59,0.18), transparent 70%),
    var(--bg-card);
}
.post-thumb--placeholder:hover { color: var(--accent-soft); }
@media (max-width: 640px) {
  .post--card { flex-direction: column; gap: 14px; }
  .post-thumb { flex: none; width: 100%; }
  .post-thumb img, .post-thumb--placeholder { height: 190px; }
}

.section-more { text-align: center; margin-top: 56px; }

/* Book themes grid */
.themes .section-head { margin-bottom: 18px; }
.section-intro {
  color: var(--text-dim);
  font-size: 19px;
  line-height: 1.6;
  max-width: 640px;
  margin: 0 0 44px;
}
.section-intro em { color: var(--text-muted); font-style: normal; font-size: 15px; }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.theme {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 28px 30px;
  transition: border-color .15s ease, transform .15s ease;
}
.theme:hover { border-color: #3a3a42; transform: translateY(-2px); }
.theme-num {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .12em;
  display: block;
  margin-bottom: 12px;
}
.theme h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 23px;
  color: #cfd4da;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.theme p { color: var(--text-dim); font-size: 17px; line-height: 1.6; }
@media (max-width: 640px) { .theme-grid { grid-template-columns: 1fr; } }

/* Email signup form */
.subscribe-form {
  display: flex;
  gap: 10px;
  max-width: 430px;
  margin: 28px auto 14px;
}
.subscribe-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 13px 15px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
}
.subscribe-input::placeholder { color: var(--text-muted); }
.subscribe-input:focus { outline: none; border-color: var(--accent); }
.subscribe-form .btn { white-space: nowrap; }
.subscribe-fine { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
@media (max-width: 480px) { .subscribe-form { flex-direction: column; } }
.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.dot {
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}
.post h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.post h3 a { color: #cfd4da; }
.post h3 a:hover { color: var(--accent); }
.post p {
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 16px;
  max-width: 600px;
}
.readmore {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
}

/* ---------- About ---------- */
.about-body p {
  font-size: 20px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 20px;
  max-width: 620px;
}

/* ---------- Subscribe ---------- */
.subscribe { border-bottom: none; padding-bottom: 120px; }
.subscribe-card {
  background: linear-gradient(180deg, #1c1b21 0%, #18171c 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 56px 48px;
  text-align: center;
}
.subscribe-card h2 {
  font-size: 38px;
  margin-bottom: 12px;
}
.subscribe-card p {
  color: var(--text-dim);
  font-size: 18px;
  margin-bottom: 32px;
  font-style: normal;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  padding: 32px 0;
  position: relative;
  z-index: 2;
}
.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .book-hero-inner {
    grid-template-columns: 1fr;
    gap: 48px;
    text-align: center;
  }
  .book-hero-content .hero-actions { justify-content: center; }
  .book-lede { margin-left: auto; margin-right: auto; }
  .book-cover { max-width: 260px; }
}

@media (max-width: 640px) {
  .nav-inner { padding: 16px 22px; }
  .book-hero { padding: 60px 0 70px; }
  .book-title { font-size: 44px; }
  .book-lede { font-size: 18px; }
  .nav-links { gap: 18px; }
  .nav-links a:not(.nav-cta) { display: none; }
  main { padding: 0 22px; }
  .hero { padding: 70px 0 60px; }
  .lede { font-size: 20px; }
  .section { padding: 56px 0; }
  .section h2 { font-size: 30px; }
  .post h3 { font-size: 24px; }
  .subscribe-card { padding: 40px 24px; }
  .subscribe-card h2 { font-size: 28px; }
  .footer-inner { padding: 0 22px; flex-direction: column; gap: 12px; }
}

/* ---------- Headshot (personal site) ---------- */
.headshot {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
  box-shadow:
    0 30px 60px -20px rgba(0,0,0,0.7),
    0 18px 36px -18px rgba(229,58,59,0.35),
    0 0 0 1px rgba(255,255,255,0.05);
  filter: grayscale(15%) contrast(1.03);
}
.headshot-fallback {
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 84px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 38%, rgba(229,58,59,0.16), transparent 70%),
    var(--bg-card);
  border: 1px solid var(--border);
}

/* ---------- Books grid (personal site) ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 240px));
  gap: 28px;
}
.book-card-cover {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow:
    0 24px 44px -22px rgba(0,0,0,0.7),
    0 12px 28px -18px rgba(229,58,59,0.22);
  transition: transform .25s ease, box-shadow .25s ease;
}
.book-card:hover .book-card-cover {
  transform: translateY(-4px);
  box-shadow:
    0 30px 54px -22px rgba(0,0,0,0.75),
    0 16px 34px -16px rgba(229,58,59,0.32);
}
.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.book-card-placeholder {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 40%, rgba(229,58,59,0.14), transparent 70%),
    var(--bg-card);
}
.book-card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  color: #cfd4da;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.book-card p {
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.55;
}
.books-note {
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 17px;
}
@media (max-width: 700px) {
  .books-grid { grid-template-columns: 1fr; max-width: 320px; margin: 0 auto; }
}

/* ---------- Featured book (single-book hero) ---------- */
.book-feature { align-items: center; }
.feature-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 3.4vw, 40px);
  letter-spacing: -0.015em;
  line-height: 1.08;
  color: #cfd4da;
  margin: 14px 0 18px;
}
@media (min-width: 821px) {
  .feature-title { white-space: nowrap; }
}
.feature-copy {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text);
  max-width: 480px;
  margin-bottom: 30px;
}
@media (max-width: 820px) {
  .book-feature { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .book-feature .feature-copy { margin-left: auto; margin-right: auto; }
  .book-feature .hero-actions { justify-content: center; }
}

/* ---------- 3D book object ---------- */
.book3d-wrap { perspective: 1400px; }
.book3d {
  max-width: 100%;
  position: relative;
  width: 240px;
  height: 383px;
  transform-style: preserve-3d;
  transform: rotateY(-26deg) rotateX(1deg);
  transition: transform .5s ease;
  z-index: 1;
}
.book3d-wrap:hover .book3d {
  transform: rotateY(-14deg) rotateX(0deg);
}
.book3d img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px 5px 5px 2px;
  transform: translateZ(22px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
}
/* fore-edge pages */
.book3d::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 42px;
  transform: translateX(216px) rotateY(90deg);
  background: linear-gradient(90deg,
    #e8e4da 0%, #cfc9bc 8%, #e8e4da 16%, #cfc9bc 24%, #e8e4da 32%,
    #cfc9bc 40%, #e8e4da 48%, #cfc9bc 56%, #e8e4da 64%, #cfc9bc 72%,
    #e8e4da 80%, #cfc9bc 88%, #e8e4da 100%);
}
/* back board */
.book3d::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #16181b;
  border-radius: 2px 5px 5px 2px;
  transform: translateZ(-22px);
  box-shadow: -18px 12px 50px 12px rgba(0,0,0,0.55);
}
@media (max-width: 820px) {
  .book3d { width: 200px; height: 319px; margin: 0 auto; }
  .book3d::before { width: 36px; transform: translateX(180px) rotateY(90deg); }
  .book3d img { transform: translateZ(19px); }
  .book3d::after { transform: translateZ(-19px); }
}

/* ---------- Personal hero: diversified from book feature ---------- */
.hero-flip { grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr); }
.hero-flip .book-cover-wrap { order: 2; }
.hero-flip .book-hero-content { order: 1; }
.hero-flip .headshot {
  aspect-ratio: 1 / 1;
  max-width: 260px;
  border-radius: 50%;
  object-position: center 20%;
  box-shadow:
    0 24px 50px -18px rgba(0,0,0,0.7),
    0 0 0 1px rgba(255,255,255,0.06),
    0 0 60px -12px rgba(229,58,59,0.35);
}
.hero-flip .headshot-fallback { border-radius: 50%; }
@media (max-width: 820px) {
  .hero-flip { grid-template-columns: 1fr; }
  .hero-flip .book-cover-wrap { order: 1; }
  .hero-flip .book-hero-content { order: 2; }
}

/* ---------- Essay categories ---------- */
.cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 46px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-soft);
}
.cat-chip {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--text-muted);
  padding: 6px 2px;
  transition: color .15s ease;
}
.cat-chip:hover { color: var(--text-dim); }
.cat-chip.active { color: var(--accent); }
.cat-chip .cat-n {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 3px;
  font-size: 11px;
}
.cat-chip.active .cat-n { color: var(--text-dim); }
.post-cat {
  color: var(--text-muted) !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 11px;
}
.post-cat:hover { color: var(--accent) !important; }
