/* Theralist article editor, modelled on Ghost's editor: a bare writing canvas, a toolbar that floats over selected text,
   a "+" in the margin of empty lines and a card menu. Loaded after _content/Blazor.Lexical/blazor-lexical.css. */

.article-editor {
    --article-ink: #15171a;
    --article-text: #27272f;
    --article-muted: #8e9cac;
    --article-line: #e1e3e5;
    --article-accent: #6062EA;
    position: relative;
    min-width: 0;
    background: #fff;
}

.article-editor .blazor-lexical {
    position: relative;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* The 740px writing column. The left padding leaves room for the "+" button. */
.article-editor-lead,
.article-editor-surface [data-lexical-content] {
    max-width: 740px;
    margin: 0 auto;
    box-sizing: content-box;
    padding-left: 72px;
    padding-right: 72px;
}

.article-editor-lead {
    padding-top: 56px;
}

.article-editor-surface [data-lexical-content] {
    min-height: 60vh;
    padding-bottom: 120px;
    outline: none;
    font-family: "Albert Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 20px;
    line-height: 1.65;
    letter-spacing: 0.1px;
    color: var(--article-text);
}

.article-editor-surface [data-lexical-content][data-lexical-empty]::before {
    padding-left: 72px;
    color: #a1a1aa;
}

.article-editor-surface [data-lexical-content] p {
    margin: 0 0 28px;
}

.article-editor-surface [data-lexical-content] h2 {
    margin: 48px 0 12px;
    font-family: "Aleo", ui-serif, Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--article-ink);
    text-transform: none;
}

.article-editor-surface [data-lexical-content] h3 {
    margin: 36px 0 8px;
    font-family: "Aleo", ui-serif, Georgia, serif;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--article-ink);
    text-transform: none;
}

.article-editor-surface [data-lexical-content] ul,
.article-editor-surface [data-lexical-content] ol {
    margin: 0 0 28px;
    padding-left: 28px;
}

.article-editor-surface [data-lexical-content] ul { list-style: disc; }
.article-editor-surface [data-lexical-content] ol { list-style: decimal; }

.article-editor-surface [data-lexical-content] li {
    margin: 0 0 8px;
    padding-left: 4px;
}

.article-editor-surface [data-lexical-content] blockquote {
    margin: 0 0 28px;
    padding: 0 0 0 24px;
    border-left: 3px solid var(--article-ink);
    font-style: italic;
    color: var(--article-ink);
}

.article-editor-surface [data-lexical-content] a {
    color: var(--article-accent);
    text-decoration: underline;
}

.article-editor-surface [data-lexical-content] hr {
    margin: 12px 0 40px;
    border: 0;
    border-top: 1px solid var(--article-line);
}

.article-editor-surface [data-lexical-content][contenteditable="false"] {
    background: transparent;
    color: var(--article-text);
}

@media (max-width: 760px) {
    .article-editor-lead,
    .article-editor-surface [data-lexical-content] {
        padding-left: 20px;
        padding-right: 20px;
    }
    .article-editor-lead { padding-top: 32px; }
    .article-editor-surface [data-lexical-content] { font-size: 18px; }
    .article-editor-plus { display: none; }
}

/* Title and summary: borderless, like Ghost's title */
.article-editor-title,
.article-editor-summary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 0;
    padding: 0;
    resize: none;
    overflow: hidden;
    background: transparent;
    field-sizing: content;
}

.article-editor-title {
    font-family: "Aleo", Georgia, serif;
    font-size: 48px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.015em;
    color: var(--article-ink);
}

.article-editor-summary {
    margin: 14px 0 36px;
    font-family: "Albert Sans", ui-sans-serif, system-ui, sans-serif;
    font-size: 21px;
    line-height: 1.5;
    color: #5f5f6b;
}

.article-editor-title:focus,
.article-editor-summary:focus {
    outline: none;
}

.article-editor-title::placeholder,
.article-editor-summary::placeholder {
    color: #c3c8cf;
}

@media (max-width: 760px) {
    .article-editor-title { font-size: 34px; }
    .article-editor-summary { font-size: 18px; }
}

