@charset "UTF-8";

/* ============================================================
   Blog — shared stylesheet (hand-authored, no build step).

   1. Design tokens        7. Callouts
   2. Base & reset         8. Lists & links
   3. Layout               9. Pills (tags & badges)
   4. Sidebar             10. Homepage (intro + snippets)
   5. Breadcrumbs         11. Resource listings
   6. Article             12. Responsive
   ============================================================ */

/* 1. Design tokens */
:root {
  /* Base palette */
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #2c2c2c;
  --muted: #6b6b6b;
  --border: #e5e1d8;
  --accent: #3a6ea5;
  --accent-soft: #eaf1f8;

  /* Callouts (aside note & book card) */
  --callout-bg: #f1ede4;
  --callout-fg: #4a4a4a;

  /* Section accents for pills (tags & badges):
     -soft = pill background, base = text, -strong = hover background */
  --cooking-soft: #fbeed1;
  --cooking: #8a5a00;
  --cooking-strong: #d99a1f;

  --finance-soft: #dceceb;
  --finance: #1d6a64;
  --finance-strong: #1d6a64;

  --go-soft: #e8e6e1;
  --go: #474440;
  --go-strong: #474440;

  --tea-soft: #e6efdd;
  --tea: #41703a;
  --tea-strong: #4f7a3f;

  /* Typography */
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* 2. Base & reset */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
}

/* 3. Layout */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 720px);
  gap: 2rem;
  max-width: 1020px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  align-items: start;
}

/* 4. Sidebar navigation */
.sidebar {
  position: sticky;
  top: 2rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.sidebar h2 {
  font-size: 1rem;
  color: var(--text);
  margin: 1.75rem 0 0.5rem;
  font-weight: bold;
  border: none;
  padding: 0;
  letter-spacing: normal;
  text-transform: none;
}

.sidebar h2:first-child {
  margin-top: 0;
}

.sidebar h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 1rem 0 0.4rem 0.5rem;
  font-weight: bold;
  border: none;
  padding: 0;
}

