/* Library.  OWNER: U - 08 from phase V1 (seeded by Ultron for the mockup). */

.library { display: grid; gap: var(--s3); }
.search { position: relative; }
.search-icon { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--evergreen-soft); pointer-events: none; }
.search-field { padding-left: 46px; min-height: 52px; border-radius: 14px; box-shadow: var(--lift); }
.search-field:focus { box-shadow: var(--lift), var(--ring); }
.library-status { margin-top: calc(var(--s1) * -1); padding-left: 4px; }

.newest { display: grid; gap: var(--s1); }
.note-list { list-style: none; margin: 0 -12px; padding: 0; display: grid; }
.note-row {
  position: relative; display: grid; gap: 2px; width: 100%; min-height: 44px;
  padding: 10px 40px 10px 12px; border: 0; border-radius: 12px; background: none; text-align: left;
  transition: background-color var(--fast) var(--ease);
}
.note-row:hover { background: rgb(28 73 73 / 0.045); }
.note-list li + li .note-row::before {
  content: ""; position: absolute; inset: 0 12px auto; height: 1px; background: var(--hairline);
}
.note-row-title { font-weight: 500; line-height: 1.4; }
.note-row-snippet { font-size: 15px; color: var(--evergreen-soft); line-height: 1.5; }
.note-row-go { position: absolute; right: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--mist); }
.note-row:hover .note-row-go { color: var(--tide); }

.folder-group { display: grid; gap: 12px; margin-top: var(--s2); }
.folder-group .heading { display: flex; align-items: baseline; gap: var(--s1); padding-left: 4px; }
.count { font-size: var(--t-sm); font-weight: 500; color: var(--evergreen-soft); font-variant-numeric: tabular-nums; }
.folder-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.folder-card {
  height: 100%; display: grid; align-content: space-between; gap: var(--s2);
  padding: var(--s2); border-radius: 14px; background: var(--paper); box-shadow: var(--lift);
  color: var(--evergreen); text-decoration: none;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.folder-card:hover { box-shadow: var(--lift-high); transform: translateY(-1px); }
.folder-card:focus-visible { box-shadow: var(--lift), var(--ring); }
.folder-card:active { transform: scale(0.98); }
.folder-name { font: 600 21px/1.2 var(--font-title); }
.folder-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); }
@media (max-width: 560px) { .folder-grid { grid-template-columns: 1fr 1fr; } .folder-name { font-size: 19px; } }

/* "Add a group": the last tile, a dashed outline of a card; open, the form takes the whole row */
.group-add-btn {
  width: 100%; height: 100%; min-height: 96px; display: flex; align-items: center; justify-content: center; gap: var(--s1);
  padding: var(--s2); border: 1.5px dashed var(--hairline-strong); border-radius: 14px;
  background: rgb(255 255 255 / 0.55); color: var(--evergreen); font-size: 15px; font-weight: 500;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.group-add-btn .icon { width: 18px; height: 18px; color: var(--tide); }
.group-add-btn:hover { background: var(--paper); border-color: var(--tide); }
.group-add-btn:focus-visible { border-color: transparent; box-shadow: var(--ring); border-radius: 14px; }
.group-add-btn:active { transform: scale(0.98); }
.group-add.is-open { grid-column: 1 / -1; }
.group-form {
  display: grid; gap: var(--s2); padding: var(--s3); border-radius: 14px;
  background: var(--paper); box-shadow: var(--lift); animation: rise var(--fast) var(--ease);
}
@media (max-width: 560px) { .group-form { padding: 20px; } }
.folder-group .group-form .heading { padding-left: 0; }
.group-field { display: grid; gap: 6px; }
.group-field label { font-size: 15px; font-weight: 500; }
.group-optional { color: var(--evergreen-soft); font-weight: 400; }
.group-said:empty { display: none; }
.group-pending { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.group-foot { display: flex; flex-wrap: wrap; gap: var(--s1); }
.group-foot .btn-primary { min-width: 104px; }    /* "Add" and "Adding…" keep one width */
.group-foot .btn-primary:disabled { opacity: 1; cursor: progress; }   /* "Adding…" stays readable */

.folder-title { margin-top: calc(var(--s1) * -1); }
.overview { display: grid; gap: 12px; }
.overview-summary { font-size: 18px; line-height: 1.6; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; }
.card > .chips { margin: var(--s1) 0; }
.card > .heading + .note-list, .card > .list-head + .note-list { margin-top: var(--s1); }

/* the note */
.note-head { display: grid; gap: 12px; }
.note-head .title { font-size: var(--t-xl); }
.note-lede { font-size: 18px; color: var(--evergreen-soft); }
.note-section { display: grid; gap: var(--s1); }
.note-bullets { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.note-bullets li::marker { color: var(--mist); }
.dated { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dated li { display: grid; grid-template-columns: 104px 1fr; gap: var(--s2); }
@media (max-width: 560px) { .dated li { grid-template-columns: 1fr; gap: 2px; } }
.conflict { padding: var(--s2); border-radius: 12px; background: var(--sand-soft); box-shadow: inset 3px 0 0 var(--moss); display: grid; gap: 6px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.note-foot { padding-top: var(--s2); box-shadow: inset 0 1px 0 var(--hairline); }

/* ---------------------------------------------------------------- V1 (U - 08) */
.overview .link-btn { justify-self: start; min-height: 44px; }
.library .path a { display: inline-block; padding: 12px 0; margin: -12px 0; }    /* 44 px tap height */
.topic-filter .chip { position: relative; }
.topic-filter .chip::after { content: ""; position: absolute; inset: -4px 0; }    /* 44 px hit area, same look */
.list-head { gap: var(--s2); }
.filter-status { text-align: right; }
.library-empty-title { color: var(--evergreen); font-weight: 500; }
.tag-retracted { background: var(--sand-soft); color: var(--brick); }
.focus-target:focus-visible, #note-title:focus-visible { box-shadow: none; }

/* phone only: the side panel (and its sign-out) is hidden there */
.library-foot { display: none; }
.library-signout {
  min-height: 44px; padding: 0 var(--s2); border: 0; border-radius: var(--r-ctl); background: none;
  color: var(--evergreen-soft); font-size: 15px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
@media (max-width: 860px) { .library-foot { display: flex; justify-content: center; margin-top: var(--s3); } }

/* the note panel is a native modal <dialog>; undo the browser's dialog box */
dialog.note-panel {
  margin: 0; padding: 0; border: 0; height: auto; max-width: none; max-height: none; color: var(--evergreen);
}
dialog.note-panel::backdrop { background: transparent; }   /* the .panel-scrim under it is the scrim */
.note-panel:focus-visible { box-shadow: var(--lift-high); border-radius: 0; }
html:has(dialog.note-panel[open]) { overflow: hidden; }
.note-close .icon-back { display: none; }
@media (max-width: 600px) {   /* the panel is full screen here: a back arrow on the left */
  .note-panel-bar { flex-direction: row-reverse; justify-content: flex-end; gap: var(--s-1); padding: var(--s1) var(--s2) var(--s1) var(--s-1); }
  .note-close .icon-back { display: block; }
  .note-close .icon-close { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .note-panel, .panel-scrim, .note-panel .waiting { animation: none; }
  .folder-card:hover, .folder-card:active, .group-add-btn:active { transform: none; }
  .group-form { animation: none; }
}
