:root {
	--bg: #111214;
	--surface: #1a1b1f;
	--line: #2b2d32;
	--text: #e7e7ea;
	--muted: #9a9ca4;
	--accent: #8cc8ff;
	--free: #6fd39a;
	--soon: #8a8c94;
	--radius: 10px;
	color-scheme: dark;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site, main, footer.site {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 16px;
}

/* Sticky, and its backdrop reaches the window's edges although the bar itself keeps the
   page's width: the shadow paints the sides and the clip trims it top and bottom. */
header.site {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	gap: 16px;
	padding-top: 16px;
	padding-bottom: 16px;
	margin-bottom: 12px;
	background: rgba(17, 18, 20, .86);
	box-shadow: 0 0 0 100vmax rgba(17, 18, 20, .86);
	clip-path: inset(0 -100vmax);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}
.brand { display: block; line-height: 0; }
.brand img { display: block; height: 32px; width: auto; }
/* What this place is, above the list. */
.intro { margin: 12px 0 48px; }
.intro p { margin: 0 0 .6em; font-size: 1rem; }
.intro p:last-child { margin-bottom: 0; }
.lang { margin-left: auto; display: flex; gap: 10px; font-size: .85rem; }

/* Footer: the author and the site's own links on top, the yama-ko.net mark and the
   copyright under a hairline. The rule runs the window's width, as the header's backdrop. */
footer.site {
	margin-top: 88px;
	padding-top: 36px;
	padding-bottom: 32px;
	color: var(--muted);
	font-size: .85rem;
	background: var(--surface);
	box-shadow: 0 0 0 100vmax var(--surface);
	clip-path: inset(0 -100vmax);
}
.footer-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}
/* The site's own links, as buttons: the terms by name, the two sites by their marks. */
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-nav a {
	display: inline-flex;
	align-items: center;
	height: 36px;
	padding: 0 16px;
	border: 1px solid var(--line);
	border-radius: 99px;
	color: var(--text);
}
.footer-nav a:hover { border-color: var(--muted); text-decoration: none; }
.footer-nav .logo-btn img { display: block; height: 14px; width: auto; opacity: .9; }
.footer-nav .logo-btn:hover img { opacity: 1; }
.footer-bottom {
	margin-top: 28px;
	padding-top: 20px;
	border-top: 1px solid var(--line);
	text-align: center;
}

/* ── cards ─────────────────────────────────────────────────────────────── */

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));   /* three across at 1280 */
	gap: 20px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.card-media { display: block; }
.card-body { padding: 14px 16px 18px; }
.category { color: var(--muted); font-size: .75rem; letter-spacing: .04em; margin-bottom: 2px; }
.card h2 { font-size: 1.05rem; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.card h2 a { color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }

.thumb, .hero-media {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: #000;
}
.placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
}
.placeholder span {
	color: rgba(255, 255, 255, .85);
	font-weight: 700;
	letter-spacing: .04em;
	text-shadow: 0 1px 12px rgba(0, 0, 0, .35);
}

.badge {
	font-size: .7rem;
	font-weight: 700;
	padding: 1px 8px;
	border-radius: 99px;
	border: 1px solid currentColor;
	line-height: 1.6;
	white-space: nowrap;
}
.badge.free { color: var(--free); }
.badge.soon { color: var(--soon); }

/* ── product page ──────────────────────────────────────────────────────── */

