/*
 * Oriel themes — pages from the portal add-on: News & Patch Notes and its
 * editor, Downloads, Guild ranking, and the item and monster databases.
 * Colours come from the --o-* tokens each theme sets for Light and Dark.
 */

/* ---------- Shared ---------- */
.o-page-head--split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.o-page-head--split > div { min-width: 0; flex: 1 1 420px; }
.o-page-head--split .o-lead { margin-bottom: 0; }
.o-backlink { margin: 0 0 16px; font-size: 15px; }
.o-backlink a { text-decoration: none; }
.o-backlink a:hover { text-decoration: underline; }
.o-muted { color: var(--o-text-2); }
.o-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.o-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.o-results { margin: 0 0 12px; color: var(--o-text-2); font-size: 15px; }
.o-subnav__count { margin-left: 4px; color: var(--o-text-2); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }

.o-btn--danger { background: transparent; color: var(--o-error); border-color: var(--o-error); }
.o-btn--danger:hover { background: var(--o-error-bg); color: var(--o-error); }

.o-badge {
	display: inline-block; padding: 1px 8px; border: 1px solid var(--o-border); border-radius: 999px;
	background: var(--o-surface-2); color: var(--o-heading);
	font-size: 12px; font-weight: 700; letter-spacing: .04em; line-height: 1.6; vertical-align: middle; white-space: nowrap;
}
.o-badge--mvp { background: var(--o-action); border-color: var(--o-action); color: var(--o-on-action); }

.o-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; margin: 8px 0 28px; }
.o-pager__status { color: var(--o-text-2); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------- News & Patch Notes ---------- */
.o-tag--patch { background: var(--o-surface-2); color: var(--o-heading); box-shadow: inset 0 0 0 1px var(--o-border); }
.o-content .o-post-list { display: grid; gap: 16px; margin: 0 0 24px; padding: 0; list-style: none; }
.o-post-card {
	padding: 22px 24px; border: 1px solid var(--o-border); border-radius: var(--o-radius);
	background: var(--o-surface); box-shadow: var(--o-shadow);
}
.o-post-card.is-pinned { border-color: color-mix(in srgb, var(--o-accent) 60%, var(--o-border)); }
.o-post-card article { display: flex; flex-direction: column; align-items: flex-start; }
.o-post-meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
	margin: 0 0 10px; color: var(--o-text-2); font-size: 14px;
}
.o-post-meta .o-tag { margin: 0; }
.o-post-meta__pin { font-weight: 600; color: var(--o-heading); }
.o-post-card__title { margin: 0 0 8px !important; font-family: var(--o-font-display); font-size: 26px !important; line-height: 1.2; font-weight: 600; }
.o-post-card__title a { color: var(--o-heading); text-decoration: none; }
.o-post-card__title a:hover { text-decoration: underline; }
.o-post-card__summary { margin: 0 0 12px !important; color: var(--o-text-2); max-width: 78ch; }

.o-article { max-width: 80ch; }
.o-article__head { margin: 0 0 24px; padding-bottom: 20px; border-bottom: 1px solid var(--o-border); }
.o-article__head h2 { margin-bottom: 10px; }
.o-article__head .o-lead { margin: 0; }
.o-article__actions { margin: 28px 0 0; }

