/* nosk vault mode: setup screen, folder tree and rendered Obsidian notes. Uses the tokens from
   main.css, so both themes work. */

/* --- Setup ----------------------------------------------------------------------------------- */

.setup {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}
.setup__card {
    width: min(460px, 100%);
    display: grid;
    gap: 14px;
    padding: 28px;
    border: 1px solid var(--bdr-hi);
    background: var(--panel);
    box-shadow: var(--shadow-float);
}
.setup__lead { margin: 0; color: var(--txt-2); font-size: 13px; line-height: 1.6; }
.setup__steps { margin: 4px 0 0; padding-left: 18px; color: var(--txt-3); font-size: 12px; line-height: 1.7; }
.setup__steps a { color: var(--amber); }
.setup__steps b { color: var(--txt-2); font-weight: 600; }

/* --- Layout --------------------------------------------------------------------------------- */

/* Keep the note pane in its own column: with the sidebar hidden, auto-placement would otherwise
   drop it into the sidebar's (zero-width) column. */
.app > .main { grid-column: 2; }

/* --- Sidebar tree ---------------------------------------------------------------------------- */

.tree-toolbar { display: flex; gap: 4px; align-items: center; }
.tree-toolbar .sidebar__filter { flex: 1; min-width: 0; }
.tree { display: flex; flex-direction: column; }
.tree-folder {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 8px 4px calc(var(--depth, 0) * 14px);
    background: none;
    border: 0;
    color: var(--txt-2);
    font-size: 12.5px;
    text-align: left;
}
.tree-folder:hover { color: var(--txt); background: var(--surface-2); }
.tree-folder__chevron { width: 16px; flex: none; color: var(--txt-3); font-size: 15px; line-height: 1; text-align: center; }
.tree-folder:hover .tree-folder__chevron, .tree-folder[aria-expanded="true"] .tree-folder__chevron { color: var(--amber); }
.tree-folder__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tree-file { padding-left: calc(var(--depth, 0) * 14px + 8px); margin-left: 0; }
.tree-file .nav-page__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-file .nav-page__icon { width: 16px; flex: none; color: var(--txt-3); font-size: 14px; line-height: 1; text-align: center; }
.tree-file:not(.tree-file--note) { color: var(--txt-3); }
.tree-file__folder { margin-left: auto; color: var(--txt-4); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.sidebar__user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Home ------------------------------------------------------------------------------------ */

.home-list { display: grid; border: 1px solid var(--bdr); }
.home-list__item {
    display: flex;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bdr);
    color: var(--txt);
    text-decoration: none;
    font-size: 13px;
}
.home-list__item:last-child { border-bottom: 0; }
.home-list__item:hover { background: var(--amber-wash); }
.home-list__item .muted { font-size: 11px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.progress { display: grid; gap: 8px; max-width: 420px; margin-top: 24px; }
.progress__track { height: 4px; background: var(--surface-3); }
.progress__fill { height: 100%; width: 0; background: var(--amber); transition: width .2s; }

/* --- Note view ------------------------------------------------------------------------------- */

.note .page-meta { display: flex; gap: 8px; align-items: center; color: var(--txt-3); font-size: 11px; }
.tag {
    color: var(--cyan);
    text-decoration: none;
    font-size: 12px;
    padding: 1px 6px;
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--cyan) 25%, transparent);
}
.tag:hover { border-color: var(--cyan); }
.properties { grid-template-columns: minmax(80px, max-content) 1fr; margin: 10px 0 4px; padding: 10px 12px; border: 1px solid var(--bdr); background: var(--surface); font-size: 12px; }
.properties dd { word-break: break-word; }

