/*
Theme Name: TubeJav
Theme URI: https://tubejav.com/
Description: Performance-first premium child theme for RetroTube, built for TubeJav.
Author: TubeJav
Version: 1.0.1
Template: retrotube
Text Domain: tubejav
Requires at least: 6.6
Requires PHP: 8.1
*/

:root {
	--tj-bg: #0d0f12;
	--tj-surface: #15181d;
	--tj-surface-2: #1c2026;
	--tj-line: rgba(255, 247, 232, .11);
	--tj-text: #fff8ea;
	--tj-muted: #a9a7a1;
	--tj-red: #d52232;
	--tj-red-bright: #f03543;
	--tj-ivory: #f2e5ca;
	--tj-radius: 14px;
	--tj-shadow: 0 16px 45px rgba(0, 0, 0, .28);
	--tj-max: 1440px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body.tubejav-theme {
	margin: 0;
	background: var(--tj-bg);
	color: var(--tj-text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.55;
}
body.tubejav-theme::before {
	content: "";
	position: fixed;
	inset: 0 0 auto;
	height: 420px;
	pointer-events: none;
	background: radial-gradient(circle at 20% -20%, rgba(213, 34, 50, .18), transparent 52%);
	z-index: -1;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--tj-ivory); }
img { max-width: 100%; height: auto; }
button, input { font: inherit; }
.row, .tj-shell, #content.site-content { width: min(calc(100% - 40px), var(--tj-max)); margin-inline: auto; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.screen-reader-text:focus { clip: auto; width: auto; height: auto; margin: 8px; padding: 10px 14px; background: var(--tj-text); color: #111; z-index: 100000; }

/* Header */
.tj-header { position: sticky; top: 0; z-index: 999; border-bottom: 1px solid var(--tj-line); background: rgba(13, 15, 18, .92); backdrop-filter: blur(15px); }
.admin-bar .tj-header { top: 32px; }
.tj-header__main { min-height: 72px; display: grid; grid-template-columns: auto minmax(260px, 1fr) auto; align-items: center; gap: 28px; }
.tj-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--tj-text); font-size: 24px; font-weight: 900; letter-spacing: -.8px; }
.tj-brand svg { width: 38px; height: 38px; flex: 0 0 38px; }
.tj-brand b { color: var(--tj-red-bright); }
.tj-menu ul, .tj-menu { list-style: none; margin: 0; padding: 0; }
.tj-menu > ul { display: flex; justify-content: center; gap: 4px; }
.tj-menu a { display: block; padding: 10px 13px; color: #d8d5ce; font-weight: 700; border-radius: 9px; }
.tj-menu a:hover, .tj-menu .current-menu-item > a { color: #fff; background: rgba(255,255,255,.06); }
.tj-header__actions { display: flex; align-items: center; gap: 8px; }
.tj-icon-button { width: 42px; height: 42px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--tj-line); border-radius: 50%; background: var(--tj-surface); color: #fff; cursor: pointer; }
.tj-icon-button:hover { border-color: rgba(240,53,67,.65); background: #21171a; }
.tj-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.tj-menu-toggle { display: none; }

/* Search overlay */
.tj-search { position: fixed; inset: 0; z-index: 2000; visibility: hidden; opacity: 0; background: rgba(4,5,7,.82); backdrop-filter: blur(18px); transition: opacity .18s ease, visibility .18s ease; }
.tj-search.is-open { visibility: visible; opacity: 1; }
.tj-search__panel { width: min(720px, calc(100% - 28px)); margin: min(15vh, 130px) auto 0; padding: 24px; border: 1px solid var(--tj-line); border-radius: 20px; background: #13161a; box-shadow: var(--tj-shadow); }
.tj-search__top { display: flex; gap: 10px; }
.tj-search__input { min-width: 0; flex: 1; height: 52px; padding: 0 16px; border: 1px solid var(--tj-line); border-radius: 12px; outline: 0; background: #0b0d10; color: #fff; font-size: 17px; }
.tj-search__input:focus { border-color: var(--tj-red-bright); box-shadow: 0 0 0 3px rgba(240,53,67,.12); }
.tj-search__results { display: grid; gap: 8px; max-height: 55vh; overflow: auto; margin-top: 14px; }
.tj-search-result { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 14px; align-items: center; padding: 8px; border-radius: 11px; background: rgba(255,255,255,.035); }
.tj-search-result:hover { background: rgba(255,255,255,.075); }
.tj-search-result img { width: 110px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.tj-search-result strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tj-search-result small, .tj-search__hint { color: var(--tj-muted); }
body.tj-search-open { overflow: hidden; }

/* Shared headings and controls */
.site-content { padding-block: 32px 70px; }
.tj-section { margin-bottom: 48px; }
.tj-section__head, .page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.tj-eyebrow { display: block; margin-bottom: 4px; color: var(--tj-red-bright); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.tj-section h2, .widget-title, .page-title { margin: 0; color: var(--tj-text); font-size: clamp(22px, 2.3vw, 32px); line-height: 1.13; letter-spacing: -.03em; }
.tj-section__link { flex: none; color: var(--tj-muted); font-weight: 750; }
.tj-section__link:hover { color: var(--tj-red-bright); }
.archive-description { width: 100%; margin: 8px 0 0; color: var(--tj-muted); }
.button, button.button, input[type="submit"] { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--tj-red); color: #fff; font-weight: 800; cursor: pointer; }
.button:hover { background: var(--tj-red-bright); color: #fff; }

/* Hero */
.tj-hero { position: relative; overflow: hidden; min-height: 330px; display: grid; align-items: end; margin-bottom: 48px; border: 1px solid var(--tj-line); border-radius: 20px; background: linear-gradient(115deg, #241114, #11151b 56%, #17191d); box-shadow: var(--tj-shadow); }
.tj-hero::after { content:"日本"; position:absolute; right: 3%; top: 50%; transform: translateY(-54%); color: rgba(255,248,234,.035); font-family: Georgia, serif; font-size: clamp(120px, 20vw, 290px); font-weight: 900; line-height: 1; }
.tj-hero__content { position: relative; z-index: 1; max-width: 760px; padding: clamp(28px, 6vw, 70px); }
.tj-hero h1 { max-width: 720px; margin: 0 0 14px; font-size: clamp(38px, 6vw, 72px); line-height: .98; letter-spacing: -.055em; }
.tj-hero h1 span { color: var(--tj-red-bright); }
.tj-hero p { max-width: 600px; margin: 0 0 24px; color: #c7c2b8; font-size: 16px; }
.tj-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tj-button--ghost { border: 1px solid var(--tj-line); background: rgba(255,255,255,.05); }

/* Video grids/cards */
.videos-list, .tj-video-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px 16px; }
.loop-video.tj-card { width: auto !important; margin: 0 !important; float: none !important; background: transparent; }
.tj-card > a { display: block; }
.tj-card .post-thumbnail { position: relative; overflow: hidden; aspect-ratio: 16/9; border-radius: var(--tj-radius); background: var(--tj-surface-2); box-shadow: 0 9px 24px rgba(0,0,0,.22); }
.tj-card .post-thumbnail::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.58), transparent 48%); pointer-events:none; }
.tj-card img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .28s ease, filter .28s ease; }
.tj-card:hover img { transform: scale(1.035); filter: brightness(1.08); }
.tj-card__play { position: absolute; z-index: 2; left: 50%; top: 50%; width: 44px; height: 44px; display: grid; place-items: center; transform: translate(-50%,-45%) scale(.8); border-radius: 50%; background: rgba(213,34,50,.93); opacity: 0; transition: .2s ease; }
.tj-card:hover .tj-card__play { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.tj-card__play svg { width: 18px; fill: #fff; margin-left: 2px; }
.tj-badges { position: absolute; z-index: 3; inset: 8px 8px auto; display: flex; gap: 5px; pointer-events:none; }
.tj-badge { padding: 3px 7px; border-radius: 6px; background: rgba(10,12,15,.78); color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.tj-badge--red { background: var(--tj-red); }
.tj-duration { position: absolute; z-index: 3; right: 8px; bottom: 8px; padding: 3px 7px; border-radius: 6px; background: rgba(0,0,0,.78); color:#fff; font-size: 11px; font-weight: 800; }
.tj-card .entry-header { margin-top: 10px; }
.tj-card .entry-title { display: -webkit-box; min-height: 42px; overflow: hidden; margin: 0; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #f4f0e8; font-size: 14px; font-weight: 800; line-height: 1.45; }
.tj-card__meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; color: var(--tj-muted); font-size: 11px; }
.tj-card__meta i { width: 3px; height: 3px; border-radius: 50%; background: #696a6d; }
.tj-empty { grid-column: 1/-1; padding: 40px 20px; border: 1px dashed var(--tj-line); border-radius: var(--tj-radius); text-align:center; color: var(--tj-muted); }

/* Term cards */
.tj-term-grid { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 14px; }
.tj-term-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--tj-line); border-radius: 14px; background: var(--tj-surface); }
.tj-term-card__media { aspect-ratio: 3/4; background: linear-gradient(145deg,#2b2d32,#15171a); }
.tj-term-card__media img { width:100%; height:100%; object-fit:cover; filter: saturate(.86); transition: .25s ease; }
.tj-term-card:hover img { transform: scale(1.04); filter: saturate(1); }
.tj-term-card__body { padding: 10px 11px 12px; }
.tj-term-card strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.tj-term-card small { color: var(--tj-muted); font-size: 11px; }
.tj-studio-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:12px; }
.tj-studio { padding: 16px; border:1px solid var(--tj-line); border-radius:12px; background:var(--tj-surface); }
.tj-studio strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tj-studio small { color:var(--tj-muted); }

/* Single */
.single .site-content { width: min(calc(100% - 40px), 1240px); }
.single .content-area, .single .site-main { width: 100% !important; float: none !important; }
.tj-single .video-player { overflow:hidden; width:100%; margin:0; border-radius:16px; background:#000; box-shadow:var(--tj-shadow); }
.tj-single .video-player iframe, .tj-single .video-player video { display:block; width:100%; aspect-ratio:16/9; height:auto; min-height:0; border:0; }
.tj-single__head { padding: 22px 0 14px; border-bottom:1px solid var(--tj-line); }
.tj-single__head h1 { margin:0 0 12px; font-size:clamp(24px,3.5vw,40px); line-height:1.15; letter-spacing:-.035em; }
.tj-single__actions { margin:0 0 14px; }
.tj-single__bar { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; color:var(--tj-muted); font-size:13px; }
.tj-single__bar .tj-badge { position:static; }
.tj-single__content { display:grid; grid-template-columns:minmax(0,1fr) 270px; gap:34px; padding:24px 0 6px; }
.tj-single__description { color:#cbc8c1; }
.tj-single__description p:first-child { margin-top:0; }
.tj-detail-list { margin:0; padding:18px; border:1px solid var(--tj-line); border-radius:14px; background:var(--tj-surface); }
.tj-detail-list div { display:grid; grid-template-columns:80px minmax(0,1fr); gap:10px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.06); }
.tj-detail-list div:last-child { border:0; }
.tj-detail-list dt { color:var(--tj-muted); }
.tj-detail-list dd { margin:0; }
.tj-chips { display:flex; flex-wrap:wrap; gap:7px; margin-top:18px; }
.tj-chip { padding:6px 10px; border:1px solid var(--tj-line); border-radius:99px; background:rgba(255,255,255,.035); color:#dad5cc; font-size:12px; }
.tj-chip:hover { border-color:var(--tj-red); color:#fff; }
.tj-related { padding-top:40px; }

/* Parent compatibility */
#primary { width:100%; float:none; }
#sidebar { display:none; }
.pagination, .nav-links { display:flex; justify-content:center; gap:7px; margin:38px 0; }
.pagination a, .pagination span, .nav-links a, .nav-links span { min-width:40px; height:40px; display:grid; place-items:center; border:1px solid var(--tj-line); border-radius:9px; background:var(--tj-surface); }
.pagination .current, .nav-links .current { border-color:var(--tj-red); background:var(--tj-red); color:#fff; }
.wp-video, .mejs-container { max-width:100%; }

/* Footer and dock */
.tj-footer { border-top:1px solid var(--tj-line); background:#0a0c0f; }
.tj-footer__main { display:grid; grid-template-columns:1.4fr 1fr; gap:50px; padding-block:48px 30px; }
.tj-footer p { max-width:620px; color:var(--tj-muted); }
.tj-footer__menu ul { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px 18px; margin:0; padding:0; list-style:none; }
.tj-footer__menu a { color:#c9c5bd; font-weight:700; }
.tj-footer__bottom { display:flex; justify-content:space-between; gap:20px; padding-block:17px; border-top:1px solid var(--tj-line); color:#777a7f; font-size:12px; }
.tj-mobile-dock { display:none; }

@media (max-width: 1160px) {
	.videos-list, .tj-video-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
	.tj-term-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
	.tj-header__main { gap:14px; }
	.tj-menu a { padding-inline:9px; }
}
@media (max-width: 900px) {
	.admin-bar .tj-header { top:46px; }
	.tj-header__main { grid-template-columns:auto 1fr auto; min-height:64px; }
	.tj-menu-toggle { display:inline-grid; }
	.tj-menu { position:absolute; left:0; right:0; top:100%; display:none; padding:10px 20px 18px; border-bottom:1px solid var(--tj-line); background:#101216; }
	.tj-menu.is-open { display:block; }
	.tj-menu > ul { display:grid; }
	.tj-menu a { padding:11px 10px; }
	.videos-list, .tj-video-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
	.tj-term-grid { grid-template-columns:repeat(5,minmax(0,1fr)); }
	.tj-studio-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
	.tj-single__content { grid-template-columns:1fr; }
}
@media (max-width: 640px) {
	body.tubejav-theme { padding-bottom:68px; }
	.row, .tj-shell, #content.site-content, .single .site-content { width:min(calc(100% - 24px), var(--tj-max)); }
	.site-content { padding-block:22px 42px; }
	.tj-brand { font-size:21px; }
	.tj-brand svg { width:34px; height:34px; }
	.tj-header__actions .tj-account { display:none; }
	.tj-hero { min-height:310px; margin-bottom:34px; }
	.tj-hero__content { padding:30px 22px; }
	.tj-hero h1 { font-size:40px; }
	.tj-section { margin-bottom:36px; }
	.tj-section__head, .page-header { align-items:center; }
	.tj-section__link { font-size:12px; }
	.videos-list, .tj-video-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:19px 10px; }
	.tj-card .entry-title { min-height:38px; font-size:12.5px; line-height:1.42; }
	.tj-card__meta { font-size:10px; }
	.tj-card__play { display:none; }
	.tj-badges { inset:5px 5px auto; }
	.tj-badge { padding:2px 5px; font-size:8px; }
	.tj-duration { right:5px; bottom:5px; padding:2px 5px; font-size:9px; }
	.tj-term-grid { display:flex; overflow-x:auto; scroll-snap-type:x mandatory; padding-bottom:8px; }
	.tj-term-card { flex:0 0 132px; scroll-snap-align:start; }
	.tj-studio-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
	.tj-search__panel { margin-top:72px; padding:14px; }
	.tj-search__input { font-size:16px; }
	.tj-search-result { grid-template-columns:86px minmax(0,1fr); gap:10px; }
	.tj-search-result img { width:86px; }
	.tj-single .video-player { margin-inline:-12px; width:calc(100% + 24px); border-radius:0; }
	.tj-single__head h1 { font-size:23px; }
	.tj-footer__main { grid-template-columns:1fr; gap:20px; padding-block:34px 24px; }
	.tj-footer__menu ul { justify-content:flex-start; }
	.tj-footer__bottom { display:block; }
	.tj-mobile-dock { position:fixed; z-index:1000; left:8px; right:8px; bottom:8px; height:58px; display:grid; grid-template-columns:repeat(4,1fr); border:1px solid var(--tj-line); border-radius:16px; background:rgba(17,19,23,.96); box-shadow:0 10px 35px rgba(0,0,0,.48); backdrop-filter:blur(15px); }
	.tj-mobile-dock a, .tj-mobile-dock button { min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; border:0; background:none; color:#b5b3ae; font-size:9px; font-weight:800; }
	.tj-mobile-dock svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:2; }
	.tj-mobile-dock .is-accent { color:var(--tj-red-bright); }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; }
}