.o-prose { font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.o-prose > :first-child { margin-top: 0; }
.o-prose h1, .o-prose h2, .o-prose h3 { margin: 32px 0 12px; font-family: var(--o-font-display); color: var(--o-heading); line-height: 1.2; }
.o-prose h1, .o-prose h2 { font-size: 28px; }
.o-prose h3 { font-size: 23px; }
.o-prose h4, .o-prose h5, .o-prose h6 { margin: 24px 0 8px; font-size: 17px; color: var(--o-heading); }
.o-prose p { margin: 0 0 16px; }
.o-prose ul, .o-prose ol { margin: 0 0 16px; padding-left: 1.5em; }
.o-prose li { margin: 4px 0; }
.o-prose li::marker { color: var(--o-accent); }
.o-prose blockquote {
	margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--o-accent);
	border-radius: 0 var(--o-radius-sm) var(--o-radius-sm) 0; background: var(--o-surface-2);
}
.o-prose blockquote > :last-child { margin-bottom: 0; }
.o-prose code { padding: 1px 5px; border-radius: 4px; background: var(--o-surface-2); }
.o-prose pre code { padding: 0; background: none; }
.o-prose img { display: block; max-width: 100%; height: auto; margin: 8px 0 16px; border-radius: var(--o-radius-sm); }
.o-prose table { display: block; width: max-content; max-width: 100%; overflow-x: auto; margin: 0 0 16px; border: 0; border-collapse: collapse; font-size: 15px; background: none; }
.o-prose th, .o-prose td { padding: 8px 12px; border: 1px solid var(--o-border); text-align: left; vertical-align: top; }
.o-prose th { background: var(--o-table-head); color: var(--o-heading); }
.o-prose hr { margin: 28px 0; }

/* Editor */
.o-editor { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.o-editor__form .o-card__title, .o-editor__list .o-card__title { font-size: 24px; }
.o-editor__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.o-editor__delete { margin: 0 0 0 auto; }
.oriel-form textarea,
.oriel-form input[type="datetime-local"],
.oriel-form input[type="number"] {
	display: block; box-sizing: border-box; width: 100%; max-width: 100%; margin: 0;
	border: 1px solid var(--o-input-border); border-radius: 8px; background: var(--o-input-bg); color: var(--o-text);
	font-family: var(--o-font-body); font-size: 16px;
}
.oriel-form input[type="datetime-local"], .oriel-form input[type="number"] { height: 48px; min-height: 48px; padding: 0 14px; }
.oriel-form textarea { min-height: 72px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.oriel-form #o-post-body { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }
.oriel-form textarea:focus-visible, .oriel-form input[type="datetime-local"]:focus-visible, .oriel-form input[type="number"]:focus-visible {
	outline: 2px solid var(--o-focus); outline-offset: 2px; border-color: var(--o-focus); box-shadow: none;
}
.oriel-form .form-row > .o-help { margin: -8px 0 18px; }
.oriel-form .o-choice input[type="checkbox"] { margin-right: 10px; }
.o-markdown-help { margin-top: 10px; font-size: 15px; }
.o-markdown-help summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--o-link); cursor: pointer; font-weight: 500; }
.o-markdown-help pre { margin: 6px 0 0; white-space: pre; }
.o-content .o-editor-posts { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; max-height: 70vh; overflow-y: auto; }
.o-editor-posts a {
	display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--o-radius-sm);
	color: var(--o-text); text-decoration: none; border: 1px solid transparent;
}
.o-editor-posts a:hover { background: var(--o-surface-2); }
.o-editor-posts a[aria-current="true"] { border-color: var(--o-accent); background: var(--o-surface-2); }
.o-editor-posts__meta { font-size: 13px; color: var(--o-text-2); }
.o-editor-posts__title { font-weight: 600; color: var(--o-heading); }

