/*
Theme Name: GK Timber
Theme URI: https://gktimber.co.uk/
Author: David Gourley
Description: Bespoke theme for GK Timber Ltd, South Shields. WooCommerce catalogue with cut list builder, inc/ex VAT toggle and a quote-request checkout that can switch to online payments later.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
WC requires at least: 8.0
License: Proprietary
Text Domain: gk-timber
*/

/* ---------- Tokens ---------- */
:root {
	--ink: #1B1E1B;
	--paper: #F4F5F2;
	--card: #FFFFFF;
	--line: #D9DBD4;
	--muted: #50574F;
	--pine: #2E5B3B;
	--pine-soft: #E3EDE5;
	--saw: #B8430E;
	--saw-dark: #8F340B;
	--display: "Barlow Condensed", "Arial Narrow", sans-serif;
	--body: "Barlow", "Helvetica Neue", Helvetica, sans-serif;
	--mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
	--wrap: 1240px;
	--r-sm: 4px;
	--r: 6px;
	--r-lg: 10px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font: 400 17px/1.55 var(--body);
	font-variant-numeric: tabular-nums;
}
img { max-width: 100%; height: auto; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--saw); }
:focus-visible { outline: 3px solid var(--saw); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.05; letter-spacing: .005em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 4vw + 1rem, 4rem); }
h2 { font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem); }
h3 { font-size: 1.5rem; }
p { margin: 0 0 1em; }
.gk-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.screen-reader-text, .gk-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
	position: fixed; top: 8px; left: 8px; z-index: 1000; width: auto; height: auto; clip: auto;
	padding: 12px 16px; background: var(--card); color: var(--ink); border-radius: var(--r);
}