.note-body { color: var(--txt); font-size: 14px; line-height: 1.7; padding-bottom: 32px; overflow-wrap: anywhere; }
.note-body > :first-child { margin-top: 0; }
.note-body h1, .note-body h2, .note-body h3, .note-body h4, .note-body h5, .note-body h6 {
    margin: 1.6em 0 .5em;
    letter-spacing: -.03em;
    line-height: 1.25;
    scroll-margin-top: 64px;
}
.note-body h1 { font-size: 26px; }
.note-body h2 { font-size: 21px; }
.note-body h3 { font-size: 17px; }
.note-body h4, .note-body h5, .note-body h6 { font-size: 14px; color: var(--txt-2); }
.note-body p, .note-body ul, .note-body ol, .note-body table, .note-body pre { margin: 0 0 1em; }
.note-body ul, .note-body ol { padding-left: 1.4em; }
.note-body li { margin: 2px 0; }
.note-body li > ul, .note-body li > ol { margin: 2px 0; }
.note-body a { color: var(--blue); text-decoration-color: color-mix(in srgb, var(--blue) 40%, transparent); text-underline-offset: 3px; }
.note-body a:hover { color: var(--amber); }
.note-body .wikilink { color: var(--violet); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--violet) 35%, transparent); }
.note-body .wikilink:hover { color: var(--amber); border-bottom-color: currentColor; }
.note-body .wikilink.is-unresolved { color: var(--txt-3); border-bottom-style: dashed; cursor: default; }
.note-body .wikilink--file { color: var(--cyan); }
.note-body code { font-family: var(--mono); font-size: .92em; color: var(--orange); background: var(--surface-2); padding: 1px 4px; }
.note-body pre { position: relative; padding: 12px 14px; overflow-x: auto; background: var(--code-surface); border: 1px solid var(--bdr); color: #e4e8f7; font-size: 12.5px; line-height: 1.6; }
.note-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.note-body pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 4px; right: 8px; color: #747b9e; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.note-body pre.is-query { border-style: dashed; }
.note-body blockquote { margin: 0 0 1em; padding: 2px 0 2px 14px; border-left: 2px solid var(--amber); color: var(--txt-2); }
.note-body hr { border: 0; border-top: 1px solid var(--bdr-hi); margin: 2em 0; }
.note-body table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 13px; }
.note-body th, .note-body td { border: 1px solid var(--bdr-hi); padding: 6px 10px; text-align: left; vertical-align: top; }
.note-body th { background: var(--surface-2); font-weight: 600; }
.note-body img { max-width: 100%; height: auto; }
.note-body img.is-missing { display: inline-block; padding: 12px; border: 1px dashed var(--bdr-hi); color: var(--txt-3); font-size: 12px; }
.note-body mark { background: color-mix(in srgb, var(--amber) 30%, transparent); color: inherit; padding: 0 2px; }
.note-body .math-block { margin: 0 0 1em; overflow-x: auto; }
.note-body .is-target { outline: 1px solid var(--amber-line); outline-offset: 4px; background: var(--amber-wash); }

/* Tasks */
.note-body .task-list { list-style: none; padding-left: .4em; }
.note-body .task { position: relative; }
.note-body .task input[type="checkbox"] { margin: 0 8px 0 0; vertical-align: -1px; accent-color: var(--amber); }
.note-body .task.is-done { color: var(--txt-3); text-decoration: line-through; text-decoration-color: var(--txt-4); }
.note-body .task__marker { margin-right: 8px; color: var(--amber); font-size: 12px; }
.note-body .task--cancelled { color: var(--txt-3); text-decoration: line-through; }
.note-body .task--doing .task__marker { color: var(--cyan); }

/* Callouts */
.note-body .callout {
    --c: var(--blue);
    margin: 0 0 1em;
    border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
    border-left: 2px solid var(--c);
    background: color-mix(in srgb, var(--c) 7%, transparent);
}
.note-body .callout[data-color="cyan"] { --c: var(--cyan); }
.note-body .callout[data-color="green"] { --c: var(--green); }
.note-body .callout[data-color="amber"] { --c: var(--amber); }
.note-body .callout[data-color="rose"] { --c: var(--rose); }
.note-body .callout[data-color="violet"] { --c: var(--violet); }
.note-body .callout[data-color="muted"] { --c: var(--txt-3); }
.note-body .callout__title { padding: 8px 12px; color: var(--c); font-weight: 700; font-size: 13px; }
.note-body summary.callout__title { cursor: pointer; }
.note-body .callout__content { padding: 0 12px 4px; }
.note-body .callout__content:empty { display: none; }

/* Embedded notes */
.note-body .note-embed { margin: 0 0 1em; border: 1px solid var(--bdr-hi); border-left: 2px solid var(--violet); background: var(--surface); }
.note-body .note-embed__title { display: block; padding: 6px 12px; border-bottom: 1px solid var(--bdr); color: var(--violet); font-size: 11px; text-decoration: none; letter-spacing: .04em; }
.note-body .note-embed__body { padding: 10px 14px 0; font-size: 13px; }

