/*
Theme Name:        Retro Computing
Theme URI:         https://www.teodoropiccinni.com
Author:            Teodoro Piccinni
Author URI:        https://www.teodoropiccinni.com
Description:       A retro desktop block theme with Windows 95-style icons (Chicago95). Pages open as windows, the home page is a desktop of icons, the blog is a file explorer. Works without JavaScript; light and dark mode follow the system.
Version:           0.13.0
Requires at least: 6.6
Tested up to:      7.1
Requires PHP:      7.4
License:           GPL-3.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-3.0.html
Text Domain:       tp_retro_computing
Tags:              block-theme, full-site-editing, blog, portfolio, dark-mode
*/

/* ---------------------------------------------------------------------------
   Tokens. Palette lives in theme.json; dark mode swaps the same presets so
   every block colour follows automatically.
--------------------------------------------------------------------------- */
:root {
	--sc-border: 2px solid var(--wp--preset--color--ink);
	--sc-radius: 6px;
	--sc-shadow: 6px 6px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
	--sc-bar-h: 2.5rem;
	/* Text on the primary colour (brand "on-primary"). */
	--sc-on-primary: #FFFFFF;
	/* Window controls: light boxes, ink glyphs, on both themes. */
	--sc-control: #EDF0F4;
}

/* Dark theme: brand dark tokens (design-system.html, "Web token block"). */
@media (prefers-color-scheme: dark) {
	:root {
		--wp--preset--color--desk: #090B0D;
		--wp--preset--color--surface: #1C2024;
		--wp--preset--color--muted: #31363B;
		--wp--preset--color--ink: #EDF0F4;
		--wp--preset--color--ink-soft: #A0A5AB;
		--wp--preset--color--primary: #82B0C0;
		--wp--preset--color--primary-hover: #A7C7D2;
		--wp--preset--color--accent: #EC8682;
		--wp--preset--color--link: #A7C7D2;
		--wp--preset--color--focus: #82B0C0;
		--wp--preset--color--divider: #31363B;
		--sc-on-primary: #0F1215;
		--sc-shadow-color: #000;
			color-scheme: dark;
	}
}

/* ---------------------------------------------------------------------------
   Desk: dotted background, full height, footer pinned to the bottom.
--------------------------------------------------------------------------- */
/* The background colour and the default dot pattern come from theme.json
   (styles.background), so both can be changed in Appearance > Editor >
   Styles > Background without touching this file. */
body {
	-webkit-font-smoothing: antialiased;
}

.wp-site-blocks {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks > main {
	flex: 1;
}

::selection {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

a:where(:not(.wp-element-button)):hover {
	color: var(--sc-on-primary);
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	color: var(--sc-on-primary);
}

:focus-visible {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}

.screen-reader-text:focus {
	background: var(--wp--preset--color--surface);
	clip-path: none;
	color: var(--wp--preset--color--ink);
	display: block;
	height: auto;
	left: 0.5rem;
	padding: 0.75rem 1rem;
	top: 0.5rem;
	width: auto;
	z-index: 100000;
}

/* ---------------------------------------------------------------------------
   Menu bar (header part)
--------------------------------------------------------------------------- */
/* Sticky on the header wrapper (the template part), not on the bar inside
   it: the wrapper is exactly as tall as the bar, so a sticky child could
   never move. Mirrors the taskbar footer. */
.wp-site-blocks > header {
	position: sticky;
	top: 0;
	z-index: 60;
}

.admin-bar .wp-site-blocks > header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .wp-site-blocks > header {
		top: 0;
	}
}

.sc-menubar {
	position: relative;
	z-index: 50;
	min-height: var(--sc-bar-h);
	background: var(--wp--preset--color--surface);
	border-bottom: var(--sc-border);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
}

/* Brand mark (patterns/site-brand.php): 28 px tall, clear space around it. */
.sc-menubar .sc-brand {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	padding: 4px;
	margin-right: 0.25rem;
	border-radius: 3px;
	background: none;
	line-height: 0;
}

.sc-menubar .sc-brand img {
	display: block;
	width: auto;
	height: 28px;
}

.sc-menubar .sc-brand:hover {
	background: var(--wp--preset--color--muted);
}

/* Menu bar navigation (patterns/menubar-nav.php): classic menu, pull-downs. */
.sc-menubar__nav {
	min-width: 0;
}

.sc-menubar__list,
.sc-menubar__list .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sc-menubar__list {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.25rem;
}

.sc-menubar__list li {
	position: relative;
}

.sc-menubar__list a {
	display: block;
	padding: 0.35rem 0.6rem;
	border-radius: 3px;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	white-space: nowrap;
	background: none;
}

.sc-menubar__list > .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	margin-left: 0.4rem;
	vertical-align: 0.15em;
	border: 4px solid transparent;
	border-top: 5px solid currentColor;
	border-bottom: 0;
}

