/**
 * Reusable components: buttons, cards, section headings, breadcrumbs.
 */

/* Buttons */
.tg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px 12px 28px;
  border-radius: var(--tg-radius-lg);
  font-weight: 600;
  font-size: 15px;
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--tg-transition),
    color var(--tg-transition),
    border-color var(--tg-transition);
  min-height: 44px;
}

.tg-btn::after {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: transform var(--tg-transition);
}

.tg-btn:hover::after,
.tg-btn:focus-visible::after {
  transform: translateX(3px);
}

.tg-btn--primary {
  background-color: var(--tg-color-primary);
  color: var(--tg-white);
}

.tg-btn--primary:hover,
.tg-btn--primary:focus-visible {
  background-color: var(--tg-color-primary-dark);
  color: var(--tg-white);
}

.tg-btn--secondary {
  background-color: transparent;
  border-color: var(--tg-white);
  color: var(--tg-white);
}

.tg-btn--secondary:hover,
.tg-btn--secondary:focus-visible {
  background-color: var(--tg-white);
  color: var(--tg-dark-blue);
}

.tg-btn--outline {
  background-color: transparent;
  border-color: var(--tg-color-secondary);
  color: var(--tg-color-secondary);
}

.tg-btn--outline:hover,
.tg-btn--outline:focus-visible {
  background-color: var(--tg-color-secondary);
  color: var(--tg-white);
}

.tg-btn--accent {
  background-color: var(--tg-color-accent);
  color: var(--tg-white);
}

.tg-btn--accent:hover,
.tg-btn--accent:focus-visible {
  background-color: var(--tg-color-accent-dark);
  color: var(--tg-white);
}

/* Section heading */
.tg-section-heading {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 48px;
}

.tg-section-heading__eyebrow {
  display: inline-block;
  color: var(--tg-green);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  margin-bottom: 12px;
}

.tg-section-heading__title {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 12px;
}

.tg-section-heading__desc {
  color: var(--tg-muted);
  font-size: 17px;
}

/* Cards */
.tg-card {
  position: relative;
  background-color: var(--tg-white);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  overflow: hidden;
  box-shadow: var(--tg-shadow-sm);
  transition:
    box-shadow var(--tg-transition),
    transform var(--tg-transition);
}

/*
 * Stretched-link pattern: the title link's ::after covers the whole card,
 * making the entire card clickable while leaving room for a real, separately
 * clickable button (Enquire) layered above it via z-index.
 */
.tg-card__link-overlay {
  position: relative;
  z-index: 1;
}

.tg-card__link-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.tg-product-card__actions {
  position: relative;
  z-index: 2;
}

.tg-card:hover {
  box-shadow: var(--tg-shadow);
  transform: translateY(-2px);
}

.tg-card__media {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: var(--tg-background);
}

.tg-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*
 * Product shots are catalogue images: the whole product centred on a white
 * background, often with generous margins of its own. `cover` crops their top
 * and bottom, so product cards switch to `contain` to keep the item whole.
 * Project/post cards keep `cover` — those are real photographs where filling
 * the frame is what's wanted.
 */
.tg-product-card .tg-card__media {
  background-color: var(--tg-white);
  padding: 12px;
}

/*
 * height is restated here, not just inherited from .tg-card__media img: that
 * base rule is (0,1,1), which only ties with Elementor's `.elementor img
 * { height: auto }` reset and loses on source order wherever a product grid
 * sits inside an Elementor page. This selector is (0,2,1) and wins outright.
 */
.tg-product-card .tg-card__media img {
  height: 100%;
  object-fit: contain;
}

/* ------------------------------------------------------------------ */
/* Shine sweep on hover                                                */
/* ------------------------------------------------------------------ */

/*
 * A diagonal band of light passes across an image when its card is hovered.
 *
 * The highlight is a pseudo-element on the media wrapper rather than a filter
 * on the <img>, so it works whether the image is `cover` or `contain` and
 * never alters the product's own colours.
 *
 * Applied to content imagery only — the site logo, feature ticks, social and
 * decorative SVGs are deliberately excluded, since a gloss sweep across a
 * transparent logo or a 16px icon reads as a rendering glitch.
 *
 * The wrappers each already clip their contents; position is asserted here
 * because several of them are static, and an unpositioned parent would let the
 * highlight escape and slide across the whole page.
 */
