:root {
  /* Quiet, Personal Note Vibe */
  --bg-color: #fcfcfc;
  --text-primary: #111;
  --text-secondary: #666;
  --text-light: #999;
  
  --accent-color: #333; /* Very minimal accent */
  --link-color: #2c3e50;
  
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Georgia", "Palatino", serif;
  
  --max-width: 720px;
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 var(--spacing-md);
}

a { color: inherit; text-decoration: none; }

/* Layout */
.site-header, #app, .site-footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Header */
.site-header {
  padding-top: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.site-title {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.site-subtitle {
  font-weight: 400;
  color: var(--text-secondary);
}

.site-desc {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 1px 8px 1px 2px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  background-color: #f5f5f5;
  border-radius: 99px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.2s ease;
  vertical-align: middle;
  line-height: 1;
}

.about-link::before {
  content: 'i';
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 14px;
  height: 14px;
  background: #fff;
  color: #999;
  border-radius: 50%;
  font-family: serif;
  font-style: italic;
  font-weight: bold;
  font-size: 9px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.about-link:hover {
  background-color: #eee;
  color: #333;
  border-color: #ddd;
}
.about-link:hover::before {
  color: #333;
}

/* Search */
.search-container {
  margin-bottom: var(--spacing-lg);
}
.search-input {
  width: 100%;
  padding: 8px 0;
  font-size: 1rem;
  border: none;
  background: transparent;
  border-bottom: 1px solid #eee;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-bottom-color: #ccc; }
.search-input::placeholder { color: #ddd; }

/* Grouped List */
.resource-group {
  margin-bottom: var(--spacing-lg);
}

.group-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #777;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.15em;
  border: none;
  padding: 0;
}

.resource-list {
  list-style: none;
  padding-left: 0.5rem; /* Indent content */
}

.resource-item {
  display: block;
  padding: 0.5rem 0.75rem; /* Comfortable touch target */
  border-radius: 6px; /* Subtle roundness */
  border-bottom: none; /* Remove line noise */
  transition: background-color 0.2s;
  margin-bottom: 2px;
}
.resource-item:last-child { margin-bottom: 0; }
.resource-item:hover { 
  background-color: #f5f5f5; /* Interactive feel */
  opacity: 1; /* Reset opacity change */
}

.item-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.item-title {
  font-weight: 500;
  font-size: 1rem;
  color: var(--text-primary);
}

.item-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.item-note {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}

.pinned-badge {
  color: var(--text-primary);
  margin-right: 4px;
}

/* Internal Page (Note) */
.note-view {
  padding-bottom: 4rem;
}
.note-nav {
  margin-bottom: var(--spacing-lg);
  font-size: 0.9rem;
  color: var(--text-light);
}
.note-nav a:hover { color: var(--text-primary); text-decoration: underline; }

.note-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--spacing-lg);
  color: #000;
}

.note-content p { margin-bottom: 1rem; text-align: justify; }
.note-content h2 { 
  font-family: var(--font-ui); 
  font-size: 1.1rem; 
  font-weight: 600; 
  margin-top: 2rem; 
  margin-bottom: 0.75rem; 
}
.note-content ul { 
  margin-left: 1.2rem; 
  margin-bottom: 1rem; 
  color: var(--text-secondary); 
}
.note-content .block-quote {
  border-left: 2px solid #ddd;
  padding-left: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 1.5rem 0;
}
.note-content .block-scripture {
  background: #fdfdfd;
  border: 1px solid #eee;
  padding: 1rem;
  border-radius: 4px;
  margin: 1.5rem 0;
  text-align: center;
}
.scripture-text { font-family: var(--font-serif); font-size: 1.1rem; color: #222; display: block; margin-bottom: 0.5rem;}
.scripture-ref { font-size: 0.8rem; color: #888; text-transform: uppercase; }

/* Micro App Host */
.app-host-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.app-host-container {
  height: 70vh;
  height: 70dvh; /* Better mobile support */
  background: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
}
.app-frame { width: 100%; height: 100%; border: none; }

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 1rem 0;
  border-top: 1px solid #eee;
  text-align: center;
  color: #ccc;
  font-size: 0.8rem;
}

/* Utilities */
.hidden { display: none; }

/* Mobile Optimizations */
@media (max-width: 480px) {
  .site-header {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
  }
  
  .note-title {
    font-size: 1.5rem; /* Slightly smaller on mobile */
  }

  .resource-item {
    padding: 0.75rem 0.5rem; /* Larger touch target vertical */
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-light: #666;
    /* --accent-color: #eee; */
  }

  body {
    background-color: var(--bg-color);
  }

  /* Specific Overrides for Dark Mode */
  .resource-item:hover {
    background-color: #1e1e1e;
  }
  
  .about-link {
    background-color: #1e1e1e;
    color: #bbb;
    border-color: #333;
  }
  .about-link::before {
    background: #333;
    color: #ccc;
  }
  
  .search-input {
    border-bottom-color: #333;
  }
  .search-input:focus {
    border-bottom-color: #555;
  }
  
  .group-title {
    color: #888;
    border-bottom-color: #333;
  }

  .note-title {
    color: #e0e0e0;
  }
  
  .note-content .block-quote {
    border-left-color: #333;
    color: #888;
  }
  
  .note-content .block-scripture {
    background: #181818;
    border-color: #333;
  }
  .scripture-text {
    color: #ddd;
  }
  
  .app-host-container {
    background: #1e1e1e;
    border-color: #333;
  }
  
  .site-footer {
    border-top-color: #333;
    color: #555;
  }
  
  /* Link color in dark mode */
  a {
    color: inherit;
  }
  .note-content a {
    color: #8ab4f8; /* Softer blue for dark mode links */
  }
}
