/* Visual Brain, gallery-paper skin. Loads after style.css and only overrides it.
   Palette and type match the landing page: cream paper, ink, terracotta, sage, gold. */
:root {
  --paper: #f6f1e7; --paper-2: #efe8d9; --card: #fbf8f1; --ink: #24251f; --muted: #626459; --faint: #68645a;
  --line: #e1d9c8; --terra: #d98b5a; --terra-d: #b9693a; --sage: #8fa08a; --gold: #c9a56a;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --shadow-s: 0 1px 2px rgba(36,37,31,.12), 0 14px 26px -16px rgba(36,37,31,.55);
  --shadow-l: 0 2px 4px rgba(36,37,31,.14), 0 24px 36px -16px rgba(36,37,31,.6);
  color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased;
}
body { background: var(--paper); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }

/* Layout widths */
#app, #app.inspector-open { grid-template-columns: 272px minmax(0, 1fr) 312px; }
#app:not(.inspector-open) { grid-template-columns: 272px minmax(0, 1fr); }
@media (max-width: 1000px) { #app:not(.inspector-open) { grid-template-columns: 236px minmax(0, 1fr); } #app.inspector-open { grid-template-columns: 236px minmax(0, 1fr); } }
@media (max-width: 650px) { #app:not(.inspector-open), #app.inspector-open { grid-template-columns: minmax(0, 1fr); } }
.workspace { position: relative; }

/* Sidebar */
.sidebar { background: var(--paper-2); border-right: 1px solid var(--line); }
.brand { height: 66px; padding: 0 18px; gap: 11px; border-bottom: 0; }
.brand a { font-family: var(--serif); font-size: 20px; letter-spacing: -.02em; }
.brand strong { font-weight: 500; }
.brandmark { width: 32px; height: 32px; border-radius: 9px; }
.sideheading { height: 42px; padding: 0 18px; font-size: 11px; letter-spacing: .13em; color: var(--faint); }
.sideheading button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #5c5748; }
.heading-actions .ic { width: 17px; height: 17px; }
.heading-actions #new-folder { font-size: inherit; }
#boards { flex: none; padding: 0 10px 10px; gap: 3px; max-height: min(46vh, 440px); }
.board-link { gap: 12px; padding: 7px 8px; border-radius: 13px; white-space: normal; overflow: visible; text-overflow: clip; transition: background .15s, box-shadow .15s; }
.board-link:before { content: none; }
.board-link:hover:not(.active) { background: #e8dfcc; }
.board-link.active { background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 8px 18px -12px rgba(36,37,31,.5); font-weight: inherit; }
.cover { flex: none; width: 46px; height: 46px; border-radius: 10px; overflow: hidden; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 1.5px; background: #ddd3bf; }
.cover i { background-size: cover; background-position: center; }
.cover-1 { grid-template: 1fr / 1fr; }
.cover-2 { grid-template: 1fr / 1fr 1fr; }
.cover-3 i:first-child { grid-row: 1 / 3; }
.board-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.board-text b { font-weight: 600; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-text small { font-size: 11.5px; color: var(--faint); }
.folder-toggle { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 650; padding: 9px 10px; }
.folder-toggle:hover, .folder-more:hover { background: #e8dfcc; }
.folder-boards { padding-left: 6px; }
.library-heading { border-top: 1px solid var(--line); }
.search { margin: 0 14px 10px; height: 38px; border-radius: 999px; border-color: var(--line); background: #fffdf8; padding: 0 13px; gap: 8px; color: var(--faint); }
.search .ic { width: 16px; height: 16px; }
.search input { font-size: 13px; }
.search:focus-within { outline: 2px solid var(--terra); }
.library-filters { padding: 0 14px 12px; }
.library-filters select, .library-filters button { border-radius: 999px; border-color: var(--line); background: #fffdf8; }
.library-filters select { padding: 6px 11px; }
.library-filters button { width: 34px; }
.library { display: block; flex: 1 1 0; min-height: 0; overflow: auto; padding: 0 14px 16px; }
.library-columns { column-count: 2; column-gap: 8px; }
.library-card { aspect-ratio: auto; display: block; margin: 0 0 8px; break-inside: avoid; }
.library-card .library-tile { height: auto; aspect-ratio: auto; border: 0; border-radius: 11px; background: #e6dfcd; box-shadow: 0 1px 3px rgba(36,37,31,.16); transition: transform .2s, box-shadow .2s; }
.library-card .library-tile img { height: auto; object-fit: initial; }
.library-tile:hover { outline: none; transform: translateY(-2px); box-shadow: 0 12px 20px -10px rgba(36,37,31,.5); }
.library-tile .heart { border-radius: 999px; padding: 2px 6px; font-size: 11px; box-shadow: 0 2px 6px rgba(36,37,31,.2); }
.library-more { width: 100%; margin-top: 4px; }
.sidebar-options { border-top: 1px solid var(--line); }
.sidebar-options summary { border-radius: 10px; }

/* Top bar and tools */
.topbar { height: 66px; min-height: 66px; padding: 0 18px; background: rgba(246,241,231,.86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: relative; z-index: 30; }
.board-name { font-family: var(--serif); font-weight: 500; font-size: 25px; letter-spacing: -.02em; }
.board-title #board-options { color: var(--faint); }
.tools { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 1px; box-shadow: 0 10px 24px -16px rgba(36,37,31,.6); }
.tools button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 11px; border-radius: 999px; color: #4f4b3e; transition: background .15s, color .15s; }
.tools button:hover { background: #efe8d9; }
.tools button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tools button span { font-size: 12.5px; font-weight: 550; }
.tools .divider { border-color: var(--line); height: 18px; }
#save-as { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600; }
#save-as:hover { background: var(--terra-d); border-color: var(--terra-d); }
#delete-selection:not(:disabled) { color: #a8432f; }
#zoom-label { color: var(--faint); }
#save-status { color: var(--faint); }
@media (min-width: 1560px) { .tools button span { display: inline; } }
#upload span, #save-as span { display: inline; }
.board-title { flex: 0 1 auto; min-width: 120px; }
.board-name { overflow: visible; max-width: none; text-overflow: clip; }
/* The tools never wrap or show a scrollbar. When there is not room for all of them they scroll sideways,
   and a soft edge on the clipped side says so (the .more-left / .more-right classes come from glow.js). */
.tools { scrollbar-width: none; max-width: 100%; }
.tools::-webkit-scrollbar { display: none; }
.tools.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent); }
.tools.more-left { -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(270deg, #000 calc(100% - 34px), transparent); }
.tools.more-left.more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 34px, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(90deg, transparent, #000 34px, #000 calc(100% - 34px), transparent); }
/* Tablet: every tool as an icon, so the Save button and the zoom level stay on screen. */
@media (max-width: 1100px) {
  #upload span, #save-as span { display: none; }
  .tools button { padding: 6px 9px; }
  #zoom-label { min-width: 36px; padding-right: 6px; }
  .board-title { min-width: 0; }
}

/* Canvas */
.viewport { background-color: var(--paper); }
.viewport[data-background="dots"] { background-image: radial-gradient(#d6ccb6 .9px, transparent .9px); }
.canvas-hint { left: 18px; bottom: 14px; max-width: calc(100% - 250px); padding: 6px 13px; border-radius: 14px; background: rgba(251,248,241,.92); border: 1px solid var(--line); color: #5f5b4e; font-size: 11.5px; line-height: 1.35; box-shadow: 0 8px 18px -14px rgba(36,37,31,.6); }
.paper-picker { right: 18px; bottom: 14px; border-radius: 999px; background: rgba(251,248,241,.92); border-color: var(--line); padding: 5px 10px 5px 14px; box-shadow: 0 8px 18px -14px rgba(36,37,31,.6); }
.item.image { background: #fff; border-radius: 3px; box-shadow: var(--shadow-s); transition: box-shadow .25s ease; }
.item.image .image-clip { border-radius: 3px; }
.item.image img { transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.item.image:hover { box-shadow: var(--shadow-l); }
.item.image:hover img { transform: scale(1.035); }
.item.image::after { content: attr(data-title); position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); width: fit-content; padding: 5px 10px; border-radius: 999px; background: rgba(36,37,31,.8); backdrop-filter: blur(6px); color: #f7f2e8; font: 550 12px/1.2 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(5px); transition: opacity .2s, transform .2s; pointer-events: none; }
.item.image:hover::after { opacity: 1; transform: none; }
.item.image[data-title=""]::after { display: none; }
.item.selected { outline: 2px solid var(--terra); outline-offset: 3px; }
.resize-handle { background: var(--terra); box-shadow: 0 0 0 1px var(--terra); border-radius: 3px; }
.marquee { border-color: var(--terra); background: rgba(217,139,90,.14); }
.item.frame { border-color: var(--sage); background: rgba(143,160,138,.1); color: #52624f; border-radius: 6px; }

/* Empty state */
.empty { max-width: 430px; color: var(--muted); }
.empty-icon { width: 70px; height: 70px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); color: var(--terra); box-shadow: 0 16px 30px -18px rgba(36,37,31,.55); }
.empty-icon .ic { width: 30px; height: 30px; }
.empty h1 { font-family: var(--serif); font-weight: 500; font-size: 31px; letter-spacing: -.02em; margin: 22px 0 8px; color: var(--ink); }
.empty p { font-size: 15px; line-height: 1.55; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.empty button { border-radius: 999px; padding: 11px 20px; font-weight: 600; background: var(--ink); border: 1px solid var(--ink); color: var(--paper); }
.empty button:hover { background: var(--terra-d); border-color: var(--terra-d); }
.empty button.ghost { background: transparent; color: var(--ink); }
.empty button.ghost:hover { color: #fff; }
.empty button[hidden] { display: none; }

/* Public playground notice: a quiet dark strip */
.demo-banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px 8px 16px; font-size: 12.5px; line-height: 1.4; background: var(--ink); color: #efe9dc; border: 0; }
.demo-banner[hidden] { display: none; }
.demo-banner a { color: #f2b98f; font-weight: 600; }
.demo-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #7bd18f; box-shadow: 0 0 0 4px rgba(123,209,143,.22); }
#demo-dismiss { flex: none; margin-left: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: inherit; font-size: 16px; line-height: 1; }
#demo-dismiss:hover { background: rgba(255,255,255,.24); }

/* Search over Everything */
.visual-search { top: 16px; width: min(640px, calc(100% - 40px)); }
.visual-search-bar { height: 52px; padding: 0 18px; gap: 12px; border-radius: 999px; background: #fffdf8; border: 1px solid var(--line); box-shadow: 0 16px 34px -20px rgba(36,37,31,.6), 0 2px 6px rgba(36,37,31,.06); }
.visual-search-bar:focus-within { border-color: var(--terra); box-shadow: 0 0 0 4px rgba(217,139,90,.2), 0 16px 34px -20px rgba(36,37,31,.6); }
.visual-search-bar > span { display: grid; color: var(--faint); }
.visual-search-bar .ic { width: 19px; height: 19px; }
.visual-search-bar input { font-size: 15.5px; }
.visual-search-bar button { border-radius: 50%; }
.visual-tags { flex-wrap: wrap; justify-content: center; overflow: visible; padding: 10px 0 0; gap: 6px; }
.visual-tags button { border-radius: 999px; border-color: var(--line); background: rgba(255,253,248,.94); color: #5b5646; padding: 5px 12px; font-size: 12px; transition: background .15s, color .15s; }
.visual-tags button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.visual-search-status { text-align: center; text-shadow: none; color: var(--faint); margin-top: 8px; }
.visual-results { background: var(--paper); padding-top: 150px; }
.visual-results-grid { display: block; column-width: 210px; column-gap: 18px; }
.visual-result { display: block; width: 100%; margin: 0 0 18px; break-inside: avoid; }
.visual-result img { aspect-ratio: auto; height: auto; object-fit: initial; border: 0; border-radius: 12px; box-shadow: var(--shadow-s); transition: transform .25s, box-shadow .25s; }
.visual-result:hover img, .visual-result:focus-visible img { outline: none; transform: translateY(-3px); box-shadow: var(--shadow-l); }
.visual-result-caption { margin-top: 9px; padding: 0 4px; font-size: 12.5px; color: #4f4b3e; }
.visual-no-results { font-family: var(--serif); font-size: 20px; }

/* Details panel */
.inspector { background: var(--card); border-left: 1px solid var(--line); }
.inspector-head { height: 66px; }
.inspector-head strong { font-family: var(--serif); font-weight: 500; font-size: 18px; }
.inspector-body { padding: 18px; }
.detail-image { border-radius: 14px; border: 0; max-height: 260px; background: var(--paper-2); box-shadow: 0 10px 24px -16px rgba(36,37,31,.6); }
.credit { font-size: 11.5px; line-height: 1.45; color: var(--faint); margin: 0 0 14px; }
.field input, .field textarea, .field select { border-radius: 9px; border-color: var(--line); }
.detail-section { border-top-color: var(--line); }
details.adv > summary { cursor: pointer; list-style: none; font-size: 12px; font-weight: 650; color: #5b5646; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "+"; display: inline-block; width: 16px; color: var(--faint); }
details.adv[open] > summary::before { content: "\2212"; }
details.adv[open] > summary { margin-bottom: 12px; }
.action-row button, .image-save-row button { border-radius: 999px; border-color: var(--line); }

/* Dialogs, toast */
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: 0 40px 90px -30px rgba(36,37,31,.65); }
dialog::backdrop { background: rgba(36,37,31,.4); backdrop-filter: blur(3px); }
dialog h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: -.01em; }
.dialog-actions button, .save-choice, .save-cancel { border-radius: 999px; }
.save-choice { border-radius: 14px; }
.dialog-actions button:first-child, .dialog-actions button[type=submit], .add-images-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); border-radius: 999px; }
.add-images-dialog { border-radius: 20px; background: var(--card); }
.add-saved-image { border-radius: 12px; }
#toast { left: 50%; right: auto; bottom: 26px; transform: translateX(-50%); background: var(--ink); border-radius: 999px; padding: 10px 18px; font-size: 13px; box-shadow: 0 16px 30px -14px rgba(36,37,31,.7); }

/* Welcome pill (public playground and first visit) */
.welcome { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0 auto; z-index: 25; width: fit-content; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 14px; padding: 9px 44px 9px 20px; border-radius: 999px; background: rgba(251,248,241,.94); backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: 0 24px 50px -24px rgba(36,37,31,.7); animation: welcome-in .5s cubic-bezier(.2,.8,.2,1) both; }
.welcome[hidden] { display: none; }
.welcome strong { font-family: var(--serif); font-weight: 500; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.welcome > span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.welcome-chips { display: flex; gap: 6px; }
.welcome-chips button { border: 1px solid var(--line); border-radius: 999px; background: #fffdf8; color: var(--ink); padding: 6px 12px; font-size: 12.5px; font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; }
.welcome-chips button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.welcome-close { position: absolute; right: 9px; top: 50%; width: 26px; height: 26px; margin-top: -13px; border: 0; border-radius: 50%; background: transparent; color: var(--faint); font-size: 19px; line-height: 1; }
.welcome-close:hover { background: var(--paper-2); }
.viewport.searching .welcome, .viewport.has-welcome .canvas-hint { display: none; }
.welcome.leaving { opacity: 0; transform: translateY(10px); transition: opacity .45s, transform .45s; pointer-events: none; }
@keyframes welcome-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) { .welcome > span { display: none; } }
@media (max-width: 650px) { .welcome { bottom: 12px; flex-wrap: wrap; border-radius: 22px; gap: 8px 10px; padding: 12px 40px 12px 16px; } .welcome-chips { flex-wrap: wrap; } }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 5000; display: grid; grid-template-columns: minmax(0, 1fr) 340px; background: rgba(22,22,18,.94); color: #f3eee2; opacity: 0; pointer-events: none; transition: opacity .22s; }
.lb.open { opacity: 1; pointer-events: auto; }
.lb-stage { position: relative; display: grid; place-items: center; padding: 44px 64px; min-width: 0; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 88px); min-height: min(62vh, 640px); object-fit: contain; border-radius: 6px; box-shadow: 0 40px 90px rgba(0,0,0,.55); transition: opacity .2s; }
.lb-nav { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -22px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(255,255,255,.07); color: inherit; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-side { background: #1b1b17; border-left: 1px solid #2c2c26; padding: 40px 30px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.lb-side h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 32px; line-height: 1.1; letter-spacing: -.02em; }
.lb-meta { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #a79f8c; }
.lb-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.lb-tags button, .lb-actions button { border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: transparent; color: #f3eee2; padding: 6px 12px; font-size: 12.5px; }
.lb-tags button:hover, .lb-actions button:hover { background: #f3eee2; color: #1b1b17; }
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-actions .primary { background: var(--terra); border-color: var(--terra); color: #1b1b17; font-weight: 650; }
.lb-credit { margin-top: auto; font-size: 11.5px; line-height: 1.5; color: #8d8672; }
.lb-close { position: absolute; right: 16px; top: 14px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: inherit; font-size: 22px; line-height: 1; }
.lb-close:hover { background: rgba(255,255,255,.2); }
@media (max-width: 820px) { .lb { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; } .lb-stage { padding: 56px 16px 12px; } .lb-nav { display: none; } .lb-side { border-left: 0; border-top: 1px solid #2c2c26; padding: 18px 20px 24px; max-height: 38vh; gap: 12px; } .lb-side h2 { font-size: 24px; } }

/* Phones */
@media (max-width: 650px) {
  .demo-more { display: none; }
  .tools { scrollbar-width: none; }
  .tools::-webkit-scrollbar { display: none; }
  .topbar { height: 58px; min-height: 58px; padding: 0 10px; }
  .demo-banner { font-size: 11.5px; padding: 7px 10px 7px 12px; justify-content: flex-start; }
  .tools { border-radius: 16px; }
  .visual-search-bar { height: 46px; }
}
@media (prefers-reduced-motion: reduce) { .welcome, .item.image img, .library-tile, .visual-result img { animation: none; transition: none; } }

/* Embedded in the landing page: it already says what this is. */
.framed .demo-banner { display: none; }