.tg-card__media,
.tg-product-card__media,
.tg-cat-card__media,
.tg-service-card__media,
.tg-project-feature__media {
  position: relative;
}

.tg-card__media::before,
.tg-product-card__media::before,
.tg-cat-card__media::before,
.tg-service-card__media::before,
.tg-project-feature__media::before {
  content: "";
  position: absolute;
  top: 0;
  /* Starts fully off the left edge and travels past the right. */
  left: -75%;
  width: 50%;
  height: 100%;
  /* Above the image, below the stretched card link and any card buttons.
     pointer-events:none keeps it click-through regardless. */
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
}

/*
 * Driven from the card, not the media box, so the sweep fires wherever the
 * pointer enters the card — matching the existing zoom, which behaves the
 * same way.
 */
.tg-card:hover .tg-card__media::before,
.tg-product-card:hover .tg-product-card__media::before,
.tg-cat-card:hover .tg-cat-card__media::before,
.tg-service-card:hover .tg-service-card__media::before,
.tg-project-feature:hover .tg-project-feature__media::before {
  animation: tg-shine 0.85s ease-out;
}

@keyframes tg-shine {
  from {
    left: -75%;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  to {
    left: 125%;
    opacity: 0;
  }
}

/* A sweeping highlight is exactly the kind of non-essential motion this
   setting is meant to suppress. */
@media (prefers-reduced-motion: reduce) {
  .tg-card:hover .tg-card__media::before,
  .tg-product-card:hover .tg-product-card__media::before,
  .tg-cat-card:hover .tg-cat-card__media::before,
  .tg-service-card:hover .tg-service-card__media::before,
  .tg-project-feature:hover .tg-project-feature__media::before {
    animation: none;
  }
}

.tg-card__body {
  padding: 20px;
}

.tg-card__category {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tg-blue);
  margin-bottom: 8px;
  display: block;
}

.tg-card__title {
  font-size: 18px;
  margin-bottom: 8px;
}

.tg-card__desc {
  color: var(--tg-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Grid utility */
.tg-grid {
  display: grid;
  gap: var(--tg-gutter);
  grid-template-columns: repeat(var(--tg-cols, 3), 1fr);
}

@media (max-width: 1024px) {
  .tg-grid {
    grid-template-columns: repeat(var(--tg-cols-tablet, 2), 1fr);
  }
}

@media (max-width: 600px) {
  .tg-grid {
    grid-template-columns: repeat(var(--tg-cols-mobile, 1), 1fr);
  }
}

/* Breadcrumb */
.tg-breadcrumb {
  font-size: 14px;
  color: var(--tg-muted);
  padding: 16px 0;
}

.tg-breadcrumb a {
  color: var(--tg-muted);
}

.tg-breadcrumb a:hover {
  color: var(--tg-green);
}

.tg-breadcrumb__sep {
  margin: 0 8px;
  color: var(--tg-border);
}

.tg-breadcrumb [aria-current="page"] {
  color: var(--tg-green);
  font-weight: 600;
}

/* Page header banner — shared title treatment for archives, categories,
   static pages and single posts (not used on the single product page,
   which has its own hero). */
.tg-page-header {
  background-color: var(--tg-background);
  border-bottom: 1px solid var(--tg-border);
  padding-block: var(--tg-space-lg) var(--tg-space-xl);
  text-align: center;
}

/* Sits below the title, so its spacing is on top. The breadcrumb is a
   block nav with inline children, so the banner's text-align: center
   carries it — no extra centering needed here. */
.tg-page-header .tg-breadcrumb {
  padding: var(--tg-space-sm) 0 0;
}

.tg-page-header__title {
  font-family: var(--tg-font-heading);
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.75rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--tg-dark-blue);
  margin: 0;
}

.tg-page-header__desc {
  max-width: 640px;
  margin-inline: auto;
  color: var(--tg-muted);
  font-size: var(--tg-text-base);
  line-height: 1.6;
  margin-top: 10px;
}

/* Icon */
.tg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tg-icon svg {
  width: 1em;
  height: 1em;
}

/* CTA band */
.tg-cta-band {
  background: linear-gradient(120deg, var(--tg-dark-blue), var(--tg-blue));
  color: var(--tg-white);
  border-radius: var(--tg-radius-lg);
  padding: 56px var(--tg-gutter);
  text-align: center;
}

.tg-cta-band__title {
  color: var(--tg-white);
  font-size: clamp(24px, 3.5vw, 34px);
}

.tg-cta-band__desc {
  max-width: 640px;
  margin: 0 auto 24px;
  opacity: 0.9;
}

/* Stats */
.tg-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--tg-gutter);
  text-align: center;
}

