/* [family16] Family Recipe Book, Photo Journal and Study Room (public/recipes.js, journal.js,
   study.js, family-photos.js). Colors and sizes from the shared tokens (docs/DESIGN.md). */

.f16 { max-width: 820px; width: 100%; margin: 0 auto; display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
.f16 .p-section { min-width: 0; }
.f16-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.f16-row--center { justify-content: center; }
.f16-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.f16-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: var(--space-3); }
.f16-privacy { display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; color: var(--ink-muted); font-size: var(--text-sm); }
.f16-privacy > svg { flex: none; margin-top: 2px; }

/* ---------- photos ---------- */

.f16-thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--surface-sunken); display: block; }
.f16-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.f16-hero { border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-sunken); box-shadow: var(--shadow-1); }
.f16-hero img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: var(--surface-sunken); }
.f16-pick { display: grid; gap: var(--space-2); }
.f16-pick-preview { min-height: 96px; border: 2px dashed var(--line-strong); border-radius: var(--radius-md); display: grid; place-items: center; overflow: hidden; background: var(--surface-sunken); }
.f16-pick-preview img { display: block; max-width: 100%; max-height: 280px; width: auto; height: auto; object-fit: contain; }

.f16-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: var(--space-2); }
.f16-grid-item {
  display: grid; grid-template-rows: auto auto; border-radius: var(--radius-md); overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none; min-width: 0;
}
.f16-grid-item img, .f16-grid-empty { width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; display: grid; place-items: center; background: var(--surface-sunken); }
.f16-grid-cap { padding: 6px 8px; font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f16-grid-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.f16-strip { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 2px; }
.f16-strip-item { flex: none; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--surface-sunken); }
.f16-strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.f16-date { display: flex; align-items: center; gap: var(--space-2); margin: 0; color: var(--ink-muted); font-weight: var(--weight-strong); }
.f16-caption { margin: 0; font-size: var(--text-lg); white-space: pre-wrap; overflow-wrap: anywhere; }

.f16-decide { display: grid; gap: var(--space-2); border: 2px solid var(--accent); }
.f16-decide p { margin: 0; }
.f16-review { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-3); align-items: start; }
.f16-review p { margin: 0; overflow-wrap: anywhere; }
.f16-review-pic { display: block; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-sunken); }
.f16-review-pic img { display: block; width: 100%; height: auto; }
@media (max-width: 420px) { .f16-review { grid-template-columns: minmax(0, 1fr); } .f16-review-pic { max-width: 220px; } }

/* ---------- Recipe Book ---------- */

