/* Beat Recipe front page (Nov 2026 redesign) — built from the approved mockup
   (claude.ai/artifact/8t7rw63fWGJCr2heA3ordz). Drawn by beat-recipe-front.js on the
   real sheet data; the old editor stays mounted underneath (it keeps the sheet synced
   with The Forge) but is hidden. */
html.brf-on #beat-recipe-page { display: none !important; }

.brf { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; color: #1d1b17; background: #0b0f10; border-radius: 16px; overflow: hidden; width: 100%; box-sizing: border-box; }
.brf *, .brf *::before, .brf *::after { box-sizing: border-box; }
.brf button { font-family: inherit; }
.brf .br-btn { transition: filter .15s ease, box-shadow .15s ease; }
.brf .br-btn:hover:not(:disabled) { filter: brightness(1.08); }
.brf .br-btn:disabled { opacity: .55; cursor: wait !important; }
.brf .br-btn:focus-visible, .brf .br-row:focus-visible { outline: 2px solid #e8964f; outline-offset: 2px; }
.brf .br-row { text-decoration: none; color: inherit; cursor: pointer; background: none; border: 0; width: 100%; text-align: left; font: inherit; }
.brf .br-row:hover { background: rgba(232, 150, 79, 0.12); }
@keyframes br-breathe { 0%, 100% { opacity: .7; box-shadow: 0 0 6px rgba(216, 50, 45, .45), 0 0 2px rgba(255, 90, 74, .6); } 50% { opacity: 1; box-shadow: 0 0 22px rgba(255, 60, 50, .9), 0 0 8px rgba(255, 130, 110, .9); } }
.brf .br-redline { height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(216, 50, 45, 0), #d8322d 10%, #ff5a4a 50%, #d8322d 90%, rgba(216, 50, 45, 0)); animation: br-breathe 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .brf .br-redline { animation: none; } }

/* Editable title and producer line on the paper */
.brf [contenteditable="true"] { outline: none; border-radius: 4px; cursor: text; }
.brf [contenteditable="true"]:hover { background: rgba(232, 150, 79, 0.12); }
.brf [contenteditable="true"]:focus { background: rgba(232, 150, 79, 0.18); box-shadow: 0 0 0 2px #e8964f; }

/* Live playhead: the playing bar card, its step column and its song-map cell */
.brf .brf-bar.is-live { background: #fffaf0 !important; border: 2px solid var(--c) !important; box-shadow: 0 0 0 3px var(--c35), 0 10px 24px rgba(0, 0, 0, 0.12) !important; }
.brf .brf-bar.is-live .brf-cell.is-head { background: var(--c45) !important; }
.brf .brf-mapcell.is-live { border: 2px solid #1d1b17 !important; background: var(--c55) !important; }
.brf .brf-phone-bar.is-live { outline: 2px solid #1d1b17; }

/* SHOW: SONG MAP hides the written passes */
.brf[data-view="map"] .brf-passes, .brf[data-view="map"] .brf-redline-wrap { display: none !important; }

/* Status line under the export buttons */
.brf .brf-status { font-size: 11px; line-height: 1.5; color: #ffcf86; min-height: 0; }
.brf .brf-status:empty { display: none; }

/* Phone (from the phone mockup) */
.brf-phone { display: none; }
@media (max-width: 640px) {
  .brf .brf-desktop { display: none !important; }
  .brf .brf-phone { display: flex !important; }
}

/* Print / Save as PDF: a full-size copy of the paper only, letter pages, colours kept */
.brf-print-root { display: none; }
@media print {
  @page { size: letter; margin: 0.35in; }
  body.brf-printing > *:not(.brf-print-root) { display: none !important; }
  /* The app fixes html/body to the screen height; let the sheet run over pages. */
  html:has(body.brf-printing), body.brf-printing { height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; position: static !important; transform: none !important; zoom: 1 !important; }
  body.brf-printing .brf-print-root, body.brf-printing .brf-print-root .brf-paper { width: 100% !important; height: auto !important; max-height: none !important; position: static !important; transform: none !important; }
  body.brf-printing { background: #fff !important; }
  body.brf-printing .brf-print-root { display: block !important; background: transparent !important; border-radius: 0 !important; overflow: visible !important; }
  body.brf-printing .brf-print-root .brf-paper { box-shadow: none !important; border-radius: 0 !important; overflow: visible !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.brf-printing .brf-print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.brf-printing .brf-print-root section, body.brf-printing .brf-print-root .brf-bar { break-inside: avoid; page-break-inside: avoid; }
  body.brf-printing .brf-print-root .br-redline { animation: none !important; box-shadow: none !important; }
  body.brf-printing .brf-print-root [style*="minmax(440px"] { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important; }
}

/* The sheet is laid out for up to 1440px (like the mockup), not the old 940px frame.
   Fill the screen at any View Config zoom, centred, like the Workstation board. */
html.brf-on:not(.ws-phone) .heritage-ui #root#root .anvil-studio-board-shell:has(> .w-full > .brf) {
  max-width: min(1440px, calc(100% / var(--ws-board-zoom, 1))) !important;
  width: min(1440px, calc(100% / var(--ws-board-zoom, 1))) !important;
  margin-left: calc((100% - min(1440px, 100% / var(--ws-board-zoom, 1))) / 2) !important;
  margin-right: calc((100% - min(1440px, 100% / var(--ws-board-zoom, 1))) / 2) !important;
  align-self: auto !important;
  padding: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important;
}
html.brf-on.ws-phone .heritage-ui #root#root .anvil-studio-board-shell:has(> .w-full > .brf) { max-width: 100% !important; padding: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important; }

/* Beat Recipe is its own page, exactly like the mockup: full size (no View Config
   scaling), and none of the Workstation's pieces above it (its pinned transport, the
   note under it, the USB MIDI strip). MIDI hardware stays connected underneath. */
html.brf-on:not(.ws-phone) .heritage-ui #root#root .anvil-studio-board-shell:has(> .w-full > .brf) {
  transform: none !important;
  height: auto !important;
  width: 100% !important;
  max-width: 1440px !important;
  margin: 0 auto 1rem !important;
}
html.brf-on .heritage-ui #root#root .anvil-studio-board-shell:has(> .w-full > .brf) > .ws-transport,
html.brf-on .heritage-ui #root#root .anvil-studio-board-shell:has(> .w-full > .brf) > .wsf-note,
html.brf-on .heritage-ui #root#root .anvil-studio-board-shell:has(> .w-full > .brf) > .w-full > :not(.brf) { display: none !important; }

/* The forge picture in the paper's title row: full size when the row has room,
   smaller on a narrower sheet, hidden when it would push TEMPO onto its own line. */
.brf .brf-paper { container-type: inline-size; }
@container (max-width: 1100px) { .brf .brf-anvil { width: 128px !important; height: 128px !important; } }
@container (max-width: 980px) { .brf .brf-anvil { display: none !important; } }

/* Narrow screens (iPhone duo, small tablets, rotated phones): the tools panel and the
   paper can't sit side by side, so the panel spans the full width above the paper
   with its groups in columns, instead of a 300px strip with empty space beside it. */
.brf .brf-desktop { container-type: inline-size; container-name: brfpage; }
@container brfpage (max-width: 960px) {
  .brf .brf-cols { gap: 14px !important; padding: 14px !important; }
  .brf .brf-aside { flex: 1 1 100% !important; max-width: none !important; display: grid !important; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px !important; align-items: start; }
  .brf .brf-aside-rule { display: none !important; }
  .brf .brf-paper { flex: 1 1 100% !important; }
  .brf .brf-aside > .brf-aside-sec:last-child { grid-column: 1 / -1; }
  .brf .brf-aside > .brf-aside-sec:last-child > div { grid-template-columns: repeat(auto-fill, 28px minmax(170px, 1fr)) !important; }
}

/* One-page print sheet (Nov 2026): see onePage() in beat-recipe-front.js. */
.brf-one.brf-measure { display: block !important; position: absolute !important; left: -20000px !important; top: 0 !important; visibility: hidden !important; }
.brf-one { width: 749px; font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; color: #1d1b17; background: #fff; }
.brf-one, .brf-one * { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.brf1-fit { width: 749px; overflow: hidden; }
.brf1 { width: 749px; transform-origin: 0 0; background: #f6f0e2; padding: 14px 16px 10px; border: 1px solid #d8ccb3; }
.brf1-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 8px; border-bottom: 3px double #2b2419; }
.brf1-top small { font-size: 9px; font-weight: 800; letter-spacing: .22em; color: #7a3d12; }
.brf1-top h1 { margin: 2px 0 2px; font: 900 26px/1.05 Inter, system-ui, sans-serif; color: #1d1b17; }
.brf1-top span { font-size: 10px; color: #4a4033; }
.brf1-top dl { display: grid; grid-template-columns: repeat(4, auto); grid-auto-flow: column; grid-template-rows: auto auto; gap: 1px 16px; margin: 0; }
.brf1-top dt { font-size: 8px; font-weight: 800; color: #6b5d48; }
.brf1-top dd { margin: 0; font-size: 13px; font-weight: 800; }
.brf1-map { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 7px 0; border-bottom: 1px solid #d8ccb3; font-size: 10px; }
.brf1-map > b { font-size: 9px; letter-spacing: .12em; margin-right: 6px; }
.brf1-chip { padding: 2px 6px; border: 1.5px solid #2b2419; border-radius: 4px; font-weight: 800; font-size: 10px; }
.brf1-arrow { color: #8a7a60; }
.brf1-sec { margin-top: 7px; padding: 5px 6px 6px; border-radius: 6px; border: 1px solid #d8ccb3; border-left: 5px solid var(--c); background: #fbf7ee; break-inside: avoid; }
.brf1-sec header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 4px; font-size: 9px; font-weight: 800; color: #4a4033; }
.brf1-sec header b { font-size: 11px; color: #1d1b17; letter-spacing: .04em; }
.brf1-mark { display: inline-grid; place-items: center; min-width: 22px; height: 16px; padding: 0 4px; border: 1.5px solid #1d1b17; border-radius: 3px; font-size: 9px; font-weight: 900; color: #1d1b17; }
.brf1-plays { margin-left: auto; padding: 1px 6px; border-radius: 3px; background: #2b2419; color: #f6f0e2 !important; }
.brf1-bars { display: grid; gap: 5px; }
.brf1-bar { padding: 3px 4px 4px; border: 1px solid #e0d5bc; border-radius: 4px; background: #fff; min-width: 0; }
.brf1-barhead { display: flex; justify-content: space-between; gap: 4px; font-size: 9px; color: #6b5d48; margin-bottom: 2px; white-space: nowrap; }
.brf1-barhead b { color: #1d1b17; }
.brf1-grid { display: grid; align-items: stretch; }
.brf1-grid em { font-style: normal; font-size: 8px; font-weight: 800; color: #4a4033; padding-right: 2px; line-height: 13px; white-space: nowrap; overflow: hidden; }
.brf1-grid i { font-style: normal; height: 13px; line-height: 13px; text-align: center; font-size: 9px; font-weight: 800; border-left: 1px solid #ece3d0; border-bottom: 1px solid #ece3d0; overflow: hidden; white-space: nowrap; }
.brf1-grid i.b { border-left: 1px solid #8a7a60; }
.brf1-grid i.on { background: rgba(255, 181, 71, .28); color: #1d1b17; }
.brf1-grid i sup { font-size: 5px; vertical-align: top; line-height: 0; }
.brf1-grid em.brf1-none { grid-column: 1 / -1; color: #8a7a60; }
.brf1-key { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 8px; padding-top: 6px; border-top: 1px solid #d8ccb3; font-size: 8.5px; color: #4a4033; }
.brf1-key b { color: #1d1b17; }
.brf1-foot { margin-top: 4px; font-size: 7.5px; color: #8a7a60; text-align: right; }
@media print {
  body.brf-printing .brf-print-root.brf-one { width: 749px !important; height: auto !important; page-break-after: avoid; break-after: avoid; }
}

/* iPhone Duo / small tablets (Nov 2026): the tools panel packs into columns with no empty
   cells. Upright: TRANSPORT, FEEL and SHOW stack beside SAVE · EXPORT · SEND. On its side:
   TRANSPORT | FEEL over SHOW | SAVE · EXPORT · SEND. The symbol key runs underneath. */
@container brfpage (max-width: 960px) {
  .brf .brf-aside { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-template-areas: "transport export" "feel export" "show export" "key key"; grid-template-rows: auto auto 1fr auto; align-items: start; }
  .brf .brf-a-transport { grid-area: transport; }
  .brf .brf-a-feel { grid-area: feel; }
  .brf .brf-a-show { grid-area: show; }
  .brf .brf-a-export { grid-area: export; }
  .brf .brf-aside > .brf-a-key { grid-area: key; grid-column: 1 / -1; }
}
@container brfpage (min-width: 760px) and (max-width: 960px) {
  .brf .brf-aside { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) !important; grid-template-areas: "transport feel export" "transport show export" "key key key"; grid-template-rows: auto 1fr auto; }
}
