/* Ideas: one idea, open over the board (docs/ideas/DESIGN.md §7.3). The
   panel's content (.idea-detail: the bar, the title, the notes editor and its
   toolbar, files, links), the link popover (.idea-linkpop), the full-screen
   picture viewer (.idea-viewer) and a PDF's pages (.idea-pdf). The panel
   itself (its size, the dimmed page, the motion) is .ideas-panel in ideas.css;
   its box is what scrolls, so the bar and the toolbar stick inside it. Tokens
   from app.css only, so dark mode follows. */

.idea-detail {
  --idea-pad: 44px;
  --idea-ok: #1f9d55;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  outline: none;
}

/* The deck's round icon button, small (36 px). */
:is(.idea-detail, .idea-pdf, .idea-linkpop, .idea-viewer) .idea-iconbtn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s var(--ease-std), color 0.16s var(--ease-std), transform 0.16s var(--ease);
}

:is(.idea-detail, .idea-pdf, .idea-linkpop, .idea-viewer) .idea-iconbtn:hover {
  background: var(--soft-2);
}

:is(.idea-detail, .idea-pdf, .idea-linkpop, .idea-viewer) .idea-iconbtn:active {
  transform: scale(0.94);
}

:is(.idea-detail, .idea-pdf, .idea-linkpop, .idea-viewer) .idea-iconbtn svg {
  width: 18px;
  height: 18px;
}

.idea-detail .idea-iconbtn.is-on {
  color: var(--blue);
}

/* A ⋯ menu shows its dots, not a caret. */
:is(.idea-detail, .idea-pdf) .idea-more .dropdown__caret {
  display: none;
}

:is(.idea-detail, .idea-pdf) .dropdown .menu__panel {
  min-width: 220px;
}

.idea-detail .dropdown[open] > summary.idea-iconbtn {
  background: var(--soft-2);
}

/* Off the top of the panel once it has scrolled (the bar's hairline). */
.idea-detail__sentinel {
  height: 1px;
  margin-bottom: -1px;
}

/* -------------------------------------------------------------------- bar */

.idea-detail__bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'topics end';
  align-items: center;
  gap: 8px 10px;
  padding: 14px 14px 12px var(--idea-pad);
  background: var(--bg);
  transition: box-shadow 0.2s var(--ease);
}

.idea-detail.is-scrolled .idea-detail__bar {
  box-shadow: 0 1px 0 var(--line);
}

/* The topics sit at the right, small, beside the bar's buttons. */
.idea-detail__topics {
  grid-area: topics;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
}

.idea-detail__topics .ideas-chip--small {
  height: 26px;
  padding: 0 4px 0 10px;
}

.idea-detail__topics .ideas-chip--small .ideas-chip__name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.idea-detail__chips {
  display: contents;
}

.idea-detail .idea-addtopic {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 11px 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s var(--ease-std), color 0.16s var(--ease-std), transform 0.16s var(--ease);
}

.idea-detail .idea-addtopic:hover {
  background: var(--soft-1);
  color: var(--ink);
}

.idea-detail .idea-addtopic:active {
  transform: scale(0.97);
}

.idea-detail .idea-addtopic svg {
  width: 13px;
  height: 13px;
}

/* With topics on the idea, adding one more is a quiet round button. */
.idea-detail .idea-addtopic.is-compact {
  width: 26px;
  padding: 0;
  justify-content: center;
}

.idea-detail .idea-addtopic.is-compact span {
  display: none;
}

.idea-detail__end {
  grid-area: end;
  display: flex;
  align-items: center;
  gap: 2px;
}

.idea-detail__archived {
  margin-right: 6px;
}

/* "Saving…", "Saved", "Couldn't save · Retry". */
.idea-detail .idea-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin: 0 8px 0 0;
  color: var(--faint);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.idea-detail .idea-save svg {
  width: 14px;
  height: 14px;
}

.idea-detail .idea-save .spinner {
  width: 11px;
  height: 11px;
  border-width: 1.5px;
}

.idea-detail .idea-save.is-saved svg {
  color: var(--idea-ok);
}

.idea-detail .idea-save.is-failed {
  color: var(--danger);
}

.idea-detail .idea-save__retry {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
}

.idea-detail .idea-save__retry:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}

/* ------------------------------------------------------------------- body */

.idea-detail__inner {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 10px var(--idea-pad) 32px;
}

