/* ========================================
   CHOCOLATE PAGES ("chocolates I have known and loved")
   layout: _includes/chocolate-post.njk, posts in chocolate/*.md
   ======================================== */

body.chocolate {
  --cocoa-page: #2a170e;      /* the table the bar sits on */
  --cocoa-groove: #3b2013;    /* the lines between squares */
  --cocoa: #5e3520;           /* face of a square */
  --cocoa-light: #85502f;     /* top/left bevel */
  --cocoa-dark: #2c160b;      /* bottom/right bevel */
  --cream: #f4e4c8;
  --cream-dim: #c9a882;
  --wrapper: #b83b4a;
  --wrapper-dark: #8e2a37;
  --bar-width: 250px;
  background: var(--cocoa-page);
  color: var(--cream);
}

.choc-back {
  position: fixed; top: 1.2rem; left: 1.6rem;
  color: var(--cream); font-size: 1rem; z-index: 2;
  background: var(--cocoa-page); padding: 0.1rem 0.4rem;
}
.choc-back:hover { color: #fff; }

/* --- page title across the top --- */
.choc-title {
  padding: 4.5rem 20vw 0 23vw;
}
.choc-tagline { color: var(--cream-dim); margin: 0.6rem 0 0; }
.choc-title h1 {
  border: none;
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.15;
  text-shadow: 4px 4px 0 var(--cocoa-dark);
}

/* --- post on the left, bar on the right --- */
.choc-page {
  display: flex;
  align-items: flex-start;
  gap: 4rem;
  padding: 2.5rem 32vw 5rem 23vw; /* text column: from 23% to 68% across */
}

.choc-bar {
  /* pinned near the right edge, top level with the page title; stays put while you scroll */
  position: fixed;
  top: 4.5rem;
  right: calc(16vw - var(--bar-width) / 2); /* centered in the strip right of the text */
  width: var(--bar-width);
  filter: drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.35));
}

.squares {
  list-style: none;
  margin: 0;
  padding: 8px;
  background: var(--cocoa-groove);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.square {
  position: relative;
  margin: 0;
  height: 130px;
  padding: 0.7rem 0.75rem;
  background: var(--cocoa);
  box-shadow:
    inset 5px 5px 0 var(--cocoa-light),
    inset -5px -5px 0 var(--cocoa-dark);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.2rem;
  transition: transform 0.12s steps(2);
}
.square > a {
  color: var(--cream-dim);
  font-size: 0.8rem;
  line-height: 1.2;
}
.square > a::after { content: ""; position: absolute; inset: 0; } /* whole square clicks */
.square > a:hover { color: #fff; text-decoration: none; }
.square:not(.blank):hover { transform: translateY(-3px); }

/* the one you're reading: somebody took a bite */
.square.bitten {
  -webkit-mask:
    radial-gradient(circle at calc(100% + 4px) 20px, #0000 20px, #000 21px),
    radial-gradient(circle at calc(100% - 24px) -6px, #0000 20px, #000 21px);
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle at calc(100% + 4px) 20px, #0000 20px, #000 21px),
    radial-gradient(circle at calc(100% - 24px) -6px, #0000 20px, #000 21px);
  mask-composite: intersect;
}
.square.bitten > a { color: var(--cream); }
.square time { color: var(--cream-dim); font-size: 0.7rem; opacity: 0.8; }

/* --- the posts, one after another --- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.choc-posts {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
}
.choc-post { scroll-margin-top: 2rem; }
.choc-post + .choc-post {
  margin-top: 4rem;
  padding-top: 3.5rem;
  border-top: 8px solid var(--cocoa-groove);
}
.choc-post h2 {
  border: none;
  margin: 0 0 1.5rem;
  font-size: 1.6rem;
}
.choc-post h2:has(+ .choc-subtitle) { margin-bottom: 0.3rem; }
.choc-subtitle { color: var(--cream-dim); margin-bottom: 1.5rem; }
.choc-post img {
  display: block;
  margin: 1.5rem 0;
  border: 6px solid var(--cocoa-groove);
  background: #fff;
}
.choc-post a { color: var(--cream-dim); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .square { transition: none; }
  .square:not(.blank):hover { transform: none; }
}

/* phones: bar goes on top, post underneath */
@media (max-width: 900px) {
  .choc-title { padding: 3.5rem 1.25rem 0; }
  .choc-title h1 { font-size: 1.8rem; }
  .choc-page { flex-direction: column-reverse; gap: 2rem; padding: 1.5rem 1.25rem 4rem; }
  .choc-bar { position: static; flex: none; width: 100%; max-width: var(--bar-width); }
}
