/*
Theme Name: That Shelf Life
Theme URI: https://thatshelflife.com
Author: That Shelf Life
Description: A warm, editorial theme for hyper-specific book curation lists. Features a Pinterest-pin card grid homepage, sidebar with categories and trending posts, and a clean post layout with image wrap.
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: tsl
*/

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Crimson+Pro:ital,wght@0,300;0,400;1,300;1,400&family=Space+Mono:wght@400;700&display=swap');

/* ══════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════ */
:root {
  --cream:       #f0e6d3;
  --warm-white:  #faf7f2;
  --parchment:   #f5efe3;
  --burnt:       #c4603a;
  --burnt-dark:  #8b4a2a;
  --mahogany:    #3d1f12;
  --charcoal:    #1a1410;
  --forest:      #2d4a3e;
  --sage:        #8ecba0;
  --text:        #1a1410;
  --text-mid:    #5a4535;
  --text-light:  #8a7060;
  --border:      rgba(139,74,42,0.15);
  --border-mid:  rgba(139,74,42,0.25);

  --font-display: 'Lora', Georgia, serif;
  --font-body:    'Crimson Pro', Georgia, serif;
  --font-mono:    'Space Mono', monospace;

  --radius:  4px;
  --shadow:  0 2px 16px rgba(26,20,16,0.08);
  --shadow-hover: 0 6px 28px rgba(26,20,16,0.14);

  --sidebar-w: 280px;
  --content-max: 1140px;
  --gap: 32px;
}

/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--warm-white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--burnt); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--burnt-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ══════════════════════════════════════════
   SITE HEADER
══════════════════════════════════════════ */
.site-header {
  background: var(--charcoal);
  border-bottom: 3px solid var(--burnt);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.site-logo svg { flex-shrink: 0; }

.logo-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-that {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--burnt);
  letter-spacing: 0.02em;
}

.logo-main {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--cream);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Nav */
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  align-items: center;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(240,230,211,0.6);
  transition: color 0.2s;
}

.site-nav a:hover { color: var(--cream); }

.nav-search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(240,230,211,0.6);
  padding: 4px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}
.nav-search-btn:hover { color: var(--cream); }

/* Search overlay */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,20,16,0.92);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.search-overlay.active { display: flex; }

.search-overlay form {
  width: 100%;
  max-width: 560px;
  padding: 0 24px;
  display: flex;
  gap: 0;
}

.search-overlay input[type="search"] {
  flex: 1;
  background: var(--cream);
  border: none;
  padding: 16px 20px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
}

.search-overlay button[type="submit"] {
  background: var(--burnt);
  border: none;
  padding: 0 20px;
  color: white;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background 0.2s;
}
.search-overlay button[type="submit"]:hover { background: var(--burnt-dark); }

.search-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 28px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.search-close:hover { opacity: 1; }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--cream);
  transition: all 0.2s;
}

/* ══════════════════════════════════════════
   PAGE WRAPPER / LAYOUT
══════════════════════════════════════════ */
.page-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 40px var(--gap);
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 48px;
  align-items: start;
}

/* Full-width pages (no sidebar) */
.page-wrapper.full-width {
  grid-template-columns: 1fr;
  max-width: 780px;
}

/* ══════════════════════════════════════════
   HOMEPAGE — PIN CARD GRID
══════════════════════════════════════════ */
.archive-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.archive-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-mid);
  letter-spacing: 0.01em;
}

.archive-header h1 span {
  font-style: normal;
  font-weight: 700;
  color: var(--text);
}

/* Category strip */
.category-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.cat-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  color: var(--text-mid);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.cat-pill:hover,
.cat-pill.active {
  background: var(--forest);
  border-color: var(--forest);
  color: white;
}

/* Card grid — 2 columns, pin-ratio cards */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.post-card {
  background: var(--cream);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* Pinterest pin image — 2:3 ratio */
.card-image {
  position: relative;
  width: 100%;
  padding-top: 150%; /* 2:3 ratio */
  overflow: hidden;
  background: var(--parchment);
}

.card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .card-image img {
  transform: scale(1.03);
}

/* Placeholder when no image */
.card-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.card-image-placeholder .placeholder-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.3;
}

.card-image-placeholder .placeholder-tag {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-light);
}

/* Card meta — small strip below image */
.card-meta {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-category {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--burnt);
}

.card-read-link {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.card-read-link:hover { color: var(--burnt); }

.card-read-link::after {
  content: '→';
  font-size: 10px;
}

/* Pagination */
.pagination {
  margin-top: 40px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.pagination a,
.pagination span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 8px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text-mid);
  transition: all 0.2s;
}

.pagination a:hover,
.pagination .current {
  background: var(--burnt);
  border-color: var(--burnt);
  color: white;
}

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-widget {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.widget-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Category list */
.sidebar-cats {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-cats li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  transition: background 0.15s;
}

.sidebar-cats li a:hover {
  background: var(--parchment);
  color: var(--forest);
}

.sidebar-cats .cat-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-light);
}

