/*
Theme Name: Desk9
Theme URI: https://desk9design.com/themes/desk9
Author: Desk9 Design
Author URI: https://desk9design.com/
Description: The desk9design.com storefront theme. A monochrome block theme (FSE) for selling WordPress plugins and themes: 1px rules, radius 0, system font stack, 4 colors, 6 type sizes. Every page section ships as an editable block pattern - product rows, subscribe boxes, pricing tiers, checkout, account, docs and blog layouts.
Requires at least: 6.6
Tested up to: 6.9
Requires PHP: 7.4
Version: 1.3.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: desk9design
Tags: block-patterns, block-styles, full-site-editing, e-commerce, one-column, custom-colors, custom-menu, editor-style
*/

/* ------------------------------------------------------------------
   Desk9 base styles. Everything token-driven lives in theme.json;
   this file only covers what theme.json cannot express:
   hover inversion, details/summary chrome, focus rings, stickies.
   ------------------------------------------------------------------ */

::selection {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

/* Focus: 1px ring, offset 3 — never remove, never blur */
:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 1px solid var(--wp--preset--color--ink);
	outline-offset: 3px;
}

/* Buttons invert on hover (filled -> outline, outline -> filled) */
.wp-block-button__link {
	transition: background-color 120ms ease, color 120ms ease;
}
.wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--paper);
	color: var(--wp--preset--color--ink);
}
.wp-block-button.is-style-outline .wp-block-button__link {
	border: 1px solid currentColor;
	background: transparent;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

/* Row hover inversion: add class "d9-invert-hover" to any group/row.
   Links inside inherit the inverted color. */
.d9-invert-hover {
	transition: background-color 120ms ease, color 120ms ease;
}
.d9-invert-hover:hover {
	background-color: var(--wp--preset--color--ink) !important;
	color: var(--wp--preset--color--paper) !important;
}
.d9-invert-hover:hover :where(p, h1, h2, h3, h4, span, a, div, figcaption) {
	color: inherit !important;
}

/* Links: quiet by default in nav-ish contexts, underline on hover */
.d9-quiet-links a {
	text-decoration: none;
}
.d9-quiet-links a:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* Details / FAQ rows */
.wp-block-details {
	border-bottom: 1px solid var(--wp--preset--color--line);
	margin: 0;
}
.wp-block-details summary {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding: 14px 4px;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.wp-block-details summary::-webkit-details-marker {
	display: none;
}
.wp-block-details summary::after {
	content: "+";
	font-weight: 400;
}
.wp-block-details[open] summary::after {
	content: "\2212"; /* minus sign */
}
.wp-block-details > :not(summary) {
	margin: 0 0 16px;
	padding: 0 4px;
}

/* Block styles: framed + inverted - registered for groups, columns,
   paragraphs and headings, valid on any block that carries the class. */
.is-style-desk9-framed {
	border: 1px solid var(--wp--preset--color--ink);
}
.is-style-desk9-framed-line {
	border: 1px solid var(--wp--preset--color--line);
}
.is-style-desk9-invert {
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}
.is-style-desk9-invert :where(p, h1, h2, h3, h4, a, span, div, li) {
	color: inherit;
}

/* Safety net for content saved with older pattern markup: constrained
   groups cap unaligned children at the 760px content size, which crushes
   fixed-column rows. Row constructs and commerce tables always span their
   container. Aligned children keep core's own width rules. */
.is-layout-constrained > .wp-block-columns:not(.alignwide):not(.alignfull),
.is-layout-constrained > .d9-rule-top:not(.alignwide):not(.alignfull),
.is-layout-constrained > .d9-invert-hover,
.is-layout-constrained > .d9-rule-bottom-line,
.is-layout-constrained > .d9com-table,
.is-layout-constrained > .d9com-checkout {
	max-width: none;
}

/* Older saved markup put the sticky class on the subscribe box itself,
   which made it overlap the cards below while scrolling. Neutralize it -
   current markup puts d9-sticky on the sidebar wrapper instead. */
.is-style-desk9-framed.d9-sticky {
	position: static;
}

/* Docs layout (canvas 14): the sidebar and rail lines sit on the
   columns so they run the full height, header to footer. Plain CSS -
   the border block-support plus has-border-color would paint a frame
   on every side. */
.d9-docs-col {
	border-right: 1px solid var(--wp--preset--color--ink);
}
.d9-docs-rail {
	border-left: 1px solid var(--wp--preset--color--line);
}

/* Docs sidebar (canvas 14): section labels, full-row item links with
   hover invert; the current page is marked with .is-active. */
.d9-docs-nav .d9-docs-label {
	margin-top: 18px;
	padding-bottom: 4px;
}
.d9-docs-nav p:not(.d9-docs-label) {
	margin: 0;
}
.d9-docs-nav p:not(.d9-docs-label) > a {
	display: block;
	padding: 9px 8px 9px 0;
	font-size: 14px;
	text-decoration: none;
}
.d9-docs-nav p:not(.d9-docs-label) > a:hover,
.d9-docs-nav .is-active > a {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
	padding-left: 12px;
}
.d9-docs-nav .d9-docs-item p {
	margin: 0;
}
@media (max-width: 781px) {
	.d9-docs-nav {
		border-right: 0 !important;
		padding-right: 0 !important;
	}
	.d9-docs-col {
		border-right: 0 !important;
		padding-top: 24px !important;
		padding-bottom: 0 !important;
	}
}

/* Blog post rail (canvas 18): "On this page" links built by post-toc.js,
   1px left rules, active section bold ink. Hidden on small screens. */
.d9-post-toc a {
	display: block;
	border-left: 1px solid var(--wp--preset--color--line);
	padding: 4px 0 4px 10px;
	font-size: 13px;
	color: var(--wp--preset--color--meta);
	text-decoration: none;
}
.d9-post-toc a:hover {
	color: var(--wp--preset--color--ink);
	border-left-color: var(--wp--preset--color--ink);
}
.d9-post-toc a.is-active {
	color: var(--wp--preset--color--ink);
	border-left-color: var(--wp--preset--color--ink);
	font-weight: 600;
}
@media (max-width: 781px) {
	.d9-post-rail {
		display: none;
	}
}

/* Catalog filter chips (All / Plugins / Themes) */
.d9-filter-chip {
	border: 1px solid var(--wp--preset--color--ink);
	padding: 6px 14px;
	font-size: var(--wp--preset--font-size--sm);
	cursor: pointer;
}
.d9-filter-chip a {
	text-decoration: none;
	color: inherit;
}
.d9-filter-chip.is-active {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}
.d9-filter-chip:not(.is-active):hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
}

/* "Border top" section rules used across list patterns */
.d9-rule-top {
	border-top: 1px solid var(--wp--preset--color--ink);
}
.d9-rule-top-line {
	border-top: 1px solid var(--wp--preset--color--line);
}
.d9-rule-bottom-line {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

/* Sticky sidebar (subscribe box, docs rails) */
.d9-sticky {
	position: sticky;
	top: 24px;
}

/* Mobile buy bar (canvas 08): fixed to the bottom on small screens,
   hidden on desktop where the sticky subscribe box takes over.
   !important is required: core prints the block's layout display rule
   after this stylesheet. */
.d9-buy-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 90;
	border-top: 1px solid var(--wp--preset--color--ink);
}
@media (min-width: 782px) {
	.d9-buy-bar {
		display: none !important;
	}
}
@media (max-width: 781px) {
	body:has(.d9-buy-bar) {
		padding-bottom: 76px; /* keep the footer reachable */
	}
}

/* Screenshot placeholder: replace the inner text with a real image */
.d9-screenshot {
	background: repeating-linear-gradient(45deg, var(--wp--preset--color--paper), var(--wp--preset--color--paper) 8px, var(--wp--preset--color--soft) 8px, var(--wp--preset--color--soft) 9px);
}

/* Forms rendered by plugins inside the content area pick up the system */
.d9-form input[type="text"],
.d9-form input[type="email"],
.d9-form input[type="password"],
.d9-form select,
.d9-form textarea {
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 0;
	padding: 14px;
	font-size: 15px;
	font-family: inherit;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--paper);
	min-height: 44px;
	box-sizing: border-box;
	width: 100%;
}

