/* "What the coach knows about me": the screen the settings menu opens,
   with the switch, the notes and deleting them. */

/* The screen stands in for the app while it is open. With the tabs gone,
   the settings menu keeps its end of the bar. */
body[data-memory] .layout,
body[data-memory] .view-tabs {
  display: none;
}

body[data-memory] .topbar {
  justify-content: flex-end;
}

.memory {
  display: grid;
  gap: 16px;
  max-width: 620px;
  margin: 0 auto;
  padding: 24px;
  border: 1.5px solid var(--line);
  border-radius: 19px 14px 20px 15px;
  background: var(--surface);
}

.memory[hidden],
.memory [hidden] {
  display: none;
}

.memory-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
}

.memory-head h1 {
  margin: 0;
  font-size: 1.5rem;
  text-wrap: balance;
}

.memory-close {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  transition: border-color 0.18s ease;
}

.memory-close:hover {
  border-color: var(--brand);
}

.memory-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  text-wrap: pretty;
}

/* The privacy policy: small and quiet, close under the intro. */
.memory-privacy {
  justify-self: start;
  margin-top: -10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-underline-offset: 3px;
}

.memory-privacy:hover {
  color: var(--brand-strong);
}

.memory-privacy:focus-visible {
  border-radius: 4px;
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* The switch: on, the coach keeps and uses what the learner tells it. */
.memory-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 13px 10px 12px 9px;
  background: var(--title-wash);
  font-weight: 650;
}

.memory-switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--border);
  transition: background-color 0.18s ease;
}

.memory-switch[aria-checked="true"] {
  background: var(--brand);
}

.memory-switch-knob {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--surface);
  transition: inset-inline-start 0.18s ease;
}

.memory-switch[aria-checked="true"] .memory-switch-knob {
  inset-inline-start: calc(100% - 22px);
}

.memory-switch:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.memory-off-note {
  margin: 0;
  padding: 8px 12px;
  border: 1.5px dashed var(--signal);
  border-radius: 12px 9px 13px 8px;
  background: var(--surface-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

/* The notes, one card each, with its delete button at the end. While the
   switch is off they fade a little: the coach does not use them. */
.memory-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.memory-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 13px 10px 12px 9px;
  background: var(--surface-soft);
  transition: opacity 0.18s ease;
}

.memory[data-off] .memory-note {
  opacity: 0.6;
}

.memory-note-body {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.memory-note-body p {
  margin: 0;
  line-height: 1.5;
  text-align: start;
  overflow-wrap: anywhere;
}

.memory-note-when {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* A plan or event starts its line with a small calendar. */
.memory-note-when svg {
  width: 14px;
  height: 14px;
  margin-inline-end: 5px;
  vertical-align: -2px;
}

.memory-delete {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.memory-delete svg {
  width: 17px;
  height: 17px;
}

.memory-delete:hover {
  background: #edb6ad55;
  color: #9f1239;
}

.memory-delete:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.memory-empty {
  margin: 0;
  padding: 18px 14px;
  border: 1.5px dashed var(--border);
  border-radius: 13px 10px 12px 9px;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}

.memory-failed {
  margin: 0;
  color: var(--signal);
  font-size: 0.9rem;
  font-weight: 650;
}

/* Under the notes: what to do with a wrong one, and deleting them all. */
.memory-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.memory-hint {
  flex: 1 1 240px;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.memory-delete-all {
  flex: none;
  padding: 7px 14px;
  border: 1px solid #b84d43;
  border-radius: 10px;
  background: var(--surface-raised);
  color: #9f3f36;
  font-size: 0.9rem;
  font-weight: 650;
  transition: background-color 0.15s ease;
}

.memory-delete-all:hover {
  background: #edb6ad55;
}

.memory-delete-all:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .memory {
    padding: 20px 16px;
  }

  .memory-delete-all {
    width: 100%;
  }
}
