/* ==========================================================================
   EmojiVista — main stylesheet
   Design: quiet warm neutrals + one sunny "emoji yellow" accent, rounded
   corners, soft shadows, generous spacing. System font stack (zero webfont
   requests = faster first paint). Dark mode via [data-theme="dark"] with
   prefers-color-scheme respected before JS runs.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
	--bg:            #FBFAF7;
	--surface:       #FFFFFF;
	--surface-2:     #F3F1EC;
	--ink:           #23211C;
	--ink-soft:      #6C675C;
	--line:          #E7E3DA;
	--accent:        #FFC935;  /* emoji-smiley yellow */
	--accent-ink:    #3A2E00;  /* text ON accent */
	--accent-deep:   #B8860B;  /* links/accents on light bg (AA on --bg) */
	--fav:           #E0245E;
	--radius:        14px;
	--radius-sm:     9px;
	--shadow:        0 1px 2px rgba(35,33,28,.05), 0 6px 20px -8px rgba(35,33,28,.12);
	--shadow-hover:  0 4px 8px rgba(35,33,28,.06), 0 14px 32px -10px rgba(35,33,28,.18);
	--container:     1160px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
	--bg:          #161512;
	--surface:     #201E1A;
	--surface-2:   #2A2822;
	--ink:         #F0EDE6;
	--ink-soft:    #A7A196;
	--line:        #35322B;
	--accent:      #FFC935;
	--accent-ink:  #3A2E00;
	--accent-deep: #FFD35E;
	--shadow:      0 1px 2px rgba(0,0,0,.4), 0 6px 20px -8px rgba(0,0,0,.5);
	--shadow-hover:0 4px 8px rgba(0,0,0,.45), 0 14px 32px -10px rgba(0,0,0,.6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--bg);
	transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .15em .45em; border-radius: 6px; }
button { font-family: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.container--narrow { max-width: 780px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
	html { scroll-behavior: auto; }
}

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--surface) 88%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark { font-size: 1.5rem; }
.custom-logo { width: 36px; height: 36px; border-radius: 8px; }

.header-search { position: relative; flex: 1; max-width: 420px; }
.header-search__input, .hero-search__input {
	width: 100%; border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface-2); color: var(--ink);
	padding: 9px 18px; font-size: .95rem;
	transition: border-color .15s, box-shadow .15s;
}
.header-search__input:focus, .hero-search__input:focus {
	outline: none; border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}
.header-search__results {
	position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	box-shadow: var(--shadow-hover); max-height: 380px; overflow-y: auto; padding: 6px;
}
.search-result { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); }
.search-result:hover, .search-result.is-active { background: var(--surface-2); text-decoration: none; }
.search-result__emoji { font-size: 1.4rem; }
.search-result__name { font-weight: 600; font-size: .92rem; }
.search-result__cat { font-size: .78rem; color: var(--ink-soft); margin-left: auto; }
.search-result--all { justify-content: center; font-weight: 600; color: var(--accent-deep); }

/* Nav */
.primary-nav__list { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.primary-nav a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; font-size: .92rem; }
.primary-nav a:hover { background: var(--surface-2); text-decoration: none; }
.has-dropdown { position: relative; }
.dropdown {
	position: absolute; top: 100%; left: 0; min-width: 220px; z-index: 60;
	list-style: none; margin: 0; padding: 6px;
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); box-shadow: var(--shadow-hover);
	opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity .15s, transform .15s, visibility .15s;
}
.has-dropdown:hover .dropdown, .has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.theme-toggle { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 6px 10px; line-height: 1; }
[data-theme="dark"] .theme-toggle__sun { display: none; }
html:not([data-theme="dark"]) .theme-toggle__moon { display: none; }

.nav-toggle { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 9px; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--ink); margin: 3px 0; border-radius: 2px; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 36px; text-align: center; }
.hero__title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 900; margin: 0 0 10px; }
.hero__subtitle { color: var(--ink-soft); font-size: 1.1rem; max-width: 560px; margin: 0 auto 26px; }
.hero-search { position: relative; max-width: 560px; margin: 0 auto; }
.hero-search__input { padding: 15px 24px; font-size: 1.05rem; box-shadow: var(--shadow); }
.hero__hint { color: var(--ink-soft); font-size: .88rem; margin-top: 14px; }

/* ---------- Section titles & strips ---------- */
.section-title { font-size: 1.35rem; font-weight: 800; margin: 40px 0 16px; }
.strip .section-title { margin-top: 24px; }
.emoji-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-chip {
	font-size: 1.6rem; line-height: 1; padding: 10px 12px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
	transition: transform .12s ease, box-shadow .12s ease;
}
.emoji-chip:hover { transform: translateY(-2px) scale(1.06); box-shadow: var(--shadow); }

