/* Navigation changes presentation only; the workspace and editors stay shared. */
@media screen {
  .funify-notes-page[data-notes-editing='true'] .notes-panel {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    height: var(--notes-editor-height, calc(100dvh - 24px));
    min-height: 0;
    overflow: hidden;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-panel-head {
    position: static;
    flex: 0 0 auto;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-document {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-formatbar {
    position: relative;
    top: auto;
    flex: 0 0 auto;
  }

  .funify-notes-page[data-notes-editing='true'] :is(.notes-editor, .notes-html-editor) {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    resize: none;
  }
}

@media screen and (max-width: 767px) {
  .funify-notes-page[data-notes-editing='true'] .notes-panel {
    top: 0;
    border-radius: 0;
  }

  .funify-notes-page[data-notes-editing='true'] .notes-mobile-toolbar {
    position: static;
    flex: 0 0 auto;
  }
}

.notes-responsive-only {
  display: none;
}

.notes-browse-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-browse-heading > h2 {
  flex: 1;
}

.notes-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgb(9 23 47 / 35%);
}

.notes-document-menu,
.notes-workspace-menu {
  position: relative;
}

.notes-document-menu > summary,
.notes-workspace-menu > summary {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 22px;
  list-style: none;
}

.notes-document-menu > summary::-webkit-details-marker,
.notes-workspace-menu > summary::-webkit-details-marker {
  display: none;
}

.notes-responsive-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 45;
  display: grid;
  width: max-content;
  padding: 5px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: var(--gh-shadow);
}

.funify-notes-page :is(.notes-responsive-menu, .tree-context-menu) :is(button, a) {
  display: block;
  min-height: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  text-decoration: none;
}

.funify-notes-page :is(.notes-responsive-menu, .tree-context-menu) :is(button, a):hover {
  background: var(--gh-accent-subtle);
  color: var(--color-text);
}

details:not([open]) > .notes-responsive-menu {
  display: none;
}

@media screen and (max-width: 1024px) {
  .funify-notes-page[data-notes-navigation-open='true'] {
    overflow: hidden;
  }

  .funify-notes-page #notesCloseFoldersBtn:not([hidden]) {
    display: inline-flex;
    min-width: 32px;
    font-size: 22px;
  }

  .funify-notes-page .notes-formatbar {
    position: static;
  }

  .funify-notes-page :is(.notes-document, .notes-view, .notes-editor) {
    min-width: 0;
    max-width: 100%;
  }

  .funify-notes-page .notes-document {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes-mobile-table-scroll {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .funify-notes-page .notes-mobile-table-scroll > table {
    max-width: none;
  }

  .funify-notes-page .notes-editor {
    max-width: 100%;
    overflow-x: auto;
  }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
  .funify-notes-page .notes-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .funify-notes-page .notes-sidebar {
    display: none;
    contain: none;
  }

  .funify-notes-page[data-notes-navigation-open='true'] .notes-sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    z-index: 100;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 300px;
    min-height: 0;
    box-shadow: var(--gh-shadow);
  }

  .funify-notes-page .notes-tree-wrap {
    min-height: 0;
    max-height: none;
    overflow: auto;
  }

  .notes-tablet-toolbar {
    display: flex;
    padding: 12px 18px 0;
  }

  .funify-notes-page .notes-panel-head {
    position: static;
  }
}

@media screen and (max-width: 767px) {
  .funify-notes-page[data-notes-screen='browse'] {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  .funify-notes-page[data-notes-screen='browse'] > .wrap {
    flex: 1 0 auto;
    width: 100%;
    min-height: 0;
  }

  .funify-notes-page :is(.site-header, .repo-hero, funify-site-footer, .page-footer) {
    display: none;
  }

  .funify-notes-page[data-notes-screen='browse'] > funify-site-footer {
    display: block;
    flex: 0 0 auto;
    margin: 16px 0 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .funify-notes-page[data-notes-screen='browse'] .site-header {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 32px);
    height: 56px;
    margin: 0 auto;
    padding: 0;
  }

  .funify-notes-page .site-header .menu {
    position: relative;
    top: auto;
    right: auto;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--color-text);
    transform: none;
  }

  .funify-notes-page .site-header .menu:is(:hover, [aria-expanded='true']) {
    border-color: var(--color-border);
    background: var(--color-surface);
  }

  .funify-notes-page .site-header .menu:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  .funify-notes-page .site-header .menu::before,
  .funify-notes-page .site-header .menu::after,
  .funify-notes-page .site-header .menu span {
    left: 12px;
    width: 18px;
    height: 1.5px;
  }

  .funify-notes-page .site-header .menu::before {
    top: 14px;
  }

  .funify-notes-page .site-header .menu span {
    top: 20px;
  }

  .funify-notes-page .site-header .menu::after {
    top: 26px;
  }

  .funify-notes-page .site-header .menu[aria-expanded='true']::before {
    top: 20px;
    transform: rotate(45deg);
  }

  .funify-notes-page .site-header .menu[aria-expanded='true'] span {
    opacity: 0;
  }

  .funify-notes-page .site-header .menu[aria-expanded='true']::after {
    top: 20px;
    transform: rotate(-45deg);
  }

  .funify-notes-page .site-header .site-menu {
    width: 176px;
    padding: 6px;
    border-color: var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 8px 24px rgb(9 23 47 / 12%);
  }

  .funify-notes-page .site-header .site-menu a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 7px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
  }

  .funify-notes-page .site-header .site-menu a:is(:hover, [aria-current='page']) {
    background: var(--gh-canvas-subtle);
    color: var(--color-text);
  }

  .funify-notes-page .site-header .site-menu a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
  }

  .funify-notes-page[data-notes-screen='browse'] .repo-hero.notes-hero {
    position: relative;
    isolation: isolate;
    display: block;
    width: 100%;
    margin: -4px 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    --page-heading-size: 28px;
  }

  .funify-notes-page .notes-hero::before {
    position: absolute;
    z-index: -2;
    inset: -56px 0 0;
    background:
      radial-gradient(
        ellipse at 90% 15%,
        color-mix(in srgb, var(--color-primary) 11%, transparent),
        transparent 70%
      ),
      linear-gradient(115deg, var(--color-surface), var(--color-background));
    content: '';
    pointer-events: none;
  }

  .funify-notes-page .notes-mobile-waves {
    position: absolute;
    z-index: -1;
    inset: auto 0 0;
    display: block;
    width: 100%;
    height: 84px;
    pointer-events: none;
  }

  .funify-notes-page .notes-hero-inner {
    position: relative;
    display: block;
    min-height: 0;
    padding: 0 16px 12px;
  }

  .funify-notes-page .notes-hero-mark {
    position: absolute;
    z-index: -1;
    top: -38px;
    right: 48px;
    width: 108px;
    height: 108px;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0.1;
    transform: rotate(-12deg);
    pointer-events: none;
  }

  .funify-notes-page .notes-hero .notes-title-icon {
    width: 86px;
    height: 86px;
  }

  .funify-notes-page .notes-hero-copy {
    padding: 0;
    border: 0;
  }

  .funify-notes-page .notes-feature-strip {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: auto;
    margin-top: 8px;
  }

  .funify-notes-page .notes-feature-strip li {
    gap: 4px;
    min-height: 22px;
    padding: 3px 6px;
    border: 0;
    border-radius: 6px;
    background: color-mix(in srgb, var(--color-muted) 9%, var(--color-surface));
    color: var(--color-text);
    font-size: clamp(9px, 2.5vw, 11px);
  }

  .funify-notes-page .notes-feature-strip svg {
    display: block;
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
    color: currentColor;
  }

  .funify-notes-page[data-notes-screen='browse'] .notes-browse-heading > h2 {
    display: none;
  }

  .funify-notes-page[data-notes-screen='browse'] .notes-browse-heading {
    position: absolute;
    top: 20px;
    right: 12px;
    z-index: 1;
    margin: 0;
  }

  .funify-notes-page[data-notes-screen='browse'] .notes-search {
    padding-right: 48px;
  }

  .funify-notes-page .notes-main {
    width: 100%;
    margin: 0;
  }

  .funify-notes-page .notes-shell {
    display: block;
  }

  .funify-notes-page :is(.notes-sidebar, .notes-panel) {
    position: static;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .funify-notes-page .notes-sidebar {
    overflow: visible;
    background: var(--color-background);
    contain: none;
  }

  .funify-notes-page[data-notes-screen='browse'] .notes-sidebar {
    min-height: 0;
  }

  .funify-notes-page[data-notes-screen='browse'] #notesEditor,
  .funify-notes-page[data-notes-screen='document'] #notesTree {
    display: none;
  }

  .funify-notes-page .notes-sidebar-head {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 0;
    padding: max(16px, env(safe-area-inset-top)) 16px 12px;
    border: 0;
    background: var(--color-background);
  }

  .funify-notes-page .notes-sidebar-title {
    font-size: 18px;
    font-weight: 750;
  }

  .notes-workspace-menu {
    display: block;
  }

  .notes-browse-heading {
    margin-bottom: 10px;
  }

  .funify-notes-page .notes-search-field {
    top: 0;
    margin: 0;
  }

  .funify-notes-page .notes-search {
    height: 44px;
    min-height: 44px;
    padding-left: 36px;
    padding-right: 12px;
    border: 0;
    border-radius: 12px;
    font-size: 13px;
  }

  .funify-notes-page .notes-search-icon {
    right: auto;
    left: 12px;
    width: 16px;
    height: 16px;
  }

  .notes-browse-actions {
    display: block;
    padding: 0 16px 12px;
  }

  .funify-notes-page .notes-browse-actions .notes-create-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .notes-browse-actions .notes-create-actions::after {
    content: none;
  }

  .funify-notes-page .notes-browse-actions .notes-btn {
    min-height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface) 75%, transparent);
    color: var(--color-primary);
    font-size: 12px;
  }

  .funify-notes-page .notes-browse-actions .notes-btn:hover {
    border-color: var(--color-primary);
    background: var(--gh-accent-subtle);
  }

  .notes-folder-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 10px;
  }

  .notes-folder-navigation > div {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  #notesFolderCaption {
    display: block;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    padding-block: 3px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .funify-notes-page #notesFolderCaption button {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .funify-notes-page #notesFolderCaption button:hover {
    color: var(--color-primary);
    text-decoration: underline;
  }

  #notesFolderCaption button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  .notes-folder-navigation span {
    flex-shrink: 0;
    color: var(--color-muted);
    font-size: 11px;
  }

  .funify-notes-page .notes-tree-wrap {
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 0 16px max(20px, env(safe-area-inset-bottom));
  }

  .funify-notes-page .notes-tree {
    gap: 8px;
  }

  .funify-notes-page .tree-item {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    min-height: 48px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--color-surface);
  }

  .funify-notes-page .tree-item.active {
    background: var(--gh-accent-subtle);
  }

  .funify-notes-page .node-title {
    gap: 9px;
    font-size: 13px;
  }

  .notes-row-chevron {
    color: var(--color-muted);
    font-size: 20px;
    line-height: 1;
  }

  .funify-notes-page .tree-menu-button {
    width: 26px;
    min-height: 28px;
  }

  .notes-list-empty {
    margin: 16px 0;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.6;
  }

  .funify-notes-page .notes-sidebar-footer {
    display: none;
  }

  .notes-mobile-toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 56px;
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
  }

  .notes-mobile-toolbar :is(.notes-mobile-back, .notes-mobile-icon) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 36px;
    min-height: 40px;
    padding: 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-primary);
    cursor: pointer;
  }

  .notes-mobile-toolbar .notes-mobile-back {
    justify-content: flex-start;
    margin-right: auto;
    color: var(--color-text);
    font-size: 13px;
  }

  .notes-mobile-toolbar svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .funify-notes-page .notes-mobile-toolbar .notes-btn {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .funify-notes-page .notes-panel-head {
    position: static;
    display: block;
    min-height: 0;
    padding: 18px 16px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .funify-notes-page .notes-panel-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
  }

  .funify-notes-page #breadcrumb {
    color: var(--color-muted);
    font-size: 10px;
    font-weight: 400;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .funify-notes-page .notes-title-input {
    flex: 0 0 auto;
    width: 100%;
    min-height: 32px;
    padding: 0;
    border: 0;
    border-radius: 0;
    text-overflow: ellipsis;
  }

  .funify-notes-page .notes-panel-actions {
    display: none;
  }

  .notes-mobile-meta {
    display: block;
    margin: 8px 0 0;
    color: var(--color-muted);
    font-size: 10px;
    line-height: 1.5;
  }

  .funify-notes-page #notesDocumentDetails {
    display: none;
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: var(--gh-canvas-subtle);
  }

  .funify-notes-page[data-notes-details='true'] #notesDocumentDetails {
    display: block;
  }

  .funify-notes-page #notesDocumentDetails .notes-meta-row {
    display: grid;
    gap: 4px;
    font-size: 10px;
  }

  .funify-notes-page #notesDocumentDetails .notes-status {
    margin: 0;
    font-size: 1em;
    text-align: left;
  }

  .funify-notes-page .notes-document {
    min-width: 0;
    padding: 8px 16px 24px;
  }

  .funify-notes-page .notes-formatbar {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top));
    z-index: 30;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border-radius: 8px;
    scrollbar-width: thin;
  }

  .funify-notes-page .notes-formatbar .notes-toolbar-group {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    min-width: max-content;
    max-width: none;
  }

  .funify-notes-page .notes-formatbar .notes-btn {
    min-height: 30px;
    padding-block: 4px;
  }

  .funify-notes-page :is(.notes-view, .notes-editor, .notes-empty) {
    min-height: calc(100dvh - 160px);
  }

  .funify-notes-page :is(.notes-view, .notes-editor) {
    min-width: 0;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.7;
  }

  .funify-notes-page .notes-editor {
    overflow-x: auto;
  }

  .funify-notes-page .notes-html-editor {
    min-height: calc(100dvh - 260px);
    font-size: 13px;
  }

  .funify-notes-page[data-notes-navigation-open='true'] #notesTree {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    display: block;
    width: min(360px, 92vw);
    min-height: 0;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--color-border);
    box-shadow: var(--gh-shadow);
  }
}

@media print {
  .notes-responsive-only,
  .notes-drawer-backdrop {
    display: none !important;
  }
}
