/* ============================================
   otherminds.ai | Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Brand palette */
  --teal: #2BA5B5;
  --teal-dark: #1E8A98;
  --teal-light: #E8F6F8;
  --orange: #D97E3F;
  --orange-dark: #B8652E;
  --orange-light: #FDF0E6;
  --amber: #E8A948;

  /* Neutrals */
  --bg: #F9F9F6;
  --bg-alt: #F2F2EF;
  --surface: #FFFFFF;
  --border: #E5E3DE;
  --border-light: #EDEBE7;
  --text: #1A1A1A;
  --text-secondary: #5C5C5C;
  --text-tertiary: #8C8C8C;

  /* Functional */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Type */
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
}

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

html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

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

#root { min-height: 100vh; display: flex; flex-direction: column; }

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: 2.75rem; letter-spacing: -0.015em; }
h2 { font-size: 2rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 56px;
  border-bottom: 1px solid rgba(229, 227, 222, 0.7);
  background: rgba(249, 249, 246, 0.8);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 2rem; }
.nav-logo {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  text-decoration: none; color: var(--text);
}
.nav-logo img { width: 28px; height: 28px; border-radius: 50%; }
.nav-links { display: flex; gap: 0.15rem; }
.nav-links a, .nav-links button {
  padding: 0.4rem 0.8rem; border-radius: 6px; font-size: 1rem;
  color: var(--text-secondary); transition: all 0.15s; font-weight: 500;
  background: none; border: none; cursor: pointer; font-family: var(--font-sans);
  text-decoration: none;
}
.nav-links a:hover, .nav-links button:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.nav-links a.active, .nav-links button.active { color: var(--text); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.btn-ghost {
  padding: 0.35rem 0.7rem; border-radius: 6px; font-size: 0.9rem;
  color: var(--text-secondary); background: none; border: none;
  cursor: pointer; font-family: var(--font-sans); font-weight: 500;
}
.btn-ghost:hover { color: var(--text); }
.btn-primary {
  padding: 0.45rem 1.1rem; border-radius: 8px; font-size: 0.9rem;
  color: #fff; background: var(--teal-dark); border: none;
  cursor: pointer; font-family: var(--font-sans); font-weight: 600;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

/* Container */
.container { max-width: 1280px; margin: 0 auto; padding: 0 2rem; width: 100%; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 2rem; width: 100%; }

/* Hero */
.hero { padding: 3.5rem 0 2.5rem; }
.hero h1 { max-width: 640px; margin-bottom: 1.75rem; }

/* Search Bar */
.search-bar {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(255,255,255,0.95); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.45rem 0.45rem 0.45rem 1.1rem;
  max-width: 480px; transition: border-color 0.2s;
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.search-bar:focus-within { border-color: var(--teal); }
.search-bar svg { flex-shrink: 0; color: var(--text-tertiary); }
.search-bar input {
  flex: 1; border: none; outline: none; font-size: 0.95rem;
  font-family: var(--font-sans); background: transparent; color: var(--text);
}
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-btn {
  padding: 0.5rem 1.2rem; border-radius: 999px; font-size: 0.9rem;
  color: #fff; background: var(--teal-dark); border: none;
  cursor: pointer; font-family: var(--font-sans); font-weight: 600;
  display: flex; align-items: center; gap: 0.3rem;
  white-space: nowrap; transition: opacity 0.15s;
}
.search-btn:hover { opacity: 0.85; }

/* Section Cards */
.section-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.85rem; margin: 2.5rem 0;
}
.section-card {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 4px 16px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  border-radius: 22px; padding: 1.6rem 1.9rem 1.7rem;
  cursor: pointer; transition: all 0.3s; position: relative;
  overflow: hidden; min-height: 215px;
  display: flex; flex-direction: column; justify-content: flex-end;
  backdrop-filter: blur(16px) saturate(1.4);
}
.section-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,0.6) 0%, transparent 55%);
  border-radius: inherit; z-index: 0;
}
.section-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit; z-index: 0;
  border: 1px solid rgba(255,255,255,0.4);
}
.section-card > * { position: relative; z-index: 1; }