.f16-recipe-head { display: grid; gap: 4px; }
.f16-title { margin: 0; font: var(--weight-display) var(--text-xl) / var(--leading-tight) var(--font-display); overflow-wrap: anywhere; }
.f16-source { margin: 0; font: 700 1.35rem / 1.2 var(--font-hand); color: var(--accent-text); }
:where([data-skin="teen"], [data-skin="grown"]) .f16-source { font: var(--weight-strong) var(--text-md) / 1.3 var(--font-body); }
.f16-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.f16-ingredients, .f16-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; overflow-wrap: anywhere; }
.f16-steps li::marker { font-weight: var(--weight-display); color: var(--accent-text); }
.f16-ingredients li.is-done { color: var(--ink-muted); text-decoration: line-through; }
.f16-notes { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.f16-editor textarea.ui-input { min-height: 88px; resize: vertical; }

/* Cook together: one big step at a time. */
.f16-cook { gap: var(--space-4, 16px); }
.f16-cook-lights { display: flex; justify-content: center; overflow-x: auto; overflow-y: hidden; }
.f16-cook-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-2, var(--shadow-1)); padding: var(--space-4, 16px); display: grid; gap: var(--space-3); min-height: 240px; align-content: start; }
.f16-cook-step { margin: 0; font: var(--weight-display) var(--text-xl) / 1.2 var(--font-display); }
.f16-cook-count { margin: 0; color: var(--ink-muted); font-weight: var(--weight-strong); }
.f16-cook-text { margin: 0; font-size: var(--text-lg); overflow-wrap: anywhere; }
.f16-cook-big { font: var(--weight-display) clamp(22px, 5.5vw, 32px) / 1.3 var(--font-display); }
.f16-cook-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.f16-cook-nav .ui-btn { justify-content: center; }
.f16-cook-nav .ui-btn:last-child { flex-direction: row-reverse; }
.f16-checks { display: grid; gap: var(--space-2); }
.f16-check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; overflow-wrap: anywhere; }
.f16-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.f16-check-box {
  flex: none; width: 32px; height: 32px; border-radius: 10px; border: 2.5px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; color: transparent; transition: background var(--dur-fast), border-color var(--dur-fast);
}
.f16-check-box svg { width: 20px; height: 20px; }
.f16-check input:checked + .f16-check-box { background: var(--success); border-color: var(--success); color: #fff; }
.f16-check input:focus-visible + .f16-check-box { outline: 3px solid var(--focus); outline-offset: 2px; }
.f16-check--big { font: var(--weight-display) var(--text-lg) / 1.2 var(--font-display); }
.f16-check--big .f16-check-box { width: 44px; height: 44px; border-radius: 14px; }

/* ---------- Study Room ---------- */

.f16-timer { display: grid; gap: var(--space-3); justify-items: center; }
.f16-timer-face { position: relative; width: min(240px, 70vw); aspect-ratio: 1; }
.f16-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.f16-ring-bg { fill: none; stroke: var(--surface-sunken); stroke-width: 8; }
.f16-ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }
.f16-ring.is-break .f16-ring-fg { stroke: var(--success); }
@media (prefers-reduced-motion: reduce) { .f16-ring-fg { transition: none; } }
.f16-timer-read { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.f16-timer-time { font: var(--weight-display) clamp(36px, 11vw, 52px) / 1 var(--font-display); font-variant-numeric: tabular-nums; }
.f16-timer-say { color: var(--ink-muted); font-weight: var(--weight-strong); }
.f16-timer-controls { display: grid; gap: var(--space-3); justify-items: center; width: 100%; }
.f16-todos { display: grid; gap: 2px; }
.f16-todo { display: flex; align-items: center; gap: var(--space-2); justify-content: space-between; }
.f16-todo .f16-check { flex: 1; min-width: 0; }
.f16-todo.is-done .f16-check > span:last-child { color: var(--ink-muted); text-decoration: line-through; }
.f16-add { display: flex; gap: var(--space-2); }
.f16-add .ui-input { flex: 1; min-width: 0; }
.f16-notes-box { min-height: 160px; resize: vertical; font-size: var(--text-md); }
.f16-vol { display: flex; align-items: center; gap: var(--space-2); }
.f16-range { flex: 1; min-width: 0; accent-color: var(--accent); min-height: var(--tap); } /* [a11y] shrinks with big text */
.f16-pick-people { display: grid; gap: var(--space-2); }
.f16-person { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; }
.f16-person input { width: 22px; height: 22px; accent-color: var(--accent); }
.f16-lines { display: grid; gap: 6px; max-height: 280px; overflow-y: auto; }
.f16-line { margin: 0; padding: 6px 10px; border-radius: var(--radius-md); background: var(--surface-sunken); overflow-wrap: anywhere; }
.f16-line.is-mine { background: var(--accent-soft); }
.f16-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 96px; align-items: end; }
.f16-bar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; text-align: center; font-size: var(--text-xs); color: var(--ink-muted); }
.f16-bar-fill { align-self: end; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--accent); }

/* ---------- printing a recipe: a clean page ---------- */

@media print {
  body.f16-print .ui-appbar, body.f16-print .ui-tabbar, body.f16-print .f16-noprint, body.f16-print .ui-toasts, body.f16-print .ui-banner { display: none !important; }
  body.f16-print { background: #fff !important; color: #000 !important; }
  body.f16-print .ui-card { box-shadow: none !important; border: 1px solid #ccc; }
  body.f16-print .f16-hero img { max-height: 3.5in; }
  body.f16-print .f16 { max-width: none; }
}

/* [landscape] A phone on its side (wide and short): Cook together keeps the step and the Back and
   Next buttons on one screen (the card scrolls inside when a step is long); the Study Room timer is
   sized by the height. */
@media (orientation: landscape) and (max-height: 500px) {
  .f16-cook { gap: var(--space-2); }
  .f16-cook-card {
    min-height: 0; padding: var(--space-3); overflow-y: auto; overscroll-behavior: contain;
    max-height: calc(100vh - var(--appbar-h) - 170px); max-height: calc(100dvh - var(--appbar-h) - env(safe-area-inset-top, 0px) - 170px);
  }
  .f16-cook-step { font-size: var(--text-lg); }
  .f16-timer-face { width: min(240px, 70vw, 52vh); }
  .f16-timer-time { font-size: clamp(30px, 10vh, 48px); }
}
