/*
Theme Name: Ringtone
Description: Fast, mobile-first theme for playing and downloading ringtones by category. Requires the Ringtone Core plugin.
Version: 1.0.0
Requires PHP: 8.0
Text Domain: ringtone
*/

:root {
	--bg: #f5f4fa;
	--surface: #ffffff;
	--surface-2: #efedf7;
	--text: #1c1830;
	--muted: #6b6785;
	--border: #e3e0ee;
	--accent: #6d28d9;
	--accent-2: #db2777;
	--accent-soft: #ede7fb;
	--on-accent: #ffffff;
	--hero-a: #3b1a78;
	--hero-b: #7a1f5c;
	--radius: 14px;
	--shadow: 0 1px 2px rgba(28, 24, 48, .06), 0 4px 14px rgba(28, 24, 48, .06);
	--wrap: 1180px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #121019;
		--surface: #1b1826;
		--surface-2: #252134;
		--text: #eeeaf8;
		--muted: #a29dba;
		--border: #2e2a40;
		--accent: #a78bfa;
		--accent-2: #f472b6;
		--accent-soft: #2a2245;
		--on-accent: #160f2b;
		--hero-a: #24124a;
		--hero-b: #4a1239;
		--shadow: 0 1px 2px rgba(0, 0, 0, .4);
		color-scheme: dark;
	}
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}
.screen-reader-text:focus {
	clip: auto; width: auto; height: auto; padding: 8px 14px; z-index: 100;
	background: var(--surface); top: 8px; left: 8px;
}