.idea-detail .idea-title {
  display: block;
  width: 100%;
  min-height: 40px;
  height: var(--idea-title-h, auto);
  margin: 0 0 -24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.2px;
  overflow: hidden;
  resize: none;
  field-sizing: content;
  outline: none;
}

.idea-detail .idea-title::placeholder {
  color: var(--whisper);
}

/* The notes: the toolbar sticks under the bar while they scroll. */
.idea-detail .idea-notes {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.idea-detail__tools {
  position: sticky;
  top: var(--idea-bar-h, 62px);
  z-index: 20;
  margin: 0 -8px 6px;
  padding: 6px 0;
  background: var(--bg);
}

.idea-detail__tools::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 1px;
  background: var(--line);
}

/* ---------------------------------------------------------------- toolbar */

.idea-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.idea-toolbar::-webkit-scrollbar {
  display: none;
}

.idea-toolbar .idea-tool {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s var(--ease-std), color 0.14s var(--ease-std), transform 0.14s var(--ease);
}

.idea-toolbar .idea-tool:hover {
  background: var(--soft-2);
  color: var(--ink);
}

.idea-toolbar .idea-tool:active {
  transform: scale(0.92);
}

.idea-toolbar .idea-tool[aria-pressed='true'] {
  background: var(--soft-3);
  color: var(--ink);
}

.idea-toolbar .idea-tool svg {
  width: 18px;
  height: 18px;
}

.idea-toolbar__sep {
  flex: 0 0 auto;
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--line-strong);
}

/* ----------------------------------------------------------------- editor */

.idea-editor-box {
  position: relative;
  min-width: 0;
}

.idea-editor {
  position: relative;
  min-height: 150px;
  padding: 8px 0 12px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
  caret-color: var(--blue);
}

.idea-editor.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 8px;
  left: 0;
  color: var(--whisper);
  pointer-events: none;
}

.idea-editor :is(div, p) {
  margin: 0;
}

.idea-editor > :is(div, p) + :is(div, p) {
  margin-top: 4px;
}

.idea-editor h3 {
  margin: 20px 0 6px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.1px;
}

.idea-editor > h3:first-child {
  margin-top: 4px;
}

.idea-editor blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

/* Lines of one quote read as one. */
.idea-editor blockquote:has(+ blockquote) {
  margin-bottom: 0;
  padding-bottom: 0;
}

.idea-editor blockquote + blockquote {
  margin-top: 0;
  padding-top: 0;
}

.idea-editor ul,
.idea-editor ol {
  margin: 4px 0 10px;
  padding-left: 26px;
}

.idea-editor :is(ul, ol) :is(ul, ol) {
  margin: 2px 0;
}

.idea-editor ul {
  list-style: disc;
}

.idea-editor ul ul {
  list-style: circle;
}

.idea-editor ul ul ul {
  list-style: square;
}

.idea-editor ol {
  list-style: decimal;
}

.idea-editor ol ol {
  list-style: lower-alpha;
}

.idea-editor ol ol ol {
  list-style: lower-roman;
}

.idea-editor li {
  margin: 2px 0;
  padding-left: 2px;
}

.idea-editor li::marker {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* A checklist item: its box sits where a bullet would. */
.idea-editor li[data-todo] {
  position: relative;
  margin-left: -26px;
  padding-left: 30px;
  list-style: none;
}

.idea-editor li[data-todo]::before {
  content: '';
  position: absolute;
  top: calc(0.8em - 9px);
  left: 2px;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.15s var(--ease-std), border-color 0.15s var(--ease-std);
}

.idea-editor li[data-todo]:hover::before {
  border-color: color-mix(in srgb, var(--ink) 45%, transparent);
}

.idea-editor li[data-todo]::after {
  content: '';
  position: absolute;
  top: calc(0.8em - 4px);
  left: 6.5px;
  width: 9px;
  height: 4.5px;
  border: 2px solid var(--bg);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) scale(0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease-std), transform 0.2s var(--ease);
}

.idea-editor li[data-todo][data-done] {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: var(--whisper);
}

.idea-editor li[data-todo][data-done]::before {
  border-color: var(--ink);
  background: var(--ink);
}

.idea-editor li[data-todo][data-done]::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}

.idea-editor a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--blue) 40%, transparent);
  text-underline-offset: 3px;
}