/* ---------- Downloads ---------- */
.o-content .o-download-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin: 0 0 28px; padding: 0; list-style: none; }
.o-download-card { display: flex; flex-direction: column; align-items: flex-start; }
.o-download-card .o-tag { margin-bottom: 10px; }
.o-download-card__title { margin: 0 0 8px !important; font-family: var(--o-font-display); font-size: 28px !important; color: var(--o-heading); }
.o-download-card__text { color: var(--o-text-2); margin: 0 0 14px !important; }
.o-download-card__meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 18px; font-size: 14px; }
.o-download-card__meta div { display: flex; gap: 6px; }
.o-download-card__meta dt { color: var(--o-text-2); }
.o-download-card__meta dd { margin: 0; font-weight: 600; color: var(--o-heading); }
.o-download-card__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.o-download-card__soon { margin: 0 !important; padding: 10px 14px; border: 1px dashed var(--o-border); border-radius: var(--o-radius-sm); color: var(--o-text-2); font-size: 15px; }
.o-download-steps { margin: 0 0 28px; max-width: 760px; }
.o-content .o-steps { margin: 0; padding: 0; list-style: none; counter-reset: o-step; display: grid; gap: 12px; }
.o-steps li { counter-increment: o-step; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; }
.o-steps li::before {
	content: counter(o-step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
	background: var(--o-action); color: var(--o-on-action); font-weight: 700; font-size: 15px;
}

/* ---------- Guild ranking ---------- */
.o-stats--compact { grid-template-columns: repeat(auto-fit, minmax(200px, 260px)); }
.o-stat__of { font-family: var(--o-font-body); font-size: 18px; color: var(--o-text-2); font-weight: 500; }
.o-rank {
	display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 999px;
	border: 1px solid var(--o-border); background: var(--o-surface-2); color: var(--o-heading); font-weight: 700; font-variant-numeric: tabular-nums;
}
.o-rank--1 { background: var(--o-action); border-color: var(--o-action); color: var(--o-on-action); }
.o-guild { display: inline-flex; align-items: center; gap: 10px; }
.o-emblem { flex: none; width: 24px; height: 24px; image-rendering: pixelated; border-radius: 3px; }
.o-emblem--empty { display: inline-block; border: 1px dashed var(--o-border); }
.o-rank-table__castles { min-width: 220px; color: var(--o-text-2); }
.o-rank-table td, .o-castle-table td { vertical-align: middle; }
.o-table-scroll--narrow { max-width: 760px; }

/* ---------- Item and monster databases ---------- */
.o-catalog-search {
	display: grid; grid-template-columns: minmax(220px, 2fr) minmax(170px, 1fr) auto; gap: 0 16px; align-items: end;
	margin: 0 0 20px; padding: 20px 20px 2px; border: 1px solid var(--o-border); border-radius: var(--o-radius); background: var(--o-surface);
}
.o-catalog-search--mobs { grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(120px, 1fr)) auto; }
.o-catalog-search__buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.o-catalog-table td { vertical-align: middle; }
.o-catalog-id { color: var(--o-text-2); }
.o-catalog-name { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; font-weight: 600; text-decoration: none; }
a.o-catalog-name:hover span:last-child { text-decoration: underline; }
.o-slots { color: var(--o-text-2); font-weight: 500; }
.o-price span { display: block; font-size: 14px; }
.o-price span + span { color: var(--o-text-2); }
.o-catalog-table tr.is-card td { background: color-mix(in srgb, var(--o-accent) 9%, var(--o-surface)); }

.o-visual { position: relative; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; }
.o-visual img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; image-rendering: auto; }
.o-visual--icon img { image-rendering: pixelated; }
.o-visual--mob { width: 44px; height: 44px; }
.o-visual--head { width: 56px; height: 56px; padding: 8px; border: 1px solid var(--o-border); border-radius: var(--o-radius-sm); background: var(--o-surface); }
.o-visual--art { width: 100%; max-width: 220px; height: auto; min-height: 120px; padding: 12px; }
.o-visual--art img { max-height: 260px; }
.o-visual__none { display: block; width: 70%; height: 70%; border: 1px dashed var(--o-border); border-radius: 4px; }
.o-visual--art .o-visual__none { width: 96px; height: 96px; }

