/* ==========================================================================
   The Sewing Birdie — base styles
   Headings, body, links, buttons, inputs, chips, focus, reduced motion.
   Deliberately small: tokens.css carries the values, this file applies them.
   ========================================================================== */

/* --- Page ---------------------------------------------------------------- */
body:not(.wp-admin),
body.kadence-theme {
  background-color: var(--sb-bg);
  color: var(--sb-ink-2);
  font-family: var(--sb-font-body);
  font-size: var(--sb-size-body);
  line-height: var(--sb-leading-body);
  -webkit-font-smoothing: antialiased;
}

/* --- Page container ------------------------------------------------------
   #inner-wrap is a flex item of #wrapper.site, which Kadence makes
   `display:flex; flex-direction:column`. Cross-axis auto margins CANCEL
   `align-self:stretch`, so the item is laid out shrink-to-fit and collapses to
   its own content instead of filling the wrapper. Measured at 1440px on the
   deployed `develop` build, before this fix: /checkout/ with an item in the
   cart -> 321px (the block checkout then fell to 225px), /my-account/ -> 424px,
   the front page -> 48px.

   Fix: give the flex item a definite width so it fills the wrapper again; the
   auto margins then only absorb the difference between that width and
   --sb-wrap, which is what centres it. box-sizing keeps the gutter inside the
   width, so no page overflows. `.tsb-wrap` is used outside flex containers, so
   it needs the centring only.
   ------------------------------------------------------------------------- */
.site #inner-wrap,
.tsb-wrap {
  box-sizing: border-box;
  max-width: var(--sb-wrap);
  padding-inline: var(--sb-gutter);
}

.site #inner-wrap {
  margin-inline: auto;
  width: 100%;
}

.tsb-wrap {
  margin-inline: auto;
}

.tsb-wrap--checkout {
  max-width: var(--sb-wrap-checkout);
}

/* --- Section rhythm ------------------------------------------------------
   THE ONE PLACE THE 96px BETWEEN SECTIONS IS DECLARED.

   The mockups set every section's gap as a top MARGIN and give it no vertical
   padding — Home.dc.html, Courses.dc.html, Course.dc.html, About.dc.html and
   Main.dc.html all read `margin: 96px auto 0; padding: 0 24px` (the padding is
   the horizontal gutter only). So a section's box edge is its content edge and
   two stacked sections are exactly --sb-section apart.

   This rule used to be `padding-block: var(--sb-section)` while shop.css (agent
   02, loaded after this file) declared `margin-top: var(--sb-section)` for the
   same class. Different properties, so both applied: each section carried 96px
   of padding *and* 96px of margin — 192px of top spacing per section, and
   288px between two sections' content where the design says 96 (measured on
   develop @ ae9632a: home 288px, single product 288px at 1440px; 192/190px at
   390px). Two agents then patched around it in their own files:
   `.tsb-content .tsb-section { padding-block: 0 }` (content.css) and the
   `.tsb-home` rules in shop.css.

   The fix is to declare the gap ONCE, as the mockup does: margin-top, no
   padding. shop.css declares the same property with the same value (and
   `var(--sb-section-sm)` under 768px, which resolves to the same 64px the
   token override gives this file), so the two files now agree instead of
   stacking — whichever wins the cascade, the value is identical. `padding-block:
   0` is stated rather than left out so the rule is explicit about it, and so a
   later, more specific rule can still take the box back: `.tsb-band--soft`
   (shop.css) and `.tsb-c-band` (content.css) both load after this file and
   supply their own padding for a band, which is where a background needs it.

   The scoped overrides above are now no-ops (both wanted padding 0) or, in the
   front page's case, actively wrong — reported to the orchestrator rather than
   edited here. */
.tsb-section {
  margin-top: var(--sb-section);
  padding-block: 0;
}

.tsb-band {
  background-color: var(--sb-soft);
  border-radius: var(--sb-r-band);
}

.tsb-eyebrow {
  color: var(--sb-muted);
  font-size: var(--sb-size-eyebrow);
  font-weight: 500;
  letter-spacing: var(--sb-tracking-eyebrow);
  text-transform: uppercase;
}

/* --- Headings ------------------------------------------------------------ */
h1, h2, h3,
.entry-title,
.tsb-h1,
.tsb-h2,
.tsb-h3 {
  color: var(--sb-ink);
  font-family: var(--sb-font-display);
  font-weight: 400;
  letter-spacing: 0;
}

h1, .entry-title, .tsb-h1 {
  font-size: var(--sb-size-h1);
  line-height: var(--sb-leading-tight);
}

h2, .tsb-h2 {
  font-size: var(--sb-size-h2);
  line-height: 1.15;
}

h3, .tsb-h3 {
  font-size: var(--sb-size-h3);
  line-height: 1.2;
}

h4, h5, h6 {
  font-family: var(--sb-font-body);
  font-weight: 600;
  color: var(--sb-ink);
}

/* --- Body copy and links ------------------------------------------------- */
p, li, td, .tsb-body {
  font-family: var(--sb-font-body);
}

