/* ==========================================================================
   Utsho — notes.css
   Shared page-scoped styles for the whole Notes section: learn.html,
   physics-as.html, physics-a2.html, note-viewer.html. One stylesheet
   because they're one visual system at different depths — the hub
   gets the full hero treatment, deeper pages get progressively
   quieter chrome so the actual reading experience isn't competing
   with decoration.
   ========================================================================== */

:root {
  --vivid-green: #16A34A;
  --vivid-green-light: #22C55E;
  --vivid-green-tint: #DCFCE7;
  --vivid-green-text: #14532D;
}

/* ==========================================================================
   Hub hero (learn.html only) — same blob-wash background as every
   other major page, with a Notes-specific illustration.
   ========================================================================== */
.page-header--notes {
  position: relative;
  overflow: hidden;
  background-color: var(--card);
  background-image: url('../assets/dashboard-hero-blobs.webp');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-10) var(--space-8) !important;
  min-height: 260px;
}
.notes-hero-content { max-width: 46ch; flex: 1 1 380px; }
.notes-hero-visual { flex: 0 0 auto; width: clamp(170px, 22vw, 260px); display: flex; justify-content: center; }
.notes-hero-visual img { width: 100%; height: auto; filter: drop-shadow(0 18px 30px rgba(30, 22, 15, 0.16)); }
@media (max-width: 720px) {
  .page-header--notes { flex-direction: column; text-align: center; min-height: 0; }
  .notes-hero-content { max-width: none; }
  .notes-hero-visual { width: 150px; }
}

.section-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 var(--space-2);
}
.section-eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; opacity: 0.55; flex-shrink: 0; }
@media (max-width: 720px) { .section-eyebrow { justify-content: center; } }
.notes-hero-content h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
.notes-hero-content .lede { margin-top: var(--space-3); }

/* ---- Quieter header for chapter-grid and reader pages — same shape
   as the site's normal page-header, just given a soft wash instead of
   a full illustration, so depth in the section reads as "getting
   closer to the content," not "another hero." ---- */
.page-header--notes-sub {
  background: linear-gradient(120deg, var(--card) 0%, var(--bg-deep) 160%);
}

/* ==========================================================================
   Subject cards (learn.html) — vivid icon chip + top-edge accent,
   using the exact same subject colors as Concept Bank so "Physics"
   means the same thing everywhere on the site.
   ========================================================================== */
.notes-subject-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 640px) { .notes-subject-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .notes-subject-grid { grid-template-columns: repeat(4, 1fr); } }

.notes-subject-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  border-top: 4px solid var(--subj-color, var(--primary));
  padding: var(--space-8) var(--space-5);
  text-decoration: none; color: inherit; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.notes-subject-card--available:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(30, 22, 15, 0.12); }
.notes-subject-card--locked { opacity: 0.6; cursor: default; border-top-color: var(--border-strong); }

.notes-subject-card__icon {
  width: 58px; height: 58px; border-radius: var(--radius-md);
  background: var(--subj-color, var(--primary)); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}
.notes-subject-card--locked .notes-subject-card__icon { background: var(--border-strong); }
.notes-subject-card__icon svg { width: 27px; height: 27px; }
.notes-subject-card__code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); letter-spacing: 0.03em; }
.notes-subject-card__name { font-family: var(--font-display); font-size: 1.15rem; margin: 0; }

/* ==========================================================================
   Chapter cards (physics-as.html / physics-a2.html)
   ========================================================================== */
.notes-chapter-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 640px) { .notes-chapter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .notes-chapter-grid { grid-template-columns: repeat(3, 1fr); } }