/* ---------- Buttons ---------- */
.gk-btn,
.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 22px;
	border: 0; border-radius: var(--r);
	background: var(--saw); color: #fff;
	font: 700 1.15rem/1 var(--display); letter-spacing: .02em;
	text-decoration: none; cursor: pointer;
}
.gk-btn:hover,
.woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover,
.woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover {
	background: var(--saw-dark); color: #fff;
}
.gk-btn--quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.gk-btn--quiet:hover { background: var(--ink); color: #fff; }
.woocommerce button.button:disabled, .woocommerce button.button.disabled,
.woocommerce button.button.alt.disabled { background: #9C988C; color: #fff; opacity: 1; }

/* ---------- Top bar & header ---------- */
.gk-topbar { background: var(--pine); color: #fff; font-size: .9rem; font-weight: 500; }
.gk-topbar .gk-wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; padding-top: 8px; padding-bottom: 8px; }

.gk-header { background: var(--ink); color: #fff; }
.gk-header .gk-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 32px; padding-top: 14px; padding-bottom: 14px; }
.gk-brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: #fff; margin-right: auto; }
.gk-brand:hover { color: #fff; }
.gk-brand__name { font: 700 2.1rem/1 var(--display); letter-spacing: .03em; }
.gk-brand__sub { font-size: .85rem; color: #BDB9AD; }
.gk-brand img { max-height: 52px; width: auto; }

.gk-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 26px; }
.gk-nav a { color: #E9E6DD; text-decoration: none; font-weight: 600; display: inline-flex; min-height: 44px; align-items: center; }
.gk-nav a:hover, .gk-nav .current-menu-item > a { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.gk-nav .sub-menu { display: none; }

.gk-header__tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gk-phone { color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; }
.gk-phone:hover { color: #fff; text-decoration: underline; }
.gk-quote-link {
	display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
	border-radius: var(--r); background: var(--saw); color: #fff; text-decoration: none; font-weight: 600;
}
.gk-quote-link:hover { background: var(--saw-dark); color: #fff; }

.gk-vat { display: inline-flex; padding: 3px; gap: 2px; background: #33372F; border-radius: var(--r); }
.gk-vat button {
	min-height: 38px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
	background: transparent; color: #D6D3C9; font: 600 .85rem/1 var(--body); cursor: pointer;
}
.gk-vat button[aria-pressed="true"] { background: #fff; color: var(--ink); }

.gk-nav-toggle {
	display: none; min-height: 44px; min-width: 44px; padding: 0 12px;
	background: transparent; color: #fff; border: 2px solid #5A5F57; border-radius: var(--r);
	font: 600 .95rem/1 var(--body); cursor: pointer;
}

@media (max-width: 900px) {
	.gk-nav-toggle { display: inline-flex; align-items: center; gap: 8px; }
	.gk-nav { order: 10; flex-basis: 100%; display: none; }
	.gk-nav.is-open { display: block; }
	.gk-nav ul { flex-direction: column; gap: 0; border-top: 1px solid #3A3F3A; }
	.gk-nav li { border-bottom: 1px solid #3A3F3A; }
	.gk-header__tools { flex-basis: 100%; }
	.gk-brand__sub { display: none; }
}

/* ---------- Main ---------- */
.gk-main { padding: 32px 0 72px; }
.gk-page-title { margin-bottom: 24px; }
.gk-content > * { max-width: 72ch; }
.gk-content > .alignwide, .gk-content > .alignfull, .gk-content > .woocommerce, .gk-content > table, .gk-content > .gk-price-list { max-width: none; }

/* ---------- Hero ---------- */
.gk-hero { background: var(--ink); color: #fff; overflow: hidden; }
.gk-hero .gk-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 40px; padding-top: 56px; padding-bottom: 64px; }
.gk-hero__copy { flex: 1 1 420px; }
.gk-hero__copy h1 { max-width: 13ch; margin-bottom: 18px; }
.gk-hero__copy p { font-size: 1.15rem; color: #D6D3C9; max-width: 46ch; }
.gk-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.gk-hero .gk-btn--quiet { color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.gk-hero .gk-btn--quiet:hover { background: #fff; color: var(--ink); }
.gk-hero__diagram { flex: 1 1 480px; min-width: 0; }
.gk-hero__diagram svg { width: 100%; height: auto; display: block; }
.gk-sheet-face { fill: #C99B5F; }
.gk-sheet-grain { stroke: #B38449; stroke-width: 1.2; fill: none; opacity: .7; }
.gk-cut { stroke: var(--ink); stroke-width: 3; stroke-dasharray: 10 7; fill: none; }
.gk-dim { stroke: #D6D3C9; stroke-width: 1.5; fill: none; }
.gk-dim-text { fill: #E9E6DD; font: 500 15px var(--mono); }
.gk-piece-text { fill: var(--ink); font: 500 14px var(--mono); }
@media (prefers-reduced-motion: no-preference) {
	.gk-cut { stroke-dashoffset: 0; animation: gk-draw 1.1s ease-out both; }
	.gk-cut--2 { animation-delay: .35s; }
	.gk-cut--3 { animation-delay: .7s; }
	.gk-piece-text { animation: gk-fade .5s ease-out 1.4s both; }
}
@keyframes gk-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes gk-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Front page sections ---------- */
.gk-section { padding: 64px 0; }
.gk-section + .gk-section { padding-top: 0; }
.gk-section__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 24px; }
.gk-section__head h2 { margin: 0; }

.gk-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.gk-cat { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; text-decoration: none; height: 100%; }
.gk-cat:hover { border-color: var(--ink); color: var(--ink); }
.gk-cat__img { aspect-ratio: 4 / 3; background: #E6E1D4; display: block; width: 100%; object-fit: cover; }
.gk-cat__body { padding: 14px 16px 16px; }
.gk-cat__name { font: 700 1.5rem/1 var(--display); display: block; }
.gk-cat__count { color: var(--muted); font-size: .95rem; }

.gk-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.gk-steps li { counter-increment: step; border-top: 4px solid var(--ink); padding-top: 16px; }
.gk-steps li::before { content: counter(step); font: 700 3rem/1 var(--display); color: var(--saw); display: block; margin-bottom: 8px; }
.gk-steps h3 { margin-bottom: 6px; }
.gk-steps p { color: var(--muted); margin: 0; }

.gk-visit { display: flex; flex-wrap: wrap; gap: 32px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; }
.gk-visit > div { flex: 1 1 240px; }
.gk-visit h2 { flex-basis: 100%; margin: 0; }
.gk-visit h3 { font-size: 1.25rem; margin-bottom: 6px; }
.gk-badge { display: inline-block; padding: 6px 10px; border-radius: var(--r-sm); background: var(--pine-soft); color: #1F4029; font-weight: 600; font-size: .9rem; }

/* ---------- Footer ---------- */
.gk-footer { background: var(--ink); color: #E9E6DD; font-size: .98rem; }
.gk-footer a { color: #E9E6DD; }
.gk-footer a:hover { color: #fff; }
.gk-footer .gk-wrap { display: flex; flex-wrap: wrap; gap: 28px 56px; padding-top: 40px; padding-bottom: 40px; }
.gk-footer h2 { font-size: 1.3rem; color: #fff; margin-bottom: 8px; }
.gk-footer ul { list-style: none; margin: 0; padding: 0; }
.gk-footer__legal { border-top: 1px solid #3A3F3A; }
.gk-footer__legal .gk-wrap { padding-top: 16px; padding-bottom: 16px; font-size: .88rem; color: #BDB9AD; }

/* ---------- WooCommerce: general ---------- */
.woocommerce .woocommerce-breadcrumb { font-size: .92rem; color: var(--muted); margin-bottom: 20px; }
.woocommerce .woocommerce-breadcrumb a { color: var(--muted); }
.woocommerce-message, .woocommerce-info, .woocommerce-error {
	border-top: 0 !important; border-left: 4px solid var(--pine); background: var(--card) !important; border-radius: var(--r);
}
.woocommerce-error { border-left-color: var(--saw); }
.woocommerce-message::before, .woocommerce-info::before { color: var(--pine) !important; }
.woocommerce span.onsale { background: var(--pine); }
.woocommerce .price, .woocommerce div.product p.price, .woocommerce div.product span.price, .woocommerce ul.products li.product .price { color: var(--ink) !important; }
.gk-vat-label { font-size: .7em; font-weight: 500; color: var(--muted); margin-left: 4px; }

/* Product grid */
.woocommerce ul.products li.product { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0 0 16px; overflow: hidden; }
.woocommerce ul.products li.product a img { margin: 0 0 12px; aspect-ratio: 4 / 3; object-fit: cover; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font: 700 1.4rem/1.05 var(--display); padding: 0 16px; }
.woocommerce ul.products li.product .price { padding: 0 16px; font-size: 1.05rem; }
.woocommerce ul.products li.product .button { margin: 8px 16px 0; }

/* Single product */
.woocommerce div.product .product_title { font-size: clamp(2.4rem, 3vw + 1rem, 3.4rem); margin-bottom: 8px; }
.woocommerce div.product p.price { font: 700 2.4rem/1 var(--display); margin: 8px 0 16px; }
.woocommerce div.product .woocommerce-product-details__short-description { color: #3C423C; font-size: 1.05rem; max-width: 60ch; }
.woocommerce div.product div.images { border-radius: var(--r-lg); overflow: hidden; }
.woocommerce div.product form.cart { margin-top: 16px; }
.woocommerce div.product form.cart .variations { margin-bottom: 8px; }
.woocommerce div.product form.cart .variations th, .woocommerce div.product form.cart .variations td { display: block; padding: 0; text-align: left; }
.woocommerce div.product form.cart .variations label { font-weight: 600; display: block; margin-bottom: 8px; }
.woocommerce div.product form.cart .reset_variations { font-size: .9rem; display: inline-block; margin-top: 8px; }
.woocommerce div.product .woocommerce-variation-price .price { font: 700 2.4rem/1 var(--display); }
.woocommerce .quantity .qty { min-height: 48px; width: 5em; border: 1.5px solid #CFCCC2; border-radius: var(--r); font: 500 1.05rem var(--body); }
.woocommerce div.product .woocommerce-tabs ul.tabs li { border-radius: var(--r) var(--r) 0 0; background: #ECEDE8; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active { background: var(--card); }
.woocommerce table.shop_attributes th, .woocommerce table.shop_attributes td { padding: 10px 12px; }

/* Thickness pills (built by site.js from the variation select) */
.gk-pills { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.gk-pill {
	min-height: 60px; padding: 6px 10px; border: 1.5px solid #CFCCC2; border-radius: var(--r);
	background: var(--card); color: var(--ink); cursor: pointer;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	font: 600 1rem/1.1 var(--body);
}
.gk-pill:hover { border-color: var(--ink); }
.gk-pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.gk-pill[disabled] { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.gk-pill small { font-weight: 500; font-size: .85rem; opacity: .85; }
.gk-has-pills select { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* ---------- Cut list builder ---------- */
.gk-cutlist { margin: 20px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; min-width: 0; }
.gk-cutlist__head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.gk-cutlist__title { font: 700 1.45rem/1 var(--display); margin: 0 0 4px; }
.gk-cutlist__hint { color: var(--muted); font-size: .95rem; margin: 0; }
.gk-mode { display: inline-flex; padding: 3px; gap: 2px; background: #ECEDE8; border-radius: var(--r); }
.gk-mode label { position: relative; }
.gk-mode input { position: absolute; opacity: 0; }
.gk-mode span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: var(--r-sm); font-weight: 600; color: var(--muted); cursor: pointer; }
.gk-mode input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(27, 30, 27, .18); }
.gk-mode input:focus-visible + span { outline: 3px solid var(--saw); outline-offset: 1px; }
.gk-cutlist__body { padding: 16px 18px 18px; }
.gk-cutlist__body[hidden] { display: none; }
.gk-cut-grid { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 76px 44px; gap: 8px 10px; align-items: center; }
.gk-cut-grid--head { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.gk-cut-row + .gk-cut-row { margin-top: 8px; }
.gk-cut-n { font: 500 .9rem var(--mono); color: var(--muted); }
.gk-cut-row input {
	width: 100%; min-height: 44px; padding: 0 10px; border: 1.5px solid #CFCCC2; border-radius: var(--r);
	background: var(--card); color: var(--ink); font: 500 1rem var(--mono);
}
.gk-cut-row input:focus { border-color: var(--saw); }
.gk-icon-btn { width: 44px; height: 44px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.gk-icon-btn:hover { background: #ECEDE8; color: var(--ink); }
.gk-add-cut {
	margin-top: 12px; min-height: 44px; padding: 0 14px; border: 1.5px dashed #9C988C; border-radius: var(--r);
	background: transparent; color: var(--ink); font: 600 1rem var(--body); cursor: pointer;
}
.gk-add-cut:hover { border-color: var(--ink); }
.gk-usage { margin-top: 14px; padding: 14px; background: var(--paper); border-radius: var(--r); }
.gk-usage__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .95rem; margin-bottom: 8px; }
.gk-usage__row strong { font-weight: 600; }
.gk-meter { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.gk-meter span { display: block; height: 100%; width: 0; background: var(--pine); border-radius: 5px; transition: width .25s ease; }
.gk-meter.is-over span { background: var(--saw); }
.gk-warn { margin-top: 10px; color: var(--saw-dark); font-weight: 600; font-size: .95rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.gk-warn[hidden] { display: none; }
.gk-warn button { min-height: 40px; padding: 0 12px; border: 1.5px solid var(--saw-dark); background: transparent; color: var(--saw-dark); border-radius: var(--r); font: 600 .95rem var(--body); cursor: pointer; }
.gk-usage__note { font-size: .88rem; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 480px) {
	.gk-cut-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px 44px; }
	.gk-cut-n, .gk-cut-grid--head span:first-child { display: none; }
}

/* ---------- Cart & checkout ---------- */
.woocommerce table.shop_table { border-radius: var(--r-lg); background: var(--card); border-color: var(--line); }
.woocommerce-cart-form .variation, .woocommerce-checkout-review-order .variation { font-size: .92rem; color: var(--muted); }
.woocommerce .variation dd p { font-family: var(--mono); font-size: .88rem; white-space: pre-line; }
.woocommerce form .form-row input.input-text, .woocommerce form .form-row textarea, .woocommerce form .form-row select {
	min-height: 46px; padding: 8px 12px; border: 1.5px solid #CFCCC2; border-radius: var(--r); background: var(--card);
}
.gk-quote-note { background: var(--pine-soft); color: #1F4029; padding: 12px 14px; border-radius: var(--r); font-size: .95rem; margin: 12px 0; }
.woocommerce-checkout #payment { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* ---------- Price list shortcode ---------- */
.gk-price-list { margin: 0 0 32px; }
.gk-price-list h3 { margin-bottom: 10px; }
.gk-table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.gk-table { width: 100%; border-collapse: collapse; font-size: .98rem; }
.gk-table th, .gk-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.gk-table thead th { font-weight: 600; color: var(--muted); font-size: .88rem; background: #FAFAF8; }
.gk-table tr:last-child td { border-bottom: 0; }
.gk-table td.gk-num { text-align: right; white-space: nowrap; }
.gk-table th.gk-num { text-align: right; }

/* ---------- Posts / 404 ---------- */
.gk-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; margin-bottom: 16px; }

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