/* ============================================================
   LIVE & LEARN — Base Stylesheet
   Clean, minimal. Serif body, sans-serif headings.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@300;400;500;600&display=swap');

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Palette */
  --color-bg:           #f9f8f5;
  --color-surface:      #ffffff;
  --color-text:         #1a1a18;
  --color-text-muted:   #6e6e68;
  --color-border:       #e4e3de;
  --color-accent:       #3a5a40;      /* deep forest green */
  --color-accent-hover: #2c4430;
  --color-tag-bg:       #eef2ee;

  /* Typography */
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:  'Lora', Georgia, 'Times New Roman', serif;

  /* Type scale (fluid-ish via clamp) */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1.125rem;   /* 18px — comfortable reading size */
  --text-lg:   1.25rem;    /* 20px */
  --text-xl:   1.5rem;     /* 24px */
  --text-2xl:  1.875rem;   /* 30px */
  --text-3xl:  2.25rem;    /* 36px */
  --text-4xl:  clamp(2.5rem, 5vw, 3.25rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Layout */
  --content-width: 680px;   /* article text column */
  --wide-width:    960px;   /* wide content (full images, video) */
  --site-width:    1100px;  /* overall site max-width */

  /* Misc */
  --radius:        4px;
  --radius-lg:     8px;
  --transition:    0.18s ease;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.07);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, iframe { max-width: 100%; display: block; }

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--transition), color var(--transition);
}
a:hover {
  color: var(--color-accent-hover);
  text-decoration-color: currentColor;
}

/* ── Type Hierarchy ───────────────────────────────────────── */

/* Headings use sans-serif — clean structural contrast to serif body */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

/* h1 — Page/post title. Used once per page. SEO anchor. */
h1 {
  font-size: var(--text-4xl);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin-bottom: var(--space-6);
}

/* h2 — Major section within a page */
h2 {
  font-size: var(--text-3xl);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
}

/* h3 — Sub-section */
h3 {
  font-size: var(--text-2xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

/* h4 — Minor heading, callout label */
h4 {
  font-size: var(--text-xl);
  font-weight: 500;
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

/* h5 — Inline sub-label */
h5 {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: 0;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

/* h6 — Smallest heading, labels, captions */
h6 {
  font-size: var(--text-base);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

/* Body copy — stays serif for warmth and readability */
p {
  margin-bottom: var(--space-6);
  max-width: 68ch; /* ~optimal reading width */
}

p:last-child { margin-bottom: 0; }

/* ── Navigation ───────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.site-logo {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-logo:hover { color: var(--color-accent); text-decoration: none; }

.site-logo .logo-dot {
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a.active {
  background: var(--color-tag-bg);
  color: var(--color-accent);
}

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--color-text);
}

/* ── Page Layout ──────────────────────────────────────────── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
}

/* Centered container helpers */
.container {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

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

/* ── Hero / Page Header ───────────────────────────────────── */
.page-hero {
  padding: var(--space-16) 0 var(--space-12);
  text-align: center;
}

.page-hero .eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
  display: block;
}

.page-hero h1 {
  margin-bottom: var(--space-4);
}

.page-hero .subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 50ch;
  margin: 0 auto;
  font-style: italic;
}

/* ── Section Cards (Homepage) ─────────────────────────────── */
.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
  padding: var(--space-16) 0 var(--space-16);
}

.section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.section-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.section-card__icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.section-card__title {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.section-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
  max-width: none;
}

.section-card__count {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ── Article / Content Page ───────────────────────────────── */
.article-layout {
  padding: var(--space-12) 0 var(--space-24);
}

.article-header {
  max-width: var(--content-width);
  margin: 0 auto var(--space-12);
  padding: 0 var(--space-6);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.article-meta .tag {
  background: var(--color-tag-bg);
  color: var(--color-accent);
  font-weight: 500;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  text-decoration: none;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.article-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Wide elements break out of the narrow column */
.article-body .wide {
  max-width: var(--wide-width);
  margin-left: 50%;
  transform: translateX(-50%);
  padding: 0 var(--space-6);
}

/* ── Prose Styles ─────────────────────────────────────────── */
.prose h2:first-child,
.prose h3:first-child { margin-top: 0; }

.prose ul, .prose ol {
  padding-left: var(--space-8);
  margin-bottom: var(--space-6);
}
.prose li { margin-bottom: var(--space-2); }

.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-12) 0;
}

/* Blockquote — for quotes section and pull-quotes */
.prose blockquote,
blockquote {
  border-left: 3px solid var(--color-accent);
  margin: var(--space-8) 0;
  padding: var(--space-4) var(--space-6);
  background: var(--color-tag-bg);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-style: italic;
  color: var(--color-text);
}
.prose blockquote p,
blockquote p { margin-bottom: var(--space-2); max-width: none; }

.prose blockquote cite,
blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-style: normal;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--color-text-muted);
}
.prose blockquote cite::before { content: "— "; }

/* Standalone pull-quote variant */
.pull-quote {
  font-size: var(--text-xl);
  line-height: 1.5;
  font-style: italic;
  color: var(--color-accent);
  border-left: none;
  border-top: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  background: none;
  padding: var(--space-6) 0;
  margin: var(--space-12) 0;
  border-radius: 0;
}

/* ── Images ───────────────────────────────────────────────── */
.article-body figure {
  margin: var(--space-10, 2.5rem) 0;
}

.article-body figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.article-body figcaption {
  margin-top: var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  font-style: italic;
}

/* ── YouTube / Video Embeds ───────────────────────────────── */
.video-embed {
  margin: var(--space-10, 2.5rem) 0;
}

.video-embed__label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.video-embed__label::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 12px;
  background: #ff0000;
  border-radius: 3px;
}

/* 16:9 responsive wrapper */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: #000;
}
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed figcaption {
  margin-top: var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
}

