/* Finance Hamster — screener styles. Warm amber/brown brand, friendly + visual.
   Everything is scoped under .fh-screener so it never collides with the theme. */

.fh-screener {
	--bg: #faf7f2;
	--card: #ffffff;
	--ink: #2b2118;
	--muted: #6f6357;
	--accent: #f59e0b;
	--accent-d: #b9770a;
	--soft: #fff5e1;
	--bd: #ece4d8;
	--pos: #15803d;
	--neg: #b91c1c;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ink);
	max-width: 1080px;
	margin: 0 auto;
	padding: 8px;
	line-height: 1.5;
}
.fh-screener * { box-sizing: border-box; }

.fh-head { text-align: center; padding: 18px 0 6px; }
.fh-brand { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.fh-tag {
	display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
	letter-spacing: 0.08em; background: var(--soft); color: var(--accent-d);
	border: 1px solid #f6d9a3; border-radius: 999px; padding: 3px 10px;
	vertical-align: middle; margin-left: 6px;
}
.fh-sub { color: var(--muted); margin: 0.35rem 0 0; }

.fh-filters {
	display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
	background: var(--card); border: 1px solid var(--bd); border-radius: 16px;
	padding: 12px; box-shadow: 0 1px 3px rgba(43, 33, 24, 0.04); margin: 14px 0;
}
.fh-search { flex: 1 1 220px; min-width: 170px; padding: 10px 12px; border: 1px solid var(--bd); border-radius: 10px; font-size: 0.95rem; }
.fh-sel, .fh-maxter input { padding: 9px 10px; border: 1px solid var(--bd); border-radius: 10px; font-size: 0.9rem; background: #fff; color: var(--ink); }
.fh-maxter { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; }
.fh-maxter input { width: 76px; }
.fh-go { background: var(--accent); color: #3b2a12; border: none; border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; transition: background 0.12s, color 0.12s; }
.fh-go:hover { background: var(--accent-d); color: #fff; }

.fh-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 0.85rem; margin: 2px 2px 12px; }
.fh-asof { font-style: italic; }

.fh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

.fh-card {
	background: var(--card); border: 1px solid var(--bd); border-radius: 16px; padding: 16px;
	box-shadow: 0 1px 3px rgba(43, 33, 24, 0.05);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
	display: flex; flex-direction: column; gap: 12px;
	text-decoration: none; color: inherit;
}
.fh-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(43, 33, 24, 0.10); }
.fh-name { font-size: 1rem; font-weight: 700; margin: 0; line-height: 1.25; }
.fh-issuer { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

.fh-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.fh-badge { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; border-radius: 999px; padding: 3px 9px; }
.fh-b-asset { background: #eef4ff; color: #1d4ed8; }
.fh-b-dist { background: #effaf1; color: #15803d; }
.fh-b-dom { background: #f7f1fb; color: #7e22ce; }

.fh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--bd); padding-top: 12px; margin-top: auto; }
.fh-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fh-k { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.fh-v { font-size: 1.05rem; font-weight: 800; }
.fh-v.fh-ter { color: var(--accent-d); }
.fh-pos { color: var(--pos); }
.fh-neg { color: var(--neg); }
.fh-flat { color: var(--muted); }
.fh-h { font-size: 0.62rem; color: var(--muted); }

.fh-isin { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.02em; }
.fh-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 32px; }

.fh-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 18px 0; }
.fh-pg { color: var(--accent-d); font-weight: 700; text-decoration: none; border: 1px solid var(--bd); border-radius: 10px; padding: 8px 14px; }
.fh-pg:hover { background: var(--soft); }
.fh-pg-info { color: var(--muted); font-size: 0.85rem; }

.fh-disclaimer { margin-top: 18px; padding: 12px 14px; background: #fbf7ef; border: 1px dashed var(--bd); border-radius: 12px; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }

@media (max-width: 480px) {
	.fh-filters { padding: 10px; }
	.fh-search { flex-basis: 100%; }
}

/* Whole-card link affordance */
.fh-isin { display: flex; justify-content: space-between; align-items: center; }
.fh-view { color: var(--accent-d); font-weight: 700; opacity: 0; transition: opacity 0.12s; }
.fh-card:hover .fh-view { opacity: 1; }

/* ---------- Profile view ---------- */
.fh-back { display: inline-block; margin: 6px 0 4px; color: var(--accent-d); font-weight: 700; text-decoration: none; }
.fh-back:hover { text-decoration: underline; }
.fh-phead { padding: 6px 0 12px; border-bottom: 1px solid var(--bd); margin-bottom: 16px; }
.fh-ptitle { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; line-height: 1.2; }
.fh-pissuer { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.fh-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.fh-fact { background: var(--card); border: 1px solid var(--bd); border-radius: 12px; padding: 12px 14px; }
.fh-fact-k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }
.fh-fact-v { font-size: 1.15rem; font-weight: 800; }
.fh-section { background: var(--card); border: 1px solid var(--bd); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.fh-section h2 { font-size: 1rem; font-weight: 800; margin: 0 0 12px; }
.fh-na { color: var(--muted); font-size: 0.85rem; margin: 0; }
.fh-perf { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.fh-perf-big { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.fh-perf-meta { color: var(--muted); font-size: 0.85rem; }
.fh-perf-note { margin-top: 4px; }
.fh-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.fh-table th { text-align: left; color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--bd); padding: 6px 8px; }
.fh-table td { padding: 8px; border-bottom: 1px solid #f4eee4; }
.fh-primary { color: var(--accent-d); font-weight: 700; font-size: 0.8rem; }
.fh-asof-sm { color: var(--muted); font-size: 0.78rem; margin-bottom: 10px; }
.fh-holdings { display: flex; flex-direction: column; gap: 8px; }
.fh-hold { display: grid; grid-template-columns: 1fr 120px 52px; align-items: center; gap: 10px; }
.fh-hold-name { font-size: 0.9rem; }
.fh-bar { background: #f1e9da; border-radius: 999px; height: 8px; overflow: hidden; }
.fh-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.fh-hold-w { text-align: right; font-weight: 700; font-size: 0.85rem; }
.fh-help { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: var(--soft); color: var(--accent-d); font-size: 0.66rem; font-weight: 800; cursor: help; border: 1px solid #f6d9a3; }
.fh-b-rep { background: #fff5e1; color: #b9770a; }
.fh-b-esg { background: #ecfdf5; color: #047857; }
@media (max-width: 520px) { .fh-hold { grid-template-columns: 1fr 80px 46px; } }

/* ---------- Glossary reference page ---------- */
.fh-glossary .fh-sub { text-align: center; }
.fh-gl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.fh-gl-card { background: var(--card); border: 1px solid var(--bd); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(43,33,24,.04); }
.fh-gl-term { margin: 0 0 6px; font-size: 0.95rem; font-weight: 800; color: var(--accent-d); }
.fh-gl-def { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--ink); }

/* ---------- AI search ---------- */
.fh-ask { display: flex; gap: 8px; margin: 12px 0; }
.fh-ask-input { flex: 1; min-width: 0; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px; font-size: 0.98rem; color: var(--ink); }
.fh-ask-input:focus { outline: none; box-shadow: 0 0 0 3px var(--soft); }
.fh-ask-go { background: var(--accent); color: #3b2a12; border: none; border-radius: 12px; padding: 0 18px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.fh-ask-go:hover { background: var(--accent-d); color: #fff; }
.fh-ask-q { color: var(--muted); font-size: 0.85rem; margin: 0 2px 12px; }
.fh-ask-q a { color: var(--accent-d); }
.fh-ai-explain { background: var(--soft); border: 1px solid #f6d9a3; border-radius: 12px; padding: 12px 14px; color: #4a3a1c; font-size: 0.92rem; line-height: 1.5; margin-bottom: 14px; }
.fh-ai-badge { display: inline-block; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.05em; background: var(--accent); color: #3b2a12; border-radius: 5px; padding: 1px 6px; margin-right: 6px; vertical-align: middle; }
.fh-ai-disc { display: block; margin-top: 8px; font-size: 0.74rem; font-style: italic; color: var(--muted); }
@media (max-width: 480px) { .fh-ask { flex-wrap: wrap; } .fh-ask-input { flex-basis: 100%; } }

/* ---------- Select & compare ---------- */
.fh-card-wrap { position: relative; display: flex; }
.fh-card-wrap .fh-card { flex: 1; }
.fh-pick { position: absolute; top: 10px; right: 10px; z-index: 2; cursor: pointer; line-height: 0; }
.fh-pick input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.fh-pick-box { display: inline-block; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--bd); background: #fff; transition: all 0.12s; }
.fh-pick input:hover + .fh-pick-box { border-color: var(--accent); }
.fh-pick input:checked + .fh-pick-box { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
.fh-pick input:focus-visible + .fh-pick-box { outline: 2px solid var(--accent-d); outline-offset: 2px; }
.fh-pick input:disabled + .fh-pick-box { opacity: 0.35; cursor: not-allowed; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

.fh-cmp-bar { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; flex-wrap: wrap; }
.fh-cmp-submit:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bd); color: var(--muted); }
.fh-cmp-hint { color: var(--muted); font-size: 0.85rem; }

/* ---------- Compare view ---------- */
.fh-note { background: var(--soft); border: 1px solid #f6d9a3; border-radius: 12px; padding: 12px 14px; color: #6b4e1f; font-size: 0.86rem; line-height: 1.45; margin-bottom: 16px; }
.fh-cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--bd); border-radius: 16px; background: var(--card); }
.fh-cmp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
.fh-cmp-table th, .fh-cmp-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid #f4eee4; vertical-align: top; }
.fh-cmp-table thead th { background: #fbf7ef; font-weight: 800; font-size: 0.92rem; position: sticky; top: 0; }
.fh-cmp-table thead th a { color: var(--ink); text-decoration: none; }
.fh-cmp-table thead th a:hover { color: var(--accent-d); text-decoration: underline; }
.fh-cmp-corner { background: #fbf7ef; }
.fh-cmp-sub { color: var(--muted); font-weight: 400; font-size: 0.74rem; margin-top: 2px; }
.fh-cmp-rowh { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; background: #fffdf9; }
.fh-cmp-tag { display: inline-block; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #f3ede2; border-radius: 999px; padding: 1px 7px; vertical-align: middle; }
.fh-tag-low { color: #15803d; background: #effaf1; }

/* ---------- Accessible tooltip (hover + keyboard focus + tap) ---------- */
.fh-help { position: relative; }
.fh-help[tabindex]:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; }
.fh-help::after {
	content: attr(data-tip);
	position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%);
	width: max-content; max-width: 240px; text-align: left;
	background: #2b2118; color: #fff; font-size: 0.78rem; font-weight: 500; line-height: 1.4;
	text-transform: none; letter-spacing: 0; padding: 9px 11px; border-radius: 9px;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
	opacity: 0; visibility: hidden; transition: opacity 0.12s ease; z-index: 60; pointer-events: none;
}
.fh-help::before {
	content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%);
	border: 6px solid transparent; border-top-color: #2b2118;
	opacity: 0; visibility: hidden; transition: opacity 0.12s ease; z-index: 60; pointer-events: none;
}
.fh-help:hover::after, .fh-help:focus::after, .fh-help:focus-within::after,
.fh-help:hover::before, .fh-help:focus::before, .fh-help:focus-within::before { opacity: 1; visibility: visible; }

/* ---------- Onboarding strip ---------- */
.fh-onboard { background: var(--card); border: 1px solid var(--bd); border-radius: 14px; padding: 2px 14px; margin: 12px 0; }
.fh-onboard > summary { cursor: pointer; font-weight: 700; color: var(--accent-d); padding: 10px 0; list-style: none; }
.fh-onboard > summary::-webkit-details-marker { display: none; }
.fh-onboard > summary:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; border-radius: 6px; }
.fh-onboard-spark { margin-right: 4px; }
.fh-onboard-body { padding: 0 0 12px; }
.fh-onboard-steps { margin: 0 0 8px; padding-left: 1.2em; color: var(--ink); }
.fh-onboard-steps li { margin: 5px 0; font-size: 0.9rem; line-height: 1.45; }
.fh-onboard-link a { color: var(--accent-d); font-weight: 700; text-decoration: none; }
.fh-onboard-link a:hover { text-decoration: underline; }

/* ---------- Friendly empty state ---------- */
.fh-empty-rich { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fh-empty-title { font-size: 1.05rem; font-weight: 800; color: var(--ink); margin: 0; }
.fh-empty-sub { color: var(--muted); font-size: 0.88rem; margin: 0; }
.fh-empty-actions { margin: 4px 0; }
.fh-go-sm { display: inline-block; text-decoration: none; padding: 8px 14px; font-size: 0.9rem; }
.fh-empty-eg { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.fh-empty-eg a { color: var(--accent-d); font-weight: 600; text-decoration: none; }
.fh-empty-eg a:hover { text-decoration: underline; }

/* ---------- Profile: plain-English summary + inline fee calculator ---------- */
.fh-summary-text { margin: 0; font-size: 0.96rem; line-height: 1.6; color: var(--ink); }
.fh-feecalc-lead { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Compact/embedded screener ---------- */
.fh-screener.is-embed { padding: 0; max-width: none; }
.fh-screener.is-embed .fh-filters { margin-top: 0; }

/* ---------- Focus-visible rings for keyboard users (WCAG 2.4.7) ---------- */
.fh-screener a:focus-visible,
.fh-go:focus-visible, .fh-pg:focus-visible, .fh-ask-go:focus-visible,
.fh-search:focus-visible, .fh-sel:focus-visible, .fh-ask-input:focus-visible,
.fh-maxter input:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; }
.fh-go:active, .fh-ask-go:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
	.fh-card, .fh-go, .fh-ask-go, .fh-help::after, .fh-help::before, .fh-view { transition: none !important; }
	.fh-card:hover { transform: none; }
}

/* ---------- Legal / trust pages ---------- */
.fh-legal-doc { max-width: 760px; margin: 0 auto; }
.fh-legal-h1 { font-size: 1.7rem; font-weight: 800; margin: 8px 0 14px; }
.fh-legal-h2 { font-size: 1.05rem; font-weight: 800; margin: 20px 0 6px; }
.fh-legal-p { font-size: 0.95rem; line-height: 1.6; color: var(--ink); margin: 0 0 10px; }
.fh-legal-updated { margin-top: 22px; color: var(--muted); font-size: 0.82rem; }
.fh-legal-draft { margin-bottom: 18px; }
.fh-legal-todo { background: #fde68a; color: #7a4f01; font-weight: 700; padding: 1px 6px; border-radius: 5px; }

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
	.fh-screener {
		--bg: #181410; --card: #221c16; --ink: #f2ebe0; --muted: #b7ab9a;
		--accent: #f59e0b; --accent-d: #fbbf24; --soft: #2c2114; --bd: #3a3026;
		--pos: #4ade80; --neg: #f87171;
	}
	.fh-screener .fh-go { color: #2b2118; }
	.fh-screener .fh-disclaimer { background: #221c16; }
	.fh-screener .fh-table td { border-bottom-color: #322a20; }
	.fh-screener .fh-cmp-table th, .fh-screener .fh-cmp-table td { border-bottom-color: #322a20; }
	.fh-screener .fh-cmp-table thead th, .fh-screener .fh-cmp-corner { background: #2a221a; }
	.fh-screener .fh-cmp-rowh { background: #241d15; }
	.fh-screener .fh-cmp-tag { background: #322a20; }
	.fh-screener .fh-bar { background: #322a20; }
	.fh-screener .fh-primary, .fh-screener .fh-view { color: var(--accent-d); }
}
