/* Brand Kit fonts: specimen cards, the font picker, font files and notes.
   Tokens come from styles.css; the fallbacks keep the share page readable without it. */
.bkf { --bkf-font: inherit; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bkf svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bkf-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bkf-in-font { font-family: var(--bkf-font); }

/* Specimen cards */
.bkf-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bkf-cardwrap { min-width: 0; display: flex; }
.bkf-cardwrap[data-for="heading"] { order: 1; }
.bkf-cardwrap[data-for="body"] { order: 2; }
.bkf-panel-slot { order: 3; grid-column: 1 / -1; min-width: 0; }
.bkf-panel-slot:empty { display: none; }
.bkf-cards.is-none { grid-template-columns: minmax(0, 1fr); }
.bkf-cardwrap:empty { display: none; }
.bkf-card { flex: 1; position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px 18px 16px; border: 1px solid var(--line, #ebe6de); border-radius: var(--radius, 18px); background: var(--surface, #fff); transition: border-color .2s, box-shadow .2s, transform .25s var(--ease, ease); }
.bkf:not(.bkf-readonly) .bkf-card:hover { border-color: var(--line-2, #e2dcd2); box-shadow: var(--shadow-sm, 0 2px 8px rgba(29, 27, 24, .05)); }
.bkf-card.is-open { border-color: var(--ink, #1d1b18); box-shadow: 0 0 0 3px rgba(29, 27, 24, .08); }
.bkf-card:focus-within:has(.bkf-change:focus-visible) { border-color: var(--accent, #e0583a); box-shadow: 0 0 0 4px rgba(224, 88, 58, .14); }
.bkf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.bkf-label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint, #9a948a); }
.bkf-change { height: 28px; padding: 0 12px; border: 1px solid var(--line-2, #e2dcd2); border-radius: 999px; background: var(--surface, #fff); font-family: var(--sans, sans-serif); font-size: 12.5px; font-weight: 600; color: var(--ink-2, #3a3631); cursor: pointer; outline: none; transition: border-color .2s, background .2s; }
/* The whole card opens the picker; the button is the one real control underneath. */
.bkf-change::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.bkf-card .bkf-change::after { border-radius: var(--radius, 18px); }
.bkf-card:hover .bkf-change, .bkf-change:focus-visible { border-color: var(--ink, #1d1b18); background: var(--ink, #1d1b18); color: #fff; }
.bkf-card-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bkf-aa { flex: 0 0 76px; height: 76px; display: grid; place-items: center; border-radius: 16px; background: var(--bg, #faf8f4); border: 1px solid var(--line, #ebe6de); font-size: 40px; line-height: 1; color: var(--ink, #1d1b18); overflow: hidden; }
.bkf-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bkf-family { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--ink, #1d1b18); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bkf-kind { font-size: 12.5px; color: var(--muted, #6f6a62); }
.bkf-card.is-empty .bkf-family { color: var(--muted, #6f6a62); }
.bkf-card.is-empty .bkf-aa { border-style: dashed; color: var(--faint, #9a948a); background: none; }
.bkf-sample { margin: 0; color: var(--ink, #1d1b18); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.bkf-card[data-slot="heading"] .bkf-sample { font-size: 27px; line-height: 1.15; letter-spacing: -.015em; -webkit-line-clamp: 3; }
.bkf-card[data-slot="body"] .bkf-sample { font-size: 15.5px; line-height: 1.55; color: var(--ink-2, #3a3631); -webkit-line-clamp: 4; }
.bkf-scale { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; padding-top: 12px; border-top: 1px dashed var(--line-2, #e2dcd2); }
.bkf-step { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bkf-step-aa { line-height: 1; color: var(--ink, #1d1b18); }
.bkf-step-label { font-family: var(--sans, sans-serif); font-size: 11px; color: var(--faint, #9a948a); white-space: nowrap; }
.bkf-note { position: relative; z-index: 1; display: flex; gap: 7px; align-items: flex-start; margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted, #6f6a62); }
.bkf-note svg { margin-top: 1px; width: 14px; height: 14px; flex-basis: 14px; color: var(--amber, #b27812); }
.bkf-empty { margin: 0; padding: 18px; border: 1px dashed var(--line-2, #e2dcd2); border-radius: var(--radius, 18px); color: var(--muted, #6f6a62); font-size: 14px; }

/* Small text buttons */
.bkf-link { position: relative; z-index: 1; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink, #1d1b18); text-decoration: underline; text-decoration-color: var(--line-2, #e2dcd2); text-underline-offset: 3px; cursor: pointer; }
.bkf-link:hover { text-decoration-color: currentColor; }
.bkf-link.is-danger { color: var(--red, #c23b2a); }
.bkf-link:focus-visible, .bkf-btn:focus-visible, .bkf-chip:focus-visible { outline: 2px solid var(--accent, #e0583a); outline-offset: 2px; }

/* Picker panel: opens inline under the cards so it never clips on small screens. */
.bkf-panel { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line-2, #e2dcd2); border-radius: 18px; background: var(--surface, #fff); box-shadow: var(--shadow-lg, 0 24px 60px -12px rgba(29, 27, 24, .18)); animation: bkf-in .28s var(--ease, ease) both; }
.bkf-panel::before { content: ""; position: absolute; top: -7px; left: 25%; width: 12px; height: 12px; background: var(--surface, #fff); border-left: 1px solid var(--line-2, #e2dcd2); border-top: 1px solid var(--line-2, #e2dcd2); transform: translateX(-50%) rotate(45deg); }
.bkf-panel[data-slot="body"]::before { left: 75%; }
@keyframes bkf-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.bkf-panel-title { margin: 2px 2px 0; font-size: 15px; font-weight: 650; }

.bkf-search { position: relative; display: flex; align-items: center; }
.bkf-search svg { position: absolute; left: 13px; color: var(--faint, #9a948a); pointer-events: none; }
.bkf-search-input, .bkf-input, .bkf-textarea { width: 100%; border: 1px solid var(--line-2, #e2dcd2); border-radius: 12px; background: var(--surface, #fff); font-family: var(--sans, sans-serif); font-size: 15px; color: var(--ink, #1d1b18); outline: none; transition: border-color .2s, box-shadow .2s; }
.bkf-search-input { height: 44px; padding: 0 14px 0 38px; }
.bkf-input { height: 44px; padding: 0 14px; }
.bkf-search-input:focus, .bkf-input:focus, .bkf-textarea:focus { border-color: var(--accent, #e0583a); box-shadow: 0 0 0 4px rgba(224, 88, 58, .12); }

.bkf-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.bkf-cats::-webkit-scrollbar { display: none; }
.bkf-chip { flex: 0 0 auto; height: 30px; padding: 0 12px; border: 1px solid var(--line-2, #e2dcd2); border-radius: 999px; background: var(--surface, #fff); font-size: 12.5px; font-weight: 600; color: var(--ink-2, #3a3631); cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.bkf-chip:hover { border-color: var(--ink, #1d1b18); }
.bkf-chip[aria-pressed="true"] { background: var(--ink, #1d1b18); border-color: var(--ink, #1d1b18); color: #fff; }

.bkf-list { position: relative; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px 4px; }
.bkf-group { position: sticky; top: 0; z-index: 1; padding: 10px 10px 5px; background: var(--surface, #fff); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint, #9a948a); }
.bkf-opt { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 10px; border-radius: 11px; cursor: pointer; }
.bkf-opt.is-active { background: var(--bg, #faf8f4); box-shadow: inset 0 0 0 1px var(--line-2, #e2dcd2); }
.bkf-opt-name { flex: 1; min-width: 0; font-size: 19px; font-weight: 400; line-height: 1.25; color: var(--ink, #1d1b18); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bkf-opt-tag { flex: 0 0 auto; font-family: var(--sans, sans-serif); font-size: 12px; color: var(--faint, #9a948a); }
.bkf-opt svg { color: var(--green, #268a52); }
.bkf-opt.is-current .bkf-opt-name { font-weight: 400; }
.bkf-opt-custom .bkf-opt-name { font-family: var(--sans, sans-serif); font-size: 14.5px; font-weight: 600; white-space: normal; }
.bkf-opt-hint { margin-left: 6px; font-weight: 400; color: var(--faint, #9a948a); }

.bkf-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line, #ebe6de); }
.bkf-foot-end { display: flex; gap: 4px; margin-left: auto; }
.bkf-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid var(--line-2, #e2dcd2); border-radius: 999px; background: var(--surface, #fff); font-family: var(--sans, sans-serif); font-size: 13.5px; font-weight: 600; color: var(--ink, #1d1b18); white-space: nowrap; cursor: pointer; transition: border-color .2s, background .2s; }
.bkf-btn:hover:not(:disabled) { border-color: #d0c8bb; }
.bkf-btn:disabled { opacity: .5; cursor: not-allowed; }
.bkf-btn-ghost { border-color: transparent; background: none; color: var(--muted, #6f6a62); }
.bkf-btn-ghost:hover:not(:disabled) { border-color: transparent; background: rgba(29, 27, 24, .05); color: var(--ink, #1d1b18); }
.bkf-btn-dark { border-color: var(--ink, #1d1b18); background: var(--ink, #1d1b18); color: #fff; }
.bkf-btn-dark:hover:not(:disabled) { border-color: #2c2925; background: #2c2925; }

.bkf-upload { display: flex; flex-direction: column; gap: 8px; }
.bkf-upload-file { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--bg, #faf8f4); font-size: 13.5px; overflow-wrap: anywhere; }
.bkf-muted { color: var(--faint, #9a948a); }
.bkf-field-label, .bkf-notes-label { font-size: 13px; font-weight: 600; color: var(--ink-2, #3a3631); }
.bkf-field-label { margin-top: 4px; }
.bkf-hint { margin: 0; font-size: 12.5px; color: var(--faint, #9a948a); }
.bkf-error { margin: 0; font-size: 13px; color: var(--red, #c23b2a); }
.bkf-upload .bkf-foot { justify-content: flex-end; }

/* Font files */
.bkf-files:empty { display: none; }
.bkf-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.bkf-files-title { font-size: 13px; font-weight: 600; color: var(--ink-2, #3a3631); }
.bkf-file-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.bkf-file { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--line, #ebe6de); border-radius: 999px; background: var(--surface, #fff); font-size: 13px; }
.bkf-file-name { font-size: 15px; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bkf-file-type { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--faint, #9a948a); }
.bkf-files .bkf-error { flex-basis: 100%; }

/* Notes */
.bkf-notes { display: flex; flex-direction: column; gap: 8px; }
.bkf-notes:empty { display: none; }
.bkf-textarea { min-height: 64px; padding: 11px 14px; line-height: 1.55; resize: vertical; }
.bkf-notes-text { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-2, #3a3631); white-space: pre-wrap; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  .bkf-panel { animation: none; }
  .bkf-card { transition: none; }
}

@media (max-width: 560px) {
  .bkf-cards { grid-template-columns: minmax(0, 1fr); }
  /* Stacked cards: the picker opens right under the card it belongs to. */
  .bkf-cards[data-open="heading"] .bkf-panel-slot { order: 2; }
  .bkf-cards[data-open="heading"] .bkf-cardwrap[data-for="body"] { order: 3; }
  .bkf-panel::before, .bkf-panel[data-slot="body"]::before { left: 50%; }
  .bkf-list { max-height: 55vh; }
  .bkf-aa { flex-basis: 64px; height: 64px; font-size: 34px; }
  .bkf-card[data-slot="heading"] .bkf-sample { font-size: 24px; }
}

@media print {
  .bkf-change, .bkf-note .bkf-link, .bkf-panel-slot, .bkf-files { display: none !important; }
  .bkf-card { break-inside: avoid; box-shadow: none; }
}
