/*
 * SOGANET - Từ Điển SEO
 * Design tokens pulled from the live Flatsome customizer settings
 * (heading/nav color #1e73be/#154f99, hover accent #e57e42) so the
 * dictionary reads as part of the site, not a bolted-on template.
 * Typography intentionally inherits the theme's font-family instead of
 * hardcoding one, so it stays in sync if the customizer font ever changes.
 */

.sgd-dictionary-page,
.sgd-term-page {
	--sgd-primary: #1e73be;
	--sgd-primary-dark: #154f99;
	--sgd-accent: #e57e42;
	--sgd-text: #333;
	--sgd-text-muted: #6b7280;
	--sgd-border: #e5e7eb;
	--sgd-surface: #ffffff;
	--sgd-surface-alt: #f7f9fc;
	--sgd-radius: 10px;
	--sgd-shadow: 0 1px 3px rgba(20, 30, 60, 0.06);
	--sgd-shadow-hover: 0 6px 20px rgba(20, 30, 60, 0.10);
	color: var(--sgd-text);
}

/* ---------- Breadcrumb (visual only - schema stays with Rank Math) ---------- */

.sgd-breadcrumb {
	display: inline-block;
	margin-bottom: 16px;
	max-width: 100%;
}

.sgd-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 13.5px;
}

.sgd-breadcrumb li {
	display: flex;
	align-items: center;
	color: var(--sgd-text-muted);
	min-width: 0;
}

.sgd-breadcrumb li:not(:last-child)::after {
	content: "\203A";
	margin: 0 8px;
	color: var(--sgd-border);
	font-weight: 700;
}

.sgd-breadcrumb a {
	color: var(--sgd-text-muted);
	text-decoration: none;
}
.sgd-breadcrumb a:hover { color: var(--sgd-primary); text-decoration: underline; }

.sgd-breadcrumb li[aria-current="page"] span {
	color: var(--sgd-text);
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

@media (max-width: 600px) {
	.sgd-breadcrumb { display: block; }
	.sgd-breadcrumb li[aria-current="page"] span { max-width: 42vw; display: inline-block; }
	.sgd-breadcrumb li:not([aria-current="page"]):not(:first-child) span,
	.sgd-breadcrumb li:not([aria-current="page"]):not(:first-child) a {
		max-width: 22vw;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		display: inline-block;
		vertical-align: bottom;
	}
}

/* ---------- Hero / hub header ---------- */

.sgd-hero {
	background: linear-gradient(180deg, var(--sgd-surface-alt) 0%, var(--sgd-surface) 100%);
	border-bottom: 1px solid var(--sgd-border);
	padding: 56px 0 32px;
	text-align: center;
}

.sgd-hero__eyebrow {
	display: inline-block;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--sgd-primary);
	background: rgba(30, 115, 190, 0.08);
	padding: 5px 14px;
	border-radius: 999px;
	margin-bottom: 16px;
}

.sgd-hero h1 {
	font-size: clamp(28px, 4vw, 40px);
	line-height: 1.2;
	margin: 0 0 12px;
	color: #111827;
}

.sgd-hero__subtitle {
	font-size: 17px;
	color: var(--sgd-text-muted);
	max-width: 640px;
	margin: 0 auto 28px;
}

.sgd-search {
	position: relative;
	max-width: 640px;
	margin: 0 auto;
}

.sgd-search__icon {
	position: absolute;
	left: 18px;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 20px;
	color: var(--sgd-text-muted);
	pointer-events: none;
}

.sgd-search__input {
	width: 100%;
	font-size: 16px;
	padding: 16px 16px 16px 50px;
	border: 1.5px solid var(--sgd-border);
	border-radius: 12px;
	background: var(--sgd-surface);
	box-shadow: var(--sgd-shadow);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sgd-search__input:focus {
	outline: none;
	border-color: var(--sgd-primary);
	box-shadow: 0 0 0 4px rgba(30, 115, 190, 0.12);
}

.sgd-search__clear {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: 0;
	color: var(--sgd-text-muted);
	font-size: 20px;
	line-height: 1;
	padding: 8px;
	cursor: pointer;
	border-radius: 50%;
}
.sgd-search__clear:hover { background: var(--sgd-surface-alt); }
.sgd-search__clear[hidden] { display: none; }

/* ---------- A-Z bar ---------- */

.sgd-az {
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	overflow-x: auto;
	padding: 20px 0 4px;
	-ms-overflow-style: none;
	scrollbar-width: thin;
}

.sgd-az::-webkit-scrollbar { height: 5px; }
.sgd-az::-webkit-scrollbar-thumb { background: var(--sgd-border); border-radius: 5px; }

.sgd-az__btn {
	flex: 0 0 auto;
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--sgd-text);
	background: var(--sgd-surface);
	border: 1px solid var(--sgd-border);
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.15s ease;
}

