/* MemoryMark: Personal Bookmark & Memory Archive */
:root {
  --bg: #0f1117;
  --bg-surface: #161822;
  --bg-elevated: #1c1f2e;
  --bg-input: #13151e;
  --border: #2a2d3e;
  --border-focus: #f59e0b;
  --text: #e2e4ed;
  --text-muted: #8b8fa3;
  --text-dim: #5c5f73;
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.25);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, monospace;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #000;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-icon { flex-shrink: 0; }
.main-nav {
  display: flex;
  gap: 24px;
}
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}
.main-nav a:hover { color: var(--accent); }

/* Layout */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  flex: 1;
}

/* Panels */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.panel-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* Form */
.entry-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.required { color: var(--accent); }
.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-dim); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}
.btn--primary {
  background: var(--accent);
  color: #000;
}
.btn--primary:hover { background: #d97706; }
.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger-dim);
}
.btn--danger:hover { background: var(--danger-dim); }
.btn--sm { padding: 6px 14px; font-size: 0.82rem; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Form tools */
.form-tools {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.tools-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tools-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Archive panel */
.panel--archive { display: flex; flex-direction: column; gap: 20px; }
.archive-header { display: flex; align-items: flex-start; justify-content: space-between; }
.archive-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Search */
.search-bar {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.search-input { padding-left: 40px; }

/* Tag filters */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: all var(--transition);
  font-family: var(--font);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip--active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Archive list */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Entry card */
.entry-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}
.entry-card:hover { border-color: var(--accent); }
.entry-card__header {
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.entry-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  word-break: break-word;
}
.entry-card__title a {
  color: var(--text);
  text-decoration: none;
}
.entry-card__title a:hover { color: var(--accent); }
.entry-card__date {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  padding-top: 2px;
}
.entry-card__body {
  padding: 0 18px 18px;
  display: none;
  flex-direction: column;
  gap: 12px;
}
.entry-card__body.open { display: flex; }
.entry-card__note {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.entry-card__prompt {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}
.entry-card__prompt::before {
  content: "Memory prompt: ";
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}
.entry-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.entry-tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}
.entry-card__actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}
.entry-card__actions .btn { padding: 5px 12px; font-size: 0.78rem; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-icon { margin-bottom: 8px; }
.empty-title { font-size: 1.1rem; font-weight: 600; }
.empty-text { color: var(--text-muted); font-size: 0.9rem; max-width: 360px; }

/* Info panel */
.panel--info {
  grid-column: 1 / -1;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.info-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.info-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.info-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.info-note {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.info-note h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}
.info-note p, .info-note li {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.info-note ul { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.info-note strong { color: var(--text); }
.last-updated {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toast-in 0.3s ease;
  max-width: 360px;
}
.toast--success { border-color: var(--success); }
.toast--error { border-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-inner p {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.footer-nav {
  display: flex;
  gap: 20px;
}
.footer-nav a {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-nav a:hover { color: var(--accent); }

/* Print */
@media print {
  .site-header, .site-footer, .panel--form, .search-bar, .tag-filters, .entry-card__actions, .form-tools { display: none; }
  body { background: #fff; color: #000; }
  .panel { border: none; padding: 0; }
  .entry-card { border: 1px solid #ddd; break-inside: avoid; }
  .entry-card__body { display: flex; }
}

/* Responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 20px 16px; gap: 24px; }
  .panel { padding: 20px; }
  .info-grid { grid-template-columns: 1fr; }
  .header-inner { padding: 0 16px; }
  .main-nav { gap: 16px; }
  .main-nav a { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .tools-row { flex-direction: column; }
  .tools-row .btn { width: 100%; }
  .footer-inner { flex-direction: column; text-align: center; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