.sidebar h2 a,
.sidebar h3 a {
  color: inherit;
  display: inline-block;
  margin-left: -0.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border-bottom: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar h2 a:hover,
.sidebar h2 a.active,
.sidebar h3 a:hover,
.sidebar h3 a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar ul {
  list-style: none;
  margin: 0 0 0 0.5rem;
  padding: 0;
}

.sidebar-content > ul:first-child {
  margin-left: 0;
}

.sidebar-content > ul:first-child > li > a {
  padding-left: 0;
  padding-right: 0;
}

.sidebar-content > ul.sidebar-standalone {
  margin-left: 0;
  margin-top: 1rem;
}

.sidebar li {
  margin-bottom: 0.35rem;
}

.sidebar a {
  border-bottom: none;
  color: var(--text);
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.sidebar a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: bold;
}

.sidebar > summary {
  display: none;
}

/* On desktop, always show content regardless of details open state */
@media (min-width: 1081px) {
  details.sidebar > .sidebar-content {
    display: block !important;
  }
  details.sidebar::details-content {
    display: block !important;
    content-visibility: visible !important;
  }
}

/* 5. Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: -1rem 0 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  border-bottom: none;
  transition: color 0.15s;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumb-sep {
  color: var(--muted);
  font-size: 0.95em;
  user-select: none;
}

.intro .breadcrumbs {
  margin-top: -0.5rem;
}

/* 6. Article — headings, figure & prose */
article {
  max-width: 720px;
  margin: 0;
  padding: 2.5rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

h1 {
  font-size: 2.2rem;
  line-height: 1.2;
  margin: 0 0 2rem;
  color: var(--text);
  border-bottom: 3px solid var(--accent);
  padding-bottom: 1rem;
}

.article-figure {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 6px;
  background: var(--accent-soft);
}

.article-figure-narrow {
  max-width: 350px;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 1.5rem 0 0.75rem;
  color: var(--accent);
  font-weight: normal;
}

p {
  margin: 0 0 1.2rem;
  text-align: justify;
  hyphens: auto;
}

p.lead {
  font-size: 1.05rem;
  color: var(--muted);
  font-style: italic;
}

/* 7. Callouts — aside note (p.aside) & book card (.book-card) share a frame */
p.aside,
.book-card {
  margin: 1.5rem 0 1.5rem 1.5rem;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background: var(--callout-bg);
  color: var(--callout-fg);
}

p.aside {
  font-size: 0.97rem;
}

p.list-label {
  margin-bottom: 0.3rem;
}

p.list-label + ul {
  margin-top: 0;
}

@media (max-width: 600px) {
  p.aside { margin-left: 0; }
}

.book-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  font-size: 0.95rem;
}

.book-card img {
  width: 90px;
  height: auto;
  flex-shrink: 0;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.book-card-body {
  flex: 1;
  min-width: 0;
}

.book-card-title {
  font-weight: bold;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.3;
}

.book-card-author {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.book-card-desc {
  margin: 0 0 0.6rem;
  line-height: 1.5;
  text-align: left;
  hyphens: none;
}

.book-card-link {
  font-size: 0.9rem;
  font-weight: bold;
}

@media (max-width: 600px) {
  .book-card { margin-left: 0; flex-direction: column; align-items: center; text-align: center; }
  .book-card-desc { text-align: left; }
  .book-card img { width: 110px; }
}

/* 8. Lists & links */
ul li {
  margin-bottom: 0.4rem;
}

ul li:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.2s;
}

a:hover {
  border-bottom-color: var(--accent);
}

em.ref {
  color: var(--muted);
  font-style: italic;
}

/* 9. Pills — tags are links (with hover); badges are static labels.
   Both share one pill shape; section colors come from the tokens above. */
.tags,
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  padding: 0;
  list-style: none;
}

.tags li,
.badges li {
  margin: 0;
}

.tags a,
.badges li {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: none;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.tags a:hover {
  background: var(--accent);
  color: #fff;
}

.tags-cooking a,
.badges-cooking li { background: var(--cooking-soft); color: var(--cooking); }
.tags-cooking a:hover { background: var(--cooking-strong); color: #fff; }

.tags-finance a,
.badges-finance li { background: var(--finance-soft); color: var(--finance); }
.tags-finance a:hover { background: var(--finance-strong); color: #fff; }

.tags-go a,
.badges-go li { background: var(--go-soft); color: var(--go); }
.tags-go a:hover { background: var(--go-strong); color: #fff; }

.tags-tea a,
.badges-tea li { background: var(--tea-soft); color: var(--tea); }
.tags-tea a:hover { background: var(--tea-strong); color: #fff; }

/* 10. Homepage — intro & snippets */
.home {
  max-width: 720px;
}

.home .intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 2rem 2rem 1.5rem;
  margin-bottom: 1.5rem;
}

.home .intro h1 {
  margin-top: 0;
}

.snippets {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.snippet {
  display: flex;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 1.25rem;
  align-items: flex-start;
}

.snippet-thumb {
  flex-shrink: 0;
  border-bottom: none;
  display: block;
}

.snippet-thumb img {
  display: block;
  width: 180px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
  background: var(--accent-soft);
}

.snippet-thumb.snippet-thumb-portrait img {
  width: auto;
  max-width: 180px;
  max-height: 260px;
  aspect-ratio: auto;
  object-fit: contain;
}

.snippet-body {
  flex: 1;
  min-width: 0;
}

.snippet-title {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--text);
  font-weight: bold;
  border: none;
  padding: 0;
}

.snippet-title a {
  color: var(--text);
  border-bottom: none;
}

.snippet-title a:hover {
  color: var(--accent);
}

.snippet-perex {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-style: italic;
  text-align: justify;
  hyphens: none;
}

.snippet-date {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--font-sans);
  text-align: left;
  hyphens: none;
}

.snippet-date-label {
  font-weight: bold;
}

@media (max-width: 600px) {
  .snippet {
    flex-direction: column;
    padding: 1rem;
    align-items: center;
    text-align: center;
  }
  .snippet-thumb {
    width: 100%;
  }
  .snippet-thumb img {
    width: 100%;
    height: auto;
  }
  .snippet-thumb.snippet-thumb-portrait img {
    margin-left: auto;
    margin-right: auto;
  }
  .snippet-body {
    width: 100%;
  }
  .snippet-date,
  .snippet-perex {
    text-align: center;
  }
  .tags {
    justify-content: center;
  }
}

/* 11. Resource listings */
.resources {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.resource {
  display: flex;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 1.25rem;
  align-items: flex-start;
}

.resource-media {
  flex-shrink: 0;
}

.resource-media img {
  display: block;
  width: 120px;
  height: auto;
  border-radius: 4px;
  background: var(--accent-soft);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.resource-body {
  flex: 1;
  min-width: 0;
}

.resource-title {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--text);
  font-weight: bold;
  border: none;
  padding: 0;
}

.resource-desc {
  margin: 0 0 0.75rem;
  text-align: justify;
  hyphens: none;
}

.resource-links {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  font-family: var(--font-sans);
}

.resource-links li {
  margin: 0 0 0.3rem;
}

.resource-links li:last-child {
  margin-bottom: 0;
}

.resource-link-type {
  color: var(--muted);
  font-weight: bold;
  margin-right: 0.3rem;
}

.resource-sublabel {
  margin: 0.85rem 0 0.3rem;
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--muted);
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
}

@media (max-width: 600px) {
  .resource {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
  }
  .resource-media img {
    width: 150px;
  }
  .badges {
    justify-content: center;
  }
  .resource-desc {
    text-align: justify;
  }
  .resource-links {
    width: 100%;
  }
}

/* 12. Responsive — layout & small-screen tweaks */
@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem auto;
  }
  .sidebar {
    position: static;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
  }
  .sidebar > summary {
    display: block;
    list-style: none;
    cursor: pointer;
    padding: 0.75rem 1rem;
    font-weight: bold;
    color: var(--accent);
    user-select: none;
  }
  .sidebar > summary::-webkit-details-marker {
    display: none;
  }
  .sidebar > summary::after {
    content: "▾";
    float: right;
    transition: transform 0.2s;
  }
  .sidebar[open] > summary {
    border-bottom: 1px solid var(--border);
  }
  .sidebar[open] > summary::after {
    transform: rotate(180deg);
  }
  .sidebar > .sidebar-content {
    padding: 0.75rem 1rem 1rem;
  }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .layout { padding: 0 1rem; margin: 1rem auto; }
  article { padding: 1.5rem 1.25rem; }
  .home .intro { padding: 1.5rem 1.25rem; }
  .breadcrumbs { margin-top: -0.75rem; }
  h1 { font-size: 1.7rem; }
}