/* Other files */
.file-view { display: grid; gap: 12px; padding-bottom: 32px; }
.file-view img { max-width: 100%; border: 1px solid var(--bdr); background: var(--surface); }
.file-view iframe { width: 100%; height: 75vh; border: 1px solid var(--bdr); background: #fff; }
.file-view__actions { display: flex; gap: 6px; }
.file-source { max-height: 70vh; overflow: auto; padding: 12px 14px; background: var(--code-surface); border: 1px solid var(--bdr); color: #e4e8f7; font-size: 12px; margin-top: 12px; white-space: pre-wrap; word-break: break-all; }
.modal__actions--start { justify-content: flex-start; flex-wrap: wrap; }

@media (max-width: 860px) {
    .note-body { font-size: 15px; }
    .note-body pre { font-size: 12px; }
}

/* --- Editing --------------------------------------------------------------------------------- */

.page-actions { gap: 8px; margin-top: 4px; }
.unsynced { color: var(--amber); font-size: 11px; letter-spacing: .02em; }
.tree-file.is-dirty .nav-page__title::after { content: " ●"; color: var(--amber); font-size: 9px; vertical-align: 1px; }
.sync-status[data-state="pending"] .sync-status__dot { background: var(--amber); }
.sync-status[data-state="pending"] { color: var(--amber); }

.note-editor-wrap { position: relative; padding-bottom: 40vh; }
.editor-toolbar {
    position: sticky;
    top: 48px;
    z-index: 5;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin: 0 0 8px;
    padding: 4px;
    border: 1px solid var(--bdr);
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
    backdrop-filter: blur(10px);
}
.editor-tool { min-width: 32px; height: 30px; padding: 0 8px; background: none; border: 1px solid transparent; color: var(--txt-2); font-family: var(--mono); font-size: 13px; font-weight: 600; }
.editor-tool:hover { color: var(--amber); border-color: var(--bdr-hi); }
.note-editor {
    display: block;
    width: 100%;
    min-height: 50vh;
    padding: 4px 0;
    border: 0;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    color: var(--txt);
    caret-color: var(--amber);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.7;
    tab-size: 4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.note-editor:focus { background: transparent; border-color: transparent; }
.link-suggest { position: absolute; z-index: 20; width: 260px; max-height: 260px; overflow-y: auto; padding: 4px 0; border: 1px solid var(--bdr-hi); background: var(--panel); box-shadow: var(--shadow-pop); }
.link-suggest__item { display: flex; width: 100%; flex-direction: column; gap: 2px; padding: 6px 10px; background: none; border: 0; border-left: 2px solid transparent; color: var(--txt); font-size: 12.5px; text-align: left; }
.link-suggest__item .muted { font-size: 10.5px; }
.link-suggest__item.is-selected { background: var(--amber-wash); border-left-color: var(--amber); }
.note-body .task input[type="checkbox"]:not(:disabled) { cursor: pointer; }
.daily-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 860px) {
    .note-editor { font-size: 15px; }
    .editor-tool { min-width: 38px; height: 36px; }
    #open-today { padding: 0 8px; }
}

/* --- Search bar: floats over the note pane, not the whole window ------------------------------ */

.palette-backdrop.is-anchored { display: block; padding: 0; background: color-mix(in srgb, var(--scrim) 55%, transparent); backdrop-filter: blur(2px); }
.palette-backdrop.is-anchored .palette { position: absolute; top: 14vh; max-height: 72vh; display: flex; flex-direction: column; }
.palette-backdrop.is-anchored .palette__list { max-height: none; flex: 1; min-height: 0; }
.palette__snippet mark { background: color-mix(in srgb, var(--amber) 28%, transparent); color: var(--txt); padding: 0 1px; }
.palette__item:hover { background: var(--surface-2); }
.palette__item .palette__label { color: var(--txt); }

@media (max-width: 860px) {
    .app > .main { grid-column: 1; }
    .palette-backdrop.is-anchored .palette { top: 64px; max-height: calc(100dvh - 96px); }
}
@media (hover: none) { .palette__footer { display: none; } }

/* --- Top bar path -------------------------------------------------------------------------- */

.topbar__nav { width: 26px; height: 26px; font-size: 18px; line-height: 1; color: var(--txt-2); }
.topbar__nav:disabled { color: var(--txt-4); cursor: default; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; margin-left: 6px; font-size: 12px; white-space: nowrap; }
.crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--txt-3); text-decoration: none; flex: 0 1 auto; }
a.crumb:hover { color: var(--amber); }
.crumb--current { color: var(--txt); flex: 0 0 auto; max-width: 50vw; }
.crumb-sep { color: var(--txt-4); flex: none; }
.folder-list__icon { display: inline-block; width: 18px; color: var(--txt-3); }

@media (max-width: 860px) {
    .crumbs { font-size: 11.5px; gap: 4px; }
    .crumb--current { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
    .crumb:not(.crumb--current):not(:first-child) { max-width: 18vw; }
}
@media (max-width: 520px) {
    /* On phones only the vault, the parent folder and the current item fit. */
    .crumbs > :nth-child(n + 2):nth-last-child(n + 5) { display: none; }
    #nav-forward { display: none; }
}

/* --- Moving files (drag in the tree) --------------------------------------------------------- */

.tree-folder.is-drop-target { color: var(--txt); background: var(--amber-wash); box-shadow: inset 0 0 0 1px var(--amber-line); }
.tree-folder.is-drop-target .tree-folder__chevron { color: var(--amber); }
.tree.is-drop-root { background: var(--amber-wash); box-shadow: inset 0 0 0 1px var(--amber-line); }
.tree .is-dragging { opacity: .45; }
.tree-file, .tree-folder { -webkit-user-drag: element; }