.sc-menubar__list li:hover > a,
.sc-menubar__list li:focus-within > a,
.sc-menubar__list .current-menu-item > a,
.sc-menubar__list .current-menu-ancestor > a,
.sc-menubar__list .current-page-ancestor > a {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

/* Pull-down menus, like classic desktop menus. */
.sc-menubar__list .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 55;
	min-width: 14rem;
	padding: 0.25rem;
	background: var(--wp--preset--color--surface);
	border: var(--sc-border);
	border-radius: 0 0 var(--sc-radius) var(--sc-radius);
	box-shadow: 4px 4px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
}

.sc-menubar__list li:hover > .sub-menu,
.sc-menubar__list li:focus-within > .sub-menu {
	display: block;
}

/* Small screens: the Start menu carries the same items. */
@media (max-width: 782px) {
	.sc-menubar__nav {
		display: none;
	}
}

.sc-clock {
	font-variant-numeric: tabular-nums;
	min-width: 3.2rem;
	text-align: right;
}

.sc-lang ul {
	display: flex;
	gap: 0.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.sc-lang a {
	display: inline-block;
	padding: 0.15rem 0.4rem;
	border: var(--sc-border);
	border-radius: 3px;
	color: inherit;
	text-decoration: none;
	text-transform: uppercase;
}

.sc-lang .current-lang a {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

/* ---------------------------------------------------------------------------
   Window (block style "Window" on core/group)
   Markup: group.is-style-window > group.sc-window__bar + group.sc-window__body
--------------------------------------------------------------------------- */
.is-style-window {
	background: var(--wp--preset--color--surface);
	border: var(--sc-border);
	border-radius: var(--sc-radius);
	box-shadow: var(--sc-shadow);
	overflow: hidden;
	padding: 0 !important;
}

/* Window parts sit flush: no block gap between bar, toolbar, body, status. */
.is-style-window > *,
.sc-explorer > * {
	margin-block: 0 !important;
}

.sc-window__toolbar .wp-block-search__inside-wrapper {
	max-width: 28rem;
}

.is-style-window > .sc-window__bar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0;
	padding: 0.4rem 0.75rem;
	min-height: 2.25rem;
	background-color: var(--wp--preset--color--primary);
	background-image: repeating-linear-gradient(
		to bottom,
		transparent 0 3px,
		color-mix(in srgb, var(--sc-on-primary) 22%, transparent) 3px 4px
	);
	border-bottom: var(--sc-border);
	color: var(--sc-on-primary);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

/* Title sits on a solid patch over the stripes, like old title bars. */
.is-style-window > .sc-window__bar > * {
	margin: 0 !important;
	background: var(--wp--preset--color--primary);
	padding: 0 0.4rem;
	font: inherit;
	color: inherit;
	letter-spacing: 0;
	line-height: 1.4;
}

.is-style-window > .sc-window__bar a {
	color: inherit;
	text-decoration: none;
}

/* Decorative window controls (minimise, maximise, close): one inline SVG,
   CSS only, so they never reach the markup or screen readers. */
.is-style-window > .sc-window__bar::after {
	content: "";
	margin-left: auto;
	flex: 0 0 auto;
	width: 58px;
	height: 16px;
	background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='58' height='16' viewBox='0 0 58 16' shape-rendering='crispEdges'><g fill='%23EDF0F4' stroke='%230F1215' stroke-width='2'><rect x='1' y='1' width='16' height='14'/><rect x='21' y='1' width='16' height='14'/><rect x='41' y='1' width='16' height='14'/></g><g fill='none' stroke='%230F1215' stroke-width='2'><path d='M5 11h8'/><rect x='25' y='4' width='8' height='7'/><path d='M45 4l8 8M53 4l-8 8'/></g></svg>") no-repeat;
}

/* Working window buttons (added by assets/js/theme.js). With JavaScript the
   decorative drawing above is replaced by real buttons. */
.sc-js .is-style-window > .sc-window__bar::after {
	display: none;
}

.is-style-window > .sc-window__bar > .sc-window__controls {
	display: flex;
	gap: 4px;
	margin-left: auto !important;
	padding: 0;
	background: none;
	flex: 0 0 auto;
}

.sc-ctl {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 18px;
	padding: 0;
	border: 2px solid #0F1215;
	border-radius: 2px;
	background: var(--sc-control);
	color: #0F1215;
	cursor: pointer;
	line-height: 0;
	box-shadow: inset -1px -1px 0 rgba(15, 18, 21, 0.25);
}

.sc-ctl svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	shape-rendering: crispEdges;
}

/* The title-bar link colour (on-primary) must not reach the close glyph. */
.is-style-window > .sc-window__bar a.sc-ctl,
.is-style-window > .sc-window__bar a.sc-ctl:hover {
	color: #0F1215;
}

.is-style-window > .sc-window__bar .sc-ctl:hover {
	background: #FFFFFF;
	color: #0F1215;
}

.sc-ctl:active {
	box-shadow: inset 1px 1px 0 rgba(15, 18, 21, 0.35);
	transform: translate(1px, 1px);
}

.sc-ctl:focus-visible {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 1px;
}

/* Double-clicking the title bar maximises: no text selection there. */
.sc-js .is-style-window > .sc-window__bar {
	user-select: none;
}

/* Minimise: shrink towards the taskbar, then hide (hidden attribute). */
.is-style-window {
	transition: transform 0.18s ease-in, opacity 0.18s ease-in;
}

.is-style-window.is-minimizing {
	transform: translate(-20%, 40vh) scale(0.1);
	transform-origin: bottom left;
	opacity: 0;
}

.is-style-window[hidden] {
	display: none !important;
}

/* Maximise: fill the space between the menu bar and the taskbar. */
.is-style-window.is-maximized {
	position: fixed;
	top: var(--sc-max-top, 0);
	bottom: var(--sc-max-bottom, 0);
	left: 0;
	right: 0;
	z-index: 45;
	display: flex;
	flex-direction: column;
	max-width: none !important;
	margin: 0 !important;
	border-radius: 0;
	box-shadow: none;
	transition: none;
}

.is-style-window.is-maximized > .sc-window__body,
.is-style-window.is-maximized > .sc-explorer {
	flex: 1 1 auto;
	overflow: auto;
}

.is-style-window.is-maximized > .sc-window__bar,
.is-style-window.is-maximized > .sc-window__toolbar,
.is-style-window.is-maximized > .sc-window__status {
	flex: 0 0 auto;
}

.sc-has-maximized body {
	overflow: hidden;
}

.is-style-window > .sc-window__body {
	margin: 0 !important;
	padding: var(--wp--preset--spacing--40);
}

/* A window whose content is a terminal: the console fills the body, edge to
   edge, with the same black background (no white frame around it). */
.is-style-window > .sc-window__body:has(.is-style-terminal) {
	padding: 0;
	background: #000;
}

.sc-window__body:has(.is-style-terminal) > *,
.sc-window__body:has(.is-style-terminal) .wp-block-post-content > .is-style-terminal {
	max-width: none !important;
	margin: 0 !important;
}

.sc-window__body:has(.is-style-terminal) .wp-block-post-content > .is-style-terminal {
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: var(--wp--preset--spacing--40);
}

@media (max-width: 600px) {
	.sc-window__body:has(.is-style-terminal) .wp-block-post-content > .is-style-terminal {
		padding: var(--wp--preset--spacing--20);
	}
}

/* Template "Console (terminal window)" (templates/page-console.html): the
   window body is the terminal. A Terminal group inside the content is
   flattened into it, so both ways of building the page look the same. */
.is-style-window > .sc-window__body.sc-console,
.is-style-window > .sc-window__body.sc-console:has(.is-style-terminal) {
	padding: var(--wp--preset--spacing--40);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: #000;
}

.sc-console .wp-block-post-content > * {
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.sc-window__body.sc-console .wp-block-post-content > .is-style-terminal {
	padding: 0;
	border: 0;
	box-shadow: none;
	background: transparent;
}

@media (max-width: 600px) {
	.is-style-window > .sc-window__body.sc-console,
	.is-style-window > .sc-window__body.sc-console:has(.is-style-terminal) {
		padding: var(--wp--preset--spacing--20);
	}
}

.is-style-window.is-maximized > .sc-window__body:has(.is-style-terminal) .wp-block-post-content,
.is-style-window.is-maximized > .sc-window__body:has(.is-style-terminal) .is-style-terminal {
	min-height: 100%;
}

.is-style-window > .sc-window__status {
	margin: 0 !important;
	padding: 0.35rem 0.75rem;
	border-top: var(--sc-border);
	background: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-soft);
}

/* Inactive window: grey title bar (secondary windows, sidebars, dialogs). */
.is-style-window.sc-window--inactive > .sc-window__bar,
.is-style-window.sc-window--inactive > .sc-window__bar > * {
	background-color: var(--wp--preset--color--muted);
	color: var(--wp--preset--color--ink);
}

.is-style-window.sc-window--inactive > .sc-window__bar {
	background-image: none;
}

.is-style-window.sc-window--inactive > .sc-window__bar::after {
	display: none;
}

/* Dialog: a small centred window (404, confirmations). */
.sc-dialog {
	max-width: 34rem;
	margin-inline: auto !important;
}

/* Dialog icon: fixed 64 x 64, never squeezed by the text next to it. */
.sc-dialog .sc-window__body > .wp-block-image {
	flex: 0 0 64px;
	width: 64px;
	margin: 0;
}

.sc-dialog .sc-window__body > .wp-block-image img {
	width: 64px !important;
	height: 64px !important;
	max-width: none;
	image-rendering: pixelated;
}

.sc-dialog .sc-window__body > .wp-block-group {
	flex: 1 1 auto;
	min-width: 0;
}

/* Featured image as a framed screenshot inside the window. */
.is-style-window .wp-block-post-featured-image img {
	border: var(--sc-border);
	border-radius: 4px;
}

/* ---------------------------------------------------------------------------
   Desktop icons (block style "Desktop icons" on core/group)
   Markup: group.is-style-desktop-icons > figure.wp-block-image (linked) with caption
--------------------------------------------------------------------------- */
.is-style-desktop-icons {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
	gap: var(--wp--preset--spacing--20) !important;
	align-items: start;
}

.is-style-desktop-icons > .wp-block-image {
	position: relative;
	margin: 0 !important;
	text-align: center;
}

/* Icon + label are one click target (the caption sits outside the link). */
.is-style-desktop-icons > .wp-block-image a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.is-style-desktop-icons > .wp-block-image a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.25rem;
	border-radius: 4px;
	text-decoration: none;
	color: var(--wp--preset--color--ink);
	background: none;
}

