@import "https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600;700&display=swap";

/* src/styles.css */
:root {
  --bg: #f7f0e8;
  --bg-accent: #e3f1f0;
  --ink: #1c1b1a;
  --muted: #5a5753;
  --surface: #fff;
  --surface-2: #fff7ee;
  --brand: #0f6f6a;
  --brand-2: #e9843a;
  --border: #e4d9cf;
  --shadow: 0 18px 45px #1e23241f;
}

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

html {
  scroll-behavior: smooth;
}

body {
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  font-family: Space Grotesk, Segoe UI, sans-serif;
  line-height: 1.5;
}

body:before {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  background: none;
  inset: 0;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.meta {
  background: #1c1b1a0f;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}

.meta:before {
  content: "";
  display: inline-block;
  vertical-align: middle;
  background: #3bb078;
  border-radius: 50%;
  width: 8px;
  height: 8px;
  margin-right: 8px;
}

.panel {
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
}

.search {
  display: grid;
  grid-template-columns: 1fr 180px 140px;
  align-items:  end;
  gap: 16px;
}

.search__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search__field label {
  color: var(--muted);
  font-size: 14px;
}

.search__input-wrapper {
  position: relative;
  display: flex;
  align-items:  center;
}

.search__icon {
  position: absolute;
  color: var(--muted);
  pointer-events: none;
  left: 14px;
}

.search__input-wrapper input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  width: 100%;
  padding: 14px 80px 14px 40px;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
  font-size: 16px;
}

.search__input-wrapper input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #0f6f6a26;
}

.search__kbd {
  position: absolute;
  border: 1px solid var(--border);
  color: var(--muted);
  pointer-events: none;
  background: #1c1b1a0f;
  border-radius: 6px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 11px;
  right: 12px;
}

.search select {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 16px;
}

.search__button {
  position: relative;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  border: none;
  border-radius: 14px;
  justify-content: center;
  align-items:  center;
  gap: 8px;
  padding: 14px 16px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  font-size: 16px;
  font-weight: 600;
}

.search__button:disabled {
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.search__button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px #0f6f6a3d;
}

.search__button:not(:disabled):active {
  transform: scale(.97);
}

.spinner {
  display: inline-block;
  animation: spin .6s linear infinite;
  border: 2px solid #ffffff4d;
  border-top-color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
}

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

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 10px;
}

.hint {
  color: var(--muted);
  margin-bottom: 16px;
  font-size: 13px;
}

.chip {
  color: var(--brand);
  cursor: pointer;
  background: #f0fbfa;
  border: 1px solid #0f6f6a33;
  border-radius: 999px;
  padding: 8px 14px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, background .2s;
  font-family: inherit;
  font-size: 13px;
}

.chip:hover {
  background: #e3f7f4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px #0f6f6a26;
}

.alert {
  color: #9a4d16;
  background: #e9843a1f;
  border: 1px solid #e9843a4d;
  border-radius: 12px;
  margin-bottom: 12px;
  padding: 12px 16px;
}

.results {
  margin-top: 18px;
}

.results__header {
  display: flex;
  color: var(--muted);
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  margin-bottom: 18px;
}

.results__header h2 {
  color: var(--ink);
  font-family: Fraunces, Times New Roman, serif;
  font-size: 22px;
}

.results__empty {
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  display: flex;
  border-radius: 16px;
  flex-direction: column;
  align-items:  center;
  gap: 12px;
  padding: 40px 20px;
}

.empty-icon {
  opacity: .4;
}

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

.results__grid--search {
  grid-template-columns: 1fr;
}

.results__pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  margin-top: 18px;
}