.idea-editor code {
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--soft-2);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.idea-editor strong,
.idea-editor b {
  font-weight: 650;
}

/* ----------------------------------------------------------- link popover */

.idea-linkpop {
  position: fixed;
  top: var(--y, 0);
  left: var(--x, 0);
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(380px, calc(100vw - 16px));
  padding: 6px;
  border-radius: 26px;
  background: var(--glass-menu);
  -webkit-backdrop-filter: blur(36px) saturate(150%);
  backdrop-filter: blur(36px) saturate(150%);
  box-shadow: var(--shadow-pill);
  color: var(--ink);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.16s var(--ease), transform 0.2s var(--ease);
}

.idea-linkpop.is-open {
  opacity: 1;
  transform: none;
}

.idea-linkpop.is-view {
  width: auto;
  max-width: min(420px, calc(100vw - 16px));
}

.idea-linkpop__form,
.idea-linkpop__row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.idea-linkpop .idea-linkpop__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

.idea-linkpop .btn {
  flex: 0 0 auto;
}

.idea-linkpop__error {
  margin: 0;
  padding: 2px 14px 4px;
  color: var(--danger);
  font-size: 13px;
}

.idea-linkpop__go {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--blue);
  text-decoration: none;
}

a.idea-linkpop__go:hover {
  background: var(--soft-2);
}

.idea-linkpop__go span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-linkpop__go svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------- sections */

.idea-detail .idea-sec {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.idea-detail .idea-sec__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.idea-detail .idea-sec__title {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 560;
  line-height: 1.2;
}

.idea-detail .idea-sec__count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.idea-detail .idea-sec__add {
  margin-left: auto;
}

/* ------------------------------------------------------------------ files */

.idea-detail .idea-files__empty {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.idea-detail .idea-files__empty:hover {
  background: var(--soft-1);
  border-color: color-mix(in srgb, var(--ink) 40%, transparent);
  color: var(--ink);
}

.idea-detail .idea-files__empty > svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.idea-detail .idea-files__empty strong {
  display: block;
  color: var(--ink);
  font-weight: 510;
}

/* Every file as a tile: a square thumbnail (or its type), its name and size. */
.idea-detail .idea-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 14px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.idea-detail .idea-tile {
  position: relative;
  min-width: 0;
}

.idea-detail .idea-tile__open {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}

.idea-detail .idea-tile__face {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  margin-bottom: 4px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--soft-1);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.idea-detail .idea-tile__open:hover .idea-tile__face {
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-tile);
  transform: translateY(-1px);
}

.idea-detail .idea-tile__open:focus-visible {
  outline: none;
}

.idea-detail .idea-tile__open:focus-visible .idea-tile__face {
  outline: 2px solid color-mix(in srgb, var(--ink) 55%, transparent);
  outline-offset: 2px;
}

.idea-detail .idea-tile__face.has-pic {
  background: var(--tile);
}

/* A PDF's first page from its top, on paper. */
.idea-detail .idea-tile__face.is-pdf.has-pic {
  background: #fff;
}

.idea-detail .idea-tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idea-detail .idea-tile__face.is-pdf .idea-tile__img {
  object-position: top;
}

.idea-detail .idea-tile__name {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-detail .idea-tile__meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-detail .idea-tile.is-failed .idea-tile__meta {
  color: var(--danger);
}

.idea-detail .idea-tile__tag,
.idea-detail .idea-tile__badge {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--tile-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}

.idea-detail .idea-tile__tag {
  left: 8px;
  bottom: 8px;
}

.idea-detail .idea-tile__badge {
  top: 8px;
  left: 8px;
}

.idea-detail .idea-tile__badge svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.idea-detail .idea-tile__play {
  position: absolute;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
}

.idea-detail .idea-tile__play svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
  fill: currentColor;
}

/* A file's ⋯ over its thumbnail: on hover or focus, always on touch screens. */
.idea-detail .idea-tile .idea-file__menu {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.16s var(--ease-std);
}

.idea-detail .idea-tile:is(:hover, :focus-within) .idea-file__menu,
.idea-detail .idea-tile .idea-file__menu[open] {
  opacity: 1;
}

@media (hover: none) {
  .idea-detail .idea-tile .idea-file__menu {
    opacity: 1;
  }
}

.idea-detail .idea-tile .idea-file__menu > summary,
.idea-detail .idea-tile__x {
  width: 30px;
  height: 30px;
  background: var(--tile-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
}

.idea-detail .idea-tile .idea-file__menu > summary:hover,
.idea-detail .idea-tile__x:hover {
  background: rgba(20, 20, 20, 0.7);
}

.idea-detail .idea-tile__x {
  position: absolute;
  top: 8px;
  right: 8px;
}

.idea-detail .idea-tile__x svg {
  width: 14px;
  height: 14px;
}

/* Uploads on their way: the picture dimmed, a bar along its foot. */
.idea-detail .idea-tile.is-uploading .idea-tile__open {
  cursor: default;
}

.idea-detail .idea-tile.is-uploading .idea-tile__img {
  opacity: 0.55;
}

.idea-detail .idea-tile .idea-bar {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  color: var(--blue);
}

.idea-detail .idea-bar {
  position: relative;
  display: block;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 22%, transparent);
  overflow: hidden;
}

.idea-detail .idea-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  transition: transform 0.2s var(--ease-std);
}