.is-style-desktop-icons > .wp-block-image img {
	width: 64px;
	height: 64px;
	image-rendering: pixelated;
	filter: drop-shadow(2px 2px 0 color-mix(in srgb, var(--wp--preset--color--ink) 35%, transparent));
}

.is-style-desktop-icons > .wp-block-image figcaption,
.is-style-desktop-icons > .wp-block-image .wp-element-caption {
	margin: 0.4rem auto 0;
	padding: 0.1rem 0.4rem;
	width: fit-content;
	background: var(--wp--preset--color--surface);
	border-radius: 2px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink);
}

.is-style-desktop-icons > .wp-block-image:hover figcaption,
.is-style-desktop-icons > .wp-block-image:focus-within figcaption {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

.is-style-desktop-icons > .wp-block-image:focus-within img {
	outline: 2px dotted var(--wp--preset--color--ink);
	outline-offset: 4px;
}

/* ---------------------------------------------------------------------------
   File explorer list (posts query, class "sc-explorer")
--------------------------------------------------------------------------- */
.sc-explorer .sc-explorer__head,
.sc-explorer .wp-block-post-template > li {
	display: grid;
	grid-template-columns: 1.5rem minmax(0, 1fr) 9rem 9rem;
	gap: 0.75rem;
	align-items: baseline;
	padding: 0.55rem 0.75rem;
	margin: 0;
}

.sc-explorer .sc-explorer__head {
	border-bottom: var(--sc-border);
	background: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.sc-explorer .sc-explorer__head > * {
	margin: 0;
}

.sc-explorer .wp-block-post-template {
	margin: 0;
	padding: 0;
}

.sc-explorer .wp-block-post-template > li {
	border-bottom: 1px dashed color-mix(in srgb, var(--wp--preset--color--ink) 30%, transparent);
}

.sc-explorer .wp-block-post-template > li > * {
	margin: 0 !important;
}

.sc-explorer .wp-block-post-template > li::before {
	content: "";
	width: 16px;
	height: 16px;
	align-self: center;
	background: url("assets/icons/file-16.png") center / contain no-repeat;
	image-rendering: pixelated;
}

.sc-explorer .wp-block-post-template > li:hover,
.sc-explorer .wp-block-post-template > li:focus-within {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

.sc-explorer .wp-block-post-template > li:hover a,
.sc-explorer .wp-block-post-template > li:focus-within a,
.sc-explorer .wp-block-post-template > li:hover .wp-block-post-date {
	color: var(--sc-on-primary);
	background: none;
}

.sc-explorer .wp-block-post-title {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
}

.sc-explorer .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--ink);
}

.sc-explorer .wp-block-post-title a::after {
	/* Whole row is clickable. */
	content: "";
	position: absolute;
	inset: 0;
}

.sc-explorer .wp-block-post-template > li {
	position: relative;
}

.sc-explorer .wp-block-post-terms a {
	position: relative;
	z-index: 1;
}

.sc-explorer .wp-block-query-pagination {
	padding: 0.75rem;
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
}

@media (max-width: 700px) {
	.sc-explorer .sc-explorer__head {
		display: none;
	}

	.sc-explorer .wp-block-post-template > li {
		grid-template-columns: 1.5rem minmax(0, 1fr);
	}

	.sc-explorer .wp-block-post-template > li > .wp-block-post-date,
	.sc-explorer .wp-block-post-template > li > .wp-block-post-terms {
		grid-column: 2;
	}
}

/* ---------------------------------------------------------------------------
   Taskbar (footer part)
--------------------------------------------------------------------------- */
/* Always visible: the footer sticks to the bottom of the viewport. */
.wp-site-blocks > footer {
	position: sticky;
	bottom: 0;
	z-index: 50;
}

.sc-taskbar {
	background: var(--wp--preset--color--surface);
	border-top: var(--sc-border);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
	white-space: nowrap;
}

/* Taskbar never wraps; the open-window buttons shrink instead. */
.sc-taskbar,
.sc-taskbar .wp-block-group {
	flex-wrap: nowrap !important;
}

/* ---------------------------------------------------------------------------
   Open windows = breadcrumb (patterns/taskbar-windows.php)
--------------------------------------------------------------------------- */
.sc-tasks {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0 !important;
}

.sc-tasks ol {
	display: flex;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sc-tasks li {
	flex: 0 1 12rem;
	min-width: 2.25rem;
}

.sc-task {
	--sc-hi: var(--wp--preset--color--surface);
	--sc-lo: color-mix(in srgb, var(--wp--preset--color--ink) 55%, transparent);
	display: flex;
	align-items: center;
	gap: 0.4rem;
	box-sizing: border-box;
	height: 2.1rem;
	padding: 0.15rem 0.5rem;
	border: 2px solid;
	border-color: var(--sc-hi) var(--sc-lo) var(--sc-lo) var(--sc-hi);
	border-radius: 2px;
	background: var(--wp--preset--color--muted);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	box-shadow: 1px 1px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
}

.sc-taskbar a.sc-task:hover {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

.sc-task img {
	flex: 0 0 16px;
	image-rendering: pixelated;
}

.sc-task span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Current window: pressed in, checkered like a held-down taskbar button. */
.sc-task.is-active {
	border-color: var(--sc-lo) var(--sc-hi) var(--sc-hi) var(--sc-lo);
	box-shadow: none;
	font-weight: 600;
	background-color: var(--wp--preset--color--surface);
	background-image: repeating-conic-gradient(color-mix(in srgb, var(--wp--preset--color--ink) 8%, transparent) 0 25%, transparent 0 50%);
	background-size: 4px 4px;
}

/* Desktop button: icon only, then a groove separator (Quick Launch style). */
.sc-tasks li.sc-tasks__desktop {
	flex: 0 0 auto;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.sc-tasks__desktop .sc-task {
	justify-content: center;
	width: 2.25rem;
	padding: 0.15rem;
}

.sc-tasks__desktop::after {
	align-self: stretch;
}

.sc-tasks__desktop::after {
	content: "";
	flex: 0 0 auto;
	width: 0;
	margin: 0.1rem 0.15rem;
	border-left: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 45%, transparent);
	border-right: 1px solid var(--wp--preset--color--surface);
}

.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

/* The current page's button restores minimised windows: pointer, and it
   pops out (not pressed) while its windows are minimised. */
.sc-js .sc-task.is-active {
	cursor: pointer;
}

.sc-task.is-active.is-minimized {
	border-color: var(--sc-hi) var(--sc-lo) var(--sc-lo) var(--sc-hi);
	background-image: none;
	background-color: var(--wp--preset--color--muted);
	box-shadow: 1px 1px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
	font-weight: 400;
}

.sc-task.is-active:focus-visible {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 1px;
}

/* Small screens: earlier windows show only their icon. */
@media (max-width: 782px) {
	.sc-tasks li {
		flex: 0 0 auto;
	}

	.sc-tasks li:last-child {
		flex: 0 1 auto;
		min-width: 0;
	}

	.sc-tasks li:not(:last-child) .sc-task span {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}
}

/* Tray in the top bar (language + date/time): pushed to the right. */
.sc-menubar > .sc-tray {
	margin-left: auto !important;
	flex: 0 0 auto;
}

/* Company info (patterns/taskbar-company.php), bottom right of the taskbar. */
.sc-company {
	flex: 0 1 auto;
	min-width: 0;
	margin: 0 0 0 auto !important;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--wp--preset--color--ink-soft);
	font-size: 0.8125rem;
}

.sc-company__name {
	color: var(--wp--preset--color--ink);
	font-weight: 600;
}

@media (max-width: 782px) {
	.sc-company__vat,
	.sc-company__address,
	.sc-company__sep {
		display: none;
	}
}

@media (max-width: 480px) {
	.sc-company {
		display: none;
	}
}

/* Tray: language switcher + date/time in a sunken box. */
.sc-tray {
	padding: 0.15rem 0.6rem;
	border: 2px solid;
	border-color: color-mix(in srgb, var(--wp--preset--color--ink) 45%, transparent) var(--wp--preset--color--surface) var(--wp--preset--color--surface) color-mix(in srgb, var(--wp--preset--color--ink) 45%, transparent);
	background: var(--wp--preset--color--muted);
	border-radius: 2px;
}

.sc-tray .sc-lang a {
	padding: 0 0.3rem;
	border-width: 1px;
}

.sc-tray .sc-clock {
	min-width: 0;
	white-space: nowrap;
}

.sc-taskbar a {
	color: inherit;
}

/* ---------------------------------------------------------------------------
   Start button + start menu (patterns/taskbar-start.php)
   <details class="sc-start"><summary/> <div class="sc-start__menu">…
   The menu is positioned against the sticky footer and opens upwards.
--------------------------------------------------------------------------- */
.sc-taskbar .sc-taskbar__start {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	height: 2.1rem;
	gap: 0.5rem;
	padding: 0.2rem 0.65rem;
	border: var(--sc-border);
	border-radius: 3px;
	box-shadow: 2px 2px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
	font-weight: 600;
	margin: 0;
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.sc-taskbar .sc-taskbar__start::-webkit-details-marker {
	display: none;
}

.sc-taskbar__start img {
	image-rendering: pixelated;
}

.sc-start[open] > .sc-taskbar__start {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
	box-shadow: inset 2px 2px 0 var(--sc-shadow-color, #000);
	transform: translate(1px, 1px);
}

.sc-start__menu {
	position: absolute;
	bottom: calc(100% - 2px);
	left: var(--wp--preset--spacing--20);
	z-index: 60;
	display: flex;
	min-width: 17rem;
	max-width: calc(100vw - 2rem);
	max-height: calc(100vh - 6rem);
	background: var(--wp--preset--color--surface);
	border: var(--sc-border);
	border-radius: var(--sc-radius) var(--sc-radius) 0 0;
	box-shadow: var(--sc-shadow);
	white-space: normal;
	font-size: var(--wp--preset--font-size--medium);
}

/* Vertical band with the site name, read bottom to top. */
.sc-start__banner {
	flex: 0 0 2.25rem;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	padding: 0.75rem 0;
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
	font-weight: 600;
	font-size: 1.05rem;
	letter-spacing: 0.08em;
	text-align: left;
	overflow: hidden;
	border-radius: 0 var(--sc-radius) 0 0;
}

.sc-start__nav {
	flex: 1;
	min-width: 0;
	padding: 0.25rem;
	overflow-y: auto;
}

.sc-start__list,
.sc-start__list ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sc-start__list--system {
	margin-top: 0.25rem;
	padding-top: 0.25rem;
	border-top: 2px groove color-mix(in srgb, var(--wp--preset--color--ink) 35%, transparent);
}

.sc-start__list li {
	position: relative;
}

.sc-start__list a {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.45rem 2rem 0.45rem 0.5rem;
	border-radius: 3px;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	background: none;
}

/* Item icon: document by default, folder when it has sub-items. */
.sc-start__list a::before {
	content: "";
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	background: url("assets/icons/articles.png") center / 32px 32px no-repeat;
	image-rendering: pixelated;
}

.sc-start__list .menu-item-has-children > a::before { background-image: url("assets/icons/works.png"); }
.sc-start__list .sc-icon-about > a::before { background-image: url("assets/icons/about.png"); }
.sc-start__list .sc-icon-services > a::before { background-image: url("assets/icons/services.png"); }
.sc-start__list .sc-icon-works > a::before { background-image: url("assets/icons/works.png"); }
.sc-start__list .sc-icon-articles > a::before { background-image: url("assets/icons/articles.png"); }
.sc-start__list .sc-icon-contacts > a::before { background-image: url("assets/icons/contacts.png"); }
.sc-start__list .sc-icon-computer > a::before { background-image: url("assets/icons/computer.png"); }
.sc-start__list .sc-icon-search > a::before { background-image: url("assets/icons/search.png"); }

/* Arrow on items with sub-items. */
.sc-start__list .menu-item-has-children > a::after {
	content: "";
	position: absolute;
	right: 0.6rem;
	border: 5px solid transparent;
	border-left: 6px solid currentColor;
	border-right: 0;
}

.sc-start__list li:hover > a,
.sc-start__list li:focus-within > a,
.sc-start__list .current-menu-item > a {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

/* Sub-menus: smaller icons, fly out to the right on wide screens. */
.sc-start__list .sub-menu a {
	padding-top: 0.3rem;
	padding-bottom: 0.3rem;
	font-size: var(--wp--preset--font-size--small);
}

.sc-start__list .sub-menu a::before {
	flex-basis: 16px;
	width: 16px;
	height: 16px;
	background-size: 16px 16px;
}

@media (min-width: 783px) {
	.sc-start__menu {
		overflow: visible;
	}

	.sc-start__nav {
		overflow: visible;
	}

	.sc-start__list .sub-menu {
		display: none;
		position: absolute;
		left: calc(100% + 2px);
		bottom: -0.3rem;
		min-width: 15rem;
		padding: 0.25rem;
		background: var(--wp--preset--color--surface);
		border: var(--sc-border);
		border-radius: 3px;
		box-shadow: 4px 4px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
	}

	.sc-start__list li:hover > .sub-menu,
	.sc-start__list li:focus-within > .sub-menu {
		display: block;
	}
}

/* Narrow screens: sub-items listed under their parent, indented. */
@media (max-width: 782px) {
	.sc-start__list .sub-menu {
		padding-left: 1.25rem;
	}

	.sc-start__list .menu-item-has-children > a::after {
		transform: rotate(90deg);
	}
}

/* ---------------------------------------------------------------------------
   Content details
--------------------------------------------------------------------------- */
.sc-window__body .wp-block-post-content > * + h2 {
	margin-top: 2.5rem;
}

.wp-block-image img {
	border-radius: 4px;
}

.wp-block-table table {
	border-collapse: collapse;
}

.wp-block-table th,
.wp-block-table td {
	border: 1px solid var(--wp--preset--color--ink);
	padding: 0.4rem 0.6rem;
}

.wp-block-table thead {
	background: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	border-bottom: var(--sc-border);
}

/* Forms (Contact Form 7, search) */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
	font: inherit;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--surface);
	border: var(--sc-border);
	border-radius: 3px;
	padding: 0.5rem 0.65rem;
	box-shadow: inset 2px 2px 0 color-mix(in srgb, var(--wp--preset--color--ink) 12%, transparent);
	max-width: 100%;
}

input[type="submit"],
button:not(.wp-block-navigation__responsive-container-open):not(.wp-block-navigation__responsive-container-close):not(.wp-block-navigation-submenu__toggle) {
	font-family: var(--wp--preset--font-family--mono);
	font-weight: 600;
	cursor: pointer;
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--ink);
	border: var(--sc-border);
	box-shadow: none;
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--wp--preset--color--primary);
	color: var(--sc-on-primary);
}

/* Press effect on buttons */
.wp-element-button:active,
.wp-block-button__link:active {
	transform: translate(2px, 2px);
	box-shadow: 1px 1px 0 var(--wp--preset--color--ink);
}

/* ---------------------------------------------------------------------------
   Old articles notice (functions.php, scrivania_old_post_notice): a small
   warning box above the text of articles older than N months.
   --------------------------------------------------------------------------- */
.sc-old-post {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin: var(--wp--preset--spacing--30) 0 var(--wp--preset--spacing--40);
	padding: 0.75rem 1rem;
	background: color-mix(in srgb, var(--wp--preset--color--accent) 9%, var(--wp--preset--color--surface));
	color: var(--wp--preset--color--ink);
	border: var(--sc-border);
	border-left: 6px solid var(--wp--preset--color--accent);
	border-radius: 3px;
	box-shadow: 3px 3px 0 var(--sc-shadow-color, var(--wp--preset--color--ink));
	font-size: var(--wp--preset--font-size--small);
}

.sc-old-post p {
	margin: 0;
}

.sc-old-post__icon {
	flex: 0 0 auto;
	display: inline-grid;
	place-items: center;
	width: 1.6rem;
	height: 1.6rem;
	background: var(--wp--preset--color--accent);
	color: #FFFFFF;
	border: 2px solid var(--wp--preset--color--ink);
	border-radius: 50%;
	font-family: var(--wp--preset--font-family--mono);
	font-weight: 700;
	line-height: 1;
}

/* ---------------------------------------------------------------------------
   Terminal (block style "Terminal" on core/group, patterns/terminal-contact.php)
   Black screen, white monospace text. Holds a boot text (preformatted,
   .sc-terminal__boot) and a Jetpack contact form whose fields render as
   prompts: "> Name: ____". Same colours in light and dark mode.
   --------------------------------------------------------------------------- */
.is-style-terminal {
	--sc-term-bg: #000;
	--sc-term-fg: #F2F2F2;
	--sc-term-dim: #A7ADB3;
	background: var(--sc-term-bg);
	color: var(--sc-term-fg);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.95rem;
	line-height: 1.6;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--30);
	border: var(--sc-border);
	border-radius: 3px;
	box-shadow: inset 0 0 0 2px #2A2F35;
}