@media (max-width: 768px) {
  .tg-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tg-stats__number {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  color: var(--tg-green);
  display: block;
}

.tg-stats__label {
  color: var(--tg-muted);
  font-size: 14px;
}

/* Process steps */
.tg-process {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--tg-gutter);
}

@media (max-width: 768px) {
  .tg-process {
    grid-template-columns: 1fr;
  }
}

.tg-process__step {
  text-align: center;
  position: relative;
}

.tg-process__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--tg-green);
  color: var(--tg-white);
  font-weight: 700;
  margin-bottom: 16px;
}

/* Badge / tag */
/* ------------------------------------------------------------------ */
/* Search form (header panel + archive/category pages)                 */
/* ------------------------------------------------------------------ */

.tg-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Decorative magnifier sitting inside the field's left padding. */
.tg-search-form__icon {
  position: absolute;
  left: 16px;
  display: flex;
  align-items: center;
  pointer-events: none;
  color: var(--tg-muted);
}

.tg-search-form__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.tg-search-form__input {
  width: 100%;
  /* Right padding clears the submit button, left clears the icon. */
  padding: 14px 108px 14px 46px;
  font-family: inherit;
  font-size: 15px;
  color: var(--tg-text);
  background-color: var(--tg-white);
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius);
  transition: border-color var(--tg-transition), box-shadow var(--tg-transition);
}

.tg-search-form__input::placeholder {
  color: var(--tg-muted);
}

.tg-search-form__input:focus {
  outline: none;
  border-color: var(--tg-color-primary);
  box-shadow: 0 0 0 3px rgba(22, 120, 184, 0.15);
}

/* Clear the UA-drawn clear button so it can't collide with the submit. */
.tg-search-form__input::-webkit-search-cancel-button {
  margin-right: 4px;
}

.tg-search-form__submit {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding-inline: 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-white);
  background-color: var(--tg-color-primary);
  border: none;
  border-radius: var(--tg-radius-sm);
  cursor: pointer;
  transition: background-color var(--tg-transition);
}

.tg-search-form__submit:hover,
.tg-search-form__submit:focus-visible {
  background-color: var(--tg-color-primary-dark);
}

.tg-search-form__submit svg {
  width: 16px;
  height: 16px;
  display: block;
}

@media (max-width: 480px) {
  .tg-search-form__input {
    padding-right: 56px;
  }

  .tg-search-form__submit {
    padding-inline: 14px;
  }
}

.tg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: rgba(0, 155, 85, 0.1);
  color: var(--tg-green-dark);
}

.tg-badge--blue {
  background-color: rgba(22, 120, 184, 0.1);
  color: var(--tg-blue-dark);
}

.tg-badge--orange {
  background-color: rgba(245, 166, 35, 0.12);
  color: var(--tg-orange-dark);
}

/* Form fields (enquiry form/modal) */
.tg-field {
  margin-bottom: 0;
}

.tg-field label {
  display: block;
  font-weight: 600;
  font-size: var(--tg-text-sm);
  margin-bottom: 4px;
  color: var(--tg-text);
}

.tg-field input,
.tg-field textarea,
.tg-field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--tg-border);
  border-radius: var(--tg-radius-sm);
  font-family: var(--tg-font-body);
  font-size: var(--tg-text-base);
  color: var(--tg-text);
  background-color: var(--tg-white);
  transition: border-color var(--tg-transition);
  min-height: 40px;
}

.tg-field textarea {
  min-height: 40px;
  resize: vertical;
}

.tg-field input:focus,
.tg-field textarea:focus,
.tg-field select:focus {
  outline: none;
  border-color: var(--tg-blue);
  box-shadow: 0 0 0 3px rgba(22, 120, 184, 0.15);
}

/* Floating labels: the label sits inside the field at rest (acting like a
   placeholder) and floats above the border once the field is focused or
   already has a value. Relies on the input's own `placeholder=" "` (a
   single space) so `:placeholder-shown` reliably tracks "empty" across
   browsers — an empty placeholder attribute doesn't trigger the pseudo-class
   consistently in every engine, but a whitespace one does. */
