@import "tailwindcss";
@import "./actiontext.css";
/* class strategy: only elements with form-checkbox/form-radio classes are
   styled — the plugin never restyles inputs/selects globally. */
@plugin "@tailwindcss/forms" {
  strategy: class;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/poppins-latin-400-f3f0f5ee.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/poppins-latin-ext-400-ec743ea9.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/poppins-latin-700-54e23180.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/poppins-latin-ext-700-9c681fff.woff2") format("woff2");
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@theme {
  --font-sans: "Poppins", sans-serif;

  --color-brand-50: #eef2ff;
  --color-brand-100: #e0e7ff;
  --color-brand-200: #c7d2fe;
  --color-brand-300: #a5b4fc;
  --color-brand-400: #818cf8;
  --color-brand-500: #6366f1;
  --color-brand-600: #4f46e5;
  --color-brand-700: #4338ca;
  --color-brand-800: #3730a3;
  --color-brand-900: #312e81;
  --color-brand-950: #1e1b4b;

  --color-success-50: var(--color-green-50);
  --color-success-100: var(--color-green-100);
  --color-success-500: var(--color-green-500);
  --color-success-600: var(--color-green-600);
  --color-success-700: var(--color-green-700);
  --color-progress-100: var(--color-amber-100);
  --color-progress-500: var(--color-amber-500);
  --color-progress-700: var(--color-amber-700);
}

@layer components {
  /* Custom elements default to display:inline, which swallows vertical
     margins — every frame in this app wraps block-level cards. */
  turbo-frame {
    display: block;
  }

  .pagy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex-wrap: wrap;
  }
  .pagy a,
  .pagy label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 0.75rem;
    border-width: 2px;
    border-color: var(--color-gray-200);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-gray-500);
  }
  .pagy a:hover {
    background-color: var(--color-gray-50);
    color: var(--color-gray-900);
  }
  .pagy a[aria-current="page"] {
    background-color: var(--color-brand-600);
    border-color: var(--color-brand-800);
    color: white;
  }
  .pagy a[aria-disabled="true"] {
    border-color: transparent;
    color: var(--color-gray-300);
  }
  .pagy a[aria-disabled="true"]:hover {
    background-color: transparent;
    color: var(--color-gray-300);
  }

  /* Boolean on/off toggle switch (student side). Pair a sr-only checkbox
     with a label.toggle-label wrapping a span.toggle-span "knob". */
  .toggle-label {
    position: relative;
    display: inline-flex;
    height: 1.5rem;
    width: 3rem;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 9999px;
    background-color: var(--color-gray-300);
    transition: background-color 150ms;
  }
  input[type="checkbox"]:checked + .toggle-label {
    background-color: var(--color-brand-500);
  }
  .toggle-span {
    pointer-events: none;
    position: absolute;
    top: -0.125rem;
    left: 0;
    height: 1.75rem;
    width: 1.75rem;
    border-radius: 0.5rem;
    border-width: 2px;
    border-bottom-width: 4px;
    border-color: var(--color-gray-300);
    background-color: white;
    transition: all 150ms;
  }
  input[type="checkbox"]:checked + .toggle-label .toggle-span {
    transform: translateX(1.25rem);
    border-color: var(--color-brand-500);
  }

  .panel-editor {
    border-radius: 0.5rem;
    border: 1px solid var(--color-gray-300);
    background-color: white;
  }
  .panel-editor:focus-within {
    border-color: var(--color-brand-500);
    box-shadow: 0 0 0 1px var(--color-brand-500);
  }
  .panel-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--color-gray-300);
    background-color: var(--color-gray-50);
    padding: 0.5rem;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
  }
  .panel-editor-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-right: 0.5rem;
    border-right: 1px solid var(--color-gray-300);
  }
  .panel-editor-group:last-child {
    padding-right: 0;
    border-right: none;
  }
  .panel-editor-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    width: 2rem;
    border-radius: 0.375rem;
    border: 1px solid var(--color-gray-300);
    background-color: white;
    color: var(--color-gray-700);
    transition: all 100ms;
  }
  .panel-editor-button:hover:not(:disabled) {
    background-color: var(--color-gray-100);
  }
  .panel-editor-button.bg-brand-50 {
    border-color: var(--color-brand-500);
    color: var(--color-brand-600);
  }
  .panel-editor-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }
  .panel-editor-content {
    display: flex;
    flex-direction: column;
    /* Scale with the viewport so long documents get real estate on big screens. */
    min-height: clamp(14rem, 50vh, 36rem);
    color: var(--color-gray-900);
    font-size: 0.875rem;
    padding: 0.75rem;
    cursor: text;
  }
  /* The contenteditable must fill the whole box — otherwise only a thin
     first-line strip is clickable and the editor feels dead. */
  .panel-editor-content .tiptap {
    flex: 1;
    outline: none;
  }
  .panel-editor-content .tiptap :first-child {
    margin-top: 0;
  }
  .panel-editor-content .tiptap h1 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.375rem;
    font-weight: 700;
  }
  .panel-editor-content .tiptap h2 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
  }
  .panel-editor-content .tiptap h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
  }
  .panel-editor-content .tiptap p {
    margin-bottom: 0.75rem;
  }
  .panel-editor-content .tiptap ul,
  .panel-editor-content .tiptap ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
  }
  .panel-editor-content .tiptap ul {
    list-style-type: disc;
  }
  .panel-editor-content .tiptap ol {
    list-style-type: decimal;
  }
  .panel-editor-content .tiptap ul[data-type="taskList"] {
    list-style: none;
    padding-left: 0;
  }
  .panel-editor-content .tiptap ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .panel-editor-content .tiptap ul[data-type="taskList"] li > label {
    margin-top: 0.25rem;
    user-select: none;
  }
  .panel-editor-content .tiptap ul[data-type="taskList"] li > div {
    flex: 1;
  }
  .panel-editor-content .tiptap ul[data-type="taskList"] input[type="checkbox"] {
    height: 1rem;
    width: 1rem;
    border-radius: 0.25rem;
    accent-color: var(--color-brand-500);
  }
  .panel-editor-content .tiptap blockquote {
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    border-left: 3px solid var(--color-gray-300);
    color: var(--color-gray-600);
  }
  .panel-editor-content .tiptap pre {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    background-color: var(--color-gray-900);
    color: var(--color-gray-50);
    font-family: monospace;
    font-size: 0.8125rem;
    overflow-x: auto;
  }
  .panel-editor-content .tiptap pre code {
    background: none;
    padding: 0;
    color: inherit;
  }
  .panel-editor-content .tiptap code {
    border-radius: 0.25rem;
    background-color: var(--color-gray-100);
    padding: 0.125rem 0.25rem;
    font-family: monospace;
    font-size: 0.8125rem;
  }
  .panel-editor-content .tiptap mark {
    border-radius: 0.125rem;
    background-color: #fef08a;
    padding: 0 0.125rem;
  }
  .panel-editor-content .tiptap hr {
    margin: 1rem 0;
    border-color: var(--color-gray-300);
  }
  .panel-editor-content .tiptap a {
    color: var(--color-brand-600);
    text-decoration: underline;
  }
  .panel-editor-content .tiptap p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    color: var(--color-gray-400);
    float: left;
    height: 0;
    pointer-events: none;
  }

  /* ---------------------------------------------------------------------
     Notion-like editor (EditorHelper / editor_controller.js). Reads as a
     document, not a form input: no heavy border, generous padding, a
     comfortable max-width column. Typography below is copied 1:1 from
     app/views/articles/nodes/*.html.erb so authoring previews honestly.
     --------------------------------------------------------------------- */
  .editor-surface {
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem;
    background-color: white;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 8px rgb(0 0 0 / 0.04);
  }
  .editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-gray-100);
  }
  /* Submit-blocking validation banner (submit_banner.js) — content stays
     intact underneath it, this only ever reports what is wrong. */
  .editor-error-banner {
    margin: 0.75rem 0.75rem 0;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid var(--color-red-500);
    background-color: var(--color-red-50);
  }
  .editor-error-banner-heading {
    font-weight: 600;
    color: var(--color-red-700);
  }
  .editor-error-banner ul {
    margin-top: 0.25rem;
    padding-left: 1.25rem;
    list-style-type: disc;
    color: var(--color-red-700);
  }
  .editor-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding-right: 0.5rem;
    border-right: 1px solid var(--color-gray-100);
  }
  .editor-toolbar-group:last-child {
    padding-right: 0;
    border-right: none;
  }
  .editor-toolbar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.75rem;
    width: 1.75rem;
    border-radius: 0.375rem;
    color: var(--color-gray-500);
    transition: all 100ms;
  }
  .editor-toolbar-button:hover:not(:disabled) {
    background-color: var(--color-gray-100);
    color: var(--color-gray-900);
  }
  .editor-toolbar-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .editor-toolbar-button.bg-brand-50 {
    color: var(--color-brand-600);
  }
  /* flex + min-height make the box read as a page, not a squat input. The
     contenteditable below is stretched to match (flex: 1, height: 100%)
     so it — not just its narrower text column — covers the whole box;
     native contenteditable behavior then means a click anywhere in that
     whitespace lands inside it and places the caret at the nearest
     position (the document end, for a click below all content). No
     click-forwarding JS needed. */
  .editor-surface-content {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 24rem;
    padding: 1rem 3rem 4rem;
    cursor: text;
  }
  .editor-surface-content .tiptap {
    flex: 1;
    height: 100%;
    /* The 42rem measure is centred in the card, Notion-style: text still
       starts at the column's left edge, but a centre-aligned image or a
       centre-aligned paragraph is centred in the card rather than parked
       left of it. width:100% is required alongside max-width+margin:auto —
       auto margins on a flex item disable cross-axis stretch (align-items:
       stretch has no effect once margin-inline:auto is set), so without an
       explicit width the column shrinks to its own content's max-content
       width instead of filling the card. That collapse was invisible for
       left-aligned text (content already reached the column's left edge)
       but broke text-align:center/right outright: centering text inside a
       box already shrunk to that text's own width is a no-op. */
    width: 100%;
    max-width: 42rem;
    margin-inline: auto;
    color: var(--color-gray-700);
    font-size: 1rem;
    line-height: 1.625;
    outline: none;
  }
  .editor-surface-content .tiptap > :first-child {
    margin-top: 0 !important;
  }
  .editor-surface-content .tiptap h1 {
    margin-top: 2rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--color-gray-900);
  }
  .editor-surface-content .tiptap h1:first-child {
    margin-top: 0;
  }
  .editor-surface-content .tiptap h2 {
    margin-top: 1.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--color-gray-900);
  }
  .editor-surface-content .tiptap h3 {
    margin-top: 1.25rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-gray-900);
  }
  .editor-surface-content .tiptap p {
    margin-top: 1rem;
  }
  .editor-surface-content .tiptap p:first-child {
    margin-top: 0;
  }
  .editor-surface-content .tiptap ul,
  .editor-surface-content .tiptap ol {
    margin-top: 1rem;
    padding-left: 1.5rem;
  }
  .editor-surface-content .tiptap ul {
    list-style-type: disc;
  }
  .editor-surface-content .tiptap ol {
    list-style-type: decimal;
  }
  .editor-surface-content .tiptap li > p {
    margin-top: 0;
  }
  .editor-surface-content .tiptap a {
    font-weight: 700;
    color: var(--color-brand-600);
    text-decoration: underline;
  }
  /* Highlight mark preview inside the editor — matches the student render
     (Article::Content::MarkStyles::HIGHLIGHT_CLASSES) so what the teacher
     sees while writing is what the reader gets. Without this the mark's own
     `data-color` attr paints nothing and the browser falls back to <mark>'s
     UA-stylesheet default (a jarring saturated yellow, not our palette). */
  .editor-surface-content .tiptap mark[data-color="green"] {
    background-color: var(--color-green-200);
  }
  .editor-surface-content .tiptap mark[data-color="blue"] {
    background-color: var(--color-blue-200);
  }
  .editor-surface-content .tiptap mark[data-color="red"] {
    background-color: var(--color-red-200);
  }
  .editor-surface-content .tiptap mark[data-color="purple"] {
    background-color: var(--color-purple-200);
  }
  .editor-surface-content .tiptap mark[data-color="amber"] {
    background-color: var(--color-amber-200);
  }
  /* Doc-empty and node-empty placeholders (@tiptap/extension-placeholder):
     the same rule serves both — presets.js's placeholderText() decides
     which string lands in data-placeholder for a given empty paragraph. */
  .editor-surface-content .tiptap p.is-empty::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    color: var(--color-gray-400);
    pointer-events: none;
  }

  /* Gap cursor (StarterKit's gapcursor, kept ON): the only way to place a
     caret before/after a leading or trailing atom block (image/video/task
     have no text position of their own) or between two adjacent atoms with
     no paragraph separating them — verified in-browser, not just asserted.
     tiptap/ProseMirror never ships its own CSS for this; without these
     rules it paints as a bare unstyled `border-top: 1px solid black` line.
     Restyled here to blink in brand color instead. */
  .editor-surface-content .ProseMirror-gapcursor {
    display: none;
    pointer-events: none;
    position: absolute;
  }
  .editor-surface-content .ProseMirror-focused .ProseMirror-gapcursor {
    display: block;
  }
  .editor-surface-content .ProseMirror-gapcursor::after {
    content: "";
    display: block;
    position: absolute;
    top: -2px;
    width: 1.5rem;
    border-top: 2px solid var(--color-brand-500);
    animation: editor-gapcursor-blink 1.1s steps(2, start) infinite;
  }

  /* Left-gutter "+" button (editor/gutter.js). Absolutely positioned by JS
     against .editor-surface-content; hidden until a block is hovered. Small
     and low-contrast on purpose — a discoverability nudge, not a control
     that should compete with the text. */
  .editor-gutter-button {
    position: absolute;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    width: 1.5rem;
    border-radius: 0.25rem;
    color: var(--color-gray-400);
    transition: background-color 100ms;
  }
  .editor-gutter-button:hover {
    background-color: var(--color-gray-100);
    color: var(--color-gray-700);
  }

  /* Selection bubble menu (editor/bubble_menu.js): bold, italic, link. */
  .editor-bubble-menu {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.1875rem;
    border-radius: 0.5rem;
    background-color: var(--color-gray-900);
    box-shadow: 0 10px 25px rgb(0 0 0 / 0.2);
  }
  .editor-bubble-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 0.25rem;
    color: var(--color-gray-200);
    transition: background-color 100ms;
  }
  .editor-bubble-button:hover {
    background-color: rgb(255 255 255 / 0.12);
    color: white;
  }
  .editor-bubble-button.is-active {
    background-color: rgb(255 255 255 / 0.16);
    color: white;
  }

  /* Highlight color picker (editor/highlight_picker.js) — trigger button
     matches the other bubble buttons; the panel is a small popover with one
     swatch per Article::Content::MarkSchema::HIGHLIGHT_COLORS name plus a
     clear action, mirroring the product owner's screenshot. Colors are
     painted here by NAME, never inline from JS — the editor never carries a
     raw hex/rgb value, matching the persisted mark contract. */
  .editor-highlight-picker {
    position: relative;
    display: inline-flex;
  }
  .editor-highlight-panel {
    position: absolute;
    top: calc(100% + 0.375rem);
    left: 50%;
    z-index: 20;
    display: flex;
    gap: 0.25rem;
    padding: 0.375rem;
    border-radius: 0.5rem;
    background-color: var(--color-gray-900);
    box-shadow: 0 10px 25px rgb(0 0 0 / 0.2);
    transform: translateX(-50%);
  }
  .editor-highlight-swatch {
    display: inline-flex;
    height: 1.25rem;
    width: 1.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 2px solid rgb(255 255 255 / 0.2);
  }
  .editor-highlight-swatch:hover {
    border-color: rgb(255 255 255 / 0.6);
  }
  .editor-highlight-swatch-green {
    background-color: var(--color-green-200);
  }
  .editor-highlight-swatch-blue {
    background-color: var(--color-blue-200);
  }
  .editor-highlight-swatch-red {
    background-color: var(--color-red-200);
  }
  .editor-highlight-swatch-purple {
    background-color: var(--color-purple-200);
  }
  .editor-highlight-swatch-amber {
    background-color: var(--color-amber-200);
  }
  .editor-highlight-swatch-clear {
    background-color: transparent;
    color: var(--color-gray-300);
  }

  /* Slash "/" command popup (editor/slash_menu.js) — rounded card, icon +
     name + Polish description per row, active row highlighted. */
  .editor-slash-menu {
    position: absolute;
    z-index: 60;
    width: 15rem;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.25rem;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.625rem;
    background-color: white;
    box-shadow: 0 12px 28px rgb(0 0 0 / 0.14);
  }
  .editor-slash-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3125rem 0.5rem;
    border-radius: 0.375rem;
    text-align: left;
    cursor: pointer;
  }
  .editor-slash-item[data-active="true"] {
    background-color: var(--color-gray-100);
  }
  .editor-slash-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-400);
  }
  .editor-slash-labels {
    display: flex;
    min-width: 0;
    flex-direction: column;
  }
  .editor-slash-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-gray-900);
  }
  .editor-slash-hint {
    font-size: 0.6875rem;
    color: var(--color-gray-500);
  }

  /* Callout node — tinted rounded block, matches articles/nodes/_callout. */
  .editor-callout {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 2px solid var(--color-brand-200);
    background-color: var(--color-brand-50);
  }
  .editor-callout-emoji {
    font-size: 1.125rem;
    line-height: 1;
    user-select: none;
  }
  .editor-callout-body {
    flex: 1;
    min-width: 0;
    color: var(--color-gray-700);
  }
  .editor-callout-body > :first-child {
    margin-top: 0;
  }

  /* Image node (editor/nodes/image.js) — same rounded/bordered treatment as
     the student render, plus resize handles and an alignment control that
     only appear on hover/selection. data-align positions the INNER FRAME
     (editor-image-frame) inside the full-width figure; the FRAME's own
     width (set inline by the node view, as a "%" string) is what actually
     resizes — never the img's. The img is always width:100% of the frame,
     height:auto, so its intrinsic aspect ratio is preserved. This split
     matters: the frame is a flex item of .editor-image (a definite-width
     container — the 42rem text column), so a percentage on the FRAME always
     resolves against that real width, at any alignment. A percentage on the
     IMG instead, with the frame shrink-to-fit around it, is a circular
     sizing constraint — collapses toward the intrinsic size, invisible
     left-aligned (the figure's full width was still there to fall back on)
     but very visible centered (the product owner's "malutkie" report). */
  .editor-image {
    position: relative;
    display: flex;
    margin-top: 1.5rem;
  }
  .editor-image[data-align="left"] {
    justify-content: flex-start;
  }
  .editor-image[data-align="center"] {
    justify-content: center;
  }
  .editor-image[data-align="right"] {
    justify-content: flex-end;
  }
  .editor-image-frame {
    position: relative;
    flex: 0 0 auto;
    max-width: 100%;
  }
  .editor-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 1rem;
    border: 2px solid var(--color-gray-200);
  }

  /* Left/right drag handles — width-only resize, never height (see image.js
     for why: the reference this feature follows clamps to a min width and
     always scales proportionally, so an image can never be squashed).
     Matches the reference (tiptap.niazmorshed.dev): a THIN bar inset
     slightly INSIDE the image edges, light with a shadow so it reads on
     both dark and light photos — not the earlier thick purple bar sitting
     outside the image. The visible bar is a ::before, narrower than the
     element itself: .editor-image-handle stays a generous invisible hit
     area (padding, not just the bar's own width) so slimming the bar never
     shrinks the actual pointer target. */
  .editor-image-handle {
    position: absolute;
    top: 50%;
    z-index: 5;
    height: 3rem;
    width: 1.25rem;
    margin-top: -1.5rem;
    opacity: 0;
    cursor: ew-resize;
    transition: opacity 100ms;
  }
  .editor-image-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    height: 1.75rem;
    width: 0.25rem;
    margin: -0.875rem 0 0 -0.125rem;
    border-radius: 9999px;
    background-color: white;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.18), 0 1px 3px rgb(0 0 0 / 0.35);
  }
  .editor-image:hover .editor-image-handle,
  .editor-image.is-selected .editor-image-handle {
    opacity: 1;
  }
  .editor-image-handle-left {
    left: 0.375rem;
  }
  .editor-image-handle-right {
    right: 0.375rem;
  }

  /* Floating alignment control — same dark pill treatment as the selection
     bubble menu, shown above the image on hover/selection only. Anchored to
     the frame (image width), not the figure, so it stays centered over the
     image itself at any width/alignment. top is the control's own height
     (1.5rem button + 2*0.1875rem padding ≈ 1.875rem) plus a visible gap, so
     the pill sits entirely above the image with clear air between them
     rather than the bottom of the pill overlapping the image's top edge. */
  .editor-image-align {
    position: absolute;
    /* Clear of the image's top edge: at -2.75rem the strip's shadow visually
       merged with the image and read as overlapping it. */
    top: -3.25rem;
    left: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.1875rem;
    border-radius: 0.5rem;
    background-color: var(--color-gray-900);
    box-shadow: 0 10px 25px rgb(0 0 0 / 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 100ms;
  }
  .editor-image:hover .editor-image-align,
  .editor-image.is-selected .editor-image-align {
    opacity: 1;
    pointer-events: auto;
  }
  .editor-image-align-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 0.25rem;
    color: var(--color-gray-200);
    transition: background-color 100ms;
  }
  .editor-image-align-button:hover {
    background-color: rgb(255 255 255 / 0.12);
    color: white;
  }
  .editor-image-align-button.is-active {
    background-color: rgb(255 255 255 / 0.16);
    color: white;
  }

  /* Video/task node cards — rounded, subtle background, hover affordance. */
  .editor-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-top: 1.5rem;
    padding: 0.75rem;
    border: 2px solid var(--color-gray-200);
    border-radius: 1rem;
    background-color: var(--color-gray-50);
    transition: border-color 100ms;
  }
  .editor-card:hover {
    border-color: var(--color-gray-300);
  }
  .editor-card-thumb {
    height: 3.5rem;
    width: 6rem;
    flex-shrink: 0;
    border-radius: 0.625rem;
    object-fit: cover;
    background-color: var(--color-gray-200);
  }
  .editor-card-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    height: 3.5rem;
    width: 3.5rem;
    border-radius: 0.625rem;
    background-color: white;
    border: 1px solid var(--color-gray-200);
    color: var(--color-brand-600);
  }
  .editor-card-body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 0.125rem;
  }
  .editor-card-title {
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .editor-card-badge {
    align-self: flex-start;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background-color: var(--color-brand-100);
    color: var(--color-brand-700);
    font-size: 0.6875rem;
    font-weight: 600;
  }

  /* Native <select> appearance clashes with our border/rounded utilities
     (double chevron, mismatched box). Reset to appearance:none and paint our
     own chevron-down (lucide) so it matches icon_tag renders elsewhere. */
  /* Toast flash messages: enter from the right, exit by fading (see the
     `flash` Stimulus controller, which removes the node on animationend). */
  .slide-in-right {
    animation: slide-in-right 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  }
  .fade-out {
    animation: fade-out 0.5s ease-out both;
  }

  .select-arrow {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%236a7282%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1rem;
  }
}

@keyframes slide-in-right {
  0% {
    transform: translateX(1000px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes editor-gapcursor-blink {
  to {
    visibility: hidden;
  }
}
