/*
 * tt-shop base styles.
 *
 * Only for rules theme.json cannot express: accessible touch-target sizes and a
 * universal keyboard focus ring (BUILD_SPEC §2 and §9). Visual tokens live in
 * theme.json. Component styles (swatches, cart bar, etc.) arrive in later phases.
 */

/* Smooth the variable font and keep long words from breaking the 360px layout. */
body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-wrap: break-word;
	overflow-x: clip; /* Safety against any single element overflowing at 360px. */
}

/*
 * Visible focus on EVERY interactive element, not just links/buttons.
 * 3px solid primary, 2px offset (DESIGN_TOKENS "Focus"). Uses :focus-visible so
 * the ring shows for keyboard users without flashing on every mouse click.
 */
:where(a, button, input, select, textarea, summary, [tabindex], [role="tab"], [role="button"]):focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
	border-radius: 4px;
}
/* No outline when focused by mouse/tap (only keyboard shows the ring). */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible),
.single_add_to_cart_button:focus,
.tt-swatch:focus,
.tt-size:focus,
.tt-format:focus {
	outline: none;
}

/* Minimum touch target: 48px tall buttons (DESIGN_TOKENS; CTAs set larger per component). */
.wp-element-button,
.wp-block-button__link,
button,
input[type="submit"],
input[type="button"] {
	min-height: 48px;
	font-family: var(--wp--preset--font-family--nunito);
}

/* Form fields: 48px+ tall, 18px text, 2px border, readable radius (DESIGN_TOKENS "Inputs"). */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]),
select,
textarea {
	min-height: 48px;
	font-family: var(--wp--preset--font-family--nunito);
	font-size: var(--wp--preset--font-size--medium);
	color: var(--wp--preset--color--ink);
	border: 2px solid var(--wp--preset--color--field-border);
	border-radius: 12px;
}

/* Checkbox / radio large enough to tap (≈22px per the checkout design). */
input[type="checkbox"],
input[type="radio"] {
	width: 22px;
	height: 22px;
	accent-color: var(--wp--preset--color--primary);
}

/* Puzzle grids only (Product-Book "Look inside"). */
.is-style-puzzle-grid,
.tt-puzzle-grid {
	font-family: var(--wp--preset--font-family--mono);
}

/* ---------- Content tables (Size Guide, policy pages) ----------
 * Plain <table> in page content → full width with clear borders. Scoped to
 * class-less tables so WooCommerce's own tables (.variations, .shop_table …)
 * keep their own styling. */
.wp-block-post-content table:not([class]) {
	width: 100%;
	border-collapse: collapse;
	margin: 1rem 0 2rem;
	border: 1px solid var(--wp--preset--color--line);
	overflow: hidden;
}
.wp-block-post-content table:not([class]) th,
.wp-block-post-content table:not([class]) td {
	border: 1px solid var(--wp--preset--color--line);
	padding: 12px 14px;
	text-align: center;
}
.wp-block-post-content table:not([class]) thead th {
	background: var(--wp--preset--color--primary);
	color: #fff;
	font-weight: 800;
}
.wp-block-post-content table:not([class]) tbody th {
	background: var(--wp--preset--color--tint-slate);
	text-align: left;
	font-weight: 800;
	white-space: nowrap;
}
.wp-block-post-content table:not([class]) tbody tr:nth-child(even) td {
	background: rgba(0, 0, 0, 0.025);
}
@media (max-width: 600px) {
	.wp-block-post-content table:not([class]) th,
	.wp-block-post-content table:not([class]) td {
		padding: 8px 6px;
		font-size: 14px;
	}
}