a {
  color: var(--sb-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus {
  color: var(--sb-accent-hover);
}

.tsb-link-quiet {
  color: var(--sb-muted);
  text-decoration: none;
}

/* --- Focus --------------------------------------------------------------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sb-accent-hover);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Buttons ------------------------------------------------------------- */
.tsb-btn,
.wp-block-button__link,
.kb-advanced-btn-primary,
.single_add_to_cart_button.button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.wc-block-components-button {
  align-items: center;
  background-color: var(--sb-accent-strong);
  border: 1px solid var(--sb-accent-strong);
  border-radius: var(--sb-r-btn);
  color: var(--sb-surface);
  cursor: pointer;
  display: inline-flex;
  font-family: var(--sb-font-body);
  font-size: 1rem;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  min-height: var(--sb-tap);
  padding: 12px 22px;
  text-decoration: none;
  transition: background-color var(--sb-transition), border-color var(--sb-transition);
}

.tsb-btn:hover,
.tsb-btn:focus,
.wp-block-button__link:hover,
.kb-advanced-btn-primary:hover,
.single_add_to_cart_button.button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.wc-block-components-button:hover {
  background-color: var(--sb-accent-hover);
  border-color: var(--sb-accent-hover);
  color: var(--sb-surface);
}

/* Secondary: outlined, ink. */
.tsb-btn--secondary {
  background-color: var(--sb-surface);
  border-color: var(--sb-ink);
  color: var(--sb-ink);
}

.tsb-btn--secondary:hover,
.tsb-btn--secondary:focus {
  background-color: var(--sb-soft);
  border-color: var(--sb-ink);
  color: var(--sb-ink);
}

/* Dark: ink fill. */
.tsb-btn--dark {
  background-color: var(--sb-ink);
  border-color: var(--sb-ink);
  color: var(--sb-surface);
}

.tsb-btn--dark:hover,
.tsb-btn--dark:focus {
  background-color: var(--sb-ink-2);
  border-color: var(--sb-ink-2);
  color: var(--sb-surface);
}

.tsb-btn--block {
  width: 100%;
}

/* --- Inputs -------------------------------------------------------------- */
input[type='text'],
input[type='email'],
input[type='search'],
input[type='tel'],
input[type='number'],
input[type='password'],
select,
textarea,
.tsb-input {
  background-color: var(--sb-surface);
  border: 1px solid var(--sb-line-input);
  border-radius: var(--sb-r-btn);
  color: var(--sb-ink);
  font-family: var(--sb-font-body);
  font-size: 1rem;
  min-height: 48px;
  padding: 0 14px;
  width: 100%;
}

textarea {
  padding: 12px 14px;
}

.tsb-label {
  color: var(--sb-ink);
  display: block;
  font-size: var(--sb-size-small);
  font-weight: 500;
  margin-bottom: 6px;
}

/* --- Chips and badges ---------------------------------------------------- */
.tsb-chip {
  align-items: center;
  background-color: var(--sb-chip);
  border-radius: var(--sb-r-chip);
  color: var(--sb-ink);
  display: inline-flex;
  font-size: var(--sb-size-caption);
  gap: 6px;
  padding: 6px 12px;
}

.tsb-free-price {
  color: var(--sb-success);
  font-weight: 600;
}

/* --- Images -------------------------------------------------------------- */
.tsb-photo,
.woocommerce ul.products li.product img {
  aspect-ratio: 4 / 5;
  background-color: var(--sb-photo);
  border-radius: var(--sb-r-img);
  object-fit: cover;
  width: 100%;
}

/* --- Motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* --- Screen-reader helper ------------------------------------------------ */
.tsb-visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* --- Owner-input placeholder marker ------------------------------------- */
/* Visible on staging only: anything still waiting on owner input. The wording
   is kept customer-safe — no config paths or internal file names on screen. */
.tsb-placeholder {
  border: 1px dashed var(--sb-muted);
  border-radius: var(--sb-r-btn);
  color: var(--sb-muted);
  display: inline-block;
  font-size: var(--sb-size-caption);
  padding: 6px 10px;
}

/* --- Zero-priced products read "Free" in the Cart and Checkout blocks -----
   The shop grid and the single-product page render "Free" through
   `woocommerce_get_price_html` (inc/quick-fixes.php). The Cart and Checkout
   blocks do not: they build every price client-side from the Store API's
   minor-unit amounts, and their price-format filters (`cartItemPrice`,
   `subtotalPriceFormat`, `totalValue`) THROW unless the returned string still
   contains the `<price/>` token — verified on WooCommerce 11.2.1, console:
   "Returned value must include <price/>, you passed \"Free\"". So the amount
   itself cannot be replaced from PHP or from those filters.

   What the blocks do expose is `cartItemClass`, which adds a class to the
   rendered line item in BOTH contexts (args.context 'cart' and 'summary').
   assets/js/block-free-price.js adds `tsb-item-free` to zero-priced items; here
   the numeric amount is hidden — also from the accessibility tree — and the
   word "Free" is printed in its place. Anything without the class is untouched,
   so paid prices keep formatting as 12,50 €. */
.tsb-item-free .wc-block-components-product-price__value > bdi {
  display: none;
}

.tsb-item-free .wc-block-components-product-price__value::after {
  color: var(--sb-success);
  content: 'Free';
  font-weight: 600;
}