.tg-field--floating {
  position: relative;
}

.tg-field--floating input,
.tg-field--floating textarea {
  padding-top: 18px;
  padding-bottom: 6px;
}

.tg-field--floating textarea {
  padding-top: 20px;
}

.tg-field--floating label {
  position: absolute;
  left: 15px;
  top: 12px;
  margin: 0;
  font-weight: 500;
  font-size: var(--tg-text-base);
  color: var(--tg-muted);
  pointer-events: none;
  transform-origin: left top;
  transition: transform var(--tg-transition), color var(--tg-transition), top var(--tg-transition);
}

.tg-field--floating input:focus + label,
.tg-field--floating input:not(:placeholder-shown) + label,
.tg-field--floating textarea:focus + label,
.tg-field--floating textarea:not(:placeholder-shown) + label {
  top: 5px;
  transform: scale(0.75);
  color: var(--tg-blue);
}

/* Enquiry modal shell — stays in the DOM/rendering flow at all times (not
   display:none) so opacity/transform can actually transition; visibility
   handles removing it from the accessibility tree and hit-testing once
   fully faded out. */
.tg-enquiry-modal {
  position: fixed;
  inset: 0;
  z-index: var(--tg-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--tg-space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--tg-transition-slow), visibility 0s linear var(--tg-transition-slow);
}

.tg-enquiry-modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--tg-transition-slow), visibility 0s linear;
}

.tg-enquiry-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(23, 43, 58, 0.6);
}

.tg-enquiry-modal__panel {
  position: relative;
  background-color: var(--tg-white);
  border-radius: var(--tg-radius-lg);
  box-shadow: var(--tg-shadow-lg);
  max-width: 780px;
  width: 100%;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  opacity: 0;
  transition: transform var(--tg-transition-slow), opacity var(--tg-transition-slow);
}

.tg-enquiry-modal.is-open .tg-enquiry-modal__panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tg-enquiry-modal,
  .tg-enquiry-modal__panel {
    transition-duration: 0.01ms;
  }
}

.tg-enquiry-modal__media {
  position: relative;
  background-color: var(--tg-background);
  overflow: hidden;
}

.tg-enquiry-modal__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tg-enquiry-modal__media .tg-product-placeholder {
  padding: var(--tg-space-md);
}

.tg-enquiry-modal__body {
  padding: 28px 32px;
  min-width: 0;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .tg-enquiry-modal__panel {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow-y: auto;
  }

  .tg-enquiry-modal__media {
    height: 160px;
  }
}

.tg-enquiry-modal__close {
  position: absolute;
  top: var(--tg-space-sm);
  right: var(--tg-space-sm);
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--tg-muted);
}

.tg-enquiry-modal__close:hover {
  background-color: var(--tg-background);
  color: var(--tg-text);
}

body.tg-menu-open {
  overflow: hidden;
}

/* Pagination (the_posts_pagination default markup) */
.tg-pagination {
  margin-top: var(--tg-space-xl);
}

.tg-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tg-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--tg-radius);
  border: 1px solid var(--tg-border);
  background-color: var(--tg-white);
  color: var(--tg-text);
  font-weight: 600;
  font-size: var(--tg-text-sm);
  text-decoration: none;
  transition:
    background-color var(--tg-transition),
    border-color var(--tg-transition),
    color var(--tg-transition);
}

.tg-pagination a.page-numbers:hover,
.tg-pagination a.page-numbers:focus-visible {
  background-color: var(--tg-color-primary);
  border-color: var(--tg-color-primary);
  color: var(--tg-white);
}

.tg-pagination .page-numbers.current {
  background-color: var(--tg-color-primary);
  border-color: var(--tg-color-primary);
  color: var(--tg-white);
}

.tg-pagination .page-numbers.dots {
  border-color: transparent;
  background: none;
  min-width: auto;
  padding: 0 4px;
  color: var(--tg-muted);
}

.tg-pagination .page-numbers.next,
.tg-pagination .page-numbers.prev {
  padding: 0 18px;
}

@media (max-width: 480px) {
  .tg-pagination .page-numbers {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    font-size: var(--tg-text-xs);
  }
}