.sgd-az__btn:hover { border-color: var(--sgd-primary); color: var(--sgd-primary); }

.sgd-az__btn.is-active {
	background: var(--sgd-primary);
	border-color: var(--sgd-primary);
	color: #fff;
}

/* ---------- Category chips ---------- */

.sgd-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 16px 0 8px;
}

.sgd-chip {
	display: inline-flex;
	align-items: center;
	font-size: 13.5px;
	font-weight: 500;
	padding: 8px 16px;
	border-radius: 999px;
	border: 1px solid var(--sgd-border);
	background: var(--sgd-surface);
	color: var(--sgd-text);
	cursor: pointer;
	text-decoration: none;
	transition: all 0.15s ease;
	white-space: nowrap;
}

.sgd-chip:hover { border-color: var(--sgd-primary); color: var(--sgd-primary); text-decoration: none; }

.sgd-chip.is-active {
	background: var(--sgd-primary-dark);
	border-color: var(--sgd-primary-dark);
	color: #fff;
}

/* ---------- Toolbar (count + sort) ---------- */

.sgd-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	padding: 18px 0;
	border-bottom: 1px solid var(--sgd-border);
	margin-bottom: 24px;
	font-size: 14px;
	color: var(--sgd-text-muted);
}

.sgd-toolbar__sort select {
	font-size: 14px;
	padding: 8px 12px;
	border: 1px solid var(--sgd-border);
	border-radius: 8px;
	background: var(--sgd-surface);
}

/* ---------- Grid + cards ---------- */

.sgd-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	padding-bottom: 40px;
}

@media (max-width: 989px) {
	.sgd-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
	.sgd-grid { grid-template-columns: 1fr; }
	.sgd-hero { padding: 36px 0 24px; }
}

.sgd-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 22px;
	background: var(--sgd-surface);
	border: 1px solid var(--sgd-border);
	border-radius: var(--sgd-radius);
	box-shadow: var(--sgd-shadow);
	text-decoration: none;
	color: inherit;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sgd-card:hover {
	box-shadow: var(--sgd-shadow-hover);
	border-color: rgba(30, 115, 190, 0.35);
	color: inherit;
	text-decoration: none;
	transform: translateY(-2px);
}

.sgd-card__head {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.sgd-card__title {
	font-size: 18px;
	font-weight: 700;
	color: #111827;
	margin: 0;
}

.sgd-card__abbr {
	font-size: 12px;
	font-weight: 600;
	color: var(--sgd-primary);
	background: rgba(30, 115, 190, 0.08);
	padding: 2px 8px;
	border-radius: 999px;
}

.sgd-card__category {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--sgd-accent);
}

.sgd-card__excerpt {
	font-size: 14.5px;
	line-height: 1.55;
	color: var(--sgd-text-muted);
	margin: 0;
	flex-grow: 1;
}

.sgd-card__cta {
	font-size: 14px;
	font-weight: 600;
	color: var(--sgd-primary);
}

/* ---------- Empty state ---------- */

.sgd-empty {
	text-align: center;
	padding: 60px 20px;
	color: var(--sgd-text-muted);
}
.sgd-empty[hidden] { display: none; }
.sgd-empty p { margin: 0 0 16px; font-size: 15px; }

.sgd-empty__reset {
	display: inline-flex;
	align-items: center;
	padding: 10px 20px;
	border-radius: 8px;
	background: var(--sgd-primary);
	color: #fff;
	font-weight: 600;
	font-size: 14px;
	border: 0;
	cursor: pointer;
	text-decoration: none;
}
.sgd-empty__reset:hover { background: var(--sgd-primary-dark); color: #fff; }

/* ---------- Pagination ---------- */

.sgd-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	padding: 8px 0 40px;
}
.sgd-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border-radius: 8px;
	border: 1px solid var(--sgd-border);
	color: var(--sgd-text);
	text-decoration: none;
	font-size: 14px;
}
.sgd-pagination .page-numbers.current {
	background: var(--sgd-primary);
	border-color: var(--sgd-primary);
	color: #fff;
}
.sgd-pagination .page-numbers:hover:not(.current) { border-color: var(--sgd-primary); color: var(--sgd-primary); }