.o-catalog-head { display: flex; align-items: center; gap: 16px; margin: 0 0 20px; }
.o-catalog-head h2 { margin: 0 0 4px; }
.o-catalog-head .o-kicker { margin: 0 0 4px; }
.o-catalog-head__sub { margin: 0 !important; color: var(--o-text-2); }
.o-catalog-overview { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 20px; margin: 0 0 28px; align-items: start; }
.o-catalog-overview--mob { grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); }
.o-catalog-overview .o-card { padding: 22px 24px; }
.o-catalog-overview .o-card__title { font-size: 24px; margin-bottom: 14px; }
.o-catalog-about__body { display: flex; gap: 20px; align-items: flex-start; }
.o-catalog-about__body .o-visual--art { flex: 0 0 auto; width: 160px; }
.o-item-desc { min-width: 0; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
/* Client colour codes (^RRGGBB) keep their hue but get a lightness that reads on this
   theme: at most oklch 0.5 in Light; at least 0.84, with a little less chroma, in Dark. Older browsers: mixed with the text colour. */
.o-item-desc .c { color: color-mix(in srgb, var(--c) 40%, var(--o-text)); }
@supports (color: oklch(from red l c h)) {
	.oriel-ui[data-mode="light"] .o-item-desc .c { color: oklch(from var(--c) min(l, 0.5) c h); }
	.oriel-ui[data-mode="dark"] .o-item-desc .c { color: oklch(from var(--c) max(l, 0.84) min(c, 0.13) h); }
}
.o-fact-list { display: grid; margin: 0; }
.o-fact-list div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--o-border); }
.o-fact-list div:last-child { border-bottom: 0; }
.o-fact-list dt { color: var(--o-text-2); }
.o-fact-list dd { margin: 0; text-align: right; font-weight: 600; color: var(--o-heading); font-variant-numeric: tabular-nums; }
.o-fact-list--two { grid-template-columns: 1fr 1fr; column-gap: 28px; }
.o-fact-list--two div:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.o-attr-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.o-attr-row div { padding: 8px 4px; border: 1px solid var(--o-border); border-radius: var(--o-radius-sm); text-align: center; background: var(--o-surface-2); }
.o-attr-row dt { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--o-text-2); }
.o-attr-row dd { margin: 0; font-weight: 700; color: var(--o-heading); font-variant-numeric: tabular-nums; }
.o-content .o-mode-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.o-mode-list li { padding: 3px 10px; border: 1px solid var(--o-border); border-radius: 999px; font-size: 14px; }
.o-mob-art { display: grid; justify-items: center; gap: 14px; }
.o-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; }
.o-chips div { display: grid; padding: 6px 12px; border: 1px solid var(--o-border); border-radius: var(--o-radius-sm); text-align: center; background: var(--o-surface-2); }
.o-chips dt { font-size: 12px; color: var(--o-text-2); }
.o-chips dd { margin: 0; font-weight: 600; color: var(--o-heading); }
.o-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.o-jump a {
	display: inline-flex; align-items: center; min-height: 40px; padding: 4px 14px; border: 1px solid var(--o-border); border-radius: 999px;
	background: var(--o-surface); color: var(--o-link); font-weight: 500; text-decoration: none;
}
.o-jump a:hover { border-color: var(--o-link); }
.o-catalog-section { scroll-margin-top: 90px; margin: 0 0 12px; }
.o-catalog-section > .o-help { margin: 0 0 18px; }
.o-map-cell { display: inline-flex; align-items: center; gap: 12px; }
.o-map-cell img { border-radius: 4px; border: 1px solid var(--o-border); }

/* ---------- Narrow screens ---------- */
@media (max-width: 1240px) {
	.o-catalog-search--mobs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.o-catalog-search--mobs .o-catalog-search__q, .o-catalog-search--mobs .o-catalog-search__buttons { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
	.o-editor, .o-catalog-overview, .o-catalog-overview--mob { grid-template-columns: minmax(0, 1fr); }
	.o-content .o-editor-posts { max-height: none; }
	.o-catalog-search, .o-catalog-search--mobs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.o-catalog-search .o-catalog-search__q, .o-catalog-search .o-catalog-search__buttons { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
	.o-catalog-search, .o-catalog-search--mobs { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 0; }
	.o-catalog-about__body { flex-direction: column; align-items: center; }
	.o-fact-list--two { grid-template-columns: minmax(0, 1fr); }
	.o-fact-list--two div:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--o-border); }
	.o-attr-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.o-post-card { padding: 18px; }
	.o-post-card__title { font-size: 23px !important; }
	.o-content .o-download-grid { grid-template-columns: minmax(0, 1fr); }
	.o-editor__delete { margin-left: 0; }
	.o-catalog-head { align-items: flex-start; }
}
