/*
 * legacy.css — Backward-compatible styles for secondary pages
 * (journal, stats, calendar, gallery, search, memories)
 * that still use the old class names from the pre-redesign CSS.
 *
 * Loaded AFTER styles.css so it can reference the new custom properties.
 */

/* ── Variable aliases ──────────────────────────────────────── */
:root {
  --text:        var(--ink);
  --text-light:  var(--ink-2);
  --text-muted:  var(--ink-3);
  --border:      var(--line);
  --border-pink: var(--accent-line);
  --font-serif:  var(--serif);
  --shadow-xs:   var(--shadow-1);
  --shadow-sm:   var(--shadow-1);
  --shadow-md:   var(--shadow-2);
  --r-full:      9999px;
  --core:        var(--tier-core);
  --creative:    var(--tier-creative);
  --journal:     var(--tier-journal);
  --journal-bg:  rgba(149,124,155,0.10);
  --journal-light: rgba(149,124,155,0.20);
  --creative-bg: rgba(201,122,69,0.10);
}

body.dark {
  --border-pink: var(--accent-line);
  --journal-bg:  rgba(149,124,155,0.15);
  --journal-light: rgba(149,124,155,0.25);
  --creative-bg: rgba(201,122,69,0.15);
}

/* ── Navigation bar ────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-family: var(--serif);
}

.nav-logo {
  font-size: 1.15rem;
}

.nav-title {
  font-size: 1rem;
}

.nav-amp {
  font-style: italic;
  opacity: 0.5;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  padding: 0.375rem 0.625rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--ink-2);
  margin-left: 0.5rem;
}

.nav-toggle:hover {
  background: var(--accent-soft);
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
  color: var(--ink);
}

.page-header p {
  color: var(--ink-2);
  font-size: 0.85rem;
  margin: 0;
}

.page-header-inner {
  max-width: 960px;
  margin: 0 auto;
}

.header-journal { background: linear-gradient(135deg, #F0E4F8, #FAF4E7, #E8EEF8); }
.header-stats   { background: linear-gradient(135deg, #E8EEF8, #FAF4E7, #F0E4F8); }
.header-search  { background: linear-gradient(135deg, #FAF4E7, #E8EEF8); }
.header-library { background: linear-gradient(135deg, #FAF4E7, #F0E4F8, #E8EEF8); }

body.dark .header-journal,
body.dark .header-stats,
body.dark .header-search,
body.dark .header-library {
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
}

/* ── Page wrap ─────────────────────────────────────────────── */
.page-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Sidebar card ──────────────────────────────────────────── */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1rem;
  box-shadow: var(--shadow-1);
}

/* ── Calendar components ───────────────────────────────────── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.cal-nav-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 0.8rem;
}

.cal-nav-btn:hover {
  background: var(--accent-soft);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 0.75rem;
}

.cal-day-label {
  font-weight: 600;
  color: var(--ink-3);
  padding: 0.25rem 0;
}

/* ── Buttons (legacy) ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
  color: var(--ink);
}

.btn:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* ── Tag pill ──────────────────────────────────────────────── */
.tag-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

/* ── Tier pills ────────────────────────────────────────────── */
.tier-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tier-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}

.tier-pill:hover,
.tier-pill.active,
.tier-pill.active-all {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
  padding: 0.75rem 0;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-select {
  padding: 0.35rem 0.625rem;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}

/* ── Memory card (old class) ───────────────────────────────── */
.memory-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1rem 1.125rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-1);
}

.memory-card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-2);
}

/* ── Memory grid (old class) ───────────────────────────────── */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ── Skeleton (old class) ──────────────────────────────────── */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1rem;
}

.skeleton-line {
  background: var(--bg-2);
  border-radius: var(--r-sm);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Author badge ──────────────────────────────────────────── */
.author-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}

.author-elias { border-color: var(--tier-core); color: var(--tier-core); }
.author-baby  { border-color: var(--accent); color: var(--accent); }
.author-aston { border-color: var(--tier-journal); color: var(--tier-journal); }

/* ── Stat card ─────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-1);
}

.stat-card-core     { border-top: 3px solid var(--tier-core); }
.stat-card-daily    { border-top: 3px solid var(--tier-daily); }
.stat-card-journal  { border-top: 3px solid var(--tier-journal); }
.stat-card-creative { border-top: 3px solid var(--tier-creative); }

.stat-icon   { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--ink); }
.stat-name   { font-size: 0.78rem; color: var(--ink-3); margin-top: 0.25rem; font-weight: 500; }
.stat-desc   { font-size: 0.72rem; color: var(--ink-3); margin-top: 0.25rem; }

/* ── Section title ─────────────────────────────────────────── */
.section-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1.5rem 0 0.75rem;
}

/* ── Modal (old pattern: .modal-overlay + .hidden) ─────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(43, 35, 28, 0.35);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--ink);
}

/* ── Form elements (legacy pages) ──────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Search (legacy pages) ─────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  font-size: 0.9rem;
  pointer-events: none;
}

.search-wrap .search-input {
  width: 100%;
  padding: 0.65rem 0.875rem 0.65rem 2.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
}

.search-wrap .search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Timeline (journal) ────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 0.5rem;
}

.timeline-dot {
  position: absolute;
  left: -1.75rem;
  top: 0.375rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 1.5rem;
}

.page-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.page-btn:hover,
.page-btn.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Prose content ─────────────────────────────────────────── */
.prose {
  line-height: 1.75;
  color: var(--ink);
  font-size: 0.9rem;
}

.prose h1, .prose h2, .prose h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.prose p { margin-bottom: 0.875rem; }
.prose a { color: var(--accent); }
.prose code { background: var(--bg-2); padding: 0.15rem 0.35rem; border-radius: var(--r-sm); font-size: 0.85em; }
.prose blockquote { border-left: 3px solid var(--accent-line); padding-left: 1rem; color: var(--ink-2); margin: 1rem 0; }

/* ── Gallery card ──────────────────────────────────────────── */
.gallery-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  box-shadow: var(--shadow-1);
}

.gallery-card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.gallery-footer {
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* ── Fade-in animation ─────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ── Annotation dot ────────────────────────────────────────── */
.ann-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .nav-menu { display: none; }
  .page-header { padding: 1.75rem 1rem 1.5rem; }
  .page-header h1 { font-size: 1.25rem; }
  .page-wrap { padding: 1rem; }
}
