/*
Theme Name: Tools/400
Theme URI: https://www.tools400.de/
Author: Thomas Raddatz
Description: Block theme of tools400.de - free and open source tools for IBM i developers.
Version: 0.2.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tools400
*/

/* ------------------------------------------------------------------ Basics */
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: var(--wp--preset--color--primary-soft); }
:where(a) { text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:where(code, kbd) { font-family: var(--wp--preset--font-family--mono); font-size: 0.9em; }
:where(p, li) > code { padding: 0.1em 0.35em; border-radius: 5px; background: var(--wp--preset--color--surface); }
img { height: auto; }

.t4-eyebrow {
	margin: 0;
	color: var(--wp--preset--color--primary);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.t4-lead { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--large); line-height: 1.55; }

/* Template parts and main follow each other without gap. */
.wp-site-blocks > * { margin-block-start: 0; }

/* ------------------------------------------------------------------ Header */
.t4-header-wrap { position: sticky; top: 0; z-index: 50; }
.admin-bar .t4-header-wrap { top: var(--wp-admin--admin-bar--height, 32px); }
.t4-header {
	position: relative;
	isolation: isolate;
	border-bottom: 1px solid var(--wp--preset--color--line);
}
/* Frosted background on a layer of its own: a backdrop filter on the header itself would confine
   the menu overlay of phones (position: fixed) to the header. */
.t4-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--wp--preset--color--paper);
	background: color-mix(in srgb, var(--wp--preset--color--paper) 86%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	backdrop-filter: saturate(180%) blur(12px);
}

.t4-brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--wp--preset--color--ink); text-decoration: none; }
.t4-brand:hover { color: var(--wp--preset--color--ink); }
.t4-brand__mark { width: 34px; height: 34px; flex: none; }
.t4-brand__mark rect { fill: var(--wp--custom--color--mark); }
.t4-brand__name { font-family: var(--wp--preset--font-family--display); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.t4-brand__name span { color: var(--wp--preset--color--primary); font-family: var(--wp--preset--font-family--mono); font-size: 1.1rem; font-weight: 700; }

.t4-header .wp-block-navigation__responsive-container.is-menu-open { padding: 1.5rem; }
.t4-header .wp-block-navigation .current-menu-item > a,
.t4-header .wp-block-navigation a[aria-current="page"] { color: var(--wp--preset--color--primary); }
.t4-header .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
}

.t4-github-button.wp-block-button .wp-block-button__link {
	display: inline-flex;
	gap: 0.45rem;
	align-items: center;
	padding: 0.5rem 0.9rem;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}
.t4-github-button.wp-block-button .wp-block-button__link:hover { background: var(--wp--custom--color--button); color: var(--wp--custom--color--on-button); }
.t4-github-button svg { width: 18px; height: 18px; }