/* "+ Add feature image" above the title */
.article-feature-add {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 28px;
    font-size: 14px;
    color: var(--article-muted);
}

.article-feature-add button,
.article-feature-add label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.article-feature-add button:hover,
.article-feature-add label:hover {
    color: var(--article-ink);
}

.article-feature {
    margin: 0 0 40px;
}

.article-feature-frame {
    position: relative;
}

.article-feature-frame img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 2px;
    background: #f6f6f8;
}

.article-feature-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.article-feature-frame:hover .article-feature-actions,
.article-feature-frame:focus-within .article-feature-actions {
    opacity: 1;
}

.article-feature-actions button,
.article-feature-actions label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: rgba(21, 23, 26, 0.75);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.article-feature-actions button:hover,
.article-feature-actions label:hover {
    background: var(--article-ink);
}

.article-feature-caption {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 14px;
    color: var(--article-muted);
}

.article-feature-caption input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 4px 0;
    background: transparent;
    font: inherit;
    text-align: center;
    color: #3f3f4a;
    outline: none;
}

.article-feature-caption input::placeholder {
    color: #b5bcc4;
}

.article-feature-caption .is-missing {
    color: #b45309;
}

/* The "+" in the margin of an empty line */
.article-editor-plus {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #aeb7c1;
    border-radius: 999px;
    background: #fff;
    color: #5f6b7a;
    cursor: pointer;
    transform: translate(calc(-100% - 30px), -50%);
    transition: border-color 0.15s, color 0.15s, transform 0.15s;
}

.article-editor-plus:hover {
    border-color: var(--article-ink);
    color: var(--article-ink);
}

.article-editor-plus[hidden] {
    display: none;
}

.article-editor-surface :is(.blazor-lexical__floating-toolbar, .blazor-lexical__slash-menu, .blazor-lexical__mention-menu, .blazor-lexical__link-editor, .blazor-lexical__comment-composer, .blazor-lexical__table-menu, .blazor-lexical__drop-line):not([data-lexical-visible]) {
    top: 0 !important;
    left: 0 !important;
}

/* The toolbar that floats over selected text */
.article-editor-float {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.12), 0 6px 24px -4px rgba(0, 0, 0, 0.18);
}

.article-editor-float button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    margin: 4px 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--article-ink);
    cursor: pointer;
}

.article-editor-float button:hover {
    background: rgba(225, 227, 229, 0.8);
}

.article-editor-float button[data-lexical-active],
.article-editor-float button[aria-pressed="true"] {
    color: var(--article-accent);
}

.article-float-sep {
    width: 1px;
    height: 32px;
    background: #ebeef0;
}

.article-float-bold { font: 700 17px/1 "Albert Sans", system-ui, sans-serif; }
.article-float-italic { font: italic 400 18px/1 Georgia, serif; }
.article-float-h2 { font: 700 18px/1 "Albert Sans", system-ui, sans-serif; }
.article-float-h3 { font: 700 13px/1 "Albert Sans", system-ui, sans-serif; }

/* The card menu: "+" and "/" both open it */
.article-editor-cards {
    width: 312px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0 8px 8px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.12), 0 10px 32px -6px rgba(0, 0, 0, 0.2);
    font-family: "Albert Sans", ui-sans-serif, system-ui, sans-serif;
}

.article-cards-label {
    padding: 14px 8px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--article-muted);
}

.article-editor-cards button {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 40px;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--article-ink);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.article-editor-cards button:hover,
.article-editor-cards button[aria-selected="true"],
.article-editor-cards button.is-active,
.article-editor-cards button.active {
    background: #f4f5f6;
}

.article-cards-icon {
    display: inline-flex;
    width: 22px;
    justify-content: center;
    color: #394047;
}

.article-cards-name {
    font-weight: 500;
}

/* Word count, bottom right, as in Ghost */
.article-editor-words {
    position: sticky;
    bottom: 0;
    padding: 10px 24px 16px;
    text-align: right;
    font-size: 13px;
    color: var(--article-muted);
    pointer-events: none;
}

