/* Research Desk portal styles. Uses Frappe's CSS variables so it follows the site theme (light/dark). */

.rd {
	--rd-accent: var(--primary, #2f6f5e);
	--rd-border: var(--border-color, #e2e6e9);
	--rd-muted: var(--text-muted, #6c7680);
	--rd-bg: var(--card-bg, #fff);
	--rd-soft: var(--subtle-fg, #f4f5f6);
	--rd-mark: #fff1a8;
	font-size: 15px;
	line-height: 1.55;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 16px 48px;
}
.rd * { box-sizing: border-box; }
.rd .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.rd-muted { color: var(--rd-muted); }
.rd-error { color: var(--red-600, #c0392b); }
.rd mark { background: var(--rd-mark); color: inherit; padding: 0 1px; border-radius: 2px; }

/* hero + search */
.rd-hero { padding: 32px 0 16px; }
.rd-hero__title { font-size: 2rem; margin: 0 0 4px; }
.rd-hero__logo { display: block; max-height: 96px; max-width: min(360px, 80%); width: auto; margin: 0 0 14px; }
.rd-hero--banner {
	position: relative; padding: 40px 24px 24px; margin: 16px 0 0; border-radius: 14px; overflow: hidden; color: #fff;
	background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.55)), var(--rd-banner) center/cover no-repeat;
}
.rd-hero--banner .rd-hero__tagline, .rd-hero--banner .rd-muted, .rd-hero--banner .rd-modes label { color: rgba(255,255,255,.88); }
.rd-hero__tagline { color: var(--rd-muted); margin: 0 0 20px; max-width: 60ch; }
.rd-search { display: flex; gap: 8px; }
.rd-search__input {
	flex: 1; min-width: 0; font-size: 1.1rem; padding: 12px 14px;
	border: 1px solid var(--rd-border); border-radius: 8px; background: var(--rd-bg); color: inherit;
}
.rd-search__input:focus { outline: 2px solid var(--rd-accent); outline-offset: 1px; }
.rd-modes { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 10px; }
.rd-modes label { display: flex; gap: 6px; align-items: center; margin: 0; cursor: pointer; }
.rd-count { margin-left: auto; }

.rd-btn {
	display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 8px;
	border: 1px solid var(--rd-border); background: var(--rd-bg); color: inherit; cursor: pointer;
	font-size: 0.95rem; text-decoration: none; white-space: nowrap;
}
.rd-btn:hover { text-decoration: none; background: var(--rd-soft); }
.rd-btn--primary { background: var(--rd-accent); border-color: var(--rd-accent); color: #fff; }
.rd-btn--primary:hover { filter: brightness(1.08); background: var(--rd-accent); color: #fff; }
.rd-btn[disabled] { opacity: .5; cursor: default; }

/* layout */
.rd-layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; margin-top: 12px; }
.rd-facet { margin-bottom: 18px; }
.rd-facet h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rd-muted); margin: 0 0 6px; }
.rd-facet ul { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow: auto; }
.rd-facet li label { display: flex; gap: 6px; align-items: baseline; margin: 2px 0; font-weight: normal; cursor: pointer; }
.rd-facet li span:first-of-type { flex: 1; overflow-wrap: anywhere; }
.rd-years { display: flex; gap: 6px; }
.rd-years input { width: 50%; padding: 6px 8px; border: 1px solid var(--rd-border); border-radius: 6px; background: var(--rd-bg); color: inherit; }

.rd-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rd-toolbar__right { display: flex; gap: 8px; align-items: center; }
.rd-toolbar select { padding: 7px 10px; border: 1px solid var(--rd-border); border-radius: 8px; background: var(--rd-bg); color: inherit; }

.rd-basket { position: relative; }
.rd-basket__menu {
	position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 260px; padding: 10px;
	background: var(--rd-bg); border: 1px solid var(--rd-border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.rd-basket__menu a { display: block; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: inherit; }
.rd-basket__menu a:hover { background: var(--rd-soft); text-decoration: none; }
.rd-basket__menu p { margin: 0 0 6px; font-size: .85rem; }
.rd-danger { color: var(--red-600, #c0392b) !important; }

.rd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.rd-chip {
	display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--rd-border);
	background: var(--rd-soft); color: inherit; font-size: .85rem; margin: 0 4px 4px 0; cursor: pointer;
}
.rd-chip.is-active { background: var(--rd-accent); color: #fff; border-color: var(--rd-accent); }
.rd-badge { font-size: .75rem; padding: 1px 6px; border-radius: 4px; background: var(--rd-soft); border: 1px solid var(--rd-border); }

/* results */
.rd-hits { list-style: none; padding: 0; margin: 0; }
.rd-hit { display: grid; grid-template-columns: 72px 1fr 36px; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rd-border); }
.rd-hit--page { grid-template-columns: 1fr 36px; }
.rd-hit__thumb { display: block; width: 72px; height: 96px; border-radius: 4px; background: var(--rd-soft) center/40% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5'%3E%3Cpath d='M4 19.5V5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 0A2 2 0 0 0 6 21h13'/%3E%3C/svg%3E"); }
.rd-hit__thumb img { width: 72px; height: 96px; object-fit: cover; border-radius: 4px; background: var(--rd-soft); }
.rd-hit h3 { font-size: 1.05rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.rd-hit__creators { font-size: .95rem; }
.rd-snippet { margin: 6px 0 0; font-size: .92rem; color: var(--text-color, inherit); overflow-wrap: anywhere; }
.rd-empty { padding: 32px 0; color: var(--rd-muted); }
.rd-save {
	width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--rd-border); background: var(--rd-bg);
	color: inherit; cursor: pointer; font-size: 1rem;
}
.rd-save.is-saved { background: var(--rd-accent); border-color: var(--rd-accent); color: #fff; }
.rd-pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 20px 0; }

/* item page */
.rd-crumbs { padding: 20px 0 8px; }
.rd-item__head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.rd-item__thumb { width: 120px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.rd-item__title { font-size: 1.7rem; margin: 0; overflow-wrap: anywhere; }
.rd-item__alt { font-size: 1.1rem; color: var(--rd-muted); margin: 2px 0 6px; }
.rd-item__creators { margin: 4px 0; font-size: 1.05rem; }
.rd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rd-item__grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
.rd-reader iframe { width: 100%; height: 78vh; min-height: 480px; border: 1px solid var(--rd-border); border-radius: 8px; background: var(--rd-soft); }
.rd-inside form { display: flex; gap: 8px; margin-bottom: 8px; }
.rd-inside input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--rd-border); border-radius: 8px; background: var(--rd-bg); color: inherit; }
.rd-inside__hits { list-style: none; padding: 0; margin: 0 0 10px; max-height: 220px; overflow: auto; }
.rd-inside__hits li { border-bottom: 1px solid var(--rd-border); }
.rd-linkish { all: unset; display: block; cursor: pointer; padding: 6px 4px; font-size: .9rem; }
.rd-linkish:hover { background: var(--rd-soft); }
.rd-card { border: 1px solid var(--rd-border); border-radius: 10px; padding: 16px; margin-bottom: 16px; background: var(--rd-bg); }
.rd-card h2 { font-size: 1rem; margin: 0 0 10px; }
.rd-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.rd-tab { border: 1px solid var(--rd-border); background: var(--rd-bg); color: inherit; border-radius: 6px; padding: 3px 8px; font-size: .82rem; cursor: pointer; }
.rd-tab.is-active { background: var(--rd-accent); border-color: var(--rd-accent); color: #fff; }
.rd-cite { white-space: pre-wrap; word-break: break-word; font-size: .8rem; max-height: 260px; overflow: auto; background: var(--rd-soft); padding: 10px; border-radius: 6px; margin: 0; }
.rd-cite.is-hidden { display: none; }
.rd-meta { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 0; font-size: .92rem; }
.rd-meta dt { color: var(--rd-muted); font-weight: normal; }
.rd-meta dd { margin: 0; overflow-wrap: anywhere; }
.rd-desc { margin-top: 12px; font-size: .92rem; }

@media (max-width: 900px) {
	.rd-layout, .rd-item__grid { grid-template-columns: 1fr; }
	.rd-facets { order: 2; }
	.rd-count { margin-left: 0; }
	.rd-item__head { flex-direction: column; }
	.rd-reader iframe { height: 70vh; }
}
@media (max-width: 520px) {
	.rd-hit { grid-template-columns: 56px 1fr 32px; gap: 10px; }
	.rd-hit__thumb { display: block; width: 72px; height: 96px; border-radius: 4px; background: var(--rd-soft) center/40% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5'%3E%3Cpath d='M4 19.5V5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2zm0 0A2 2 0 0 0 6 21h13'/%3E%3C/svg%3E"); }
.rd-hit__thumb img { width: 56px; height: 76px; }
	.rd-search { flex-direction: column; }
}

/* navbar brand (set from RD Settings → Logo) */
.rd-brand { display: inline-flex; align-items: center; gap: 10px; }
.rd-brand__logo { max-height: 32px; width: auto; }
.rd-brand__name { font-weight: 600; }

/* access control */
.rd-badge--members { background: #fff4e0; border-color: #f0c987; color: #7a4b00; }
.rd-access-note { margin: 10px 0 0; font-size: .9rem; color: var(--rd-muted); }
.rd-locked { padding: 28px; text-align: center; }
.rd-locked h2 { margin-top: 0; }
.rd-locked .rd-actions { justify-content: center; }
.rd-staffbar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px; padding: 8px 12px;
	border: 1px dashed var(--rd-border); border-radius: 8px; background: var(--rd-soft); font-size: .9rem;
}
.rd-staffbar select { padding: 5px 8px; border: 1px solid var(--rd-border); border-radius: 6px; background: var(--rd-bg); color: inherit; }
@media (prefers-color-scheme: dark) {
	.rd-badge--members { background: #3a2c12; border-color: #7a5a20; color: #f3d59a; }
}

/* collections */
.rd-page-title { font-size: 1.8rem; margin: 6px 0 8px; }
.rd-browse { margin: 18px 0 0; }
.rd-featured { margin: 26px 0 8px; }
.rd-featured__head { display: flex; align-items: baseline; justify-content: space-between; }
.rd-featured__head h2 { font-size: 1.1rem; margin: 0 0 10px; }
.rd-coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 10px 0 20px; }
.rd-coll-card { display: block; border: 1px solid var(--rd-border); border-radius: 10px; overflow: hidden; background: var(--rd-bg); color: inherit; }
.rd-coll-card:hover { text-decoration: none; border-color: var(--rd-accent); }
.rd-coll-card__cover { height: 120px; background: var(--rd-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; }
.rd-coll-card__cover span { font-size: 2.4rem; color: var(--rd-muted); }
.rd-coll-card__body { padding: 10px 12px; }
.rd-coll-card__body h3 { font-size: 1rem; margin: 0 0 2px; }
.rd-coll-card__body p { margin: 0; font-size: .85rem; }
.rd-coll-head { display: flex; gap: 18px; align-items: flex-start; margin: 8px 0 14px; }
.rd-coll-head__cover { width: 160px; height: 120px; object-fit: cover; border-radius: 8px; flex: none; }
.rd-coll-head__desc { max-width: 70ch; }
.rd-coll-search { margin-bottom: 8px; }
@media (max-width: 640px) { .rd-coll-head { flex-direction: column; } .rd-coll-head__cover { width: 100%; } }

/* help pages */
.rd-help__layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; margin-top: 12px; }
.rd-help__nav { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; font-size: 14px; }
.rd-help__nav h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rd-muted); margin: 18px 0 6px; }
.rd-help__nav ul { list-style: none; padding: 0; margin: 0; }
.rd-help__nav li { margin: 2px 0; }
.rd-help__nav a[aria-current="page"] { font-weight: 600; color: var(--rd-accent); }
.rd-help__toc--3 { padding-left: 12px; }
.rd-help__body { max-width: 78ch; }
.rd-help__body h1 { font-size: 1.9rem; margin: 0 0 12px; }
.rd-help__body h2 { font-size: 1.35rem; margin: 32px 0 10px; padding-top: 8px; border-top: 1px solid var(--rd-border); }
.rd-help__body h3 { font-size: 1.1rem; margin: 22px 0 8px; }
.rd-help__body h2, .rd-help__body h3 { scroll-margin-top: 72px; }
.rd-help__body table { border-collapse: collapse; margin: 12px 0; width: 100%; font-size: 14px; }
.rd-help__body th, .rd-help__body td { border: 1px solid var(--rd-border); padding: 6px 10px; vertical-align: top; text-align: left; }
.rd-help__body pre { background: var(--rd-soft); padding: 12px; border-radius: 8px; overflow: auto; font-size: 13px; }
.rd-help__body code { font-size: .92em; }
.rd-help-img, .rd-help__body img { max-width: 100%; height: auto; border: 1px solid var(--rd-border); border-radius: 8px; margin: 8px 0; }
@media (max-width: 800px) {
	.rd-help__layout { grid-template-columns: 1fr; }
	.rd-help__nav { position: static; max-height: none; }
}

/* first-visit tips */
.rd-tips { margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--rd-border); border-left: 4px solid var(--rd-accent);
	border-radius: 8px; background: var(--rd-bg); color: var(--text-color, inherit); max-width: 760px; }
.rd-tips__list { list-style: none; margin: 0 0 8px; padding: 0; }
.rd-tips__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.rd-tips__bar .rd-btn { padding: 4px 12px; }
.rd-tips__count { margin-right: auto; }
.rd-hero--banner .rd-tips, .rd-hero--banner .rd-tips .rd-muted { color: var(--text-color, #1f272e); }
.rd-coll-subhead { font-size: 1.1rem; margin: 18px 0 4px; }

/* -- About page (/about, edited in the Desk: RD About Page) ------------------------------- */
.rd-about { max-width: 1040px; margin: 0 auto; }
.rd-about__hero { display: grid; grid-template-columns: 1fr; gap: 28px; align-items: center; padding: 40px 0 24px; }
.rd-about__hero--image { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.rd-about__title { font-size: 2.2rem; line-height: 1.2; margin: 0 0 8px; }
.rd-about__tagline { color: var(--rd-muted); font-size: 1.15rem; margin: 0 0 16px; max-width: 60ch; }
.rd-about__intro { font-size: 1.05rem; max-width: 65ch; }
.rd-about__image { width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; border: 1px solid var(--rd-border); }
.rd-about__buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.rd-btn--large { padding: 10px 22px; font-size: 1.05rem; }
.rd-about__numbers { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 24px; }
.rd-about__number { flex: 1 1 160px; padding: 14px 16px; border: 1px solid var(--rd-border); border-radius: 10px; background: var(--rd-soft); }
.rd-about__number b { display: block; font-size: 1.5rem; }
.rd-about__number span { color: var(--rd-muted); }
.rd-about__section { margin: 32px 0; }
.rd-about__section h2 { font-size: 1.35rem; margin: 0 0 14px; }
.rd-about__steps { list-style: none; counter-reset: rd-step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.rd-about__steps li { counter-increment: rd-step; position: relative; padding: 16px 16px 16px 58px; border: 1px solid var(--rd-border); border-radius: 10px; background: var(--rd-bg); }
.rd-about__steps li::before { content: counter(rd-step); position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--rd-accent); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.rd-about__steps h3, .rd-about__card h3 { font-size: 1.02rem; margin: 2px 0 6px; }
.rd-about__steps p, .rd-about__card p { margin: 0 0 8px; color: var(--rd-muted); }
.rd-about__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.rd-about__card { padding: 18px; border: 1px solid var(--rd-border); border-top: 3px solid var(--rd-accent); border-radius: 10px; background: var(--rd-bg); }
.rd-prose img { max-width: 100%; height: auto; border-radius: 8px; }
.rd-prose p { margin: 0 0 .8em; }
.rd-about__end { text-align: center; margin: 40px 0 24px; }
@media (max-width: 720px) {
	.rd-about__hero--image { grid-template-columns: 1fr; }
	.rd-about__title { font-size: 1.7rem; }
}

/* the library's logo at the top of the help pages (Settings → Logo; else the SOK logo) */
.rd-help__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 0 14px; padding: 0 0 12px; border-bottom: 1px solid var(--rd-border); color: inherit; }
.rd-help__brand:hover { text-decoration: none; }
.rd-help__brand img { max-width: 200px; max-height: 64px; width: auto; height: auto; }
.rd-help__brand span { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--rd-muted); }