.is-style-terminal ::selection {
	background: var(--sc-term-fg);
	color: var(--sc-term-bg);
}

.is-style-terminal a {
	color: var(--sc-term-fg);
	text-decoration: underline;
}

.is-style-terminal a:focus-visible,
.is-style-terminal :focus-visible {
	outline: 2px dashed var(--sc-term-fg);
	outline-offset: 2px;
}

/* Boot text: preformatted, no box of its own. */
.is-style-terminal .sc-terminal__boot,
.is-style-terminal pre {
	margin: 0 0 1rem;
	padding: 0;
	background: transparent;
	color: inherit;
	border: 0;
	font: inherit;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* Typing effect (theme.js): lines appear one by one, then the form. */
.sc-js .is-style-terminal.is-booting .jetpack-contact-form-container,
.sc-js .is-style-terminal.is-booting .wp-block-jetpack-contact-form,
.sc-js .is-style-terminal.is-booting .contact-form {
	visibility: hidden;
}

/* One line at a time (theme.js): hidden lines, and a short typed-out
   reveal for each new one. */
.is-style-terminal .sc-step-hidden {
	display: none !important;
}

.is-style-terminal .sc-step-in {
	animation: sc-line-in 0.35s steps(8, end);
}

@keyframes sc-line-in {
	from {
		clip-path: inset(0 100% 0 0);
	}
	to {
		clip-path: inset(0 0 0 0);
	}
}

.sc-terminal__cursor {
	display: inline-block;
	width: 0.6em;
	height: 1.1em;
	vertical-align: text-bottom;
	background: var(--sc-term-fg);
	animation: sc-blink 1s steps(1) infinite;
}

@keyframes sc-blink {
	50% {
		opacity: 0;
	}
}

/* Jetpack form inside the terminal: plain prompts, no boxes. */
.is-style-terminal form,
.is-style-terminal .wp-block-jetpack-contact-form {
	display: flex;
	flex-flow: row wrap;
	align-items: baseline;
	gap: 0.9rem 1.5ch;
	padding: 0;
	margin: 0;
	background: transparent;
	color: inherit;
}

.is-style-terminal .grunion-field-wrap,
.is-style-terminal .grunion-field-wrap * {
	font-family: inherit;
	color: inherit;
}

.is-style-terminal .grunion-field-wrap {
	margin: 0;
	padding: 0;
	width: 100%;
	flex: 0 0 100%;
}

/* One-line prompts: "> Name (required) ________". The message box and the
   privacy checkbox keep their own layout. */
.is-style-terminal .grunion-field-wrap:not(.grunion-field-textarea-wrap):not(.grunion-field-checkbox-wrap):not(.grunion-field-consent-wrap) {
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: baseline;
	column-gap: 1ch;
}

.is-style-terminal .grunion-field-wrap > :not(label):not(input) {
	grid-column: 1 / -1;
}

@media (max-width: 600px) {
	.is-style-terminal {
		padding: var(--wp--preset--spacing--20);
		font-size: 0.9rem;
	}

	.is-style-terminal .grunion-field-wrap:not(.grunion-field-textarea-wrap):not(.grunion-field-checkbox-wrap):not(.grunion-field-consent-wrap) {
		grid-template-columns: minmax(0, 1fr);
	}
}

.is-style-terminal form {
	display: block;
}

.is-style-terminal .wp-block-jetpack-contact-form {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.is-style-terminal .grunion-field-wrap {
	min-width: 0;
}

.is-style-terminal .grunion-field-label:not(.checkbox):not(.consent) {
	display: block;
	margin: 0 0 0.15rem;
	font-weight: 400;
	font-size: inherit;
	line-height: inherit;
}

@media (min-width: 601px) {
	.is-style-terminal .grunion-field-label:not(.checkbox):not(.consent) {
		white-space: nowrap;
	}
}

.is-style-terminal .grunion-field-label:not(.checkbox):not(.consent)::before {
	content: "> ";
	color: var(--sc-term-dim);
}

.is-style-terminal .grunion-field-label::after {
	content: none;
}

.is-style-terminal .grunion-label-required {
	color: var(--sc-term-dim);
	font-size: 0.85em;
	margin-left: 0.4em;
}

.is-style-terminal input[type="text"],
.is-style-terminal input[type="email"],
.is-style-terminal input[type="url"],
.is-style-terminal input[type="tel"],
.is-style-terminal textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 0.2rem 0 0.2rem 1.3ch;
	background: transparent;
	color: var(--sc-term-fg);
	caret-color: var(--sc-term-fg);
	border: 0;
	border-bottom: 1px dashed var(--sc-term-dim);
	border-radius: 0;
	box-shadow: none;
	font: inherit;
}

.is-style-terminal textarea {
	min-height: 8rem;
	resize: vertical;
	border: 1px dashed var(--sc-term-dim);
	padding: 0.4rem 0.6rem;
}

.is-style-terminal input:focus,
.is-style-terminal textarea:focus {
	outline: none;
	border-color: var(--sc-term-fg);
	border-style: solid;
	background: #0D0F11;
}

.is-style-terminal ::placeholder {
	color: var(--sc-term-dim);
	opacity: 1;
}

/* Privacy checkbox: drawn as [ ] / [x]. */
.is-style-terminal .contact-form__checkbox-wrap {
	display: flex;
	align-items: baseline;
	gap: 1ch;
}

.is-style-terminal input[type="checkbox"] {
	appearance: none;
	flex: 0 0 auto;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--sc-term-fg);
	font: inherit;
	cursor: pointer;
}

