/* The Batter Diaries — flip-through recipe diary.
   Builds on the --brand/--cream/--gold tokens from store.css.
   This stylesheet only loads on /batter-diaries/, so the override below
   gives the diary its own green identity without touching the shop/blog. */

:root {
  --brand: #3f7d4a;
  --brand-dark: #2c5934;
  --brand-mid: #6f9b6a;
  --gold: #c2a23a;
  --gold-light: #ecdca0;
}

.diary-hero { padding-bottom: 10px; }
.diary-hero .pill--count { font-family: var(--sans); }

.diary-app {
  --diary-w: 1240px;
  --diary-h: clamp(780px, calc(100vh - 380px), 940px);
  max-width: var(--diary-w);
  margin: 10px auto 70px;
  padding: 0 16px;
}

.diary-frame {
  position: relative;
  display: flex;
  gap: 0;
}

/* ---------- the book itself ---------- */

.diary-book {
  position: relative;
  flex: 1;
  height: var(--diary-h);
  perspective: 2400px;
  filter: drop-shadow(0 18px 40px rgba(107, 79, 38, 0.28));
}

.diary-cover-back {
  position: absolute;
  inset: -14px -10px -22px;
  background: linear-gradient(160deg, var(--brand-dark) 0%, var(--brand) 60%, var(--brand-mid) 100%);
  border-radius: 14px;
  z-index: 0;
}
.diary-cover-back::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 10px;
  margin-left: -5px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25) inset;
}

.diary-viewport {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cream);
  z-index: 1;
}

.diary-page {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  backface-visibility: hidden;
  transition: transform 0.85s cubic-bezier(0.45, 0.05, 0.15, 1);
  background: var(--cream);
  will-change: transform;
}
.diary-page.is-flipped { transform: rotateY(-180deg); }

.diary-page::before {
  /* faux page-turn shading, fades in/out with the same timing as the flip */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 40%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.85s ease;
}
.diary-page.is-flipped::before { opacity: 1; }

/* paper texture, shared by every page */
.diary-page__paper {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 255, 255, 0.5), transparent 55%),
    var(--cream);
  border-left: 3px solid var(--cream-deep);
}

/* ---------- cover page ---------- */

.diary-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
}
.diary-cover__badge {
  font-family: 'Caveat', var(--serif);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.diary-cover__title {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 54px);
  color: var(--brand-dark);
  margin: 6px 0 4px;
}
.diary-cover__script {
  font-family: 'Caveat', cursive;
  font-size: 26px;
  color: var(--red);
  margin: 0 0 18px;
}
.diary-cover__desc {
  max-width: 440px;
  color: #5a4a58;
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0 0 22px;
}
.diary-cover__hint {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px dashed var(--gold);
  border-radius: 999px;
  animation: diary-nudge 1.8s ease-in-out infinite;
}
@keyframes diary-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

/* ---------- recipe spread ---------- */

.diary-spread {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  /* minmax(0, 1fr) — not "auto" — forces the single row to the spread's own
     height instead of growing to fit whichever column has more content;
     without the 0 min, a tall column silently overflows past the book's
     edge with no scrollbar because "auto" row tracks size to max-content. */
  grid-template-rows: minmax(0, 1fr);
}

.diary-spread__photos {
  position: relative;
  padding: 26px 18px 26px 30px;
  border-right: 1px dashed var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.diary-spread__stamp {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-mid);
  margin-bottom: 10px;
}
.diary-photogrid-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.diary-photogrid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-content: start;
  overflow-y: auto;
  padding: 4px 4px 10px;
}

.diary-photo-nutrition {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.diary-photo-nutrition h5 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-mid);
  margin: 0 0 6px;
}

.diary-photo {
  position: relative;
  background: var(--white);
  padding: 8px 8px 22px;
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(43, 42, 34, 0.18);
  transform: rotate(var(--tilt, -2deg));
  transition: transform 0.2s ease;
}
.diary-photo:hover { transform: rotate(0deg) scale(1.03); z-index: 2; }
.diary-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  background: var(--cream-deep);
}
.diary-photo__tape {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 46px;
  height: 18px;
  margin-left: -23px;
  background: rgba(231, 201, 135, 0.55);
  border: 1px solid rgba(185, 139, 62, 0.35);
  transform: rotate(-3deg);
}

.diary-photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-mid);
  font-family: var(--sans);
  font-size: 11.5px;
  text-align: center;
  border: 1.5px dashed var(--line);
  box-shadow: none;
  background: var(--cream-deep);
}
.diary-photo--empty span { padding: 0 8px; }

