/*
 * SPDX-FileCopyrightText: 2026 Mad Scientist
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

.notes-page {
  --note-focus: #a33b20;
  --note-focus-soft: #fff0ea;
  --note-verb: #176b5b;
  --note-verb-soft: #e8f7f3;
  --note-noun: #3559e0;
  --note-noun-soft: #e9edff;
  --note-modifier: #7652c7;
  --note-modifier-soft: #f1ebff;
  --note-context: #68707d;
}

.notes-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  padding: 2rem clamp(1rem, 4vw, 4rem) 1.25rem;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}

.page-nav a {
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 750;
}

.page-nav a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #20358d;
}

.notes-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  padding: 0 clamp(1rem, 4vw, 4rem) 3rem;
}

.notes-controls {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.notes-control-panel { padding: 1.1rem; }
.notes-control-panel h2 { margin: 0; }

.search-field {
  display: grid;
  gap: .35rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
}

.search-field input {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.notes-toggle {
  display: flex;
  margin-top: .65rem;
  box-shadow: none;
}

.notes-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .8rem;
  margin-top: .9rem;
  color: var(--muted);
  font-size: .75rem;
}

.notes-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.notes-legend i { width: .72rem; height: .72rem; border-radius: 3px; }

.notes-study-area { min-width: 0; }
.notes-toolbar { margin: .2rem 0 .8rem; }
.notes-intro { padding: 1rem 1.1rem; margin-bottom: 1rem; color: var(--muted); line-height: 1.5; }
.notes-intro strong { color: var(--ink); }
.notes-list { display: grid; gap: 1rem; }

.note-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.note-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.note-card-head h2 { margin: 0; font-size: 1.45rem; }
.note-question { margin: .35rem 0 0; color: var(--muted); }
.note-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; align-content: flex-start; }
.note-tags span {
  padding: .28rem .5rem;
  border-radius: 999px;
  background: #eef0f3;
  color: #58606b;
  font-size: .72rem;
  font-weight: 750;
}

.note-rule-band {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, .7fr);
  gap: .8rem;
  padding: 1rem 1.15rem;
  background: #fff;
}

.note-rule, .note-memory {
  margin: 0;
  padding: .85rem;
  border-radius: 14px;
  line-height: 1.5;
}
.note-rule { background: var(--accent-soft); }
.note-memory { background: var(--note-focus-soft); font-weight: 750; }

.note-body { padding: 0 1.15rem 1.15rem; }
.note-section { margin-top: 1rem; }
.note-section h3 { margin: 0 0 .65rem; font-size: .92rem; }

.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: .7rem;
}

.term-card {
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.term-card h4 { margin: 0; color: var(--note-focus); font-size: 1.1rem; }
.term-kind { display: block; margin-top: .15rem; color: var(--muted); font-size: .72rem; text-transform: uppercase; font-weight: 800; }
.term-meaning { margin: .5rem 0 .25rem; font-weight: 750; }
.term-rule { margin: 0; color: var(--muted); line-height: 1.45; font-size: .85rem; }
.pattern-list { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .65rem; }
.pattern-list code { padding: .25rem .4rem; border-radius: 7px; background: #f2f3f5; font-size: .75rem; }

.example-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .7rem; }
.note-example { padding: .85rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.example-sentence { margin: 0; font-size: 1.08rem; font-weight: 800; }
.example-translation { margin: .45rem 0 0; color: var(--muted); }
.example-note { margin: .45rem 0 0; color: #5c6470; font-size: .82rem; line-height: 1.4; }

.sentence-role { border-radius: 4px; padding: .06em .1em; }
.role-focus { color: var(--note-focus); background: var(--note-focus-soft); }
.role-verb { color: var(--note-verb); background: var(--note-verb-soft); }
.role-noun { color: var(--note-noun); background: var(--note-noun-soft); }
.role-modifier { color: var(--note-modifier); background: var(--note-modifier-soft); }
.role-context { color: var(--note-context); }
.no-note-highlights .sentence-role { color: inherit; background: transparent; padding: 0; }

.contrast-grid { display: grid; gap: .65rem; }
.contrast-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: .7rem;
  align-items: center;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.contrast-phrase { font-weight: 800; }
.contrast-vs { color: var(--muted); font-size: .7rem; font-weight: 900; }
.contrast-explanation { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .84rem; }

.trap-list { margin: 0; padding-left: 1.25rem; color: #5c6470; line-height: 1.55; }

.personal-box {
  display: grid;
  gap: .7rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.status-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.status-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .65rem;
  background: var(--panel);
  color: var(--muted);
  font-weight: 750;
}
.status-button.is-active { border-color: var(--accent); background: var(--accent-soft); color: #20358d; }
.personal-box label { display: grid; gap: .35rem; color: var(--muted); font-size: .8rem; font-weight: 750; }
.personal-box textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}
.save-state { min-height: 1.1em; color: var(--muted); font-size: .75rem; }

@media (max-width: 860px) {
  .notes-topbar { align-items: center; }
  .notes-layout { grid-template-columns: 1fr; }
  .notes-controls { position: static; max-height: none; overflow: visible; }
}

@media (max-width: 620px) {
  .notes-topbar { flex-direction: column; }
  .page-nav { justify-content: flex-start; }
  .note-card-head { flex-direction: column; }
  .note-tags { justify-content: flex-start; }
  .note-rule-band { grid-template-columns: 1fr; }
  .contrast-row { grid-template-columns: 1fr; }
  .contrast-vs { display: none; }
}