.idea-detail .is-failed .idea-bar {
  display: none;
}

/* A file's type, drawn: an icon and its extension, in the kind's colour. */
.idea-filetype {
  --kind: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--kind);
}

.idea-filetype svg {
  width: 30px;
  height: 30px;
}

.idea-filetype b {
  min-height: 1em;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.idea-filetype.is-pdf {
  --kind: var(--danger);
}

.idea-filetype.is-video,
.idea-filetype.is-audio {
  --kind: var(--blue);
}

.idea-filetype.is-image {
  --kind: var(--ok);
}

.idea-filetype.is-large svg {
  width: 56px;
  height: 56px;
}

.idea-filetype.is-large b {
  font-size: 15px;
}

:is(.idea-detail, .idea-pdf) .idea-filebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 0 0 4px;
  color: var(--muted);
  font-size: 14px;
}

:is(.idea-detail, .idea-pdf) .idea-filebar > svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

:is(.idea-detail, .idea-pdf) .idea-filebar__name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(.idea-detail, .idea-pdf) .idea-filebar__meta {
  flex: 0 0 auto;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

:is(.idea-detail, .idea-pdf) .idea-filebar__end {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

/* ------------------------------------------------------------ key visual */

.idea-detail .idea-kv {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 8px;
  border-radius: 18px;
  background: var(--soft-1);
}

.idea-detail .idea-kv[hidden] {
  display: none;
}

.idea-detail .idea-kv__pic {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 64px;
  height: 48px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--tile);
  color: var(--faint);
}

.idea-detail .idea-kv__pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idea-detail .idea-kv__label {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 14px;
}

.idea-detail .idea-kv__label strong {
  font-weight: 510;
}

.idea-detail .idea-kv__text {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The key visual's sheet: a grid of what the card can show. */
.idea-kvpick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.idea-kvpick__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border: 0;
  border-radius: 18px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease-std);
}

.idea-kvpick__item:hover {
  background: var(--soft-1);
}

.idea-kvpick__face {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  background: var(--tile);
  color: var(--muted);
}

.idea-kvpick__face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idea-kvpick__face.is-auto svg {
  width: 26px;
  height: 26px;
}

.idea-kvpick__item.is-on .idea-kvpick__face {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--blue);
}

.idea-kvpick__name {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------- PDFs */

.idea-pdf {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.idea-pdf__pages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(72vh, 720px);
  padding: 14px;
  border-radius: 20px;
  background: var(--soft-2);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.idea-pdf__pages:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 2px;
}

.idea-pdf__page {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  /* A page is at most about 640 px tall: a portrait one is narrower than the box, a slide fills it. */
  width: min(100%, calc(var(--ratio, 0.7071) * 640px));
  aspect-ratio: var(--ratio, 0.7071);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-tile);
  overflow: hidden;
}

.idea-pdf__page:not(.is-drawn)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(0, 0, 0, 0.04) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: idea-shimmer 1.4s linear infinite;
}

.idea-pdf__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.idea-pdf__note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--soft-1);
  color: var(--muted);
  font-size: 14px;
}

.idea-pdf__note .btn {
  margin-left: auto;
}

@keyframes idea-shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

/* ------------------------------------------------------------------ links */