.diary-spread__card {
  position: relative;
  padding: 20px 30px 18px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 12%);
}
.diary-spread__tags { margin-bottom: 8px; }
.diary-spread__tags .pill {
  font-size: 11px;
  padding: 3px 10px;
  margin-right: 6px;
}
.diary-spread__title {
  font-family: var(--serif);
  color: var(--brand-dark);
  font-size: 24px;
  margin: 2px 0 8px;
  line-height: 1.15;
}
.diary-spread__meta {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--brand-mid);
  margin-bottom: 10px;
}
.diary-spread__note {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  line-height: 1.35;
  color: var(--ink);
  border-left: 3px solid var(--gold-light);
  padding-left: 12px;
  margin: 0 0 14px;
}

.diary-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

/* explicit scroll buttons — a page's overflow shouldn't depend on the
   viewer noticing a native scrollbar (macOS hides them until you scroll) */
.diary-scrollbtns {
  position: absolute;
  bottom: 10px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 4;
}
.diary-scrollbtns--photos { bottom: 10px; right: 12px; }
.diary-scrollbtn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--brand);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(43, 42, 34, 0.22);
  transition: background 0.15s ease, transform 0.15s ease;
}
.diary-scrollbtn:hover:not(:disabled) { background: var(--gold-light); transform: translateY(-1px); }
.diary-scrollbtn:disabled { opacity: 0.3; cursor: default; }
.diary-scrollbtns.is-hidden { display: none; }
.diary-scroll h4 {
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 10px 0 6px;
}
.diary-scroll h4:first-child { margin-top: 0; }
.diary-ingredients-wrap { column-count: 2; column-gap: 22px; }
.diary-ingredient-group { margin-bottom: 8px; break-inside: avoid; }
.diary-ingredient-group h5 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-mid);
  margin: 8px 0 2px;
}
.diary-ingredients { list-style: none; margin: 0; padding: 0; }
.diary-ingredients li {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.3;
  padding: 2px 0 2px 20px;
  position: relative;
  break-inside: avoid;
}
.diary-ingredients li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--brand-mid);
  border-radius: 3px;
}
.diary-steps { margin: 0; padding-left: 20px; }
.diary-steps li {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 6px;
  padding-left: 4px;
}

.diary-tips { list-style: none; margin: 0; padding: 0; }
.diary-tips li {
  font-size: 12.5px;
  font-style: italic;
  color: var(--brand-mid);
  line-height: 1.4;
  padding: 2px 0 2px 18px;
  position: relative;
}
.diary-tips li::before {
  content: '·';
  position: absolute;
  left: 4px;
  top: 1px;
  font-style: normal;
  font-weight: 700;
  color: var(--gold);
}

.diary-nutrition__note {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--brand-mid);
}
.diary-nutrition {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 14px;
  font-size: 12.5px;
}
.diary-nutrition th, .diary-nutrition td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.diary-nutrition thead th {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--brand);
}
.diary-nutrition td:first-child { color: var(--brand-mid); }
.diary-nutrition td:not(:first-child), .diary-nutrition th:not(:first-child) {
  text-align: right;
}

/* ---------- controls ---------- */

.diary-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
}
.diary-nav {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--brand);
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}
.diary-nav:hover:not(:disabled) { transform: translateY(-2px); background: var(--gold-light); }
.diary-nav:disabled { opacity: 0.35; cursor: default; }
.diary-pageno {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--brand-mid);
  min-width: 120px;
  text-align: center;
}

/* ---------- ribbon index tabs ---------- */

.diary-index {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 34px;
  margin-left: -1px;
}
.diary-tab {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--cream);
  background: var(--brand-mid);
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 8px 12px 8px 10px;
  max-width: 108px;
  text-align: left;
  cursor: pointer;
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, background 0.15s ease, max-width 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diary-tab:hover { transform: translateX(4px); max-width: 220px; }
.diary-tab.is-active { background: var(--brand); font-weight: 600; }
.diary-tab--cover { background: var(--gold); color: var(--brand-dark); }

/* ---------- CTA below the book ---------- */

.diary-cta {
  max-width: 620px;
  margin: 32px auto 0;
  text-align: center;
  padding: 18px 22px;
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  background: var(--cream-deep);
}
.diary-cta p { margin: 0; font-size: 13.5px; color: #5a4a58; }
.diary-cta strong { color: var(--brand); }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .diary-app { --diary-h: min(88vh, 720px); }
  .diary-frame { flex-direction: column-reverse; }
  .diary-index {
    flex-direction: row;
    overflow-x: auto;
    padding: 0 0 10px;
    margin-left: 0;
  }
  .diary-tab { border-radius: 8px; max-width: none; box-shadow: none; }
  .diary-tab:hover { transform: none; }
  .diary-spread { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .diary-spread__photos { border-right: none; border-bottom: 1px dashed var(--line); padding: 18px; }
  .diary-photogrid { grid-template-columns: repeat(2, 1fr); overflow: visible; }
  .diary-spread__card { padding: 18px; }
}
