/* Neutral fallbacks — overridden by active scheme CSS */
:root {
  color-scheme: light;
  --bg-page: #f5f5f5;
  --bg-body-image: none;
  --bg-zettel: #fff;
  --bg-header: #e0e0e0;
  --bg-accent: #eee;
  --bg-code: #f5f5f5;

  --bg-tooltip: #333;
  --bg-kbd: #333;
  --bg-img: #fff;
  --text-primary: #333;
  --text-link: #0066cc;
  --text-header: #555;
  --text-code: #333;
  --text-muted: #999;
  --text-tooltip: #fff;
  --text-kbd: #fff;
  --text-link-code: #0066cc;
  --text-link-code-hover: #004499;
  --border-zettel: #ddd;
  --border-heading: #eee;
  --border-accent: #ddd;
  --border-code: #ddd;
  --border-hr: #ccc;
  --border-img: #ddd;
  --nav-from: #555;
  --nav-to: #666;
  --adm-note-text: #31708f;
  --adm-note-bg: #d9edf7;
  --adm-note-border: #bce8f1;
  --adm-warning-text: #8a6d3b;
  --adm-warning-bg: #fcf8e3;
  --adm-warning-border: #faebcc;
  --adm-danger-text: #a94442;
  --adm-danger-bg: #f2dede;
  --adm-danger-border: #ebccd1;
}

/* ===== Theme styles ===== */

.file-header a,
.file-header span {
  color: var(--text-link);
}

a.hidden-hyperlink {
  text-decoration: none;
}

a.hidden-hyperlink:hover {
  text-decoration: none;
  cursor: default;
}

span[data-copy-value] {
  cursor: copy;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tooltip);
  color: var(--text-tooltip);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: normal;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

h1 {
  color: var(--text-link);
}

h1,
h2,
h3 {
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--border-heading);
  margin-bottom: 0.6em;
}

svg.clickable {
  cursor: pointer;
}

.zettel-edit-dropdown {
  position: absolute;
  right: 0;
  margin-top: 0.2em;
  background: var(--bg-zettel);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  z-index: 100;
  min-width: 140px;
  display: flex;
  flex-direction: column;
}

.zettel-edit-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.4em 0.8em;
  border: none;
  background: none;
  color: var(--text-primary);
  text-align: left;
  font-size: 0.85em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.zettel-edit-dropdown-item:hover {
  background: var(--bg-accent);
  color: var(--text-link);
  text-decoration: none;
}

.zettel {
  margin-top: 1%;
  margin-bottom: 1%;
  padding: 0;
  border: 1px solid var(--border-zettel);
  border-radius: 7px;
  background-color: var(--bg-zettel);
}

.file-header {
  background-color: var(--bg-header);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  padding: 2.5em;
  padding-top: 0.2em;
  padding-bottom: 0.7em;
  font-size: small;
  color: var(--text-header);
}

.file-header .row {
  margin-top: 0.25em;
}

.file-header svg {
  display: inline-block;
  width: 1em;
  height: 1em;
  font-size: inherit;
  color: inherit;
  vertical-align: -0.125em;
  fill: currentColor;
}

.file-header .date {
  padding-right: 0;
  position: relative;
}

.file-body {
  padding: 2em;
  padding-top: 1em;
  padding-bottom: 0;
}

.codehilite,
.highlight,
pre:has(> code) {
  position: relative;
}

.codehilite,
.highlight {
  border: 1px solid var(--border-zettel);
  border-radius: 4px;
  padding: 0.7em;
  margin: 0.3em;
  margin-bottom: 1rem;
}

.copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--bg-accent);
  border: 1px solid var(--border-accent);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--text-primary);
}

.copy-btn:hover {
  background: var(--border-accent);
}

.codehilite:hover .copy-btn,
.highlight:hover .copy-btn,
pre:has(> code):hover .copy-btn {
  opacity: 1;
}

.file-references h6 .fa {
  font-size: 1.1em;
  margin-right: 0.3em;
}

.file-references {
  background-color: var(--bg-accent);
  border-top: 1px solid var(--border-accent);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  padding: 1em;
  font-style: italic;
  font-size: small;
  color: var(--text-muted);
}

/* Validation badge */
.validation-badge {
  color: #b58900;
  margin-left: 0.5em;
  font-size: 0.9em;
}

/* Editor buttons */
.editor-btn {
  margin-left: 0.3em;
  padding: 0.1em 0.4em;
  font-size: 0.8em;
}

/* Token dialog */
.token-warning {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 1em;
}

.token-warning .fa {
  margin-right: 0.3em;
}

.token-help {
  font-size: 0.85em;
  margin-top: 0.5em;
}

#zettel-token-input {
  font-family: monospace;
  margin-top: 0.3em;
}

/* Toast notifications */
.zettel-toast {
  position: fixed;
  bottom: 1.5em;
  left: 50%;
  transform: translateX(-50%) translateY(1em);
  background: var(--bg-header);
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  padding: 0.6em 1.2em;
  font-size: 0.9em;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.zettel-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.zettel-toast-error {
  border-color: var(--adm-danger-text);
  color: var(--adm-danger-text);
}

/* Settings modal */
.scheme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75em;
}

.scheme-card {
  cursor: pointer;
  border: 2px solid var(--border-zettel);
  border-radius: 6px;
  padding: 0.5em;
  text-align: center;
  transition: border-color 0.15s;
}

.scheme-card:hover {
  border-color: var(--text-link);
}

.scheme-card.active {
  border-color: var(--text-link);
  box-shadow: 0 0 0 1px var(--text-link);
}

.scheme-swatch {
  display: flex;
  height: 2em;
  border-radius: 3px;
  overflow: hidden;
}

.swatch-strip {
  flex: 1;
}

.scheme-label {
  display: block;
  margin-top: 0.3em;
  font-size: 0.8em;
  color: var(--text-primary);
}

.theme-switch-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  cursor: pointer;
}

.hljs-preview {
  margin-top: 0.5em;
  border: 1px solid var(--border-code);
  border-radius: 4px;
  padding: 0.7em;
  max-height: 200px;
  overflow: auto;
}

/* Color scheme gallery */
.gallery-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1em;
  margin-bottom: 1em;
}

.gallery-card {
  border: 1px solid var(--border-zettel);
  border-radius: 6px;
  padding: 1em;
  background: var(--bg-zettel);
}

.gallery-category {
  display: inline-block;
  font-size: 0.7em;
  padding: 0.2em 0.5em;
  border-radius: 3px;
  background: var(--bg-accent);
  color: var(--text-muted);
}