.hero { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.hero .placeholder span { font-size: clamp(1.4rem, 5vw, 2.6rem); }

.product-head { margin: 28px 0 8px; }
.product-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 6px 0 20px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;   /* Japanese can break between any two characters */
	padding: 10px 18px;
	border-radius: 8px;
	background: var(--accent);
	color: #0b1520;
	font-weight: 700;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn small { font-weight: 500; opacity: .75; }
.btn.disabled { background: var(--line); color: var(--muted); cursor: default; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.secondary:hover { border-color: var(--muted); filter: none; }
iframe.hero-media { border: 0; }
.store-note { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.store-note strong { color: var(--text); }

.meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 2px 18px;
	margin: 20px 0 0;
	font-size: .88rem;
}
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

.prose { max-width: 760px; margin-top: 36px; }
.prose h2 { font-size: 1.2rem; margin: 40px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 1rem; margin: 28px 0 8px; }
.prose ul { padding-left: 1.3em; }
.prose li { margin: 3px 0; }
.prose code {
	font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
	font-size: .88em;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 4px;
	padding: 1px 5px;
	overflow-wrap: anywhere;
}
.prose img, .prose video { max-width: 100%; border-radius: var(--radius); }
.prose table { border-collapse: collapse; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }

.related { margin-top: 64px; }
.related > h2 { font-size: 1.1rem; margin: 0 0 16px; }

@media (max-width: 600px) {
	header.site { flex-wrap: wrap; gap: 4px 12px; padding-top: 12px; padding-bottom: 12px; }
	.brand img { height: 24px; }
	.grid { grid-template-columns: 1fr; }
}

/* ── plain pages (terms) ───────────────────────────────────────────────── */

.page h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 8px 0 0; }
.page .prose { margin-top: 20px; }

/* ── list page sections ────────────────────────────────────────────────── */

.category-section + .category-section { margin-top: 48px; }
.category-title {
	font-size: .95rem;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: .04em;
	margin: 0 0 14px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

.btn .icon { width: 1.15em; height: 1.15em; flex: none; margin-right: -2px; }
.btn .icon-ext { width: .9em; height: .9em; margin: 0 0 0 -2px; opacity: .8; }

/* ── author (in the footer) ────────────────────────────────────────────── */

.author { display: flex; align-items: center; gap: 16px; }
.author-icon { width: 56px; height: 56px; border-radius: 50%; flex: none; }
.author-name { margin: 0 0 8px; font-weight: 700; font-size: 1.05rem; }
.author-name a { color: var(--text); }
.author-links { display: flex; flex-wrap: wrap; gap: 8px; }
.author-links a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 12px;
	border: 1px solid var(--line);
	border-radius: 99px;
	color: var(--text);
	font-size: .85rem;
}
.author-links a:hover { border-color: var(--muted); text-decoration: none; }
.author-links img { width: 15px; height: 15px; }
@media (max-width: 600px) { .author-icon { width: 48px; height: 48px; } }

/* ── overview with the Effect Controls beside it ────────────────────────── */

.ui-shot { margin: 20px 0 0; }
.ui-shot img {
	display: block;
	max-width: 100%;
	height: auto;
	border: 1px solid var(--line);
	border-radius: 6px;
}
@media (min-width: 960px) {
	.lead-cols {
		display: grid;
		grid-template-columns: minmax(0, 760px) auto;
		grid-template-rows: auto 1fr;
		column-gap: 56px;
		align-items: start;
	}
	.lead-overview { grid-column: 1; grid-row: 1; }
	.lead-rest     { grid-column: 1; grid-row: 2; margin-top: 0; }
	/* Level with the overview heading: the prose's 36px plus the heading's own 40px, which
	   inside a grid item no longer collapse into one. */
	.ui-shot       { grid-column: 2; grid-row: 1 / span 2; margin-top: 80px; }
	.ui-shot img   { max-width: 440px; }
}
.lead-rest { margin-top: 0; }

/* ── gallery ───────────────────────────────────────────────────────────── */

.gallery { margin-top: 40px; }
.gallery > h2 { font-size: 1.2rem; margin: 0 0 16px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 28px 20px;
	align-items: start;
}
.gallery-item { margin: 0; }
.gallery-link {
	display: block;
	border-radius: var(--radius);
	overflow: hidden;
	border: 1px solid var(--line);
	background: #000;
	cursor: zoom-in;
}
.gallery-link img, .gallery-link video { display: block; width: 100%; height: auto; }
.gallery-item figcaption { color: var(--muted); font-size: .85rem; line-height: 1.5; margin-top: 8px; }
.gallery + .prose { margin-top: 8px; }
@media (max-width: 600px) { .gallery-grid { grid-template-columns: 1fr; } }

/* ── lightbox ──────────────────────────────────────────────────────────── */

body.lb-open { overflow: hidden; }
.lightbox {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(8, 9, 11, .94);
}
.lightbox[hidden] { display: none; }
.lb-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 48px 56px; box-sizing: border-box; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox button {
	position: absolute;
	background: none;
	border: 0;
	color: #fff;
	font-size: 2.6rem;
	line-height: 1;
	padding: 10px 14px;
	cursor: pointer;
	opacity: .7;
}
.lightbox button:hover { opacity: 1; }
.lightbox button[hidden] { display: none; }
.lb-close { top: 6px; right: 10px; }
.lb-prev  { left: 6px;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 6px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lb-stage { padding: 48px 8px; } .lb-prev, .lb-next { font-size: 2rem; } }