.idea-detail .idea-links__form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.idea-detail .idea-links__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.idea-detail .idea-links__field > svg {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 17px;
  height: 17px;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.idea-detail .idea-links__input {
  height: 48px;
  padding-left: 46px;
}

.idea-detail .idea-links__error {
  margin: -6px 0 0;
  padding: 0 20px;
  color: var(--danger);
  font-size: 13px;
}

.idea-detail .idea-links__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.idea-detail .idea-link {
  position: relative;
  min-width: 0;
}

.idea-detail .idea-link__main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 88px;
  padding: 12px;
  border-radius: 20px;
  background: var(--bg);
  box-shadow: var(--shadow-tile);
  color: var(--ink);
  text-decoration: none;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.idea-detail .idea-link__main:hover {
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08), var(--shadow-tile);
  transform: translateY(-1px);
}

.idea-detail .idea-link__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 2px 36px 2px 4px;
}

.idea-detail .idea-link__site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.idea-detail .idea-link__site svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.idea-detail .idea-link__site span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-detail .idea-link__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 510;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.idea-detail .idea-link__desc {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-detail .idea-link__pic {
  position: relative;
  flex: 0 0 auto;
  width: 160px;
  aspect-ratio: var(--ratio, 1.91);
  border-radius: 12px;
  background: var(--tile);
  overflow: hidden;
}

.idea-detail .idea-link__pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idea-detail .idea-link__pic.is-empty {
  display: grid;
  place-items: center;
  width: 64px;
  aspect-ratio: 1;
  color: var(--faint);
}

.idea-detail .idea-link__pic.is-empty svg {
  width: 24px;
  height: 24px;
}

.idea-detail .idea-link__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tile-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  transform: translate(-50%, -50%);
}

.idea-detail .idea-link__play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
  fill: currentColor;
}

.idea-detail .idea-link__pic.is-empty .idea-link__play {
  width: 30px;
  height: 30px;
}

.idea-detail .idea-link__pic.is-empty .idea-link__play svg {
  width: 14px;
  height: 14px;
}

.idea-detail .idea-link .idea-file__menu {
  position: absolute;
  top: 10px;
  right: 10px;
}

.idea-detail .idea-link.is-pending .idea-link__main {
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: progress;
}

.idea-detail .idea-link.is-pending .idea-link__pic {
  background: linear-gradient(100deg, var(--soft-2) 30%, var(--soft-1) 50%, var(--soft-2) 70%);
  background-size: 200% 100%;
  animation: idea-shimmer 1.4s linear infinite;
}

.idea-detail .idea-link.is-pending .idea-link__title {
  color: var(--muted);
}

/* ------------------------------------------------------------------- foot */

.idea-detail__foot {
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------- activity and comments */

/* The foot's two tabs: small pills, like the board's segmented control. */
.idea-foottabs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: -18px;
}

.idea-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--soft-2);
}

.idea-tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s var(--ease-std), color 0.16s var(--ease-std);
}

.idea-tabs__tab:hover {
  color: var(--ink);
}

.idea-tabs__tab.is-active {
  background: var(--bg);
  box-shadow: var(--shadow-pill);
  color: var(--ink);
}

.idea-tabs__tab svg {
  width: 14px;
  height: 14px;
}

.idea-tabs__count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.idea-tabs__count:empty {
  display: none;
}

.idea-tabs__note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.idea-tabpanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.idea-tabpanel[hidden] {
  display: none;
}

/* The timeline: a quiet line down the left, a mark per entry. */
.idea-activity {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.idea-activity::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 13px;
  width: 1px;
  background: var(--line);
}

.idea-activity__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.idea-activity__mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--muted);
}

.idea-activity__mark svg {
  width: 14px;
  height: 14px;
}

.idea-activity__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-top: 4px;
}

.idea-activity__text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.idea-activity__text strong {
  color: var(--ink);
  font-weight: 560;
}

.idea-activity__names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