/* ---------- Category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.cat-card {
	display: flex; align-items: center; gap: 14px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 18px; box-shadow: var(--shadow); color: var(--ink);
	transition: transform .15s ease, box-shadow .15s ease;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); text-decoration: none; }
.cat-card__icon { font-size: 2rem; }
.cat-card__name { display: block; font-weight: 700; }
.cat-card__count { display: block; font-size: .85rem; color: var(--ink-soft); }
.cat-card__cta { margin-left: auto; font-weight: 700; font-size: .85rem; color: var(--accent-deep); white-space: nowrap; }

/* ---------- Emoji grid & cards ---------- */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.emoji-grid--compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.emoji-card {
	display: flex; flex-direction: column; align-items: center; text-align: center;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px 12px 14px; box-shadow: var(--shadow);
	transition: transform .15s ease, box-shadow .15s ease;
	content-visibility: auto; contain-intrinsic-size: 170px; /* built-in lazy rendering */
}
.emoji-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.emoji-card__glyph { font-size: 2.4rem; line-height: 1.15; text-decoration: none; transition: transform .15s ease; }
.emoji-card:hover .emoji-card__glyph { transform: scale(1.15); }
.emoji-card__name { font-size: .83rem; font-weight: 600; margin: 8px 0 10px; min-height: 2.4em; display: flex; align-items: center; }
.emoji-card__name a { color: var(--ink); }
.emoji-card__actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; gap: 6px;
	border: none; border-radius: 999px; font-weight: 700; font-size: .85rem;
	padding: 7px 16px; transition: transform .1s ease, box-shadow .15s ease, background-color .15s;
	text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn--copy { background: var(--accent); color: var(--accent-ink); }
