/* Brand Kit: logo tiles and the mock Instagram post (static/brand-preview.js).
   Tokens come from styles.css; every var() has a fallback because the public share page may not load it. */

.bkp-logos, .bkp-preview { font-family: var(--sans, system-ui, sans-serif); color: var(--ink, #1d1b18); }
.bkp-logos svg, .bkp-preview svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bkp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Small buttons, local so the module looks the same on the share page */
.bkp-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2, #e2dcd2); background: var(--surface, #fff); color: var(--ink, #1d1b18); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .2s, background .2s, transform .2s var(--ease, ease); }
.bkp-btn:hover:not(:disabled) { border-color: #d0c8bb; transform: translateY(-1px); }
.bkp-btn:disabled { opacity: .5; cursor: not-allowed; }
.bkp-btn svg { width: 15px; height: 15px; }
.bkp-btn-quiet { border-color: transparent; background: none; color: var(--muted, #6f6a62); }
.bkp-btn-quiet:hover:not(:disabled) { color: var(--ink, #1d1b18); background: rgba(29, 27, 24, .05); border-color: transparent; }
.bkp-btn-danger { border-color: transparent; background: var(--red, #c23b2a); color: #fff; }
.bkp-btn-danger:hover:not(:disabled) { border-color: transparent; background: #a93224; }
.bkp-btn:focus-visible, .bkp-drop:focus-visible, .bkp-seg button:focus-visible, .bkp-ig-more-btn:focus-visible { outline: 2px solid var(--accent, #e0583a); outline-offset: 2px; }

.bkp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.bkp-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2, #3a3631); }
.bkp-confirm > span { margin: 0 4px; }
.bkp-error { margin: 8px 0 0; font-size: 13px; color: var(--red, #c23b2a); }

/* ---------- Logo tiles ---------- */
.bkp-main { position: relative; border-radius: var(--radius, 18px); }
.bkp-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bkp-tile { margin: 0; position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; border: 1px solid var(--line, #ebe6de); display: flex; flex-direction: column; }
.bkp-tile.is-light { background: #fff; color: var(--muted, #6f6a62); }
.bkp-tile.is-dark { background: #1d1b18; border-color: #1d1b18; color: rgba(255, 255, 255, .62); }
.bkp-tile.is-brand { background: var(--bkp-tile-bg); border-color: transparent; color: var(--bkp-tile-fg); box-shadow: inset 0 0 0 1px rgba(29, 27, 24, .06); }
.bkp-tile.is-clear { background: conic-gradient(#f1ede6 25%, #fff 0 50%, #f1ede6 0 75%, #fff 0) 0 0 / 16px 16px; color: var(--muted, #6f6a62); }
/* The image is placed absolutely: a % max-height on a grid item has no definite height to resolve against,
   so on short (phone) tiles a big logo overflowed and was cropped. */
.bkp-tile-art { position: relative; flex: 1; min-height: 0; }
.bkp-tile-art img { position: absolute; top: 18px; bottom: 6px; left: 14%; width: 72%; height: calc(100% - 24px); object-fit: contain; }
.bkp-tile figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 0 12px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }
.bkp-tile figcaption em { font-style: normal; font-weight: 500; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkp-tile figcaption em.is-hex { font-family: var(--mono, ui-monospace, monospace); font-size: 10.5px; }
.bkp-tile.is-brand figcaption { opacity: .78; }

/* Drop target over existing logos */
.bkp-drop-hint { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; border: 2px dashed var(--accent, #e0583a); background: rgba(255, 250, 248, .9); color: var(--accent, #e0583a); font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.is-dragging > .bkp-drop-hint { opacity: 1; }

/* Uploading overlay */
.bkp-busy { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: inherit; background: rgba(255, 255, 255, .78); backdrop-filter: blur(2px); font-size: 13px; font-weight: 600; color: var(--ink-2, #3a3631); }
.bkp-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(29, 27, 24, .14); border-top-color: var(--accent, #e0583a); animation: bkp-spin .8s linear infinite; }
.bkp-bar { width: min(140px, 60%); height: 4px; border-radius: 4px; background: rgba(29, 27, 24, .1); overflow: hidden; }
.bkp-bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent, #e0583a); animation: bkp-slide 1.1s var(--ease, ease) infinite; }

/* Dropzones */
.bkp-drop { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px 16px; border: 1.5px dashed var(--line-2, #e2dcd2); border-radius: 16px; background: var(--surface-2, #fdfcfa); color: var(--ink, #1d1b18); font: inherit; text-align: center; cursor: pointer; overflow: hidden; transition: border-color .2s, background .2s; }
.bkp-drop:hover:not(:disabled), .bkp-drop.is-dragging { border-color: var(--accent, #e0583a); background: #fffaf8; }
.bkp-drop:disabled { cursor: progress; opacity: 1; }
.bkp-drop.is-big { min-height: 220px; border-radius: var(--radius, 18px); gap: 8px; }
.bkp-drop strong { font-size: 14px; }
.bkp-drop.is-big strong { font: var(--title-md); letter-spacing: -.02em; }
.bkp-drop small { max-width: 34ch; font-size: 12.5px; line-height: 1.45; color: var(--muted, #6f6a62); }
.bkp-drop-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft, #fdeae3); color: var(--accent, #e0583a); transition: transform .3s var(--ease, ease); }
.bkp-drop.is-big .bkp-drop-icon { width: 52px; height: 52px; }
.bkp-drop-icon svg { width: 20px; height: 20px; }
.bkp-drop:hover .bkp-drop-icon { transform: translateY(-2px); }
.bkp-drop-preview { max-width: 60%; max-height: 90px; object-fit: contain; }

.bkp-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; border-radius: var(--radius, 18px); background: var(--surface-2, #fdfcfa); border: 1px solid var(--line, #ebe6de); color: var(--muted, #6f6a62); font-size: 14px; }
.bkp-empty svg { width: 26px; height: 26px; color: var(--faint, #9a948a); }

/* Logo variants */
.bkp-variants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.bkp-variant header { margin-bottom: 8px; }
.bkp-variant h4, .bkp-usage h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-2, #3a3631); letter-spacing: -.01em; }
.bkp-variant header p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted, #6f6a62); }
.bkp-variant .bkp-drop { min-height: 132px; }
.bkp-variant-art { position: relative; height: 132px; display: grid; place-items: center; border-radius: 16px; border: 1px solid var(--line, #ebe6de); overflow: hidden; }
.bkp-variant-art.is-light { background: conic-gradient(#f5f2ec 25%, #fff 0 50%, #f5f2ec 0 75%, #fff 0) 0 0 / 14px 14px; }
.bkp-variant-art.is-dark { background: #1d1b18; border-color: #1d1b18; }
/* A px cap: a % max-height has nothing definite to resolve against in this auto-sized grid row, so tall images overflowed and were cropped. */
.bkp-variant-art img { max-width: 64%; max-height: 96px; object-fit: contain; }
.bkp-variant .bkp-actions { margin-top: 6px; }

.bkp-usage { margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2, #fdfcfa); border: 1px solid var(--line, #ebe6de); }
.bkp-usage p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-2, #3a3631); white-space: pre-line; }
.bkp-usage.is-empty p { color: var(--faint, #9a948a); font-size: 13px; }

/* ---------- Post preview ---------- */
.bkp-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.bkp-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(29, 27, 24, .06); }
.bkp-seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted, #6f6a62); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.bkp-seg button:hover { color: var(--ink, #1d1b18); }
.bkp-seg button[aria-pressed="true"] { background: var(--surface, #fff); color: var(--ink, #1d1b18); box-shadow: 0 1px 2px rgba(29, 27, 24, .08), 0 2px 6px rgba(29, 27, 24, .06); }

.bkp-stage { display: flex; justify-content: center; padding: 28px 16px; border-radius: var(--radius, 18px); background:
  radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--bkp-tint, #1d1b18) 12%, transparent), transparent 70%),
  var(--surface-2, #fdfcfa); border: 1px solid var(--line, #ebe6de); }
.bkp-note { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--muted, #6f6a62); }

/* Instagram's own look: system font, hairline borders, its link blue */
.bkp-ig, .bkp-story { --ig-ink: #0c1014; --ig-muted: #737373; --ig-line: #dbdbdb; --ig-link: #00376b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; letter-spacing: 0; }
.bkp-ig { width: 100%; max-width: 380px; background: #fff; color: var(--ig-ink); border: 1px solid var(--ig-line); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 18px 40px -18px rgba(29, 27, 24, .28); font-size: 14px; line-height: 18px; }
.bkp-ig-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.bkp-ig-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bkp-ig-who strong { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkp-ig-who span { font-size: 12px; line-height: 15px; color: var(--ig-ink); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkp-ig-more { width: 22px; height: 22px; flex: 0 0 22px; }

.bkp-avatar { width: 34px; height: 34px; flex: 0 0 34px; padding: 2px; border-radius: 50%; background: conic-gradient(from 210deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75); }
.bkp-avatar > img, .bkp-avatar > span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; border: 2px solid #fff; background: #fff; object-fit: contain; font-size: 11px; font-weight: 700; letter-spacing: -.01em; }
.bkp-avatar.sm { width: 32px; height: 32px; flex-basis: 32px; }

.bkp-ig-media { position: relative; aspect-ratio: 1; background: #efefef; overflow: hidden; container-type: inline-size; }
.bkp-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.bkp-ig-actions { display: flex; align-items: center; gap: 14px; padding: 8px 12px 4px; }
.bkp-ig-actions svg { width: 24px; height: 24px; stroke-width: 1.9; }
.bkp-spacer { flex: 1; }
.bkp-ig-text { padding: 2px 12px 14px; }
.bkp-ig-text p { margin: 0; }
.bkp-ig-likes { font-weight: 600; margin-bottom: 4px !important; }
.bkp-ig-caption { white-space: pre-line; overflow-wrap: anywhere; }
.bkp-ig-caption strong { font-weight: 600; }
.bkp-tag { color: var(--ig-link); }
.bkp-ig-more-btn { padding: 0; border: 0; background: none; color: var(--ig-muted); font: inherit; cursor: pointer; }
.bkp-ig-meta { margin-top: 6px !important; color: var(--ig-muted); }
.bkp-ig-time { margin-top: 6px !important; font-size: 10px; letter-spacing: .02em; text-transform: uppercase; color: var(--ig-muted); }

/* The designed brand tile, sized off the media's width so it scales like an image */
.bkp-graphic { position: absolute; inset: 0; overflow: hidden; display: flex; flex-direction: column; padding: 9cqw 8cqw 7cqw; background: var(--g-bg); color: var(--g-fg); }
.bkp-g-shape { position: absolute; border-radius: 50%; pointer-events: none; }
.bkp-g-shape.one { width: 64cqw; height: 64cqw; right: -20cqw; top: -22cqw; background: var(--g-2); }
.bkp-g-shape.two { width: 22cqw; height: 22cqw; right: 30cqw; top: 30cqw; background: var(--g-3); opacity: .9; }
.bkp-g-kicker { position: relative; font-size: 3.2cqw; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.bkp-g-title { position: relative; margin: auto 0 0 !important; max-width: 86%; font-weight: 400; line-height: 1.02; letter-spacing: -.02em; overflow-wrap: anywhere; text-wrap: balance; }
.bkp-g-title.is-short { font-size: 11cqw; }
.bkp-g-title.is-mid { font-size: 8.4cqw; line-height: 1.06; }
.bkp-g-title.is-long { font-size: 6cqw; line-height: 1.12; }
.bkp-g-foot { position: relative; display: flex; align-items: center; margin-top: 6cqw; }
.bkp-g-logo { display: block; height: 11cqw; max-width: 42cqw; object-fit: contain; object-position: left center; }
span.bkp-g-logo { display: inline-flex; align-items: center; }
span.bkp-g-logo img { height: 100%; max-width: 100%; object-fit: contain; }
.bkp-g-logo.on-chip { height: 13cqw; padding: 2cqw 3cqw; border-radius: 3cqw; background: #fff; }
.bkp-g-word { font-size: 4.8cqw; letter-spacing: -.01em; }

/* Story: 9:16, full bleed */
.bkp-story { position: relative; width: min(290px, 100%); aspect-ratio: 9 / 16; border-radius: 22px; overflow: hidden; background: #111; color: #fff; box-shadow: 0 0 0 6px #1d1b18, 0 24px 50px -16px rgba(29, 27, 24, .45); }
.bkp-story-media { position: absolute; inset: 0; container-type: inline-size; }
.bkp-story-media::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(0, 0, 0, .32), transparent 18%, transparent 78%, rgba(0, 0, 0, .38)); }
.bkp-graphic.is-story { padding: 30cqw 9cqw 34cqw; }
.bkp-graphic.is-story .bkp-g-shape.one { width: 90cqw; height: 90cqw; right: -34cqw; top: 12cqw; }
.bkp-graphic.is-story .bkp-g-shape.two { width: 26cqw; height: 26cqw; right: 12cqw; top: auto; bottom: 36cqw; }
.bkp-graphic.is-story .bkp-g-kicker { font-size: 4cqw; }
.bkp-graphic.is-story .bkp-g-title { margin-top: auto !important; max-width: 92%; }
.bkp-graphic.is-story .bkp-g-title.is-short { font-size: 14cqw; }
.bkp-graphic.is-story .bkp-g-title.is-mid { font-size: 10.5cqw; }
.bkp-graphic.is-story .bkp-g-title.is-long { font-size: 7.6cqw; }
.bkp-g-sticker { position: relative; align-self: flex-start; margin-top: 6cqw; padding: 2.6cqw 5cqw; border-radius: 999px; background: var(--g-2); color: var(--g-on2); font-size: 4.2cqw; font-weight: 700; box-shadow: 0 2cqw 5cqw rgba(0, 0, 0, .18); transform: rotate(-3deg); }
.bkp-graphic.is-story .bkp-g-foot { margin-top: 8cqw; }
.bkp-graphic.is-story .bkp-g-logo { height: 15cqw; max-width: 55cqw; }
.bkp-graphic.is-story .bkp-g-logo.on-chip { height: 17cqw; }
.bkp-story-text { position: absolute; left: 7cqw; right: 7cqw; bottom: 32cqw; display: flex; }
.bkp-story-text p { margin: 0; padding: 3cqw 4.5cqw; border-radius: 3cqw; font-size: 8cqw; line-height: 1.12; letter-spacing: -.015em; box-decoration-break: clone; -webkit-box-decoration-break: clone; overflow-wrap: anywhere; }

.bkp-story-top { position: absolute; top: 0; left: 0; right: 0; padding: 10px 10px 0; z-index: 1; }
.bkp-story-bars { display: flex; gap: 3px; }
.bkp-story-bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, .38); overflow: hidden; }
.bkp-story-bars i.done { background: #fff; }
.bkp-story-bars i.now { background: linear-gradient(90deg, #fff 45%, rgba(255, 255, 255, .38) 45%); }
.bkp-story-who { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.bkp-story-who strong { font-weight: 600; max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bkp-story-who > span:not(.bkp-avatar) { opacity: .75; }
.bkp-story-who svg { width: 20px; height: 20px; flex: 0 0 20px; }
.bkp-story-who .bkp-avatar { background: none; padding: 0; }
.bkp-story-who .bkp-avatar > img, .bkp-story-who .bkp-avatar > span { border-width: 1.5px; }
.bkp-story-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: flex; align-items: center; gap: 14px; padding: 0 12px 14px; }
.bkp-story-bottom svg { width: 24px; height: 24px; flex: 0 0 24px; }
.bkp-story-reply { flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; padding: 0 16px; border: 1px solid rgba(255, 255, 255, .7); border-radius: 999px; font-size: 13.5px; }

/* Motion only after the viewer does something (a toggle, a finished upload), never on the shell's routine refreshes */
.bkp-animate .bkp-tile-art img, .bkp-animate .bkp-variant-art img, .bkp-animate .bkp-photo, .bkp-animate .bkp-graphic { animation: bkp-fade .45s var(--ease, ease); }
.bkp-animate .bkp-ig, .bkp-animate .bkp-story { animation: bkp-rise .5s var(--ease, ease); }
@keyframes bkp-fade { from { opacity: 0; } }
@keyframes bkp-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes bkp-spin { to { transform: rotate(360deg); } }
@keyframes bkp-slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) {
  .bkp-logos *, .bkp-preview * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .bkp-spinner { animation: none; }
}

/* Phones: stack the tiles into a strip and give the post the full width */
@media (max-width: 520px) {
  .bkp-tiles { grid-template-columns: 1fr 1fr; }
  .bkp-tile.is-light { grid-column: 1 / -1; aspect-ratio: 16 / 7; }
  .bkp-variants { grid-template-columns: 1fr; }
  .bkp-stage { padding: 18px 10px; }
  .bkp-drop.is-big { min-height: 190px; }
}

/* Print: no motion, no controls, colors kept */
@media print {
  .bkp-actions, .bkp-toolbar, .bkp-note, .bkp-drop-hint { display: none !important; }
  .bkp-tile, .bkp-graphic, .bkp-variant-art, .bkp-avatar, .bkp-story { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bkp-ig, .bkp-story, .bkp-tiles { break-inside: avoid; }
}