.idea-activity__name {
  max-width: 100%;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft-2);
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-activity__when,
.idea-comment__when {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Comments: who and when, then the text (its addresses as links). */
.idea-comments {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.idea-comment {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--soft-2);
}

.idea-comment.is-pending {
  opacity: 0.6;
}

.idea-comment__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.idea-comment__who {
  font-size: 14px;
  font-weight: 560;
}

.idea-detail .idea-comment__delete {
  width: 28px;
  height: 28px;
  margin: -4px -6px -4px auto;
  opacity: 0;
}

.idea-detail .idea-comment__delete svg {
  width: 15px;
  height: 15px;
}

.idea-comment:hover .idea-comment__delete,
.idea-comment:focus-within .idea-comment__delete {
  opacity: 1;
}

@media (hover: none) {
  .idea-detail .idea-comment__delete {
    opacity: 1;
  }
}

.idea-comment__body {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.idea-comment__body a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.idea-comments__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.idea-detail .idea-comments__input {
  min-height: 64px;
  max-height: 240px;
  resize: vertical;
  field-sizing: content;
}

.idea-comments__row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.idea-comments__hint {
  color: var(--muted);
  font-size: 12px;
}

/* An idea that isn't here. */
.idea-detail__notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 24px var(--idea-pad) 48px;
  color: var(--muted);
}

/* -------------------------------------------------------- dropping files */

/* A pill that stays under the bar however far the panel has scrolled. */
.idea-detail__drop {
  position: sticky;
  top: calc(var(--idea-bar-h, 62px) + 14px);
  z-index: 40;
  display: flex;
  justify-content: center;
  height: 0;
  pointer-events: none;
}

.idea-detail__droppill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px 0 18px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: var(--shadow-pill);
  color: #fff;
  font-size: 15px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.16s var(--ease), transform 0.2s var(--ease);
}

.idea-detail__droppill svg {
  width: 18px;
  height: 18px;
}

.idea-detail.is-drop .idea-detail__droppill {
  opacity: 1;
  transform: none;
}

.idea-detail.is-drop .idea-detail__inner {
  border-radius: 24px;
  outline: 2px dashed color-mix(in srgb, var(--blue) 55%, transparent);
  outline-offset: -10px;
}

/* --------------------------------------------------------- picture viewer */

.idea-viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.idea-viewer[open] {
  display: block;
}

.idea-viewer.is-open {
  opacity: 1;
}

.idea-viewer.is-closing {
  opacity: 0;
  transition-duration: 0.15s;
  pointer-events: none;
}

.idea-viewer::backdrop {
  background: var(--viewer-backdrop);
  -webkit-backdrop-filter: blur(28px) saturate(120%);
  backdrop-filter: blur(28px) saturate(120%);
  opacity: 0;
  transition: opacity 0.26s var(--ease);
}

.idea-viewer.is-open::backdrop {
  opacity: 1;
}

.idea-viewer.is-closing::backdrop {
  opacity: 0;
  transition-duration: 0.15s;
}

.idea-viewer__stage {
  position: absolute;
  inset: 0;
  container-type: size;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 84px 40px 40px;
  outline: none;
}

.idea-viewer__img {
  grid-area: 1 / 1;
  width: min(var(--w, 100cqw), 100cqw, calc(100cqh * var(--ratio, 1.5)));
  max-width: 100%;
  max-height: 100%;
  height: auto;
  aspect-ratio: var(--ratio, auto);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: var(--shadow-tile);
  cursor: pointer;
}

/* Without a known size, the picture is shown as it is, never larger. */
.idea-viewer__stage.is-unsized .idea-viewer__img {
  width: auto;
  aspect-ratio: auto;
}

.idea-viewer__img.is-preview {
  z-index: 0;
  pointer-events: none;
}

.idea-viewer__img:not(.is-preview) {
  z-index: 1;
}

.idea-viewer__img.is-preview:has(+ .idea-viewer__img.is-loaded) {
  opacity: 0;
}

.idea-viewer__close {
  position: absolute;
  top: 16px;
  left: 24px;
  z-index: 3;
}

.idea-viewer__label {
  position: absolute;
  top: 16px;
  left: 84px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 300px);
  height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
}