.section-card:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 8px 28px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.04); transform: translateY(-2px); }
.section-grid { gap: 1rem; }
.section-card h2 { font-size: 2.5rem; margin-bottom: 0.35rem; font-weight: 700; letter-spacing: -0.028em; line-height: 0.98; color: #111; }
.section-card p { color: #5A6862; font-size: 1rem; line-height: 1.45; }
.section-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.8rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 500;
  background: rgba(255,255,255,0.85); color: #1A1A1A;
  border: 1px solid rgba(0,0,0,0.06);
  position: absolute; top: 1.25rem; left: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  width: fit-content;
  backdrop-filter: blur(8px);
}
.section-badge.orange, .section-badge.green, .section-badge.blue {}
.section-badge.beta::before {
  content: 'β'; width: auto; height: auto; border-radius: 0;
  background: none; color: #B88420; font-weight: 700;
  font-family: var(--font-serif); font-style: italic;
  font-size: 0.95rem; line-height: 1; margin-right: 0.05rem;
}

/* Paper Cards */
.papers-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 1.25rem; margin-top: 2.5rem;
}
.papers-header h2 { font-size: 1.5rem; font-weight: 500; }
.papers-header a { font-size: 0.95rem; color: var(--text-secondary); font-weight: 500; display: flex; align-items: center; gap: 0.25rem; }
.papers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }

.paper-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 1.35rem;
  cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column;
}
.paper-card:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.paper-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.paper-type-badge {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; color: var(--text-secondary);
}
.paper-type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.paper-bookmark {
  background: none; border: none; cursor: pointer; color: var(--text-tertiary);
  padding: 0.2rem; transition: color 0.15s;
}
.paper-bookmark:hover { color: var(--orange); }
.paper-bookmark.active { color: var(--orange); }
.paper-card h3 {
  font-size: 1.1rem; font-weight: 600; font-family: var(--font-sans);
  line-height: 1.35; margin-bottom: 0.35rem;
}
.paper-authors { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.4rem; }
.paper-description {
  font-size: 0.95rem; color: var(--text-secondary); line-height: 1.5;
  margin-bottom: 0.6rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.paper-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.6rem; border-top: 1px solid var(--border-light);
  font-size: 0.9rem; color: var(--text-secondary);
}
.paper-footer-item { display: flex; align-items: center; gap: 0.3rem; }

/* Tag Pills */
.tag-pill {
  display: inline-flex; align-items: center; padding: 0.32rem 0.85rem;
  border-radius: 999px; font-size: 0.88rem; font-weight: 600;
  color: #3a3a3a !important;
  transition: all 0.15s; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent;
}
.tag-pill:hover { opacity: 0.8; }
.paper-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.6rem; }

/* Archive Page */
.archive-layout {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 2rem; padding-top: 1.5rem; padding-bottom: 3rem;
}
.archive-sidebar {
  position: sticky; top: 72px; align-self: start;
  max-height: calc(100vh - 88px); overflow-y: auto;
  padding-right: 0.5rem;
}
.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-section h4 {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-tertiary);
  margin-bottom: 0.5rem; font-family: var(--font-sans);
}
.sidebar-option {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.35rem 0; font-size: 0.95rem; cursor: pointer;
  color: var(--text-secondary); transition: color 0.15s;
}
.sidebar-option:hover { color: var(--text); }
.sidebar-option input[type="checkbox"] {
  accent-color: var(--teal); width: 14px; height: 14px; cursor: pointer;
}
.sidebar-option .count {
  margin-left: auto; font-size: 0.85rem; color: var(--text-tertiary);
  background: var(--bg-alt); padding: 0.15rem 0.5rem; border-radius: 4px;
}
.archive-results-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.archive-results-header p { color: var(--text-secondary); font-size: 1rem; }
.archive-sort select {
  padding: 0.4rem 0.7rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; background: var(--surface);
  font-family: var(--font-sans); cursor: pointer; color: var(--text);
}
.archive-grid { display: flex; flex-direction: column; gap: 0.6rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 2rem; backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--surface); border-radius: var(--radius-xl);
  max-width: 700px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp 0.25s ease;
  position: relative;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--bg-alt); border: none; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 1rem; z-index: 2;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 1.75rem; }