.is-style-terminal input[type="checkbox"]::before {
	content: "[ ]";
	white-space: pre;
}

.is-style-terminal input[type="checkbox"]:checked::before {
	content: "[x]";
}

.is-style-terminal input[type="checkbox"]:focus-visible {
	outline: 2px dashed var(--sc-term-fg);
	outline-offset: 2px;
}

.is-style-terminal .grunion-field-label.checkbox,
.is-style-terminal .grunion-field-label.consent {
	font-weight: 400;
	cursor: pointer;
}

/* Send / Discard: [ Send ]  [ Discard ] */
.is-style-terminal .wp-block-buttons,
.is-style-terminal .wp-block-jetpack-contact-form > .wp-block-button {
	display: inline-flex;
	flex: 0 0 auto;
	width: auto;
	margin: 0.4rem 0 0;
}

.is-style-terminal .wp-block-button__link,
.is-style-terminal .wp-element-button {
	background: transparent;
	color: var(--sc-term-fg);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 0.15rem 0.3rem;
	font: inherit;
	font-weight: 600;
	text-transform: none;
}

.is-style-terminal .wp-block-button__link::before {
	content: "[ ";
}

.is-style-terminal .wp-block-button__link::after {
	content: " ]";
}

.is-style-terminal .wp-block-button__link:hover,
.is-style-terminal .wp-block-button__link:focus-visible {
	background: var(--sc-term-fg);
	color: var(--sc-term-bg);
}

.is-style-terminal .wp-block-button__link:active {
	transform: none;
	box-shadow: none;
}

/* Status lines: validation errors, the "sent" screen, the discard notice. */
.is-style-terminal .contact-form__error,
.is-style-terminal .contact-form__input-error,
.is-style-terminal .form-errors,
.is-style-terminal .contact-form-submission,
.is-style-terminal .sc-terminal__log {
	background: transparent;
	color: var(--sc-term-fg);
	border: 0;
	padding: 0;
	font: inherit;
}

.is-style-terminal .contact-form__input-error,
.is-style-terminal .contact-form__error {
	color: #FF8A94;
}

.is-style-terminal .sc-terminal__log:empty {
	display: none;
}

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