.pagination__button {
  color: var(--brand);
  cursor: pointer;
  background: #f0fbfa;
  border: 1px solid #0f6f6a33;
  border-radius: 999px;
  padding: 8px 14px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, background .2s;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

.pagination__button:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.pagination__button:not(:disabled):hover {
  background: #e3f7f4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px #0f6f6a26;
}

.pagination__meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.fade-in {
  animation: fadeInUp .4s ease both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  display: flex;
  background: #fff;
  border: 1px solid #0f6f6a1f;
  border-radius: 18px;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s;
  box-shadow: 0 8px 20px #1e232414;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px #1e232424;
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items:  flex-start;
  gap: 12px;
}

.card__header h3 {
  font-size: 16px;
}

.card__path {
  color: var(--muted);
  font-size: 12px;
}

.card__link {
  text-decoration: none;
  color: var(--brand);
  white-space: nowrap;
  border: 1px solid #0f6f6a33;
  border-radius: 999px;
  padding: 4px 12px;
  transition: background .2s, color .2s;
  font-size: 12px;
  font-weight: 600;
}

.card__link:hover {
  background: var(--brand);
  color: #fff;
}

.card__snippet {
  color: #2b2a29;
  font-size: 14px;
}

.card__snippet--empty {
  color: var(--muted);
}

.card__snippet mark {
  color: #5a2b0c;
  background: #e9843a40;
  border-radius: 6px;
  padding: 0 4px;
}

.card__summary-preview {
  color: var(--muted);
  border-top: 1px dashed #0f6f6a33;
  padding-top: 10px;
  font-size: 13px;
}

.card__summary-markdown {
  margin-top: 6px;
  line-height: 1.55;
}

.card__summary-markdown p {
  margin: 0 0 6px;
}

.card__summary-markdown p:last-child {
  margin-bottom: 0;
}

.card__summary-markdown ul, .card__summary-markdown ol {
  margin: 0 0 6px;
  padding-left: 18px;
}

.card__summary-link {
  display: inline-block;
  color: var(--brand);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  margin-top: 8px;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

.card__summary-link:hover {
  text-decoration: underline;
}

.summaries {
  margin-top: 26px;
}

.summaries .results__grid {
  grid-template-columns: 1fr;
}

.summary-card {
  border-left: 3px solid var(--brand);
  scroll-margin-top: 20px;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s, border-color .3s;
}

.summary-card:hover {
  border-left-color: var(--brand-2);
}

.summary-card--highlight {
  animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
  0% {
    box-shadow: 0 0 #0f6f6a66;
  }

  40% {
    box-shadow: 0 0 0 6px #0f6f6a26;
  }

  100% {
    box-shadow: 0 8px 20px #1e232414;
  }
}

.summary-card__badge {
  display: inline-block;
  color: var(--brand);
  background: #0f6f6a1a;
  border-radius: 999px;
  margin-bottom: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

.summary-card__preview {
  color: var(--muted);
  font-size: 13px;
}

.summary-card__expand {
  border-top: 1px solid #0f6f6a24;
  padding-top: 10px;
}

.summary-card__toggle {
  display: inline-flex;
  cursor: pointer;
  color: var(--brand);
  background: none;
  border: none;
  align-items:  center;
  gap: 6px;
  padding: 4px 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

.summary-card__toggle:hover {
  text-decoration: underline;
}

.summary-card__chevron {
  display: inline-block;
  transition: transform .3s;
  font-size: 12px;
}

.summary-card__toggle--open .summary-card__chevron {
  transform: rotate(90deg);
}

.summary-card__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s;
}

.summary-card__body--open {
  grid-template-rows: 1fr;
}

.summary-card__body-inner {
  overflow: hidden;
}

.summary-card__markdown {
  border: 1px solid var(--border);
  background: #f9f7f2;
  border-radius: 12px;
  margin-top: 10px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.65;
}

.summary-card__markdown h1 {
  border-bottom: 1px solid var(--border);
  margin: 0 0 10px;
  padding-bottom: 8px;
  font-family: Fraunces, Times New Roman, serif;
  font-size: 20px;
}

.summary-card__markdown h2 {
  color: var(--brand);
  margin: 16px 0 8px;
  font-family: Fraunces, Times New Roman, serif;
  font-size: 17px;
}

.summary-card__markdown h3 {
  margin: 14px 0 6px;
  font-size: 15px;
}

.summary-card__markdown p {
  margin: 8px 0;
}

.summary-card__markdown ul, .summary-card__markdown ol {
  margin: 8px 0;
  padding-left: 20px;
}

.summary-card__markdown li {
  margin: 4px 0;
}

.summary-card__markdown strong {
  color: var(--ink);
}

.summary-card__markdown code {
  background: #1c1b1a0f;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
}

.summary-card__markdown blockquote {
  border-left: 3px solid var(--brand);
  color: var(--muted);
  margin: 8px 0;
  padding: 4px 12px;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-line {
  animation: shimmer 1.5s ease infinite;
  background: linear-gradient(90deg, #e8e3dc 25%, #f5f0e8 50%, #e8e3dc 75%) 0 0 / 200% 100%;
  border-radius: 8px;
  height: 14px;
}

.skeleton-line--title {
  width: 60%;
  height: 18px;
}

.skeleton-line--short {
  width: 40%;
}

.skeleton-line--medium {
  width: 75%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.footer {
  text-align: center;
  color: var(--muted);
  padding-top: 10px;
  font-size: 12px;
}

@media (width <= 820px) {
  .search {
    grid-template-columns: 1fr;
  }

  .search__button {
    width: 100%;
  }

  .search__kbd {
    display: none;
  }
}