.notes-chapter-card {
  display: flex; flex-direction: column; gap: var(--space-2); text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  border-top: 4px solid var(--level-color, var(--primary));
  text-decoration: none; color: inherit; cursor: pointer; position: relative;
  padding: var(--space-6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.notes-chapter-card--available:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(30, 22, 15, 0.1); }
.notes-chapter-card--locked { background: var(--bg-deep); cursor: default; border-top-color: var(--border-strong); }
.notes-chapter-card--locked .notes-chapter-card__title,
.notes-chapter-card--locked .notes-chapter-card__index { color: var(--muted); }

.notes-chapter-card__index { font-family: var(--font-display); font-size: 2.1rem; color: var(--border-strong); line-height: 1; }
.notes-chapter-card__number { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em; color: var(--primary); text-transform: uppercase; }
.notes-chapter-card__title { font-family: var(--font-display); font-size: 1.05rem; margin: 0; }
.notes-chapter-card__status, .notes-chapter-card__lock { position: absolute; top: var(--space-4); right: var(--space-4); }
.notes-chapter-card__lock { color: var(--muted); display: flex; }
.notes-chapter-card__lock svg { width: 15px; height: 15px; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-pill--open { background: var(--vivid-green-tint); color: var(--vivid-green-text); }
.status-pill--open::before { background: var(--vivid-green-light); }
.status-pill--locked { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.status-pill--locked::before { display: none; }

/* ---- Level/topic selection popups — same modal language as Concept
   Bank's submit modal (icon header, rounded, consistent spacing). ---- */
.notes-popup-backdrop {
  position: fixed; inset: 0; background: rgba(30, 22, 15, 0.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: var(--space-5); z-index: 200;
}
.notes-popup {
  position: relative; width: 100%; max-width: 620px;
  background: var(--card); border-radius: var(--radius-xl);
  box-shadow: 0 28px 56px rgba(30, 22, 15, 0.28);
  padding: var(--space-8) var(--space-6) var(--space-6);
  max-height: 80vh; overflow-y: auto;
}
.notes-popup__close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--bg-deep); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1rem; line-height: 1;
}
.notes-popup__close:hover { background: var(--border); color: var(--text); }
.notes-popup__header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.notes-popup__header-icon { width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--primary); color: #FFFFFF; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notes-popup__header-icon svg { width: 18px; height: 18px; }
.notes-popup h2 { font-size: 1.2rem; margin: 0; }
.notes-popup__options { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.notes-popup__options--pair { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .notes-popup__options--pair { grid-template-columns: 1fr; } }
.notes-popup__option {
  display: flex; align-items: center; gap: var(--space-3); text-align: left;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4); cursor: pointer; text-decoration: none; color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.notes-popup__option:hover { border-color: var(--primary); background: var(--card); transform: translateY(-2px); }
.notes-popup__option--locked { opacity: 0.5; cursor: default; }
.notes-popup__option--locked:hover { transform: none; border-color: var(--border); background: var(--bg); }
.notes-popup__option-icon { width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--primary-tint); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notes-popup__option-icon svg { width: 16px; height: 16px; }
.notes-popup__option-title { font-family: var(--font-display); font-size: 1.02rem; margin: 0 0 2px; }
.notes-popup__option-sub { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ==========================================================================
   Reader page (note-viewer.html) — main content + sticky "On this
   page" sidebar, generated from the article's own real headings.
   ========================================================================== */
.notes-reader-layout { display: grid; grid-template-columns: 1fr; gap: var(--space-8); align-items: start; }
@media (min-width: 960px) { .notes-reader-layout { grid-template-columns: minmax(0, 1fr) 250px; } }

.notes-toc {
  position: sticky; top: 88px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.notes-toc__label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-3); }
.notes-toc__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.notes-toc__link {
  display: block; font-size: 0.86rem; color: var(--muted); text-decoration: none;
  padding: 5px 0 5px var(--space-3); border-left: 2px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.notes-toc__link:hover { color: var(--text); }
.notes-toc__link--h3 { padding-left: calc(var(--space-3) + 14px); font-size: 0.82rem; }
.notes-toc__link--active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
@media (max-width: 959px) { .notes-toc { display: none; } }

.notes-progress-note {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--sky);
  padding: var(--space-4) var(--space-5); border-radius: var(--radius-md);
  font-size: 0.85rem; color: var(--muted); margin-bottom: var(--space-6);
  display: flex; align-items: flex-start; gap: var(--space-3);
}
.notes-progress-note svg { width: 16px; height: 16px; color: var(--sky); flex-shrink: 0; margin-top: 2px; }

/* ---- Content typography ---- */
.notes-content-body { font-size: 1.05rem; line-height: 1.75; color: var(--text); }
.notes-content-body h2 { font-family: var(--font-display); font-size: 1.4rem; margin: var(--space-8) 0 var(--space-3); scroll-margin-top: 90px; }
.notes-content-body h3 { font-family: var(--font-display); font-size: 1.15rem; margin: var(--space-6) 0 var(--space-2); scroll-margin-top: 90px; }
.notes-content-body p { margin: 0 0 var(--space-4); }
.notes-content-body ul, .notes-content-body ol { padding-left: 24px; margin: 0 0 var(--space-4); }
.notes-content-body li { margin-bottom: var(--space-2); }
.notes-content-body code { background: var(--bg-deep); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; font-family: 'Courier New', monospace; }
.notes-content-body hr { border: none; border-top: 1px solid var(--border); margin: var(--space-8) 0; }
.notes-content-body a { color: var(--primary); text-decoration: underline; }
.notes-spacer { height: var(--space-4); }

.notes-figure { margin: var(--space-6) 0; }
.notes-figure img { width: 100%; border-radius: var(--radius-lg); box-shadow: 0 12px 28px rgba(30, 22, 15, 0.12); }
.notes-figure figcaption { font-size: 0.85rem; color: var(--muted); text-align: center; margin-top: var(--space-2); }

.notes-video { position: relative; width: 100%; padding-top: 56.25%; margin: var(--space-6) 0; border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 12px 28px rgba(30, 22, 15, 0.12); }
.notes-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.notes-block-equation { margin: var(--space-6) 0; padding: var(--space-4); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); overflow-x: auto; text-align: center; }
.notes-inline-equation { display: inline-block; }

/* ---- Topic footer: mark-complete + was-this-useful ---- */
.notes-topic-footer { margin-top: var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); }
.notes-complete-btn {
  display: inline-flex; align-items: center; gap: var(--space-2); align-self: flex-start;
  background: var(--card); border: 1.5px solid var(--vivid-green-light); color: var(--vivid-green-text);
  border-radius: 999px; padding: var(--space-3) var(--space-6); font-weight: 700; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.notes-complete-btn:hover { transform: translateY(-1px); }
.notes-complete-btn[data-completed="true"] { background: var(--vivid-green-light); border-color: transparent; color: #FFFFFF; }
.notes-useful-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.notes-useful-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); cursor: pointer; font-size: 0.88rem; color: var(--text);
}
.notes-useful-btn:hover { border-color: var(--primary); }
.notes-useful-btn[data-selected="true"] { background: var(--vivid-green-tint); border-color: transparent; color: var(--vivid-green-text); }

.notes-loading, .notes-error { text-align: center; color: var(--muted); padding: var(--space-10) 0; }
