/* ==========================================================================
   home.css: the sections below the hero (Projects, Articles, Journals, Books)
   restyled to match the Paper & Ink hero. Loaded only on the home page.
   No markup changes: this file only overrides the .bento-* rules in style.css.
   To undo: stop enqueuing this file (inc/articles-assets.php).
   ========================================================================== */

/* ---------- Layout: no overlap with the hero, no boxes ---------- */
.home-bento {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px 24px clamp(56px, 8vw, 96px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "topics"
    "proj"
    "bk";
  gap: 64px;
}

.home-bento .bento-tile {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
.home-bento .bento-tile:hover { transform: none; }

/* ---------- Section heading: ink rule, serif title, mono "View all" ---------- */
.home-bento .bento-head {
  align-items: baseline;
  margin: 0 0 22px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}
.home-bento .bento-head .section-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}
.home-bento .bento-head .section-title a { color: var(--ink); }
.home-bento .bento-head .section-title a:hover { color: var(--chinar-ink); }
.home-bento .bento-viewall {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0;
}
.home-bento .bento-viewall:hover { color: var(--chinar); }
.home-bento .bento-empty { font-family: var(--font-serif); font-style: italic; color: var(--muted); }

/* ---------- Read by topic (index of article categories) ---------- */
.home-bento .bento-tile--topics { grid-area: topics; }
.home-bento .topic-index { list-style: none; margin: 0; padding: 0; }
.home-bento .topic-index li { margin: 0; border-bottom: 1px solid var(--border); }
.home-bento .topic-index li:first-child { border-top: 0; }
.home-bento .topic-row {
  display: grid;
  grid-template-columns: 40px minmax(150px, 250px) minmax(0, 1fr) auto 18px;
  column-gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  color: var(--ink);
}
.home-bento .topic-row__num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.home-bento .topic-row__name {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}
.home-bento .topic-row__desc {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-bento .topic-row__count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.home-bento .topic-row__arrow { color: var(--muted); transition: transform 0.2s ease, color 0.15s ease; }
.home-bento .topic-row:hover .topic-row__name { color: var(--chinar-ink); }
.home-bento .topic-row:hover .topic-row__arrow { color: var(--chinar); transform: translateX(4px); }

/* ==========================================================================
   Projects + Books: matching "catalogue" cards
   Warm paper panel, hairline border, serif titles, ink buttons.
   ========================================================================== */
:root {
  --panel: #FBF8F1;                       /* a touch lighter than the page */
  --panel-shadow: 0 1px 2px rgba(27,23,20,.04), 0 12px 28px -18px rgba(27,23,20,.28);
}

/* shared button: solid ink, square-ish, chinar on hover */
.home-bento .bento-project-cta,
.home-bento .bento-mini-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 18px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.home-bento .bento-project-cta svg,
.home-bento .bento-mini-cta svg { transition: transform .18s ease; }
.home-bento .bento-project-cta:hover,
.home-bento .bento-tile--books .bento-mini-cta:hover,
.home-bento .bento-tile--courses .bento-mini-cta:hover {
  background: var(--chinar);
  border-color: var(--chinar);
  color: #fff;
}
.home-bento .bento-project-cta:hover svg,
.home-bento .bento-mini-cta:hover svg { transform: translateX(3px); }
.home-bento .bento-project-cta:focus-visible,
.home-bento .bento-mini-cta:focus-visible { outline: 2px solid var(--chinar); outline-offset: 3px; }

/* ---------- Projects ---------- */
.home-bento .bento-projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}
.home-bento .bento-project {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--panel-shadow);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.home-bento .bento-project:hover {
  transform: none;
  border-color: #CFC4AE;
  box-shadow: 0 1px 2px rgba(27,23,20,.05), 0 18px 34px -18px rgba(27,23,20,.34);
}
.home-bento .bento-project-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--paper-2);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}
.home-bento .bento-project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.home-bento .bento-project:hover .bento-project-thumb img { transform: scale(1.025); }
.home-bento .bento-project-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 26px 26px;
}
.home-bento .bento-project-meta {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chinar);
}
.home-bento .bento-project-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.home-bento .bento-project-title a { color: var(--ink); }
.home-bento .bento-project-title a:hover { color: var(--chinar-ink); }
.home-bento .bento-project-excerpt {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* a single project: image left, text right */
.home-bento .bento-projects-grid:has(.bento-project:only-child) { grid-template-columns: minmax(0, 1fr); }
.home-bento .bento-project:only-child {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
}
.home-bento .bento-project:only-child .bento-project-thumb {
  aspect-ratio: auto;
  min-height: 280px;
  height: 100%;
  border-bottom: 0;
  border-right: 1px solid var(--border);
}
.home-bento .bento-project:only-child .bento-project-body {
  justify-content: center;
  padding: 36px 40px;
}
.home-bento .bento-project:only-child .bento-project-title { font-size: 1.7rem; }

/* ---------- Books ---------- */
.home-bento .bento-tile--books .bento-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 200px));
  gap: 40px 32px;
}
.home-bento .bento-tile--books .bento-mini-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.home-bento .bento-mini-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--paper-2);
  border: 0;
  border-radius: 2px 5px 5px 2px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(27,23,20,.14), 0 18px 28px -14px rgba(27,23,20,.5);
  transition: transform .25s ease, box-shadow .25s ease;
}
/* soft spine highlight on the left edge, like a bound book */
.home-bento .bento-mini-thumb::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0,0,0,.2), rgba(255,255,255,.14) 55%, rgba(0,0,0,0));
  pointer-events: none;
}
.home-bento .bento-mini-card:hover .bento-mini-thumb {
  transform: translateY(-3px);
  box-shadow: 0 3px 6px rgba(27,23,20,.16), 0 24px 34px -14px rgba(27,23,20,.55);
}
.home-bento .bento-tile--books .bento-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }

.home-bento .bento-mini-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.home-bento .bento-mini-title,
.home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.home-bento .bento-tile--books .bento-mini-title a { color: var(--ink); }
.home-bento .bento-tile--books .bento-mini-title a:hover { color: var(--chinar-ink); }
.home-bento .bento-mini-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.home-bento .bento-mini-format { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.66rem; }
.home-bento .bento-mini-format + .bento-mini-price::before { content: "·"; margin-right: 10px; color: var(--border); }
.home-bento .bento-tile--books .bento-mini-price,
.home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-price {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.home-bento .bento-mini-excerpt { display: none; }
.home-bento .bento-tile--books .bento-mini-cta { margin-top: 14px; padding: 9px 15px; font-size: 0.78rem; }

/* a single book: framed panel, cover left, details right (matches the project card) */
.home-bento .bento-tile--books .bento-mini-grid:has(.bento-mini-card:only-child) { grid-template-columns: minmax(0, 1fr); }
.home-bento .bento-tile--books .bento-mini-card:only-child {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 40px;
  padding: 32px 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--panel-shadow);
}
.home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-title { font-size: 1.7rem; }
.home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-meta { margin-top: 12px; }
.home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 14px 0 0;
  max-width: 52ch;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
}
.home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-cta { margin-top: 20px; padding: 10px 18px; font-size: 0.82rem; }

/* ---------- Tablets and phones ---------- */
@media (max-width: 860px) {
  .home-bento {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "topics" "proj" "bk";
    gap: 48px;
    margin-top: 0;
    padding-left: 20px;
    padding-right: 20px;
  }
  .home-bento .bento-project:only-child .bento-project-body { padding: 28px 28px; }
  .home-bento .bento-tile--books .bento-mini-card:only-child { gap: 28px; padding: 26px 28px; grid-template-columns: 150px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .home-bento .topic-row {
    grid-template-columns: 32px minmax(0, 1fr) 18px;
    grid-template-areas:
      "num name arrow"
      ".   desc desc"
      ".   count count";
    row-gap: 6px;
    padding: 18px 0;
  }
  .home-bento .topic-row__num   { grid-area: num; }
  .home-bento .topic-row__name  { grid-area: name; font-size: 1.35rem; }
  .home-bento .topic-row__desc  { grid-area: desc; font-size: 0.95rem; }
  .home-bento .topic-row__count { grid-area: count; }
  .home-bento .topic-row__arrow { grid-area: arrow; }

  /* Projects: stack image over text */
  .home-bento .bento-projects-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .home-bento .bento-project:only-child { display: flex; flex-direction: column; }
  .home-bento .bento-project:only-child .bento-project-thumb {
    aspect-ratio: 16 / 9;
    min-height: 0;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .home-bento .bento-project-body,
  .home-bento .bento-project:only-child .bento-project-body { padding: 20px 20px 22px; }
  .home-bento .bento-project-title,
  .home-bento .bento-project:only-child .bento-project-title { font-size: 1.3rem; }
  .home-bento .bento-project-excerpt { font-size: 0.96rem; -webkit-line-clamp: 4; }
  .home-bento .bento-project-cta { margin-top: 16px; }

  /* Books: single book stays side by side, compact */
  .home-bento .bento-tile--books .bento-mini-card:only-child {
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: start;
    gap: 20px;
    padding: 18px;
  }
  .home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-title { font-size: 1.2rem; }
  .home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-excerpt { font-size: 0.92rem; -webkit-line-clamp: 3; margin-top: 10px; }
  .home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-cta { margin-top: 14px; padding: 10px 16px; }
}
@media (max-width: 560px) {
  .home-bento .bento-head .section-title { font-size: 1.35rem; }
  .home-bento .bento-viewall { font-size: 0.64rem; }
  .home-bento .bento-tile--books .bento-mini-grid:not(:has(.bento-mini-card:only-child)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 18px;
  }
}
@media (max-width: 359px) {
  /* very small phones: stack the single book, cover centred above details */
  .home-bento .bento-tile--books .bento-mini-card:only-child {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 18px;
  }
  .home-bento .bento-tile--books .bento-mini-card:only-child .bento-mini-thumb { width: 140px; }
}