.rt-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.rt-icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- Header ---------- */
.rt-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky; top: 0; z-index: 50;
}
.rt-header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.rt-logo {
	display: flex; align-items: center; gap: 10px;
	font-weight: 800; font-size: 1.2rem; color: var(--text); letter-spacing: -.01em;
}
.rt-logo:hover { text-decoration: none; }
.rt-logo-mark {
	display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
	background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.rt-logo-mark .rt-icon { width: 18px; height: 18px; }

.rt-search { display: flex; align-items: center; position: relative; }
.rt-search input {
	width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
	border-radius: 999px; padding: 10px 44px 10px 16px; font: inherit;
}
.rt-search input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.rt-search button {
	position: absolute; right: 4px; border: 0; background: transparent; color: var(--muted);
	display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 999px;
}
.rt-search-header { flex: 1; max-width: 420px; margin-left: auto; }

.rt-menu-toggle {
	display: none; flex-direction: column; justify-content: center; gap: 4px;
	width: 40px; height: 40px; border: 0; background: transparent; padding: 8px;
}
.rt-menu-toggle span:not(.screen-reader-text) { display: block; height: 2px; background: var(--text); border-radius: 2px; }

.rt-nav { border-top: 1px solid var(--border); }
.rt-menu { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.rt-menu a {
	display: block; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.rt-menu a:hover, .rt-menu .current-menu-item a { color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.rt-hero {
	background: linear-gradient(135deg, var(--hero-a), var(--hero-b));
	color: #fff; padding: 48px 0 40px; text-align: center;
}
.rt-hero h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; }
.rt-hero p { margin: 8px 0 22px; opacity: .85; }
.rt-search-hero { max-width: 560px; margin: 0 auto; }
.rt-search-hero input {
	padding: 15px 120px 15px 20px; font-size: 1.02rem; border: 0;
	background: #fff; color: #1c1830; box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}
.rt-search-hero input:focus { background: #fff; }
.rt-search-hero button {
	background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; font-weight: 700; padding: 10px 18px; right: 5px;
}

.rt-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.rt-chip {
	padding: 7px 14px; border-radius: 999px; font-size: .9rem; font-weight: 600;
	background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .2);
}
.rt-chip:hover { background: rgba(255, 255, 255, .26); text-decoration: none; }
.rt-chips-bar { justify-content: flex-start; margin: 0 0 16px; }
.rt-chips-bar .rt-chip { background: var(--surface); color: var(--text); border-color: var(--border); }
.rt-chips-bar .rt-chip:hover { border-color: var(--accent); background: var(--surface); }
.rt-chips-bar .rt-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Sections ---------- */
.rt-main { min-height: 60vh; }
.rt-section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 14px; }
.rt-section-head h2, .rt-home-side h2 { font-size: 1.3rem; font-weight: 800; }
.rt-section-head a { font-weight: 600; font-size: .92rem; }

.rt-home { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.rt-home-side {
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	padding: 18px; margin-top: 32px; position: sticky; top: 120px;
}
.rt-top { list-style: none; margin: 12px 0 0; padding: 0; counter-reset: top; }
.rt-top li {
	display: flex; align-items: center; gap: 10px; padding: 8px 0;
	border-bottom: 1px solid var(--border); counter-increment: top;
}
.rt-top li:last-child { border-bottom: 0; }
.rt-top li::before { content: counter(top); width: 18px; color: var(--muted); font-weight: 700; font-size: .85rem; text-align: right; }
.rt-top a { flex: 1; color: var(--text); font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-top li > span { color: var(--muted); font-size: .82rem; }

/* ---------- Ringtone card ---------- */
.rt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rt-card {
	display: flex; align-items: center; gap: 12px; padding: 12px;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.rt-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.rt-card.is-playing { border-color: var(--accent); background: var(--accent-soft); }
.rt-card-body { flex: 1; min-width: 0; }
.rt-card-title { font-size: 1rem; font-weight: 700; }
.rt-card-title a { color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-card-meta { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .8rem; color: var(--muted); }
.rt-card-meta a { color: var(--accent); font-weight: 600; }
.rt-card .rt-progress { margin-top: 8px; }
.rt-card-dl {
	display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: none;
	color: var(--accent); background: var(--accent-soft);
}
.rt-card-dl:hover { background: var(--accent); color: var(--on-accent); }

.rt-progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rt-progress span {
	display: block; height: 100%; width: 0;
	background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s linear;
}

/* Play button */
.rt-play {
	position: relative; display: grid; place-items: center; flex: none;
	width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0;
	background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff;
	box-shadow: 0 4px 12px rgba(124, 58, 237, .35); transition: transform .15s;
}
.rt-play:hover { transform: scale(1.06); }
.rt-play .rt-icon { width: 22px; height: 22px; }
.rt-play .rt-play-icon .rt-icon { margin-left: 3px; }
.rt-play .rt-pause-icon, .rt-play.is-playing .rt-play-icon { display: none; }
.rt-play.is-playing .rt-pause-icon { display: block; }
.rt-play.is-playing::after {
	content: ""; position: absolute; inset: -4px; border-radius: 50%;
	border: 2px solid var(--accent); animation: rt-pulse 1.4s ease-out infinite;
}
@keyframes rt-pulse { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.3); } }
.rt-play-sm { width: 34px; height: 34px; box-shadow: none; }
.rt-play-sm .rt-icon { width: 16px; height: 16px; }
.rt-play-lg { width: 76px; height: 76px; }
.rt-play-lg .rt-icon { width: 32px; height: 32px; }

/* ---------- Categories ---------- */
.rt-cat-section { padding-bottom: 16px; }
.rt-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.rt-cat-tile {
	display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
	min-height: 96px; padding: 14px; border-radius: var(--radius); color: #fff;
	background: linear-gradient(135deg, var(--c1, #6d28d9), var(--c2, #db2777));
	transition: transform .15s;
}
.rt-cat-tile:hover { transform: translateY(-2px); text-decoration: none; }
.rt-cat-tile strong { font-size: 1.05rem; }
.rt-cat-tile span { font-size: .82rem; opacity: .85; }
.rt-cat-tile:nth-child(6n+1) { --c1: #6d28d9; --c2: #a21caf; }
.rt-cat-tile:nth-child(6n+2) { --c1: #be123c; --c2: #ea580c; }
.rt-cat-tile:nth-child(6n+3) { --c1: #0f766e; --c2: #0284c7; }
.rt-cat-tile:nth-child(6n+4) { --c1: #b45309; --c2: #be123c; }
.rt-cat-tile:nth-child(6n+5) { --c1: #1d4ed8; --c2: #7c3aed; }
.rt-cat-tile:nth-child(6n+6) { --c1: #15803d; --c2: #0f766e; }

/* ---------- Listing ---------- */
.rt-listing { padding-bottom: 32px; }
.rt-page-head { padding: 28px 0 16px; }
.rt-page-head h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; letter-spacing: -.01em; }
.rt-count { margin: 4px 0 0; color: var(--muted); }
.rt-term-desc { color: var(--muted); margin-top: 6px; }
.rt-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.rt-tabs a { padding: 10px 14px; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.rt-tabs a:hover { color: var(--text); text-decoration: none; }
.rt-tabs a.is-active { color: var(--accent); border-color: var(--accent); }
.rt-empty { padding: 32px; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border); }

.pagination { margin-top: 28px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pagination .page-numbers {
	min-width: 40px; padding: 8px 12px; text-align: center; border-radius: 10px;
	background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600;
}
.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pagination a.page-numbers:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- Single ringtone ---------- */
.rt-single { max-width: 860px; padding-bottom: 32px; }
.rt-crumbs { padding: 20px 0 14px; font-size: .88rem; color: var(--muted); }
.rt-crumbs span { color: var(--text); }
.rt-player-card {
	background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
	padding: 24px; box-shadow: var(--shadow);
}
.rt-player-top { display: flex; align-items: center; gap: 18px; }
.rt-player-top h1 { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; }
.rt-player-top .rt-card-meta { font-size: .9rem; margin-top: 6px; }
.rt-seek { margin: 22px 0 6px; cursor: pointer; padding: 6px 0; }
.rt-seek .rt-progress { height: 8px; }
.rt-times { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }

.rt-dl-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 16px; }
.rt-btn {
	display: flex; align-items: center; justify-content: center; gap: 10px;
	padding: 13px 18px; border-radius: 12px; font-weight: 700;
	background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
}
.rt-btn:hover { text-decoration: none; border-color: var(--accent); }
.rt-btn small { display: block; font-weight: 500; font-size: .78rem; color: var(--muted); }
.rt-btn-primary { background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; border: 0; }
.rt-btn-primary small { color: rgba(255, 255, 255, .85); }
.rt-btn-primary:hover { filter: brightness(1.08); }

.rt-content { margin-top: 22px; }
.rt-howto {
	margin-top: 18px; background: var(--surface); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 14px 18px;
}
.rt-howto summary { font-weight: 700; cursor: pointer; }
.rt-howto p { margin: 10px 0 0; color: var(--muted); font-size: .94rem; }
.rt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.rt-tag {
	padding: 5px 11px; border-radius: 999px; font-size: .84rem; font-weight: 600;
	background: var(--accent-soft); color: var(--accent);
}
.rt-tag:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.rt-related .rt-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- Pages ---------- */
.rt-page { max-width: 780px; padding: 32px 16px 48px; }
.rt-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 16px; }
.rt-404 { text-align: center; }
.rt-404 .rt-search-hero { margin: 18px auto; }
.rt-posts { display: grid; gap: 12px; }
.rt-post-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.rt-post-item h2 { font-size: 1.15rem; margin-bottom: 6px; }

/* ---------- Footer ---------- */
.rt-footer { margin-top: 40px; padding: 28px 0; background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; text-align: center; }
.rt-footer-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 12px; }
.rt-footer-cats a { color: var(--muted); font-weight: 600; }
.rt-footer-cats a:hover { color: var(--accent); }
.rt-footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.rt-home { grid-template-columns: 1fr; gap: 0; }
	.rt-home-side { position: static; }
}
@media (max-width: 680px) {
	.rt-header-inner { height: 58px; gap: 10px; }
	.rt-search-header { display: none; }
	.rt-menu-toggle { display: flex; margin-left: auto; }
	.rt-nav { display: none; }
	.rt-nav-open .rt-nav { display: block; }
	.rt-nav-open .rt-menu { flex-direction: column; padding: 6px 0; }
	.rt-hero { padding: 32px 0 28px; }
	.rt-search-hero input { padding-right: 56px; }
	.rt-search-hero button span { display: none; }
	.rt-grid, .rt-related .rt-grid { grid-template-columns: 1fr; gap: 10px; }
	.rt-player-card { padding: 18px; }
	.rt-play-lg { width: 64px; height: 64px; }
	.rt-chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}
