/*!
 * ============================================================================
 * Caloundra Markets — Stallholder Terms & Conditions
 * ----------------------------------------------------------------------------
 * Built by Gravity Projex — https://gravityprojex.com.au
 * PROPRIETARY SOFTWARE — ALL RIGHTS RESERVED
 * Copyright (c) 2026 Gravity Projex.
 *
 * This file and its contents are the exclusive intellectual property of
 * Gravity Projex and are licensed, not sold, to the named client for use on
 * CaloundraMarkets.com.au only. Unauthorised copying, modification, reverse
 * engineering, redistribution, resale or reuse of this code — in whole or in
 * part, on any other domain or project — is strictly prohibited and will be
 * pursued.
 * Licence enquiries: admin@gravityprojex.com
 *
 * @package   CaloundraMarkets
 * @author    Gravity Projex
 * @license   Gravity Projex Proprietary License
 * ============================================================================
 *
 * Lifted out of the inline <style> block that used to sit inside
 * inc/stallholder-tc.php. A <style> element in the body is invalid placement
 * and uncacheable; this loads only on the terms page.
 *
 * Block, callout, table and fee-grid styling already lives in main.css and is
 * untouched — only the tab selector and section heading moved here.
 * ============================================================================
 */

.cm-tc-section-heading {
  margin: 3rem 0 1.5rem;
  padding: 1.25rem 1.5rem;
  background: color-mix(in srgb, var(--cm-terra, #c44536) 6%, transparent);
  border-left: 4px solid var(--cm-terra, #c44536);
  border-radius: 0 var(--cc-radius-md, 8px) var(--cc-radius-md, 8px) 0;
}
.cm-tc-section-heading__title {
  font-family: var(--cm-font-display);
  font-size: var(--cc-text-xl, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cc-text);
  margin: 0 0 0.25rem;
}
.cm-tc-section-heading__sub {
  font-size: var(--cc-text-sm, 0.875rem);
  color: var(--cc-text-secondary);
  margin: 0;
}
.cm-tc-market-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--cc-border);
  padding-bottom: 0;
}
.cm-tc-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.75rem 1.25rem;
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-family: var(--cc-font-body);
  color: var(--cc-text-secondary);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  margin-bottom: -2px;
}
.cm-tc-tab:hover {
  color: var(--cc-text);
  background: var(--cc-bg-card);
}
.cm-tc-tab--active {
  background: var(--cc-bg-card);
  color: var(--cc-primary);
  border-color: var(--cc-border);
  border-bottom-color: var(--cc-bg-card);
  font-weight: 600;
}
.cm-tc-tab__label {
  font-size: var(--cc-text-sm, 0.9rem);
  font-weight: 600;
  line-height: 1.2;
}
.cm-tc-tab__sub {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--cc-text-muted);
  line-height: 1;
}
.cm-tc-tab--active .cm-tc-tab__sub {
  color: var(--cc-text-secondary);
}
.cm-tc-market-panel--hidden {
  display: none;
}
@media (max-width: 600px) {
  .cm-tc-market-selector { gap: 0.35rem; }
  .cm-tc-tab { padding: 0.6rem 0.9rem; flex: 1 1 calc(50% - 0.35rem); }
  .cm-tc-tab__label { font-size: 0.78rem; }
}

/* ---------------------------------------------------------------------------
   Added with the record-driven rewrite
   --------------------------------------------------------------------------- */

/* Panels are hidden with the hidden attribute rather than a class, so they
   leave the accessibility tree and the tab order at the same time. The class
   is kept as a fallback for any cached markup. */
.cm-tc-market-panel[hidden] { display: none; }

/* Tabs are real buttons driven by roving tabindex. Without a visible focus
   ring, keyboard users cannot tell which tab they are on — WCAG 2.4.11. */
.cm-tc-tab:focus-visible {
  outline: 3px solid var(--cc-focus, #072e32);
  outline-offset: 2px;
  z-index: 1;
}

/* The panel itself is focusable so focus lands on the content after a tab is
   activated. It should not draw a ring when reached programmatically. */
.cm-tc-market-panel:focus { outline: none; }
.cm-tc-market-panel:focus-visible {
  outline: 3px solid var(--cc-focus, #072e32);
  outline-offset: 4px;
}

/* Minimum target size — WCAG 2.2 SC 2.5.8. */
.cm-tc-tab { min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  .cm-tc-tab { transition: none; }
}

/* ---------------------------------------------------------------------------
   Fee tables
   ---------------------------------------------------------------------------
   The table width used to come from an inline style attribute inside the block
   content: <div class="cm-tc-fee-market" style="width:100%;max-width:480px">.

   That worked while the terms were hardcoded PHP echoed straight to the page.
   Now the same content passes through wp_kses_post on every render, and through
   TinyMCE whenever the section is edited in the portal — either can drop or
   rewrite a style attribute. With no width, a single fee table sits in one
   narrow auto-fit grid track and long site descriptions wrap onto two lines.

   Sizing moves here so it no longer depends on an attribute inside editable
   content. The grid is forced to a single column: in practice every section has
   exactly one fee table, and forcing one column also means a stray element in
   the wrapper can never split the row again. Two tables would stack, which
   reads better on mobile anyway.
   --------------------------------------------------------------------------- */

.cm-tc-fee-grid {
  grid-template-columns: minmax(0, 1fr);
}

.cm-tc-fee-market {
  width: 100%;
  /* Wide enough that "3m x 3m Non-alcoholic drinks & Ice-cream" stays on one
     line, without leaving the two-column table stranded across a wide page. */
  max-width: 640px;
}

.cm-tc-table td:last-child,
.cm-tc-table th:last-child {
  width: 5rem;
  white-space: nowrap;
}