/* Phones: menu button, color scheme and GitHub as icons, close together. */
@media (max-width: 599px) {
	.t4-header .t4-header__actions { gap: 0.75rem; }
	.t4-github-button.wp-block-button .wp-block-button__link { padding: 0.55rem; }
	.t4-github-button__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* Color scheme picker */
.t4-scheme { position: relative; }
.t4-scheme[hidden], .t4-scheme__menu[hidden] { display: none; }
.t4-scheme__toggle {
	display: grid;
	place-items: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 10px;
	background: transparent;
	color: var(--wp--preset--color--ink);
	cursor: pointer;
}
.t4-scheme__toggle:hover,
.t4-scheme__toggle[aria-expanded="true"] { border-color: var(--wp--preset--color--ink); }
.t4-scheme__toggle svg { width: 20px; height: 20px; }
.t4-scheme__toggle:focus-visible,
.t4-scheme__item:focus-visible { outline: 2px solid var(--wp--preset--color--primary); outline-offset: 2px; }
.t4-scheme__menu {
	position: absolute;
	top: calc(100% + 0.6rem);
	right: 0;
	z-index: 60;
	min-width: 14rem;
	padding: 0.5rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 14px;
	background: var(--wp--preset--color--paper);
	box-shadow: 0 16px 40px -16px rgb(0 0 0 / 0.35);
}
.t4-scheme__group {
	margin: 0.75rem 0.6rem 0.25rem;
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.t4-scheme__group:first-child { margin-top: 0.25rem; }
.t4-scheme__menu ul { margin: 0; padding: 0; list-style: none; }
.t4-scheme__item {
	display: flex;
	gap: 0.7rem;
	align-items: center;
	width: 100%;
	padding: 0.4rem 0.6rem;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--wp--preset--color--ink);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	text-align: left;
	cursor: pointer;
}
.t4-scheme__item:hover { background: var(--wp--preset--color--surface); }
.t4-scheme__item[aria-pressed="true"] { font-weight: 600; }
.t4-scheme__item[aria-pressed="true"]::after { content: "\2713"; margin-left: auto; padding-left: 1rem; color: var(--wp--preset--color--primary); }
/* Each swatch has the colors of its scheme: background, text and primary color. */
.t4-scheme__swatch {
	display: grid;
	place-items: center;
	flex: none;
	width: 2.5rem;
	height: 1.75rem;
	padding-bottom: 3px;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 6px;
	background: var(--wp--preset--color--paper);
	box-shadow: inset 0 -4px 0 var(--wp--preset--color--primary);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
}

/* ------------------------------------------------------------------ Hero */
.t4-hero {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	border-bottom: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--surface);
}
.t4-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--wp--preset--color--primary) 20%, transparent), transparent 60%),
		radial-gradient(40rem 24rem at -10% 110%, color-mix(in srgb, var(--wp--preset--color--phosphor) 14%, transparent), transparent 60%),
		linear-gradient(color-mix(in srgb, var(--wp--preset--color--ink) 5%, transparent) 1px, transparent 1px) 0 0 / 100% 32px,
		linear-gradient(90deg, color-mix(in srgb, var(--wp--preset--color--ink) 5%, transparent) 1px, transparent 1px) 0 0 / 32px 100%;
	-webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
	mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.t4-hero h1 em { color: var(--wp--preset--color--primary); font-style: normal; }

.t4-hero__facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 1.75rem 0 0; padding: 0; list-style: none; color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--x-small); }
.t4-hero__facts strong { color: var(--wp--preset--color--ink); font-family: var(--wp--preset--font-family--mono); }

/* Terminal look: hero illustration and block style "Terminal" of preformatted text, in the
   colors of the terminal of the scheme. */
.t4-terminal,
.wp-block-preformatted.is-style-terminal {
	position: relative;
	margin: 0;
	padding: 3rem 1.5rem 1.5rem;
	overflow-x: auto;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 14px;
	background: var(--wp--custom--terminal--background);
	box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.5);
	color: var(--wp--custom--terminal--text);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.8125rem;
	line-height: 1.75;
	white-space: pre;
}
.t4-terminal::before,
.wp-block-preformatted.is-style-terminal::before {
	content: "";
	position: absolute;
	top: 1rem;
	left: 1.25rem;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #ff5f57;
	box-shadow: 16px 0 0 #febc2e, 32px 0 0 #28c840;
}
.t4-terminal__title { position: absolute; top: 0.7rem; right: 1.25rem; color: var(--wp--custom--terminal--dim); font-size: 0.75rem; }
.t4-terminal .t-cmd { color: var(--wp--custom--terminal--command); }
.t4-terminal .t-ok { color: var(--wp--custom--terminal--ok); }
.t4-terminal .t-dim { color: var(--wp--custom--terminal--dim); }
.t4-terminal .t-cursor { display: inline-block; width: 0.6em; height: 1.1em; vertical-align: text-bottom; background: var(--wp--custom--terminal--ok); animation: t4-blink 1.1s steps(1) infinite; }
@keyframes t4-blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------------ Sections */
.t4-section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.t4-section-head h2 { margin: 0; }
.t4-more { font-size: var(--wp--preset--font-size--small); font-weight: 600; text-decoration: none; }
.t4-more::after { content: " →"; }

.t4-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.t4-type {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.5rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 14px;
	background: var(--wp--preset--color--paper);
	transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.t4-type:hover {
	border-color: color-mix(in srgb, var(--wp--preset--color--ink) 22%, var(--wp--preset--color--line));
	box-shadow: 0 12px 28px -16px rgb(0 0 0 / 0.3);
	transform: translateY(-2px);
}
.t4-type__icon {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 10px;
	background: var(--wp--preset--color--primary-soft);
	color: var(--wp--preset--color--primary);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875rem;
	font-weight: 700;
}
.t4-type h3 { margin: 0.5rem 0 0; font-size: var(--wp--preset--font-size--large); }
.t4-type h3 a { color: inherit; text-decoration: none; }
.t4-type h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.t4-type p { margin: 0; color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--small); }