.idea-viewer__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-viewer__count {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.idea-viewer__nav {
  position: absolute;
  top: 16px;
  right: 24px;
  z-index: 3;
  display: inline-flex;
  gap: 8px;
}

/* A file that isn't a picture, full screen: a PDF's pages, a video, or a card. */
.idea-viewer__stage.is-doc {
  padding-top: 76px;
}

.idea-viewer__doc {
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.idea-viewer__doc.is-pdf {
  display: flex;
  width: min(920px, 100%);
  height: 100%;
  padding: 12px;
  border-radius: 22px;
  background: var(--bg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.idea-viewer__doc.is-pdf .idea-pdf {
  flex: 1 1 auto;
  min-height: 0;
}

.idea-viewer__doc.is-pdf .idea-pdf__pages {
  max-height: none;
  flex: 1 1 auto;
}

.idea-viewer__doc.is-video {
  width: min(1200px, 100%, calc((100vh - 200px) * var(--ratio, 1.7778)));
}

.idea-viewer__video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 200px);
  border-radius: 16px;
  background: #000;
}

.idea-viewer__doc.is-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  padding: 36px 28px 28px;
  border-radius: 28px;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.idea-viewer__docname {
  max-width: 100%;
  font-size: 17px;
  font-weight: 510;
  overflow-wrap: anywhere;
}

.idea-viewer__docmeta {
  color: var(--muted);
  font-size: 14px;
}

.idea-viewer__audio {
  width: 100%;
  margin-top: 6px;
}

.idea-viewer__docactions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ------------------------------------------------------------- edit mode */

/* Read (until Edit): the title is plain text, the notes too, without their toolbar. */
.idea-detail:not(.is-editing) .idea-title {
  cursor: text;
  caret-color: transparent;
}

.idea-detail:not(.is-editing) .idea-title::placeholder {
  color: var(--faint);
}

.idea-detail:not(.is-editing) .idea-title:focus-visible {
  outline: none;
}

.idea-editor-box.is-readonly .idea-editor {
  cursor: text;
}

.idea-editor-box.is-readonly .idea-editor a {
  cursor: pointer;
}

.idea-editor-box.is-readonly .idea-editor li[data-todo]:hover::before {
  border-color: inherit;
}

.idea-detail .idea-editbtn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
}

.idea-detail .idea-editbtn svg {
  width: 15px;
  height: 15px;
}

/* ------------------------------------------------------------------ phones */

@media (max-width: 700px) {
  .idea-detail {
    --idea-pad: 20px;
  }

  /* The bar's buttons keep their row; the topics go under them, at the right. */
  .idea-detail__bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      '. end'
      'topics topics';
    padding: 10px 8px 10px var(--idea-pad);
    padding-top: max(10px, env(safe-area-inset-top));
  }

  /* Archived shows as its mark (the word is still there for screen readers, clipped). */
  .idea-detail__archived {
    gap: 8px;
    width: 25px;
    margin-right: 4px;
    padding: 0 6px;
    overflow: hidden;
  }

  .idea-detail__archived svg {
    flex: 0 0 auto;
  }

  .idea-detail .idea-save {
    margin-right: 2px;
  }

  /* The status shows as its mark (and Retry); its words stay for screen readers, out of sight. */
  .idea-detail .idea-save span {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .idea-detail__inner {
    gap: 34px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }

  .idea-detail .idea-title {
    font-size: 24px;
  }

  .idea-detail__tools {
    margin: 0 calc(var(--idea-pad) * -1) 6px;
    padding: 6px calc(var(--idea-pad) - 6px);
  }

  .idea-detail__tools::after {
    left: 0;
    right: 0;
  }

  .idea-detail .idea-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 10px;
  }

  /* A tile in the left column opens its ⋯ to the right, so the menu stays on screen. */
  .idea-detail .idea-tiles > .idea-tile:nth-child(3n + 1) .menu__panel {
    right: auto;
    left: 0;
    min-width: min(220px, calc(66vw));
  }

  .idea-detail .idea-tiles > .idea-tile:nth-child(3n + 1) .menu[open] .menu__panel {
    transform-origin: top left;
  }

  .idea-detail .idea-link__main {
    gap: 12px;
    padding: 10px;
  }

  .idea-detail .idea-link__pic {
    width: 104px;
  }

  .idea-pdf__pages {
    max-height: 70vh;
    padding: 10px;
  }

  .idea-viewer__stage {
    padding: 84px 12px 24px;
  }

  .idea-viewer__close {
    left: 16px;
  }

  .idea-viewer__nav {
    right: 16px;
  }

  .idea-viewer__label {
    top: auto;
    bottom: 16px;
    left: 50%;
    max-width: calc(100% - 32px);
    transform: translateX(-50%);
  }

  .idea-viewer__stage {
    padding-bottom: 84px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .idea-detail *,
  .idea-linkpop,
  .idea-viewer,
  .idea-viewer::backdrop {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* Read, with no notes: the files follow the title at the usual distance. */
.idea-detail .idea-title:has(+ .idea-notes[hidden]) {
  margin-bottom: 0;
}
