/* =============================================================
   Alluvium — styles.css
   Dark geological aesthetic. Clean. No frameworks.
   ============================================================= */

/* --- Reset & Base ------------------------------------------- */

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

:root {
  --bg:          #12121f;
  --bg-section:  #15151f;
  --bg-card:     #1c1c2e;
  --bg-input:    #111120;
  --bg-hover:    #22223a;
  --border:      #2a2a42;
  --border-soft: #1f1f35;

  --gold:        #c9a96e;
  --gold-dim:    #a88448;
  --gold-bright: #e4c07a;
  --gold-glow:   rgba(201, 169, 110, 0.12);

  --text:        #e0dfd8;
  --text-dim:    #9896a0;
  --text-muted:  #5a5870;
  --text-code:   #b8b4e0;

  --danger:      #e05c5c;
  --danger-bg:   rgba(224, 92, 92, 0.1);

  --success:     #5cb85c;

  --radius:      8px;
  --radius-lg:   12px;
  --radius-sm:   4px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  --nav-height: 56px;
  --max-width:  900px;
  --section-gap: 96px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  color: var(--gold-bright);
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-code);
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* --- Scrollbar -------------------------------------------- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Nav -------------------------------------------------- */

#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(18, 18, 31, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.nav-logo:hover { color: var(--gold); }

.logo-mark {
  color: var(--gold);
  font-size: 20px;
  line-height: 1;
}

.logo-text {
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.nav-link:hover { color: var(--text); }

/* --- Sections --------------------------------------------- */

section {
  padding-top: calc(var(--nav-height) + 72px);
  padding-bottom: var(--section-gap);
}

section:first-of-type {
  padding-top: 0;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section-header {
  margin-bottom: 36px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Hero ------------------------------------------------- */

#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  padding-bottom: 80px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(201, 169, 110, 0.05) 0%, transparent 70%),
    var(--bg);
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  text-align: center;
}

.hero-mark {
  font-size: 48px;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.8;
}

.hero-title {
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.05;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: clamp(16px, 2.5vw, 20px);
  font-weight: 300;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.hero-description {
  max-width: 620px;
  margin: 0 auto 20px;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-dim);
  font-weight: 300;
}

.hero-description--secondary {
  font-size: 15px;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 48px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 72px;
}

.hero-how {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 0 12px;
}

.how-number {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-family: var(--font-mono);
}

.how-text {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

.how-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

/* --- Buttons ---------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--gold);
  color: #0f0f1a;
  border-color: var(--gold);
}

.btn-primary:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  color: #0f0f1a;
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- Spinner ---------------------------------------------- */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(15, 15, 26, 0.3);
  border-top-color: #0f0f1a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Editor ----------------------------------------------- */

#editor {
  background: var(--bg-section);
  border-top: 1px solid var(--border-soft);
}

.editor-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  color-scheme: dark;
}

.date-input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.editor-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}

.editor-wrapper:focus-within {
  border-color: var(--gold-dim);
}

.journal-textarea {
  width: 100%;
  min-height: 360px;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  padding: 28px 32px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text);
  caret-color: var(--gold);
}

.journal-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--border-soft);
}

.word-count {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Processing Status ------------------------------------ */

.processing-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 20px;
  background: var(--gold-glow);
  border: 1px solid rgba(201, 169, 110, 0.2);
  border-radius: var(--radius);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

#status-text {
  font-size: 13px;
  color: var(--gold);
}

/* --- Error Banner ----------------------------------------- */

.error-banner {
  margin-top: 20px;
  padding: 14px 20px;
  background: var(--danger-bg);
  border: 1px solid rgba(224, 92, 92, 0.3);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--danger);
}

/* --- Settings --------------------------------------------- */

#settings {
  border-top: 1px solid var(--border-soft);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
}

.input-group {
  display: flex;
  gap: 8px;
}

.text-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color 0.15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.text-input::placeholder { color: var(--text-muted); }

.domains-textarea {
  min-height: 130px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.7;
  font-family: var(--font-mono);
}

.select-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a5870' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-note {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
}

.settings-note.ok  { color: var(--success); }
.settings-note.err { color: var(--danger); }

/* --- Results ---------------------------------------------- */

#results {
  background: var(--bg-section);
  border-top: 1px solid var(--border-soft);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.results-count {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* --- Note Card -------------------------------------------- */

.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.note-card:hover {
  border-color: var(--border);
}

.note-card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.note-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.note-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

/* Type-specific colors */
.type-event       { background: rgba(94, 129, 172, 0.18); color: #7a9cc8; }
.type-idea        { background: rgba(201, 169, 110, 0.15); color: var(--gold); }
.type-task        { background: rgba(163, 190, 140, 0.15); color: #a3be8c; }
.type-reflection  { background: rgba(180, 142, 173, 0.15); color: #b48ead; }
.type-practice-log{ background: rgba(136, 192, 208, 0.12); color: #88c0d0; }
.type-meeting     { background: rgba(235, 203, 139, 0.12); color: #ebcb8b; }
.type-reading     { background: rgba(129, 161, 193, 0.15); color: #81a1c1; }
.type-person      { background: rgba(191, 97, 106, 0.12); color: #bf616a; }
.type-default     { background: var(--bg-hover); color: var(--text-dim); }

.note-card-meta {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.note-domain {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 2px 6px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.note-tag {
  font-size: 11px;
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--border-soft);
}

.note-tag::before { content: '#'; opacity: 0.5; }

.note-card-body {
  padding: 14px 20px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.note-card-body em,
.note-card-body .wikilink {
  color: var(--gold-dim);
}

.note-card-frontmatter {
  padding: 12px 20px;
  background: var(--bg-input);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  display: none;
  white-space: pre;
  overflow-x: auto;
}

.note-card-frontmatter.visible { display: block; }

.note-card-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-toggle-fm {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
  padding: 2px 0;
  transition: color 0.15s;
}

.btn-toggle-fm:hover { color: var(--text-dim); }

.btn-copy-note {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.btn-copy-note:hover {
  color: var(--text);
  border-color: var(--gold-dim);
}

/* --- Footer ----------------------------------------------- */

#footer {
  border-top: 1px solid var(--border-soft);
  padding: 36px 24px;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-mark {
  display: block;
  font-size: 28px;
  color: var(--gold);
  opacity: 0.4;
  margin-bottom: 10px;
  line-height: 1;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.footer-link:hover { color: var(--gold); text-decoration-color: var(--gold-dim); }

.footer-sub {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* --- Responsive ------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --section-gap: 64px;
  }

  .hero-how {
    flex-direction: column;
    gap: 20px;
    padding: 24px;
  }

  .how-divider {
    width: 40px;
    height: 1px;
  }

  .how-step { padding: 0; }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .journal-textarea {
    padding: 20px;
    font-size: 15px;
  }

  .notes-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
}

/* --- Utility ---------------------------------------------- */

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

/* Syntax highlight for YAML frontmatter in cards */
.fm-key   { color: #81a1c1; }
.fm-value { color: #a3be8c; }
.fm-fence { color: var(--text-muted); }
.fm-list  { color: #ebcb8b; }