.modal-body h2 { margin-bottom: 0.4rem; font-size: 1.5rem; font-weight: 500; }
.modal-authors { color: var(--text-secondary); margin-bottom: 0.85rem; font-size: 0.92rem; }
.modal-meta {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1.15rem;
}
.modal-meta-item {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.6rem; border-radius: 6px;
  font-size: 0.9rem; background: var(--bg-alt); color: var(--text-secondary);
}
.modal-summary { font-size: 1.05rem; line-height: 1.7; color: var(--text); margin-bottom: 1.25rem; }
.modal-section-title {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-tertiary); margin-bottom: 0.6rem;
  font-family: var(--font-sans);
}
.modal-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.25rem; }
.modal-actions {
  display: flex; gap: 0.6rem; padding-top: 0.85rem;
  border-top: 1px solid var(--border-light);
}
.modal-btn {
  padding: 0.55rem 1.2rem; border-radius: 10px; font-size: 0.9rem;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: var(--font-sans); font-weight: 500;
  display: flex; align-items: center; gap: 0.35rem;
  transition: all 0.15s; color: var(--text);
}
.modal-btn:hover { background: var(--bg-alt); }
.modal-btn.primary { background: var(--teal-dark); color: #fff; border-color: var(--teal-dark); }
.modal-btn.primary:hover { opacity: 0.85; }

.slides-placeholder {
  background: var(--bg-alt); border: 1px dashed var(--border);
  border-radius: var(--radius-md); padding: 1.75rem;
  text-align: center; color: var(--text-tertiary);
  font-size: 0.88rem; margin-bottom: 1.25rem;
}

/* Wiki */
.wiki-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem; padding: 1.5rem 0 3rem;
}
.wiki-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 1.5rem;
  cursor: pointer; transition: all 0.2s;
}
.wiki-card:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.wiki-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.wiki-card h3 { font-size: 1.2rem; font-family: var(--font-sans); font-weight: 600; }
.wiki-card-count { font-size: 0.85rem; color: var(--text-tertiary); background: var(--bg-alt); padding: 0.12rem 0.4rem; border-radius: 4px; }
.wiki-card p { font-size: 1rem; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.wiki-detail { max-width: 660px; padding: 1.5rem 0 3rem; }
.wiki-detail h1 { font-size: 1.85rem; margin-bottom: 0.4rem; }
.wiki-detail .wiki-tag-indicator { margin-bottom: 1.25rem; }
.wiki-detail-body { font-size: 1rem; line-height: 1.8; color: var(--text); margin-bottom: 1.75rem; }
.wiki-related { margin-bottom: 1.75rem; }
.wiki-related h3 { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); margin-bottom: 0.65rem; font-family: var(--font-sans); }
.wiki-related-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Resources */
.resources-section { margin-bottom: 2.25rem; }
.resources-section h2 { font-size: 1.5rem; margin-bottom: 0.85rem; font-weight: 500; }
.resources-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.6rem;
}
.resource-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 1.5rem;
  transition: all 0.2s;
}
.resource-card:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.resource-card h3 {
  font-size: 1.1rem; font-family: var(--font-sans); font-weight: 600;
  margin-bottom: 0.2rem; color: var(--teal-dark);
}
.resource-card p { font-size: 1rem; color: var(--text-secondary); }

/* Research Map */
.research-map-placeholder {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 3rem 2rem;
  text-align: center; margin-top: 1.25rem;
}

/* Page Header */
.page-header {
  padding: 2rem 0 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 0.85rem;
}
.page-header h1 { font-size: 2rem; }
.page-header p { color: var(--text-secondary); margin-top: 0.2rem; font-size: 1.1rem; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Hide scrollbar for recent additions */
.papers-scroll::-webkit-scrollbar { display: none; }

/* Responsive */
@media (max-width: 900px) {
  h1 { font-size: 2rem; }
  .section-grid { grid-template-columns: 1fr; }
  .papers-grid { grid-template-columns: 1fr; }
  .archive-layout { grid-template-columns: 1fr; }
  .archive-sidebar { position: static; max-height: none; }
  .nav-links { display: none; }
}
@media (max-width: 600px) {
  .container, .container-wide { padding: 0 1rem; }
  .nav { padding: 0 1rem; }
  h1 { font-size: 1.65rem; }
  .hero { padding: 2rem 0 1.5rem; }
  .modal-content { margin: 1rem; max-height: 90vh; }
  .modal-body { padding: 1.15rem; }
}

/* Archive page size overrides */
.archive-layout .paper-card { padding: 1.4rem; }
.archive-layout .paper-card h3 { font-size: 1.2rem; margin-bottom: 0.45rem; }
.archive-layout .paper-authors { font-size: 0.92rem; }
.archive-layout .paper-description { font-size: 0.95rem; line-height: 1.55; }
.archive-layout .paper-type-badge { font-size: 0.9rem; }
.archive-layout .paper-footer { font-size: 0.9rem; padding-top: 0.7rem; }
.archive-layout .tag-pill { font-size: 0.88rem; padding: 0.32rem 0.85rem; }
.archive-layout .sidebar-section h4 { font-size: 0.84rem; }
.archive-layout .sidebar-option { font-size: 0.95rem; padding: 0.35rem 0; }
.archive-layout .sidebar-option .count { font-size: 0.84rem; padding: 0.15rem 0.5rem; }