/* Trending posts */
.trending-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trending-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.trending-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--forest);
  min-width: 16px;
  padding-top: 3px;
}

.trending-item a {
  font-family: var(--font-display);
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
  font-style: italic;
}

.trending-item a:hover { color: var(--burnt); }

/* Email widget */
.email-widget-desc {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.5;
  margin-bottom: 14px;
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-form input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--warm-white);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.email-form input[type="email"]:focus {
  border-color: var(--burnt);
}

.email-form button {
  width: 100%;
  padding: 10px;
  background: var(--burnt);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
}

.email-form button:hover { background: var(--burnt-dark); }

/* ══════════════════════════════════════════
   SINGLE POST
══════════════════════════════════════════ */
.single-post-wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 40px var(--gap);
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 48px;
  align-items: start;
}

.post-header {
  margin-bottom: 36px;
}

.post-header .post-cat {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--burnt);
  display: block;
  margin-bottom: 12px;
}

.post-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.post-header .post-intro {
  font-size: 1.15rem;
  color: var(--text-mid);
  line-height: 1.65;
  font-style: italic;
  border-left: 3px solid var(--burnt);
  padding-left: 18px;
}

.post-divider {
  width: 48px;
  height: 2px;
  background: var(--forest);
  margin: 28px 0;
}

/* Pin image float on post page */
.post-pin-image {
  float: right;
  width: 280px;
  margin: 0 0 24px 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.post-pin-image img {
  width: 100%;
  border-radius: var(--radius);
}

/* Post content */
.post-content {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text);
}

.post-content p { margin-bottom: 1.4em; }

.post-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 2em 0 0.6em;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text);
  margin: 1.6em 0 0.5em;
}

/* Book entry block */
.post-content strong:first-child {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-top: 2em;
}

/* Affiliate link block */
.post-content p:has(a[href*="bookshop"]),
.post-content p:has(a[href*="amazon"]) {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--text-light);
  padding: 10px 14px;
  background: var(--parchment);
  border-radius: var(--radius);
  margin-top: 0.5em;
}

.post-content a {
  color: var(--burnt);
  border-bottom: 1px solid rgba(196,96,58,0.3);
  transition: border-color 0.2s;
}

.post-content a:hover {
  border-color: var(--burnt);
}

/* CTA block */
.post-cta-block {
  background: var(--charcoal);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin: 48px 0 32px;
  color: var(--cream);
  clear: both;
}

.post-cta-block p {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(240,230,211,0.5);
  margin-bottom: 8px;
}

.post-cta-block strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--cream);
  display: block;
  margin-bottom: 16px;
}

.post-cta-block .email-form input[type="email"] {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: var(--cream);
}

.post-cta-block .email-form input::placeholder { color: rgba(240,230,211,0.4); }

/* Related posts */
.related-posts {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  clear: both;
}

.related-posts h3 {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 20px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.related-card {
  background: var(--cream);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.related-card-img {
  width: 100%;
  padding-top: 150%;
  position: relative;
  overflow: hidden;
  background: var(--parchment);
}

.related-card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-card-title {
  padding: 12px 14px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.35;
  color: var(--text);
}

.related-card-title a { color: inherit; }
.related-card-title a:hover { color: var(--burnt); }

/* ══════════════════════════════════════════
   SITE FOOTER
══════════════════════════════════════════ */
.site-footer {
  background: var(--charcoal);
  border-top: 3px solid var(--burnt);
  margin-top: 80px;
  padding: 48px var(--gap) 32px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 28px;
}

.footer-brand .logo-main { font-size: 20px; }
.footer-brand .logo-that { font-size: 12px; }

.footer-tagline {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-style: italic;
  color: rgba(240,230,211,0.7);
  margin-top: 10px;
  line-height: 1.5;
}

.footer-col-title {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(240,230,211,0.6);
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: rgba(240,230,211,0.85);
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--sage); }

.footer-bottom {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(240,230,211,0.7);
}

/* ══════════════════════════════════════════
   BREADCRUMB
══════════════════════════════════════════ */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-light);
  margin-bottom: 28px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--forest); }
.breadcrumb span { opacity: 0.4; }

/* ══════════════════════════════════════════
   MOBILE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .page-wrapper,
  .single-post-wrapper {
    grid-template-columns: 1fr;
  }

  .sidebar { position: static; }

  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .related-grid { grid-template-columns: repeat(2, 1fr); }

  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  :root { --gap: 20px; }

  .site-nav { display: none; }
  .site-nav.open { display: flex; }
  .menu-toggle { display: flex; }

  .site-nav {
    position: fixed;
    top: 68px;
    left: 0; right: 0;
    background: var(--charcoal);
    padding: 24px var(--gap);
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .site-nav ul {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .posts-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }

  .post-pin-image {
    float: none;
    width: 100%;
    margin: 0 0 24px 0;
  }
}
