/* =========================================================================
   Product pages — /products/, /products/<p>/, .../size/, .../design/

   Scoped entirely under .wpwd-pp. Nothing here may escape that class: the
   design tokens it reads (--primary, --heading, --border) are the same ones
   the dashboard and the rest of the public site read, so a bare rule on a
   shared class would repaint screens this file has never heard of.

   The four pages share the shell and the headings; each has one section below.
   ========================================================================= */

.wpwd-pp {
	--pp-side: 280px;         /* the two designer sidebars */
	--pp-gap: 24px;
	--pp-panel: #F5F7F9;      /* sidebar fill, lighter than --section-bg */
	--pp-line: var(--border, #E7ECEC);
	color: var(--text, #454545);
}

.wpwd-pp-container {
	max-width: 1440px;
	margin: 0 auto;
	padding: 32px 20px 56px;
}

/* ---------- headings ---------- */

.wpwd-pp-head { margin: 0 0 24px; }
.wpwd-pp-head--tight { margin-bottom: 12px; }

.wpwd-pp-h1 {
	margin: 0 0 6px;
	color: var(--heading, #2E3A3B);
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
	line-height: 1.2;
}

.wpwd-pp-h2 {
	margin: 0 0 10px;
	color: var(--heading, #2E3A3B);
	font-size: 1.0625rem;
}

.wpwd-pp-lead {
	margin: 0;
	max-width: 68ch;
	color: var(--secondary, #676C6D);
}

.wpwd-pp-context {
	margin: 0 0 16px;
	color: var(--secondary, #676C6D);
	font-size: 0.9375rem;
}

.wpwd-pp-group { margin: 0 0 36px; }

.wpwd-pp-group-h {
	margin: 0 0 14px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--pp-line);
	color: var(--heading, #2E3A3B);
	font-size: 1.125rem;
}

.wpwd-pp-back { margin: 28px 0 0; }
.wpwd-pp-back a { color: var(--secondary, #676C6D); text-decoration: none; }
.wpwd-pp-back a:hover { color: var(--primary, #039D96); text-decoration: underline; }

.wpwd-pp-empty {
	padding: 28px;
	border: 1px dashed var(--pp-line);
	border-radius: 10px;
	background: var(--section-bg, #F8FAFB);
	color: var(--secondary, #676C6D);
	text-align: center;
}

/* ---------- 1 + 2: the card grids ---------- */

/* The frame tiles are bare drawings with no caption, so they need to sit on a
   quiet surface or they read as floating clip-art. */
.wpwd-pp-frames {
	padding: 20px 12px;
	border-radius: 12px;
	background: var(--section-bg, #F8FAFB);
}

.wpwd-pp-col { margin-bottom: 16px; }

/*
 * A card clips its own tooltip unless overflow is visible. The tip is absolutely
 * positioned relative to the card, so `overflow:hidden` anywhere on the chain
 * silently swallows it — which is how it was lost the first time.
 */
.wpwd-pp .wpwd-pcat-card { overflow: visible; }

/* ---------- 3: the size page ---------- */

.wpwd-pp-size {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
	gap: var(--pp-gap);
	align-items: start;
}

.wpwd-pp-size-view {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 300px;
	padding: 20px;
	border: 1px solid var(--pp-line);
	border-radius: 12px;
	background: #fff;
}

.wpwd-pp-size-view svg,
.wpwd-pp-size-view img { width: auto; max-width: 100%; max-height: 460px; }

.wpwd-pp-size-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin: 20px 0 8px;
}

.wpwd-pp-size-field { display: flex; flex-direction: column; gap: 6px; }

.wpwd-pp-size-label { color: var(--heading, #2E3A3B); font-weight: 600; font-size: 0.9375rem; }
.wpwd-pp-size-input { display: inline-flex; align-items: center; gap: 6px; }
.wpwd-pp-size-input input { width: 108px; min-height: 42px; padding: 6px 10px; }
.wpwd-pp-size-unit { color: var(--secondary, #676C6D); }

.wpwd-pp-size-range { margin: 0 0 18px; color: var(--secondary, #676C6D); font-size: 0.875rem; }

.wpwd-pp-size-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.wpwd-pp-size-help {
	padding: 20px;
	border: 1px solid var(--pp-line);
	border-radius: 12px;
	background: var(--section-bg, #F8FAFB);
}

.wpwd-pp-size-tips { margin: 0 0 12px; padding-left: 18px; }
.wpwd-pp-size-tips li { margin-bottom: 6px; }

/* ---------- 4: the designer ---------- */

.wpwd-pp-design {
	display: grid;
	grid-template-columns: var(--pp-side) minmax(0, 1fr) var(--pp-side);
	gap: var(--pp-gap);
	align-items: start;
}

.wpwd-pp-opts,
.wpwd-pp-guide {
	padding: 18px;
	border: 1px solid var(--pp-line);
	border-radius: 12px;
	background: var(--pp-panel);
}

.wpwd-pp-panel-h {
	margin: 0 0 4px;
	color: var(--primary, #039D96);
	font-size: 1.125rem;
	text-align: center;
}

.wpwd-pp-opts-sub {
	margin: 0 0 16px;
	color: var(--secondary, #676C6D);
	font-size: 0.875rem;
	text-align: center;
}

/* --- the stage --- */

.wpwd-pp-stage {
	padding: 18px;
	border: 1px solid var(--pp-line);
	border-radius: 12px;
	background: #fff;
}

.wpwd-pp-stage-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.wpwd-pp-stage-h { margin: 0; color: var(--primary, #039D96); font-size: 1.25rem; }
.wpwd-pp-stage-h span { color: var(--secondary, #676C6D); font-weight: 400; }

.wpwd-pp-zoom {
	padding: 7px 14px;
	border: 0;
	border-radius: 6px;
	background: var(--primary, #039D96);
	color: #fff;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
}
/* White on the dark teal — stated so Kadence's blanket button:hover is not the
   thing deciding it. */
.wpwd-pp-zoom:hover { background: var(--primary-dark, #027F79); color: #fff; }

.wpwd-pp-view {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 420px;
	padding: 12px;
}

.wpwd-pp-view svg { width: 100%; max-width: 520px; height: auto; }

/* A pane is a control, so it must look like one. */
.wpwd-pp-view .wpwd-win-pane { cursor: pointer; }

.wpwd-pp-dims { margin: 8px 0 0; text-align: center; color: var(--secondary, #676C6D); }
.wpwd-pp-dims strong { color: var(--heading, #2E3A3B); }
.wpwd-pp-change { margin-left: 8px; }

.wpwd-pp-total {
	margin: 12px 0 0;
	text-align: center;
	color: var(--heading, #2E3A3B);
	font-size: 1.25rem;
	font-weight: 700;
}

/*
 * Zoom. The drawing goes full-viewport rather than merely larger — at 520px the
 * pane affordances are already at their smallest legible size, so "bigger" only
 * helps if it is much bigger.
 */
.wpwd-pp-stage.is-zoomed {
	position: fixed;
	inset: 0;
	z-index: 9999;
	border-radius: 0;
	overflow: auto;
}
.wpwd-pp-stage.is-zoomed .wpwd-pp-view { min-height: calc(100vh - 160px); }
.wpwd-pp-stage.is-zoomed .wpwd-pp-view svg { max-width: min(92vw, 1000px); }

/* --- the option controls --- */

.wpwd-pp-opt { margin-bottom: 14px; }

.wpwd-pp-opt-label {
	display: block;
	margin-bottom: 5px;
	color: var(--heading, #2E3A3B);
	font-size: 0.875rem;
	font-weight: 600;
}

.wpwd-pp-opt-text,
/* Kadence puts the chevron in the `background` shorthand; the rule below
   re-declares it, so the arrow has to be re-supplied. Same repair as
   design-flow.css:456. */
.wpwd-pp-opt-select select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding-right: 34px;
	background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="%23676C6D" stroke-width="2"><path d="M3 6l5 5 5-5"/></svg>');
	background-repeat: no-repeat;
	background-position: right 11px center;
	color: var(--text);
}

.wpwd-pp-opt-select select {
	width: 100%;
	min-height: 40px;
	padding: 6px 10px;
	border: 1px solid var(--pp-line);
	border-radius: 6px;
	background: #fff;
	font: inherit;
}

.wpwd-pp-opt-select { position: relative; display: block; }

/*
 * The swatch sits INSIDE the select's padding rather than beside it, so the
 * control stays one full-width box. Setting `background` on the select itself
 * would wipe the theme's own chevron, which is painted as a background image.
 */
.wpwd-pp-opt-select.has-swatch select { padding-left: 34px; }

.wpwd-pp-swatch {
	position: absolute;
	top: 50%;
	left: 9px;
	width: 18px;
	height: 18px;
	transform: translateY(-50%);
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 50%;
	background: #F4F4F2;
	pointer-events: none;   /* never eat the click meant for the select */
}

/* Segmented control — real radios, visually joined. */
.wpwd-pp-seg { display: flex; flex-wrap: wrap; border-radius: 6px; overflow: hidden; }

.wpwd-pp-seg-item { flex: 1 1 auto; margin: 0; }
.wpwd-pp-seg-item input { position: absolute; opacity: 0; pointer-events: none; }

.wpwd-pp-seg-item span {
	display: block;
	padding: 8px 6px;
	border: 1px solid var(--pp-line);
	border-left-width: 0;
	background: #fff;
	color: var(--text, #454545);
	font-size: 0.8125rem;
	text-align: center;
	cursor: pointer;
}
.wpwd-pp-seg-item:first-child span { border-left-width: 1px; border-radius: 6px 0 0 6px; }
.wpwd-pp-seg-item:last-child span { border-radius: 0 6px 6px 0; }
.wpwd-pp-seg-item input:checked + span { background: var(--primary, #039D96); border-color: var(--primary, #039D96); color: #fff; }
.wpwd-pp-seg-item input:focus-visible + span { outline: 2px solid var(--primary, #039D96); outline-offset: 2px; }

/* Yes/No toggle. */
.wpwd-pp-opt--toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wpwd-pp-opt--toggle .wpwd-pp-opt-label { margin: 0; }

.wpwd-pp-toggle input { position: absolute; opacity: 0; pointer-events: none; }

.wpwd-pp-toggle label {
	display: inline-block;
	min-width: 74px;
	padding: 7px 12px;
	border: 1px solid var(--pp-line);
	border-radius: 6px;
	background: #fff;
	text-align: center;
	cursor: pointer;
}
.wpwd-pp-toggle label span::after { content: attr(data-off); font-size: 0.8125rem; }
.wpwd-pp-toggle input:checked + label { background: var(--primary, #039D96); border-color: var(--primary, #039D96); color: #fff; }
.wpwd-pp-toggle input:checked + label span::after { content: attr(data-on); }
.wpwd-pp-toggle input:focus-visible + label { outline: 2px solid var(--primary, #039D96); outline-offset: 2px; }

/* --- the guidance panel --- */

.wpwd-pp-guide p { font-size: 0.9375rem; }
.wpwd-pp-guide-sub { margin: 16px 0 8px; font-weight: 600; color: var(--heading, #2E3A3B); text-align: center; }

.wpwd-pp-guide-keys { margin: 0; padding: 0; list-style: none; }
.wpwd-pp-guide-keys li { display: grid; grid-template-columns: 26px 1fr; gap: 4px 10px; margin-bottom: 14px; }
.wpwd-pp-guide-keys strong { color: var(--heading, #2E3A3B); font-size: 0.9375rem; }
.wpwd-pp-guide-keys span:last-child { grid-column: 2; color: var(--secondary, #676C6D); font-size: 0.8125rem; }

.wpwd-pp-key {
	grid-row: span 2;
	width: 22px;
	height: 26px;
	border: 2px solid #222;
	border-radius: 2px;
}
.wpwd-pp-key--glass { background: #59C6DE; }
.wpwd-pp-key--opener { background: linear-gradient(105deg, #fff 62%, #C9D4D9 62%); }

.wpwd-pp-pane-body:empty { display: none; }
.wpwd-pp-pane-body { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--pp-line); }
.wpwd-pp-pane-body .wpwd-pp-opt-label { font-size: 0.8125rem; }

/* =========================================================================
   Responsive
   ========================================================================= */

/* Tablet: the guidance panel drops under the drawing, options stay beside it. */
@media (max-width: 1100px) {
	.wpwd-pp-design {
		grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
	}
	.wpwd-pp-guide { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
	.wpwd-pp-size { grid-template-columns: minmax(0, 1fr); }
	.wpwd-pp-size-help { order: 2; }
}

/* Phone: one column throughout. The drawing goes FIRST — it is what the
   visitor came to look at, and burying it under ten controls hides the thing
   the page is for.

   768 and 480, not 780 and 420: phase 53 froze the breakpoint set precisely so
   values stop accumulating one at a time. Both of these already mean what the
   invented ones would have meant. See tests/phase-53-responsive.php. */
@media (max-width: 768px) {
	.wpwd-pp-container { padding: 20px 14px 40px; }

	.wpwd-pp-design { grid-template-columns: minmax(0, 1fr); }
	.wpwd-pp-stage { order: 1; }
	.wpwd-pp-opts { order: 2; }
	.wpwd-pp-guide { order: 3; }

	.wpwd-pp-view { min-height: 300px; }
	.wpwd-pp-view svg { max-width: 100%; }

	.wpwd-pp-size-actions .wpwd-btn { flex: 1 1 100%; text-align: center; }
}

@media (max-width: 480px) {
	.wpwd-pp-seg { flex-direction: column; }
	.wpwd-pp-seg-item span { border-left-width: 1px; border-top-width: 0; }
	.wpwd-pp-seg-item:first-child span { border-top-width: 1px; border-radius: 6px 6px 0 0; }
	.wpwd-pp-seg-item:last-child span { border-radius: 0 0 6px 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.wpwd-pp * { transition: none !important; animation: none !important; }
}