.sgd-load-more-wrap { text-align: center; padding: 8px 0 40px; }
.sgd-load-more {
	padding: 12px 28px;
	border-radius: 8px;
	border: 1px solid var(--sgd-border);
	background: var(--sgd-surface);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
}
.sgd-load-more:hover { border-color: var(--sgd-primary); color: var(--sgd-primary); }
.sgd-load-more[hidden] { display: none; }

/* ---------- Single term page ---------- */

.sgd-term-layout {
	display: grid;
	grid-template-columns: 1fr 260px;
	gap: 40px;
	align-items: start;
}
@media (max-width: 900px) {
	.sgd-term-layout { grid-template-columns: 1fr; }
}

.sgd-term-header {
	margin-bottom: 24px;
}
.sgd-term-header__meta {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 10px;
}
.sgd-term-header__ipa {
	font-size: 15px;
	color: var(--sgd-text-muted);
	font-style: italic;
}
.sgd-term-header__category {
	font-size: 12.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #fff;
	background: var(--sgd-accent);
	padding: 4px 12px;
	border-radius: 999px;
}
.sgd-term-header h1 {
	font-size: clamp(26px, 3.4vw, 36px);
	margin: 0;
	color: #111827;
}

.sgd-quick-def {
	background: var(--sgd-surface-alt);
	border-left: 4px solid var(--sgd-primary);
	border-radius: 8px;
	padding: 20px 24px;
	margin: 0 0 32px;
}
.sgd-quick-def__label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--sgd-primary);
	margin-bottom: 8px;
}
.sgd-quick-def p {
	font-size: 17px;
	line-height: 1.6;
	margin: 0;
	color: #1f2937;
}

.sgd-term-main { min-width: 0; }

/* Reading width: cap long-form text at ~760px even though the grid cell
   itself is wider, so lines stay comfortable to read on desktop. */
.sgd-quick-def,
.sgd-content,
.sgd-related,
.sgd-prevnext,
.sgd-mini-search {
	max-width: 760px;
}

.sgd-content h2 {
	font-size: 24px;
	margin: 40px 0 16px;
	line-height: 1.3;
	scroll-margin-top: 100px;
}
.sgd-content h3 {
	font-size: 19px;
	margin: 28px 0 12px;
	line-height: 1.35;
	scroll-margin-top: 100px;
}
.sgd-content p { line-height: 1.75; font-size: 16px; margin: 0 0 18px; }
.sgd-content ul, .sgd-content ol { line-height: 1.75; font-size: 16px; margin: 0 0 18px; padding-left: 22px; }
.sgd-content li { margin-bottom: 6px; }

.sgd-content a { color: var(--sgd-primary); text-decoration: underline; text-underline-offset: 2px; }
.sgd-content a:hover { color: var(--sgd-primary-dark); }

.sgd-content blockquote {
	margin: 24px 0;
	padding: 4px 20px;
	border-left: 3px solid var(--sgd-primary);
	background: var(--sgd-surface-alt);
	border-radius: 0 8px 8px 0;
	color: var(--sgd-text-muted);
	font-style: italic;
}
.sgd-content blockquote p:last-child { margin-bottom: 0; }

.sgd-content code {
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 0.88em;
	background: var(--sgd-surface-alt);
	border: 1px solid var(--sgd-border);
	border-radius: 4px;
	padding: 2px 6px;
}

.sgd-content pre {
	background: #1e2530;
	color: #e5e9f0;
	border-radius: 8px;
	padding: 16px 18px;
	overflow-x: auto;
	margin: 0 0 20px;
	font-size: 13.5px;
	line-height: 1.6;
}
.sgd-content pre code {
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
	font-size: inherit;
}

.sgd-content table {
	display: block;
	overflow-x: auto;
	max-width: 100%;
	border-collapse: collapse;
	margin: 0 0 20px;
	font-size: 15px;
}
.sgd-content table th, .sgd-content table td {
	border: 1px solid var(--sgd-border);
	padding: 8px 12px;
	text-align: left;
}
.sgd-content table th { background: var(--sgd-surface-alt); font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
	.sgd-term-page { scroll-behavior: smooth; }
}

.sgd-toc {
	position: sticky;
	top: 24px;
	background: var(--sgd-surface);
	border: 1px solid var(--sgd-border);
	border-radius: var(--sgd-radius);
	padding: 20px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
}

/* Below the 2-column breakpoint the TOC drops into normal flow (after the
   article) - sticky positioning only makes sense next to a taller column. */