/* Location and tag chips */
.article-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 44px;
    padding: 6px;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
}

.article-chips:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1;
}

.article-chips.is-readonly {
    background: #f6f6f8;
}

.article-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef0ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.article-chip button {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.article-chips-entry {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.article-chips-entry input {
    width: 100%;
    border: 0;
    padding: 4px;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    color: #0d0d17;
    outline: none;
}

.article-chips-list {
    position: absolute;
    top: calc(100% + 6px);
    left: -6px;
    z-index: 10;
    min-width: 240px;
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(13, 13, 23, .12);
}

.article-chips-list li {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    color: #0d0d17;
    cursor: pointer;
}

.article-chips-list li:hover,
.article-chips-list li.is-active {
    background: #eef0ff;
}

/* Cards */
.article-node-image,
.article-node-html,
.article-node-faq,
.article-node-callout {
    margin: 0 0 32px;
}

.article-node-image {
    cursor: default;
}

.article-node-image img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.article-node-image figcaption {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.article-node-caption {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 4px 48px;
    background: transparent;
    font: 15px/1.4 "Albert Sans", ui-sans-serif, system-ui, sans-serif;
    text-align: center;
    color: #5f6b7a;
    outline: none;
}

.article-node-caption::placeholder {
    color: #b5bcc4;
}

.article-node-alt {
    position: absolute;
    right: 0;
    padding: 2px 6px;
    border: 1px solid #d4d8dd;
    border-radius: 4px;
    background: #fff;
    font: 600 11px/1.4 "Albert Sans", ui-sans-serif, system-ui, sans-serif;
    color: var(--article-muted);
    cursor: pointer;
}

.article-node-alt.is-missing {
    border-color: #f59e0b;
    color: #b45309;
}

.article-node-alt.is-on {
    border-color: var(--article-ink);
    background: var(--article-ink);
    color: #fff;
}

.article-node-image.is-selected img,
.article-node-html.is-selected {
    outline: 2px solid var(--article-accent);
    outline-offset: 0;
}

.article-node-html {
    padding: 14px 18px;
    border: 1px solid var(--article-line);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.article-node-html pre {
    margin: 6px 0 0;
    max-height: 9rem;
    overflow: hidden;
    font: 14px/1.6 ui-monospace, Consolas, Menlo, monospace;
    white-space: pre-wrap;
    color: #3a7b2a;
}

.article-node-label {
    font: 600 11px/1 "Albert Sans", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--article-muted);
}

.article-node-callout,
.article-body .callout {
    display: flex;
    gap: 16px;
    padding: 20px 28px;
    border: 0;
    border-radius: 6px;
    background: #e6f6fe;
    color: var(--article-ink);
}

.article-node-callout::before,
.article-body .callout::before {
    content: "💡";
    flex-shrink: 0;
    font-size: 20px;
    line-height: 1.6;
}

.article-node-callout > *,
.article-body .callout > * {
    flex: 1;
}

.article-node-callout-crisis,
.article-body .callout-crisis {
    background: #fdecec;
}

.article-node-callout-crisis::before,
.article-body .callout-crisis::before {
    content: "☎️";
}

.article-node-faq,
.article-body .faq {
    padding: 20px 24px 4px;
    border: 1px solid var(--article-line);
    border-radius: 6px;
}

.article-node-faq-question,
.article-body .faq h3 {
    position: relative;
    margin: 0 0 8px !important;
    padding-right: 32px;
    font-family: "Albert Sans", ui-sans-serif, system-ui, sans-serif !important;
    font-size: 21px !important;
    font-weight: 700;
    line-height: 1.35;
    color: var(--article-ink);
}

.article-node-faq-question::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 4px;
    width: 9px;
    height: 9px;
    border-right: 1.5px solid #8e9cac;
    border-bottom: 1.5px solid #8e9cac;
    transform: rotate(45deg);
}

.article-node-faq-question:empty::before {
    content: attr(data-placeholder);
    color: #b5bcc4;
}

.article-node-faq-answer > :first-child,
.article-node-callout > :first-child {
    margin-top: 0;
}

.article-node-faq-answer > :last-child,
.article-node-callout > :last-child {
    margin-bottom: 0;
}

.article-node-faq-answer > p {
    margin-bottom: 16px !important;
}

.article-editor-surface [data-lexical-content] .article-node-callout > :last-child,
.article-editor-surface [data-lexical-content] .article-node-faq-answer > :last-child {
    margin-bottom: 0 !important;
}

.article-editor-surface [data-lexical-content] .article-node-faq {
    padding-bottom: 20px;
}

/* Read-only article body (preview and review) */
.article-body {
    font-size: 1.125rem;
    line-height: 1.75;
    color: #27272f;
}

.article-body p,
.article-body ul,
.article-body ol {
    margin: 0 0 1.25rem;
}

.article-body ul,
.article-body ol {
    padding-left: 1.5rem;
}

.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

.article-body h2 {
    margin: 2.25rem 0 0.75rem;
    font-family: "Aleo", ui-serif, Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0d0d17;
}

.article-body h3 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0d0d17;
}

.article-body a {
    color: #4338ca;
    text-decoration: underline;
}

.article-body blockquote {
    margin: 1.5rem 0;
    padding-left: 1rem;
    border-left: 3px solid #6366f1;
    font-style: italic;
}

.article-body figure {
    margin: 1.5rem 0;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.article-body figcaption {
    font-size: 0.8125rem;
    color: #5f5f6b;
    text-align: center;
}

.article-body hr {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid #e4e4e7;
}

.article-body table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-body th,
.article-body td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e4e4e7;
    text-align: left;
}

/* The editor page: top bar, canvas, settings panel (ArticleWorkspace) */
.article-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100vh;
    background: #fff;
}