.btn--copy:hover { transform: translateY(-1px); box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn--ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--line); }
.btn--lg { padding: 12px 26px; font-size: 1rem; }
.btn.is-copied { background: #22a35b; color: #fff; }

.btn-fav {
	border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
	border-radius: 999px; width: 32px; height: 32px; line-height: 1; font-size: 1rem;
	transition: transform .1s ease, color .15s, border-color .15s;
}
.btn-fav:hover { transform: scale(1.12); }
.btn-fav.is-faved { color: var(--fav); border-color: var(--fav); }
.btn-fav--lg { width: 46px; height: 46px; font-size: 1.3rem; }

/* ---------- Breadcrumbs, page headers, pagination ---------- */
.breadcrumbs { margin: 22px 0 6px; font-size: .85rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; color: var(--ink-soft); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.page-header { margin: 18px 0 26px; }
.page-header--center { text-align: center; }
.page-title { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 900; margin: 0 0 8px; }
.page-desc { color: var(--ink-soft); max-width: 640px; margin: 0 0 6px; }
.page-header--center .page-desc { margin-inline: auto; }
.page-meta { font-size: .88rem; color: var(--ink-soft); }

.grid-filters { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: .9rem; }
.grid-filters select {
	border: 1px solid var(--line); background: var(--surface); color: var(--ink);
	border-radius: var(--radius-sm); padding: 7px 10px; font-family: inherit;
}

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 34px 0 10px; }
.page-btn {
	min-width: 38px; padding: 8px 12px; text-align: center;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
	color: var(--ink); font-weight: 600; font-size: .9rem;
}
.page-btn:hover { background: var(--surface-2); text-decoration: none; }
.page-btn.is-current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.page-gap { align-self: center; color: var(--ink-soft); }
.pagination .nav-links { display: flex; gap: 6px; }
.pagination .page-numbers { min-width: 38px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; }
.pagination .page-numbers.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Cards / generic ---------- */
.card {
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px;
}
.card h2 { margin-top: 0; font-size: 1.15rem; }
.empty-state { text-align: center; color: var(--ink-soft); padding: 48px 20px; }

/* ---------- Single emoji ---------- */
.emoji-single__layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.emoji-hero { text-align: center; padding: 34px 22px; }
.emoji-hero__glyph { font-size: 6rem; line-height: 1; cursor: pointer; transition: transform .15s ease; display: inline-block; }
.emoji-hero__glyph:hover { transform: scale(1.08); }
.emoji-hero__title { font-size: 1.6rem; margin: 14px 0 6px; }
.emoji-hero__cat { display: block; font-size: .85rem; font-weight: 600; margin-top: 4px; }
.emoji-hero__actions { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }

.code-table { margin: 0; }
.code-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.code-row:last-child { border-bottom: none; }
.code-row dt { font-weight: 700; font-size: .85rem; color: var(--ink-soft); }
.code-row dd { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-row code { word-break: break-all; }

.faq { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq:last-child { border-bottom: none; }
.faq summary { font-weight: 700; padding: 10px 0; cursor: pointer; }
.faq p { margin: 0 0 12px; color: var(--ink-soft); }

.share-buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Blog ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.post-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.post-card__thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card__body { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.post-card__meta { font-size: .8rem; color: var(--ink-soft); margin: 0; }
.post-card__title { font-size: 1.1rem; margin: 0; }
.post-card__title a { color: var(--ink); }
.post-card__excerpt { color: var(--ink-soft); font-size: .92rem; }
.post-card__excerpt p { margin: 0; }
.post-card__more { font-weight: 700; font-size: .88rem; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; padding-top: 4px; }
.article__title { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 6px 0 8px; }
.article__meta { color: var(--ink-soft); font-size: .9rem; }
.article__thumb { margin: 18px 0; }
.article__thumb img { border-radius: var(--radius); }
.entry-content { font-size: 1.04rem; }
.entry-content img { border-radius: var(--radius); }
.entry-content h2 { margin-top: 1.8em; }
.tag, .article__tags a {
	display: inline-block; background: var(--surface-2); border: 1px solid var(--line);
	border-radius: 999px; padding: 3px 12px; font-size: .8rem; font-weight: 600; color: var(--ink);
}
.author-box { margin-top: 26px; }
.related-posts { margin-top: 30px; }

/* ---------- About / contact ---------- */
.about-grid { display: grid; gap: 18px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 6px 0 6px 28px; position: relative; }
.checklist li::before { content: "✅"; position: absolute; left: 0; }

.contact-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: start; }
.contact-form label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 5px; }
.contact-form input, .contact-form textarea {
	width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
	background: var(--surface-2); color: var(--ink); padding: 10px 13px; font-family: inherit; font-size: .95rem;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.hp-field { position: absolute !important; left: -9999px !important; }
.map-placeholder { text-align: center; color: var(--ink-soft); padding: 40px 20px; }
.map-placeholder span { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.notice-box { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; font-weight: 600; }
.notice-box--success { background: #e5f6ec; color: #14532d; border: 1px solid #a7e0bd; }
.notice-box--error { background: #fdecec; color: #7f1d1d; border: 1px solid #f3b8b8; }
[data-theme="dark"] .notice-box--success { background: #14321f; color: #a7e0bd; border-color: #1f5f38; }
[data-theme="dark"] .notice-box--error { background: #3a1717; color: #f3b8b8; border-color: #6e2424; }

/* ---------- 404 ---------- */
.error-404 { text-align: center; padding: 60px 0; }
.error-404__emoji { font-size: 5rem; margin: 0; }
.error-404 .hero-search { margin-bottom: 26px; }

/* ---------- Ads ---------- */
.ad-slot { display: flex; justify-content: center; margin: 22px auto; max-width: var(--container); padding-inline: 20px; overflow: hidden; }
.ad-slot--sidebar { margin: 0 0 18px; padding-inline: 0; }
.ad-slot--in-grid { grid-column: 1 / -1; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 60px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 28px; padding: 44px 20px 24px; }
.footer-col__title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 0 0 12px; }
.footer-col ul { list-style: none; margin: 0 0 18px; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--ink); font-size: .92rem; }
.footer-col--brand p { color: var(--ink-soft); font-size: .92rem; }
.social-links { display: flex; gap: 8px; margin-top: 10px; }
.social-links a {
	display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; border-radius: 50%;
	background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-weight: 700;
}
.footer-newsletter { display: flex; gap: 8px; }
.footer-newsletter input {
	flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface-2); color: var(--ink); padding: 8px 14px; font-size: .9rem;
}
.footer-newsletter__blurb { font-size: .88rem; color: var(--ink-soft); margin: 0 0 8px; }
.footer-bottom { border-top: 1px solid var(--line); padding-block: 16px; font-size: .85rem; color: var(--ink-soft); text-align: center; }

/* ---------- Toast ---------- */
.toast {
	position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
	background: var(--ink); color: var(--bg); font-weight: 700; font-size: .92rem;
	padding: 11px 22px; border-radius: 999px; box-shadow: var(--shadow-hover);
	opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 200;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
	.emoji-single__layout, .article-layout { grid-template-columns: 1fr; }
	.footer-grid { grid-template-columns: 1fr 1fr; }
	.contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
	.site-header__inner { flex-wrap: wrap; padding-block: 10px; gap: 10px; }
	.header-search { order: 3; flex-basis: 100%; max-width: none; }
	.nav-toggle { display: block; margin-left: auto; }
	.primary-nav { display: none; flex-basis: 100%; }
	.primary-nav.is-open { display: block; }
	.primary-nav__list { flex-direction: column; align-items: stretch; }
	.dropdown { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; padding-left: 16px; }
	.hero { padding: 36px 0 24px; }
	.emoji-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
	.emoji-card__glyph { font-size: 2rem; }
	.footer-grid { grid-template-columns: 1fr; }
	.code-row { grid-template-columns: 1fr; gap: 2px; }
	.emoji-hero__glyph { font-size: 4.4rem; }
}