/* ── Post List (section index pages) ─────────────────────── */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.post-list-item {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-6) 0;
}
.post-list-item:first-child { border-top: 1px solid var(--color-border); }

.post-list-item a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--space-4);
  text-decoration: none;
  color: inherit;
}
.post-list-item a:hover .post-title { color: var(--color-accent); }

.post-title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text);
  transition: color var(--transition);
}

.post-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  font-style: italic;
  grid-column: 1 / -1;
}

.post-date {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ── Tags ─────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
}

.tag {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--color-tag-bg);
  color: var(--color-accent);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background var(--transition), color var(--transition);
}
.tag:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

/* ── Section Page Header ──────────────────────────────────── */
.section-hero {
  padding: var(--space-12) 0 var(--space-8);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-8);
}

.section-hero__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) 0;
  margin-top: var(--space-16);
}

.footer-inner {
  max-width: var(--site-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.footer-copy {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer-nav {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}
.footer-nav a {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.footer-nav a:hover { color: var(--color-accent); }

/* ── Books: Filter Pills ──────────────────────────────────── */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.filter-pill {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  line-height: 1;
}
.filter-pill:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}
.filter-pill.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* ── Books: Favorites Shelf ───────────────────────────────── */
.book-shelf {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-12);
  scrollbar-width: none;
}
.book-shelf::-webkit-scrollbar { display: none; }

.book-card {
  flex: 0 0 140px;
  text-decoration: none;
  color: inherit;
}
.book-card:hover .book-cover { opacity: 0.85; }

.book-cover {
  width: 140px;
  height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: flex-end;
  padding: var(--space-3);
  position: relative;
  overflow: hidden;
  transition: opacity var(--transition);
}

/* Decorative spine line on every cover */
.book-cover::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: rgba(0,0,0,0.15);
}

.book-cover__title {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.book-card__author {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.book-card__note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Books: Full List ─────────────────────────────────────── */
.book-list {
  border-top: 1px solid var(--color-border);
}

.book-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition);
}
.book-list-item:hover { opacity: 0.65; }
.book-list-item.is-hidden { display: none; }

.book-list-item__title {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: var(--space-1);
}

.book-list-item__author {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.book-list-item__note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  line-height: 1.5;
}

.book-list-item__tag {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--color-tag-bg);
  color: var(--color-accent);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

/* ── Utilities ────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--color-text-muted); }
.font-sans  { font-family: var(--font-sans); }
.font-serif { font-family: var(--font-serif); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --text-base: 1.0625rem; /* 17px on mobile */
  }

  h1 { font-size: clamp(1.875rem, 8vw, 2.5rem); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }

  .nav-inner { padding: 0 var(--space-4); }

  /* Collapse nav on mobile */
  .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-4);
    gap: 0;
    box-shadow: var(--shadow-md);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
  }

  .nav-toggle { display: block; }

  .sections-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .page-hero { padding: var(--space-10) 0 var(--space-8); }

  .container,
  .container--narrow,
  .container--wide { padding: 0 var(--space-4); }

  .article-header,
  .article-body { padding: 0 var(--space-4); }

  .article-body .wide {
    padding: 0 var(--space-4);
  }

  .post-list-item a { grid-template-columns: 1fr; }
  .post-date { font-size: var(--text-xs); }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .page-hero { padding: var(--space-8) 0 var(--space-6); }
  .sections-grid { padding: var(--space-8) 0 var(--space-12); }
}
