/* ── Note Revision Document ─────────────────────────────── */

body.nrev-open {
  overflow: hidden;
}

.nrev-root {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: var(--color-bg-base);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s var(--ease-out);
}

.nrev__toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  flex-shrink: 0;
}

.nrev__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.nrev__close:hover {
  color: var(--color-text-primary);
  border-color: var(--color-accent);
}

.nrev__toolbar-center {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.nrev__toolbar-kicker {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
}

.nrev__toolbar-title {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nrev__toolbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.nrev__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 48px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, color-mix(in srgb, var(--color-accent) 8%, transparent), transparent),
    var(--color-bg-base);
}

.nrev-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.nrev-loading__card {
  text-align: center;
  max-width: 420px;
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-md);
}

.nrev-loading__spinner {
  margin: 0 auto 20px;
}

.nrev-loading__card h2 {
  margin: 0 0 8px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
}

.nrev-loading__note {
  margin: 0 0 12px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.nrev-loading__hint {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.55;
}

.nrev__paper-wrap {
  max-width: 760px;
  margin: 0 auto;
}

.nrev__masthead {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.nrev__kicker {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

.nrev__title {
  margin: 0 0 14px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text-primary);
}

.nrev__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.nrev__tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: var(--font-weight-medium);
}

.nrev__tag--chapter {
  background: color-mix(in srgb, #6366f1 12%, transparent);
  color: #6366f1;
}

.nrev__badge {
  display: inline-block;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nrev__badge--local {
  background: color-mix(in srgb, #f59e0b 15%, transparent);
  color: #b45309;
}

.nrev__badge--section {
  background: color-mix(in srgb, #8b5cf6 15%, transparent);
  color: #7c3aed;
}

.nrev__paper {
  padding: 32px 36px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  line-height: 1.65;
}

[data-theme="dark"] .nrev__paper {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.nrev__paper h1 {
  display: none;
}

.nrev__paper h2 {
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid color-mix(in srgb, var(--color-accent) 25%, transparent);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
}

.nrev__paper h2:first-child {
  margin-top: 0;
}

.nrev__paper h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.nrev__paper blockquote {
  margin: 1rem 0;
  padding: 12px 16px;
  border-left: 3px solid var(--color-accent);
  background: var(--color-accent-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.nrev__paper ul,
.nrev__paper ol {
  padding-left: 1.35rem;
  margin: 0.5rem 0 1rem;
}

.nrev__paper li {
  margin-bottom: 0.4rem;
}

.nrev__paper li::marker {
  color: var(--color-accent);
}

.nrev__paper strong {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
}

.nrev__paper hr {
  margin: 1.5rem 0;
  border: none;
  border-top: 1px dashed var(--color-border);
}

.nrev__footer {
  margin-top: 24px;
  text-align: center;
}

.nrev__footer p {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  font-style: italic;
}

.nrev-error {
  max-width: 440px;
  margin: 10vh auto;
  text-align: center;
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
}

.nrev-error h2 {
  margin: 0 0 10px;
}

.nrev-error p {
  margin: 0 0 20px;
  color: var(--color-text-secondary);
}

.nrev-error__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

@media print {
  body.nrev-open > *:not(.nrev-root) {
    display: none !important;
  }

  .nrev-root {
    position: static;
    inset: auto;
  }

  .nrev__toolbar,
  .nrev__footer,
  .nrev__badge {
    display: none !important;
  }

  .nrev__body {
    overflow: visible;
    padding: 0;
    background: #fff;
  }

  .nrev__paper {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}

@media (max-width: 640px) {
  .nrev__toolbar {
    flex-wrap: wrap;
  }

  .nrev__toolbar-center {
    order: 3;
    width: 100%;
    text-align: left;
  }

  .nrev__paper {
    padding: 20px 18px;
  }
}
