/* Tower Bearing — small layer on top of theme.json */

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { height: auto; }
:focus-visible { outline: 2px solid var(--wp--preset--color--accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.tb-header { position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 1px 0 var(--wp--preset--color--line); }
.admin-bar .tb-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .tb-header { top: 46px; } }
.tb-topbar a { color: inherit; }
.tb-header .wp-block-site-logo img { max-height: 54px; width: auto; }
.tb-header .wp-block-navigation .wp-block-navigation__submenu-container {
	border: 1px solid var(--wp--preset--color--line) !important;
	border-radius: 10px; box-shadow: var(--wp--preset--shadow--card);
	padding: .4rem 0; min-width: 220px;
}
.tb-header .wp-block-navigation .wp-block-navigation__submenu-container a { padding: .45rem 1rem; font-weight: 500; }
.tb-header .wp-block-navigation .wp-block-navigation__submenu-container a:hover { background: var(--wp--preset--color--light); text-decoration: none; }
.tb-header .wp-block-navigation-item__content:hover { color: var(--wp--preset--color--primary); text-decoration: none; }
.tb-header .wp-block-search__inside-wrapper { border-radius: 8px; border-color: var(--wp--preset--color--line); padding: 2px; }
.tb-header .wp-block-search__input { border: 0; font-family: inherit; padding-inline: .75rem; }
.tb-header .wp-block-search__button { border-radius: 6px; margin: 0; }
@media (max-width: 900px) {
	.tb-header .tb-header-search { display: none; }
	.tb-header .tb-phone-btn .wp-block-button__link { padding: .5rem .8rem; font-size: .8125rem; }
}
.wp-block-navigation__responsive-container.is-menu-open { padding: 1.25rem; }

/* ---------- Generic cards ---------- */
.tb-card { transition: transform .2s ease, box-shadow .2s ease; }
.tb-card:hover { transform: translateY(-3px); box-shadow: var(--wp--preset--shadow--strong); }
.tb-cat-card img { aspect-ratio: 1; object-fit: contain; }
.tb-cat-card a { color: inherit; }

/* ---------- Hero ---------- */
.tb-hero .wp-block-cover__inner-container { max-width: 1280px; }
.tb-hero .wp-block-search__inside-wrapper { background: #fff; border-radius: 10px; padding: 4px; border: 0; }
.tb-hero .wp-block-search__input { border: 0; font-family: inherit; font-size: 1rem; padding-inline: .9rem; }
.tb-hero .wp-block-search__button { border-radius: 8px; margin: 0; padding-inline: 1.5rem; }

/* ---------- Content ---------- */
.wp-block-table table { border-collapse: collapse; width: 100%; }
.wp-block-table th { background: var(--wp--preset--color--primary); color: #fff; font-weight: 700; }
.wp-block-table th, .wp-block-table td { border: 1px solid var(--wp--preset--color--line); padding: .6rem .8rem; text-align: right; }
.wp-block-table tbody tr:nth-child(even) { background: var(--wp--preset--color--light); }
.wp-block-table { overflow-x: auto; }
.wp-block-details { margin-block: .6rem; background: #fff; }
.wp-block-details summary { font-weight: 700; cursor: pointer; color: var(--wp--preset--color--dark); }
.wp-block-details[open] summary { color: var(--wp--preset--color--primary); margin-bottom: .5rem; }
.tb-note { border-right: 4px solid var(--wp--preset--color--accent); }
.tb-toc a { font-weight: 500; }
.entry-content > * + h2 { margin-top: 2.25rem; }

/* ---------- Posts ---------- */
.tb-post-card .wp-block-post-featured-image img { aspect-ratio: 16/10; object-fit: cover; }
.tb-post-card .wp-block-post-title a { color: var(--wp--preset--color--dark); }
.tb-post-card .wp-block-post-title a:hover { color: var(--wp--preset--color--primary); text-decoration: none; }

/* ---------- WooCommerce ---------- */
.woocommerce ul.products li.product,
.wc-block-grid__product,
.wp-block-woocommerce-product-template > li {
	background: #fff; border: 1px solid var(--wp--preset--color--line); border-radius: 14px;
	padding: .75rem; transition: box-shadow .2s ease;
}
.wp-block-woocommerce-product-template > li:hover { box-shadow: var(--wp--preset--shadow--card); }
.wp-block-woocommerce-product-template .wc-block-components-product-image img { aspect-ratio: 1; object-fit: contain; }
.wp-block-woocommerce-product-template .wp-block-post-title a { color: var(--wp--preset--color--dark); }
.wc-block-components-product-sale-badge { border-radius: 6px; }
.woocommerce-breadcrumb, .wc-block-breadcrumbs { font-size: .875rem; color: var(--wp--preset--color--muted); }
.wp-block-woocommerce-product-details .wc-tabs { border-bottom: 1px solid var(--wp--preset--color--line); }
.wp-block-woocommerce-product-image-gallery img { border-radius: 14px; }
.single-product .wp-block-woocommerce-product-details table { border-collapse: collapse; width: 100%; }
.single-product .wp-block-woocommerce-product-details th,
.single-product .wp-block-woocommerce-product-details td { border: 1px solid var(--wp--preset--color--line); padding: .55rem .8rem; text-align: right; }
.single-product .wp-block-woocommerce-product-details tr:nth-child(even) { background: var(--wp--preset--color--light); }

/* ---------- Footer ---------- */
.tb-footer a { color: #DCE7F5; }
.tb-footer a:hover { color: #fff; }
.tb-footer .wp-block-list { list-style: none; padding: 0; }
.tb-footer .wp-block-list li { margin-bottom: .4rem; }

/* ---------- Floating call button (mobile) ---------- */
.tb-float-call { position: fixed; bottom: 16px; left: 16px; z-index: 60; margin: 0 !important; }
.tb-float-call .wp-block-button__link { border-radius: 999px; box-shadow: var(--wp--preset--shadow--strong); background: #16A34A; }
@media (min-width: 901px) { .tb-float-call { display: none; } }

@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; transition: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
	.tb-header .tb-phone-btn { display: none; }
	.tb-topbar p:first-child { display: none; }
	.tb-topbar .wp-block-group { justify-content: center !important; }
	.tb-header .wp-block-site-logo img { max-height: 42px; }
}

/* ---------- Home: categories in one row ---------- */
.tb-cat-row { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; }
.tb-cat-row .tb-cat-card { padding: .75rem !important; }
@media (max-width: 1024px) {
	.tb-cat-row { display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .75rem; -webkit-overflow-scrolling: touch; }
	.tb-cat-row > * { flex: 0 0 132px; scroll-snap-align: start; }
}

/* ---------- SEO box (home + category pages) ---------- */
.tb-seo-box { position: relative; background: #fff; border: 1px solid var(--wp--preset--color--line); border-radius: 20px; padding: clamp(1.25rem, 3vw, 2.5rem) !important; max-height: 560px; overflow: hidden; transition: max-height .4s ease; }
.tb-seo-box::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 180px; background: linear-gradient(rgba(255,255,255,0), #fff 85%); pointer-events: none; }
.tb-seo-box.is-open { max-height: none; }
.tb-seo-box.is-open::after, .tb-seo-box.is-short::after { display: none; }
.tb-seo-box.is-short { max-height: none; }
.tb-seo-toggle { display: block; margin: -1.6rem auto 0; position: relative; z-index: 2; font: inherit; font-weight: 700; font-size: .9375rem; color: #fff; background: var(--wp--preset--color--primary); border: 0; border-radius: 999px; padding: .65rem 1.6rem; cursor: pointer; box-shadow: 0 8px 24px rgba(3,65,129,.25); }
.tb-seo-toggle:hover { background: var(--wp--preset--color--primary-dark); }
.tb-seo-box h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); margin-top: 1.75rem; }
.tb-seo-box h2:first-child { margin-top: 0; }
.tb-seo-box h3 { font-size: 1.0625rem; }
.tb-seo-box ul { padding-right: 1.25rem; }
.tb-seo-box li { margin-bottom: .35rem; }
.tb-seo-box .wp-block-term-description { margin: 0; }
