/* Left sidebar — 1:1 adapted from Reverie's .catalog-menu pattern
   (reverie.css:393-528, index.html:1931-1988). */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal);
  z-index: 45;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  z-index: 50;
  padding: var(--space-xl) var(--space-lg);
  transform: translateX(-100%);
  transition: transform var(--t-normal);
  overflow-y: auto;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  transform: translateX(0);
}

/* Brand */
.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--fg-strong);
  margin: 0;
}

.sidebar-brand-divider {
  height: 1px;
  min-height: 1px;
  flex-shrink: 0;
  background: var(--gold);
  margin: var(--space-xs) 0 var(--space-xl);
}

/* Identity block — name + color + reset, prominent above settings.
   The underline replaces the old settings-input textbox at the same
   max-width (200px). The color-picker below shares that exact width
   so the 8 dots distribute evenly across it via space-between. */
/* Identity block expands to fill the vertical space between brand and
   theme/fullscreen below. The name input sits at the top; the
   sidebar-stats line floats vertically centred in the remaining space
   (margin: auto 0 — see .sidebar-stats below). */
.sidebar-identity {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-name-input {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  color: var(--fg-strong);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  padding: 4px 0;
  outline: none;
  width: 200px;
  text-align: center;
  transition: border-color var(--t-fast);
}

.sidebar-name-input:focus {
  border-bottom-color: var(--gold-dim);
}

.sidebar-name-input::placeholder {
  color: var(--fg-dim);
  font-style: italic;
}

/* Mini-stats line under the name — soft, monospaced, low contrast.
   Reads as a quiet summary (not a status badge). Center-aligned to
   match the name input above. */
.sidebar-stats {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  text-align: center;
  /* Vertical auto-margins centre the stats line in the remaining
     space inside .sidebar-identity (which is flex:1 column). The name
     sits at the top of identity; the stats float at the visual middle
     between name underline and theme/fullscreen below. */
  margin: auto 0;
  line-height: 1.5;
  max-width: 220px;
  /* The locale string contains a literal "\n" between the two stat
     rows; pre-line preserves that line break in the rendered text. */
  white-space: pre-line;
}

.sidebar-identity .color-picker {
  margin-top: 0;
  gap: 0;
  flex-wrap: nowrap;
  justify-content: space-between;
  width: 200px;
}

.sidebar-identity .color-dot {
  width: 18px;
  height: 18px;
}

.sidebar-reset-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--fg-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color var(--t-fast);
}

.sidebar-reset-link:hover {
  color: var(--fg);
}

/* Sections */
.sidebar-section {
  margin-bottom: var(--space-lg);
}

/* Settings section gets pushed to lower third */
#sidebar-settings-section {
  margin-top: auto;
}

#sidebar-settings-section ~ .sidebar-footer-group {
  margin-top: 0;
}

.sidebar-section-title {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

/* Settings grid — 1:1 Reverie reverie.css:579-599 */
.sidebar-settings-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xs) var(--space-md);
  align-items: center;
  padding: var(--space-sm) 0;
  font-size: 0.8rem;
}

.sidebar-settings-grid label {
  color: var(--fg-dim);
  font-family: var(--font-ui);
}

/* Settings-screen entry-link, sits inside #sidebar-settings-section just
   below the theme/fullscreen grid. Visually attached to the section
   (not a footer-link) — single divider line above, same text scale as
   the grid labels. */
.sidebar-section-link {
  display: block;
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--t-fast);
}

.sidebar-section-link:hover {
  color: var(--fg-strong);
}

/* Disabled nav items (upcoming features) */
.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  padding: 8px 0;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--fg);
  cursor: pointer;
  transition: color var(--t-fast);
}

.sidebar-nav li:hover {
  color: var(--fg-strong);
}

.sidebar-nav li.is-disabled {
  color: var(--fg-muted);
  cursor: default;
  font-style: italic;
}

.sidebar-nav li.is-disabled:hover {
  color: var(--fg-muted);
}

.sidebar-nav li.is-danger {
  color: var(--fg-dim);
}

.sidebar-nav li.is-danger:hover {
  color: rgba(220, 120, 120, 0.9);
}

/* Footer group — About + Imprint + Privacy + attribution */
.sidebar-footer-group {
  margin-top: auto;
  padding-top: var(--space-md);
}

.sidebar-footer-link {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 3px 0;
  transition: color var(--t-fast);
  display: block;
}

.sidebar-footer-link:hover {
  color: var(--fg);
}

/* About link — more prominent, Cormorant */
#sidebar-about {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--fg);
  margin-bottom: var(--space-xs);
}

#sidebar-about:hover {
  color: var(--fg-strong);
}

/* 1:1 Reverie reverie.css:1488-1506 */
.sidebar-attribution {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.sidebar-attribution .creator {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--fg-dim);
}

.sidebar-attribution .version {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--fg-muted);
  margin-top: var(--space-xs);
}