.article-workspace-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 0 20px 0 28px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
}

.article-workspace-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.article-workspace-docked .article-workspace-bar {
    align-items: stretch;
    padding-right: 0;
}

.article-workspace-docked .article-workspace-actions {
    width: 380px;
    box-sizing: border-box;
    padding: 0 20px 0 24px;
    border-left: 1px solid #e1e3e5;
    border-bottom: 1px solid #e1e3e5;
    background: #fff;
}

.article-workspace-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.article-workspace-canvas {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.article-workspace-notices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 740px;
    margin: 8px auto 0;
    padding: 0 72px;
    box-sizing: content-box;
}

.article-workspace-settings {
    position: sticky;
    top: 64px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    flex-shrink: 0;
    width: 380px;
    height: calc(100vh - 64px);
    box-sizing: border-box;
    overflow-y: auto;
    padding: 20px 24px 32px;
    border-left: 1px solid #e1e3e5;
    background: #fff;
}

@media (max-width: 1100px) {
    .article-workspace-body { flex-direction: column; }
    .article-workspace-docked .article-workspace-bar { align-items: center; padding-right: 20px; }
    .article-workspace-docked .article-workspace-actions { width: auto; padding: 0; border: 0; background: transparent; }
    .article-workspace-settings {
        position: static;
        width: auto;
        height: auto;
        border-left: 0;
        border-top: 1px solid #e1e3e5;
    }
    .article-workspace-notices { padding: 0 20px; }
}

/* Text buttons in the bar, as in Ghost: "Preview" in ink, the main action in colour */
.article-bar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font: 600 14px/1 "Albert Sans", ui-sans-serif, system-ui, sans-serif;
    color: #15171a;
    cursor: pointer;
}

.article-bar-button:hover:not(:disabled) {
    background: #f4f5f6;
}

.article-bar-button:disabled {
    cursor: default;
    opacity: 0.45;
}

.article-bar-primary {
    font-weight: 700;
    color: var(--article-accent, #6062EA);
}

.article-editor ::selection {
    background: rgba(96, 98, 234, 0.16);
}

/* Settings panel sections */
.article-panel-heading {
    margin: 0;
    font: 700 18px/1.3 "Aleo", ui-serif, Georgia, serif;
    color: #15171a;
}
