/* Tonkyway modernisation: photo galleries, layout fixes and small-screen layout.
   Loaded after style.css so it only overrides what it needs to. */

/* ---------- All screen sizes ---------- */

/* Cat profile boxes grow with tall (portrait) photos instead of overlapping the text below */
#catdescleft, #catdescright { height: auto; min-height: 340px; }

/* Photo galleries (old FrogJS markup, shown as a grid; GLightbox opens the full-size photo) */
#FrogJS {
	width: auto;
	height: auto;
	margin: 1em 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
	font-size: 0;          /* hides leftover filename text before the script runs */
}
#FrogJS a {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #111;
	border: 1px solid #333;
}
#FrogJS img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .25s ease;
}
#FrogJS a:hover img, #FrogJS a:focus img { transform: scale(1.05); }
#FrogJS:not(:has(a)) { display: none; }

/* Lightbox captions to suit the dark site */
.glightbox-clean .gslide-description { background: #222; }
.glightbox-clean .gslide-title { color: #E6E8FA; margin-bottom: 0; font-family: Arial, Helvetica, sans-serif; }

/* Desktop menu: keyboard users can open submenus too */
#nav li:focus-within > ul { display: block; }

/* Mobile-only controls are hidden on big screens */
.menu-toggle, .sub-toggle { display: none; }

/* Header banner: same indent the old &nbsp;s gave */
h1r { padding-left: 3.6em; }

/* ---------- Phones and small tablets ---------- */
@media (max-width: 960px) {
	html { -webkit-text-size-adjust: 100%; }
	body { font-size: 1em; }

	#logo, #header, #page, #content, #footer { width: auto; float: none; }
	#logo { height: auto; padding: 10px 12px 4px; overflow: hidden; }
	#logo h1 { font-size: 24px; }
	#logo p { padding-top: 9px; }

	#header { height: auto; margin: 0; padding: 0 8px 8px; background: none; }
	h1r { display: block; padding: 4px 0 10px; font-size: 1em; line-height: 1.4; text-align: center; }

	/* Menu: a button that opens a vertical list; tap the arrows to open submenus */
	.menu-toggle {
		display: block;
		width: 100%;
		padding: .8em 1em;
		border: 1px solid #333;
		background: #5970B2;
		color: #fff;
		font-size: 1.1em;
		text-align: left;
		cursor: pointer;
	}
	#nav { display: none; width: auto; margin: 0; padding: 0; }
	#nav.open { display: block; }
	#nav li { float: none; position: relative; }
	#nav ul { position: static; width: auto; margin: 0; padding: 0 0 0 1em; }
	#nav li ul ul { left: auto; }
	#nav li:not(.open) > ul { display: none !important; }
	#nav li.open > ul { display: block !important; }
	#nav a, #nav h3, #nav li ul a {
		float: none;
		width: auto;
		padding: .8em 3.2em .8em 1em;
		font-size: 1em;
	}
	#nav a:hover, #nav h3:hover { background-color: #5970B2; color: #fff; }
	.sub-toggle {
		display: block;
		position: absolute;
		top: 0;
		right: 0;
		width: 3em;
		height: 2.9em;
		border: 0;
		border-left: 1px solid #333;
		background: rgba(0, 0, 0, .25);
		color: #fff;
		font-size: 1em;
		cursor: pointer;
		transition: transform .2s;
	}
	li.open > .sub-toggle { background: rgba(0, 0, 0, .5); }

	/* Page content */
	#page { padding: 0 12px 1em; }
	.post .entry { width: auto; }
	p, ul, ol { text-align: left; }
	#content img { max-width: 100%; height: auto; }
	#content table { display: block; max-width: 100%; overflow-x: auto; }

	#kitsleft, #kitsright, #catdescleft, #catdescright {
		float: none;
		width: auto;
		height: auto;
		min-height: 0;
	}
	#catdescright { text-align: center; margin-top: 1em; }
	#content #catdescright img { max-height: 420px; width: auto; }

	/* Cat tiles (Queens/Studs/Retired pages): two per row */
	#catpic {
		float: none;
		display: inline-block;
		vertical-align: top;
		width: 44%;
		height: auto;
		padding: .5em 2%;
	}
	#content #catpic img { max-height: 180px; width: auto; }

	/* Home page three columns: stack them */
	.threecol .colmid, .threecol .colleft,
	.threecol .col1, .threecol .col2, .threecol .col3 {
		float: none;
		right: auto;
		left: auto;
		width: auto;
	}

	#FrogJS { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }

	#footer { height: auto; padding: 10px; background: none; }
	#footer p { padding: 10px; }
}