.t4-panel {
	padding: clamp(1.25rem, 3vw, 2rem);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 14px;
	background: var(--wp--preset--color--paper);
}

.t4-cta { border: 1px solid var(--wp--preset--color--line); border-radius: 20px; }
.t4-cta p { color: var(--wp--preset--color--muted); }

/* News list */
.t4-news .wp-block-post { padding: 1rem 0; border-bottom: 1px solid var(--wp--preset--color--line); }
.t4-news .wp-block-post:last-child { border-bottom: 0; }
.t4-news .wp-block-post-title { margin: 0.15rem 0 0; font-size: var(--wp--preset--font-size--medium); }

/* ------------------------------------------------------------------ Page heads, product page */
.t4-page-hero { border-bottom: 1px solid var(--wp--preset--color--line); background: var(--wp--preset--color--surface); }
.t4-page-hero h1 { margin-top: 0.5rem; }
.t4-sticky .t4-facts-block { padding: 0.25rem 1.5rem; border: 1px solid var(--wp--preset--color--line); border-radius: 14px; }
.t4-breadcrumb { display: flex; gap: 0.5rem; margin: 0; padding: 0; list-style: none; color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--x-small); }
.t4-breadcrumb li + li::before { content: "/"; margin-right: 0.5rem; color: var(--wp--preset--color--line); }
.t4-breadcrumb a { color: inherit; text-decoration: none; }
.t4-breadcrumb a:hover { color: var(--wp--preset--color--primary); }
.t4-page-hero .wp-block-post-excerpt { color: var(--wp--preset--color--muted); font-size: var(--wp--preset--font-size--large); }
.t4-page-hero .wp-block-post-excerpt__excerpt { margin: 0; }
.single-t4_product .t4-product-title { font-size: var(--wp--preset--font-size--xx-large); }
.t4-product-type-utilities .t4-product-title,
.t4-product-type-service-programs .t4-product-title { font-family: var(--wp--preset--font-family--mono); letter-spacing: -0.01em; }

@media (min-width: 782px) {
	.t4-sticky { position: sticky; top: 6rem; }
}
/* On phones the download box comes before the description. */
@media (max-width: 781px) {
	.t4-product-body .wp-block-columns > .wp-block-column:last-child { order: -1; }
}
.t4-product-body > .wp-block-post-content > :first-child { margin-top: 0; }
.t4-product-body .wp-block-post-content h2 { margin-top: 2.5rem; font-size: var(--wp--preset--font-size--large); }
.t4-product-body .wp-block-post-content ul { padding-left: 1.2rem; }
.t4-product-body .wp-block-post-content li { margin: 0.35rem 0; }
.t4-product-body .wp-block-post-content li::marker { color: var(--wp--preset--color--primary); }
.t4-product-body .wp-block-image img { border: 1px solid var(--wp--preset--color--line); border-radius: 10px; }

/* ------------------------------------------------------------------ Footer */
.t4-footer { border-top: 1px solid var(--wp--preset--color--line); background: var(--wp--preset--color--surface); color: var(--wp--preset--color--muted); }
.t4-footer a { color: var(--wp--preset--color--ink); text-decoration: none; }
.t4-footer a:hover { color: var(--wp--preset--color--primary); text-decoration: underline; }
.t4-footer h2 { margin: 0 0 0.75rem; color: var(--wp--preset--color--ink); font-family: var(--wp--preset--font-family--mono); font-size: var(--wp--preset--font-size--x-small); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.t4-footer ul { margin: 0; padding: 0; list-style: none; }
.t4-footer li { margin: 0.35rem 0; font-size: var(--wp--preset--font-size--small); }
.t4-footer a.t4-brand:hover { color: var(--wp--preset--color--ink); text-decoration: none; }
.t4-footer__bottom { border-top: 1px solid var(--wp--preset--color--line); font-size: var(--wp--preset--font-size--x-small); }
.t4-ukraine { display: inline-flex; gap: 0.4rem; align-items: center; }
.t4-ukraine::before { content: ""; width: 16px; height: 11px; border-radius: 2px; background: linear-gradient(#0057b7 50%, #ffd700 50%); }

/* ------------------------------------------------------------------ Misc */
.t4-404 { font-family: var(--wp--preset--font-family--mono); }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.t4-type { transition: none; }
	.t4-type:hover { transform: none; }
	.t4-terminal .t-cursor { animation: none; }
}