@media (max-width: 900px) {
	.sgd-toc {
		position: static;
		max-height: none;
		margin-top: 32px;
	}
}
.sgd-toc__title {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--sgd-text-muted);
	margin: 0 0 12px;
}
.sgd-toc ul { list-style: none; margin: 0; padding: 0; }
.sgd-toc li { margin: 0; }
.sgd-toc a {
	display: block;
	padding: 7px 0;
	font-size: 14px;
	color: var(--sgd-text);
	text-decoration: none;
	border-bottom: 1px solid var(--sgd-border);
}
.sgd-toc li:last-child a { border-bottom: 0; }
.sgd-toc a:hover { color: var(--sgd-primary); }
.sgd-toc li.sgd-toc__h3 a { padding-left: 14px; font-size: 13.5px; color: var(--sgd-text-muted); }

.sgd-related {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--sgd-border);
}
.sgd-related h2 { font-size: 20px; margin: 0 0 16px; }
.sgd-related__grid {
	/* .sgd-related is reading-width-capped at 760px regardless of viewport,
	   so 2 columns (~370px cards) is the sweet spot for a short title + a
	   one-line excerpt to stay readable - a 3rd column would squeeze the
	   excerpt too thin at that fixed width. */
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px;
}
@media (max-width: 560px) {
	.sgd-related__grid { grid-template-columns: 1fr; }
}

.sgd-related__card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px;
	border: 1px solid var(--sgd-border);
	border-radius: 8px;
	text-decoration: none;
	color: var(--sgd-text);
	transition: all 0.15s ease;
}
.sgd-related__card:hover {
	border-color: rgba(30, 115, 190, 0.35);
	box-shadow: var(--sgd-shadow);
	color: var(--sgd-text);
	text-decoration: none;
}
.sgd-related__card-title {
	font-weight: 700;
	font-size: 14.5px;
	color: #111827;
}
.sgd-related__card-excerpt {
	font-size: 13px;
	line-height: 1.5;
	color: var(--sgd-text-muted);
	flex-grow: 1;
}
.sgd-related__card-cta {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--sgd-primary);
}

.sgd-prevnext {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--sgd-border);
}
.sgd-prevnext__link {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: 46%;
	text-decoration: none;
	color: var(--sgd-text);
}
.sgd-prevnext__link:last-child { text-align: right; margin-left: auto; }
.sgd-prevnext__label { font-size: 12px; color: var(--sgd-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sgd-prevnext__title { font-weight: 700; color: var(--sgd-primary); }

.sgd-mini-search {
	margin-top: 40px;
	padding: 24px;
	background: var(--sgd-surface-alt);
	border-radius: var(--sgd-radius);
	text-align: center;
}
.sgd-mini-search p { margin: 0 0 14px; font-weight: 600; }
.sgd-mini-search form { max-width: 420px; margin: 0 auto; position: relative; }

/* ---------- Hub editorial section ---------- */

.sgd-editorial {
	background: var(--sgd-surface-alt);
	border-top: 1px solid var(--sgd-border);
	padding: 48px 0;
}
.sgd-editorial h2 {
	font-size: 22px;
	margin: 0 0 16px;
	color: #111827;
}
.sgd-editorial__content {
	max-width: 760px;
	font-size: 15.5px;
	line-height: 1.75;
	color: var(--sgd-text-muted);
}
.sgd-editorial__content p { margin: 0 0 14px; }
.sgd-editorial__content em { color: var(--sgd-text); font-style: normal; font-weight: 600; }

/* ---------- Search autocomplete ---------- */

.sgd-suggest {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 40;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--sgd-surface);
	border: 1px solid var(--sgd-border);
	border-radius: 12px;
	box-shadow: var(--sgd-shadow-hover);
	max-height: 360px;
	overflow-y: auto;
	text-align: left;
}
.sgd-suggest[hidden] { display: none; }

.sgd-suggest__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 8px;
	cursor: pointer;
	color: var(--sgd-text);
}
.sgd-suggest__item:hover,
.sgd-suggest__item.is-active {
	background: var(--sgd-surface-alt);
}

.sgd-suggest__main {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.sgd-suggest__title {
	font-size: 14.5px;
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.sgd-suggest__subtitle {
	font-size: 12.5px;
	color: var(--sgd-text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.sgd-suggest__category {
	flex: 0 0 auto;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--sgd-accent);
	white-space: nowrap;
}

/* ---------- Accessibility ---------- */

.sgd-dictionary-page a:focus-visible,
.sgd-term-page a:focus-visible,
.sgd-dictionary-page button:focus-visible,
.sgd-term-page button:focus-visible,
.sgd-dictionary-page input:focus-visible {
	outline: 2px solid var(--sgd-primary);
	outline-offset: 2px;
}

.sgd-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
