/* Notes: sidebar of notes on the left, one jumbo-type note on the right. */
[hidden] { display: none !important; }
body.notes { height: 100dvh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.nb { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }

/* Sidebar */
.side {
  display: flex; flex-direction: column; gap: 12px; padding: 18px; overflow-y: auto;
  background: var(--wash); border-right: 1px solid var(--line);
}
.side input {
  width: 100%; min-width: 0; font: inherit; padding: 10px 12px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.side input:focus { outline: 2px solid var(--link); outline-offset: -1px; }
.side .new { display: flex; gap: 8px; }
.side .new button {
  flex: none; width: 46px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 1.5rem; line-height: 1;
}
#list { list-style: none; margin: 0; padding: 0; flex: 1; }
#list a {
  position: relative; display: block; padding: 9px 12px 9px 20px; border-radius: 8px; color: var(--ink);
  font-size: 1.15rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere;
}
#list a:hover { background: #e8ecf6; text-decoration: none; }
#list a.active { background: #fff; }
/* Selected note: a short straight bar set inside the item, clear of its rounded corners */
#list a.active::before {
  content: ""; position: absolute; left: 8px; top: 10px; bottom: 10px; width: 3px;
  background: var(--accent);
}
#list small {
  display: block; margin-top: 3px; font-size: .85rem; font-weight: 400; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.out button, .tools form button {
  border: 0; background: none; padding: 0; font: inherit; font-size: .95rem; color: var(--muted); cursor: pointer;
}
.out button:hover, .tools form button:hover { color: var(--ink); text-decoration: underline; }
.side-toggle { display: none; }

/* The note */
.note { overflow-y: auto; padding: 5vh clamp(20px, 6vw, 96px) 14vh; }
.note > * { max-width: 52rem; }
.title {
  display: block; width: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-family: inherit; font-weight: 800; letter-spacing: -.03em; line-height: 1.1;
  font-size: clamp(2.2rem, 5vw, 3.75rem); text-overflow: ellipsis;
}
.tools { display: flex; align-items: center; gap: 16px; margin: 14px 0 28px; }
.tools form { margin-left: auto; }
#mode {
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
  border-radius: 999px; padding: 7px 20px; font: inherit; font-weight: 600; min-width: 84px;
}
#mode:hover { border-color: var(--link); color: var(--link); }
#status { color: var(--muted); font-size: .95rem; }

/* Jumbo text, shared by the rendered note and the editor */
.md { font-size: clamp(1.25rem, 1.7vw, 1.5rem); line-height: 1.6; overflow-wrap: anywhere; }
#view:empty::before { content: "Empty note."; color: var(--muted); }
textarea#edit {
  display: block; width: 100%; min-height: 50vh; margin: 0; padding: 0; border: 0; outline: 0;
  resize: none; overflow: hidden; background: transparent; color: inherit; font-family: inherit;
}
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { line-height: 1.15; letter-spacing: -.02em; margin: 1.3em 0 .4em; }
.md h1 { font-size: 2em; } .md h2 { font-size: 1.55em; } .md h3 { font-size: 1.25em; }
.md h4, .md h5, .md h6 { font-size: 1em; }
.md > :first-child { margin-top: 0; }
.md p { margin: .7em 0; }
.md ul, .md ol { margin: .7em 0; padding-left: 1.3em; }
.md li { margin: .2em 0; }
.md li.task { list-style: none; margin-left: -1.3em; }
.md li.task input { width: .9em; height: .9em; margin-right: .3em; accent-color: var(--accent); }
.md code {
  font: .85em ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--wash); border: 1px solid var(--line); border-radius: 6px; padding: .1em .35em;
}
.md pre { background: var(--wash); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; overflow-wrap: normal; }
.md blockquote { margin: .8em 0; padding-left: 1em; border-left: 4px solid var(--accent); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.md mark { background: #ffe9a6; padding: 0 .15em; border-radius: 3px; }
.md a.wiki { font-weight: 600; }
.md a.wiki.missing { color: var(--muted); text-decoration: underline dashed; text-underline-offset: 4px; }

.back { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.back h2 { margin: 0 0 8px; font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.back ul { list-style: none; margin: 0; padding: 0; font-size: 1.15rem; font-weight: 600; }
.back li { margin: 4px 0; }

/* Sign-in form on the shared hero layout */
.login { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.login input[type=password] {
  font: inherit; font-size: 1.1rem; padding: 11px 16px; width: min(280px, 100%);
  border: 1px solid var(--line); border-radius: 999px;
}
.login .error { flex-basis: 100%; margin: 4px 0 0; font-size: 1rem; color: #b3261e; }

/* Phones: one column, with the list of notes behind a toggle */
@media (max-width: 760px) {
  body.notes { height: auto; min-height: 100dvh; display: block; overflow: visible; }
  .nb { display: block; }
  .side-toggle {
    display: block; width: 100%; padding: 12px 18px; text-align: left; cursor: pointer;
    border: 0; border-bottom: 1px solid var(--line); background: var(--wash);
    color: var(--ink); font: inherit; font-weight: 600;
  }
  .side { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  body.side-open .side { display: flex; }
  .note { overflow: visible; padding: 22px 18px 20vh; }
}
