/* Public library pages. Base tokens live in app.css. */

.site { background: #f7fafb; }
.site-header { background: var(--gradient); color: #fff; }
.site-header .site-bar { max-width: 1200px; margin: 0 auto; padding: 16px 24px; }
.site-header .brand img { display: block; height: 44px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-nav > a { color: #fff; text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.site-nav > a:hover { text-decoration: underline; color: #fff; }

.hero { max-width: 900px; margin: 0 auto; padding: 36px 24px 64px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 200; margin-bottom: 0.25em; letter-spacing: -0.01em; }
.hero-lead { font-size: clamp(1.02rem, 2vw, 1.25rem); font-weight: 300; max-width: 680px; margin: 0 auto 28px; }
.hero-stats { margin-top: 16px; font-size: 0.92rem; opacity: 0.92; }

.searchbox { display: flex; gap: 8px; background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: 760px; margin: 0 auto; }
.searchbox input[type="search"] { border: 0; border-radius: 999px; padding: 12px 20px; font-size: 1.05rem; flex: 1; min-width: 0; }
.searchbox input[type="search"]:focus { outline: none; }
.searchbox:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-search { padding: 12px 26px; font-size: 1rem; }

.site-main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 56px; }
.block { margin: 36px 0; }
.block h2 { font-size: 1.5rem; color: var(--teal-900); }
.h-small { font-size: 1rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 10px; }

.usage-guide { background: #e6f3f7; border-left: 4px solid var(--teal); border-radius: 0 10px 10px 0; padding: 14px 20px; }
.usage-guide summary { cursor: pointer; font-weight: 600; color: var(--teal-900); }
.usage-body { margin-top: 10px; }
.usage-body ul { margin: 8px 0 0; padding-left: 1.2em; }
.usage-body li { margin: 4px 0; }
code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 0.9em; }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid #bfdde8; color: var(--teal-900); text-decoration: none; font-size: 0.93rem; }
.chip:hover { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.chip-count { font-size: 0.78rem; background: #e6f3f7; color: var(--teal-900); border-radius: 999px; padding: 0 7px; }
.chip:hover .chip-count { background: rgba(255,255,255,.2); color: #fff; }
.chip-small { padding: 4px 10px; font-size: 0.85rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.cat-card a { display: flex; flex-direction: column; justify-content: flex-end; min-height: 110px; padding: 18px; border-radius: 12px; color: #fff; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s; }
.cat-card a:hover { transform: translateY(-2px); color: #fff; }
.cat-0 a { background: linear-gradient(135deg, var(--teal-900), var(--teal-700)); }
.cat-1 a { background: linear-gradient(135deg, var(--teal-700), #2f8f73); }
.cat-2 a { background: linear-gradient(135deg, #2f7d4f, var(--lime-700)); }
.cat-3 a { background: linear-gradient(135deg, #0b5f7d, #3f7f3a); }
.cat-name { font-size: 1.15rem; font-weight: 500; }
.cat-count { font-size: 0.85rem; opacity: 0.9; }
.cat-card a { justify-content: space-between; gap: 8px; min-height: 150px; }
.cat-desc { font-size: 0.88rem; line-height: 1.4; opacity: 0.95; font-weight: 300; }
.chip-search { background: #f1f8e6; border-color: #cfe3a8; color: var(--lime-700); }
.chip-search:hover { background: var(--lime-700); border-color: var(--lime-700); color: #fff; }
.quick-filters { margin: -8px 0 20px; }
.quick-filters .chip.is-active { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.quick-filters .chip.is-active .chip-count { background: rgba(255,255,255,.2); color: #fff; }

.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.doc-list li { background: #fff; border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }

/* Search results */
.search-head { background: var(--gradient); margin: -28px -24px 24px; padding: 22px 24px; }
.search-layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.filters-panel { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 18px; position: sticky; top: 16px; }
.filters-panel .field { margin-bottom: 12px; }
.filters-panel .field > span, .filters-panel legend { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.years { border: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.years legend { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.92rem; margin: 6px 0 14px; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.results-count { font-size: 1.05rem; font-weight: 500; color: var(--ink-soft); margin: 4px 0 16px; }
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.result { background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); border-left: 4px solid var(--teal); }
.result:nth-child(even) { border-left-color: var(--lime); }
.result-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
.tag { font-size: 0.75rem; font-weight: 600; background: #eef4f6; color: var(--ink-soft); border-radius: 999px; padding: 2px 9px; }
.tag-lang { background: #e6f3f7; color: var(--teal-900); }
.tag-ok { background: var(--notice-bg); color: var(--green-ok); }
.tag-link { background: #fff4d6; color: #7a5200; }
.result-title { font-size: 1.15rem; font-weight: 600; margin: 0 0 2px; line-height: 1.35; }
.result-title a { color: var(--teal-900); text-decoration: none; }
.result-title a:hover { text-decoration: underline; }
.result-publisher { margin: 0 0 8px; color: var(--ink-soft); font-size: 0.9rem; }
.result-section { margin: 8px 0 4px; font-weight: 600; font-size: 0.93rem; }
.result-snippet { margin: 0 0 8px; color: #2c3d46; }
mark { background: #e5f4b8; color: inherit; padding: 0 2px; border-radius: 3px; }
.result-insight { background: #f1f8e6; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 0.93rem; }
.insight-label { font-weight: 700; color: var(--lime-700); margin-right: 4px; }
.result-links { margin: 8px 0 0; font-size: 0.92rem; }
.no-results { background: #fff; border-radius: 12px; padding: 28px; text-align: center; box-shadow: var(--shadow); }

/* Document page */
.crumbs { font-size: 0.9rem; color: var(--ink-soft); }
.doc-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); color: var(--teal-900); margin-bottom: 0.2em; }
.original-title { color: var(--ink-soft); font-style: italic; margin: 0 0 12px; }
.doc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.rights-note { background: #fff8e6; border-radius: 8px; padding: 8px 12px; color: #6b4b00; max-width: 760px; }
.doc-grid { display: grid; grid-template-columns: 1fr 300px; gap: 32px; margin-top: 20px; align-items: start; }
.doc-block { background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.doc-block h2 { font-size: 1.25rem; color: var(--teal-900); }
.lang-note { font-size: 0.8rem; color: var(--ink-soft); font-weight: 400; }
.sections { list-style: none; padding: 0; margin: 0; }
.section { border-top: 1px solid var(--line); padding: 14px 0; scroll-margin-top: 16px; }
.section:first-child { border-top: 0; }
.section:target { background: #f1f8e6; margin: 0 -12px; padding: 14px 12px; border-radius: 8px; }
.section h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 6px; }
.section details summary { cursor: pointer; color: var(--teal-700); font-size: 0.92rem; }
.section-text { white-space: normal; font-size: 0.95rem; margin-top: 8px; max-height: 480px; overflow-y: auto; padding-right: 8px; }
.excerpt { color: #2c3d46; margin: 0; }
.doc-side { background: #fff; border-radius: 12px; padding: 20px; box-shadow: var(--shadow); position: sticky; top: 16px; }
.doc-side h3 { margin-top: 18px; }
.fitxa { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 0.92rem; }
.fitxa dt { color: var(--ink-soft); }
.fitxa dd { margin: 0; }
.cite { background: #f5f8f9; border-radius: 8px; padding: 8px 10px; word-break: break-word; }

.prose { max-width: 760px; background: #fff; border-radius: 12px; padding: 28px 32px; box-shadow: var(--shadow); }
.prose h1 { color: var(--teal-900); }
.prose h2 { color: var(--teal-900); font-size: 1.3rem; margin-top: 1.4em; }

.site-footer { background: var(--teal-900); color: #dcebf0; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.footer-inner img { height: 36px; width: auto; margin-bottom: 8px; }
.footer-inner p { margin: 4px 0; }

@media (max-width: 900px) {
  .search-layout, .doc-grid { grid-template-columns: 1fr; }
  .filters-panel, .doc-side { position: static; }
}
@media (max-width: 560px) {
  .site-header .site-bar { padding: 12px 16px; }
  .site-main { padding: 20px 16px 40px; }
  .search-head { margin: -20px -16px 20px; padding: 16px; }
  .searchbox { border-radius: 14px; flex-direction: column; }
  .btn-search { justify-content: center; }
  .prose { padding: 20px; }
}