/* Tables: 1px rules, no zebra */
.wp-block-table table {
	border-collapse: collapse;
}
.wp-block-table th,
.wp-block-table td {
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
	padding: 12px 4px;
}
.wp-block-table thead th {
	border-bottom: 1px solid var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	font-weight: 400;
	color: var(--wp--preset--color--meta);
	text-align: left;
}

/* Code blocks: inverted, monospace */
.wp-block-code {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
	border: 0;
	border-radius: 0;
	padding: 18px 20px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	line-height: 1.7;
	overflow-x: auto;
}

/* Inline code inside paragraphs */
:where(p, li, figcaption) code {
	background: var(--wp--preset--color--soft);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875em;
	padding: 1px 6px;
	border-radius: 0;
}

/* Motion: all inversions instant when reduced motion is requested */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
}

/* Featured post box (canvas 16): the image column shows a striped
   placeholder until the post gets a featured image. */
.d9-featured-fallback {
	aspect-ratio: 16 / 10;
	border: 1px solid var(--wp--preset--color--line);
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
}
.d9-featured-media:has(figure) .d9-featured-fallback {
	display: none;
}

/* The root blockGap (24px) also inserts space between the header part,
   the main content and the footer part - visible as a white strip above
   dark full-bleed heroes (All Access). Sections carry their own padding,
   so template-level children sit flush. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Extended catalog rows (canvas 06) and home catalog rows: between 782
   and 1149px the fixed meta columns would crush the description column
   to a few pixels. Switch the row to a two-line grid instead - name on
   the left spanning both lines, description on the first line, badges /
   price / next-up (or date) sharing the second. */
@media (min-width: 782px) and (max-width: 1149px) {
	.wp-block-columns.d9-row-ext,
	.wp-block-columns.d9-cat-row {
		display: grid !important;
		grid-template-columns: 220px minmax(0, auto) minmax(0, auto) minmax(0, 1fr);
		align-items: center;
		column-gap: 24px;
		row-gap: 10px;
	}
	.d9-row-ext > .d9-col-name,
	.d9-cat-row > .wp-block-column:nth-child(1) {
		grid-column: 1;
		grid-row: 1 / span 2;
	}
	.d9-row-ext > .d9-col-desc,
	.d9-cat-row > .wp-block-column:nth-child(2) {
		grid-column: 2 / span 3;
		grid-row: 1;
	}
	.d9-row-ext > .d9-col-badges,
	.d9-cat-row > .wp-block-column:nth-child(3) {
		grid-column: 2;
		grid-row: 2;
	}
	.d9-row-ext > .d9-col-price,
	.d9-cat-row > .wp-block-column:nth-child(4) {
		grid-column: 3;
		grid-row: 2;
	}
	.d9-row-ext > .d9-col-next,
	.d9-cat-row > .wp-block-column:nth-child(5) {
		grid-column: 4;
		grid-row: 2;
	}
}
