/*
Theme Name: Feed The Gremlin
Theme URI: https://www.feedthegremlin.com
Author: William Gourley
Description: Custom theme for Feed The Gremlin - humour-driven print-on-demand apparel, now with kids & baby clothing. WooCommerce ready.
Version: 1.0
Requires PHP: 7.4
Text Domain: feedthegremlin
*/

:root {
  --color-bg: #FBF7EC;
  --color-green: #5B9A3B;
  --color-green-dark: #2F5C1E;
  --color-orange: #F0932B;
  --color-orange-dark: #D4761A;
  --color-cream-card: #FFFFFF;
  --color-border: #E5DFC8;
  --color-text: #2A2A2A;
  --font-heading: 'Baloo 2', 'Comic Sans MS', cursive, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  margin: 0;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-green-dark);
  margin: 0 0 0.5em;
}

button, input, select, textarea, optgroup {
  font-family: var(--font-body);
  font-size: 1rem;
}

a { color: inherit; text-decoration: none; }

.btn {
  display: inline-block;
  background: var(--color-orange);
  color: #fff;
  padding: 0.85em 1.8em;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--color-orange-dark); }

.btn-green {
  background: var(--color-green);
}
.btn-green:hover { background: var(--color-green-dark); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
.skip-link.screen-reader-text:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  clip: auto;
  z-index: 200;
  background: var(--color-green-dark);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 700;
}

h1 { font-size: 2.6rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.3rem; }

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
}

/* -----------------------------------------------------------
   Marquee announcement bar
   ----------------------------------------------------------- */
.ftg-marquee {
  background: var(--color-green-dark);
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
}

.ftg-marquee-track {
  display: flex;
  width: max-content;
  animation: ftg-marquee-scroll 26s linear infinite;
}

.ftg-marquee.is-paused .ftg-marquee-track,
.ftg-marquee:hover .ftg-marquee-track {
  animation-play-state: paused;
}

.ftg-marquee-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ftg-marquee-list li {
  padding: 0.6em 2rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes ftg-marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ftg-marquee-track {
    animation: none;
    overflow-x: auto;
  }
}

/* -----------------------------------------------------------
   Header
   ----------------------------------------------------------- */
.site-header {
  background: var(--color-cream-card);
  border-bottom: 3px solid var(--color-green);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header-inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 14px 24px;
  position: relative;
}

.site-branding {
  flex: 1 1 auto;
  min-width: 0;
}

.site-branding .custom-logo-link {
  display: inline-block;
}

.site-branding img.custom-logo {
  display: block;
  height: 76px;
  width: auto;
  max-width: 280px;
}

.site-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--color-green-dark);
}

.main-navigation {
  flex: 0 0 auto;
}

.primary-nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.75rem;
}

.primary-nav-list a {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 2px;
}

.primary-nav-list a:hover,
.primary-nav-list a:focus {
  color: var(--color-orange);
}

.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-icon-link {
  position: relative;
  display: inline-flex;
  color: var(--color-green-dark);
}

.header-icon-link:hover,
.header-icon-link:focus {
  color: var(--color-orange);
}

.cart-count {
  position: absolute;
  top: -7px;
  right: -9px;
  background: var(--color-orange);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 999px;
  padding: 0 3px;
}

.nav-toggle {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-green-dark);
}

@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
    order: 1;
  }

  .site-branding {
    order: 2;
    flex: 0 1 auto;
    text-align: center;
  }

  .header-actions {
    order: 3;
  }

  /* Bigger than the original mobile size, but still capped so it never
     pushes the icon row onto a new line at common mobile widths
     (375 / 390 / 414px) - the real image ratio (~1.45:1) renders well
     under this max-width at this height, so there's no wrap risk. */
  .site-branding img.custom-logo {
    height: 50px;
    max-width: 170px;
  }

  .site-title {
    font-size: 1.1rem;
  }

  .header-actions {
    gap: 10px;
  }

  .main-navigation {
    order: 4;
    flex-basis: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--color-cream-card);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
    transition: max-height 0.25s ease;
  }

  body.nav-open .main-navigation {
    max-height: 560px;
  }

  .primary-nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 20px;
  }

  .primary-nav-list li {
    border-bottom: 1px solid var(--color-border);
  }

  .primary-nav-list a {
    display: block;
    padding: 13px 4px;
  }
}

/* -----------------------------------------------------------
   Hero
   ----------------------------------------------------------- */
.hero {
  padding: 4rem 0;
  overflow: hidden;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-copy {
  flex: 1 1 480px;
}

.eyebrow {
  font-weight: 700;
  color: var(--color-orange-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  margin-bottom: 0.75em;
}

.hero h1 {
  font-size: 3.2rem;
  line-height: 1.1;
}

.hero-sub {
  font-size: 1.1rem;
  max-width: 46ch;
  margin-bottom: 1.75em;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-visual {
  flex: 1 1 360px;
  display: flex;
  justify-content: center;
}

.hero-mascot {
  max-width: 100%;
  height: auto;
  width: 420px;
  aspect-ratio: auto;
  object-fit: contain;
  filter: drop-shadow(0 20px 30px rgba(47, 92, 30, 0.25));
  transform: rotate(-4deg);
}

@media (max-width: 860px) {
  .hero-inner {
    flex-direction: column;
    text-align: center;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .hero-sub {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-ctas {
    justify-content: center;
  }
}

/* -----------------------------------------------------------
   Category showcase
   ----------------------------------------------------------- */
.category-showcase {
  padding: 3rem 0 4rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.category-card {
  background: var(--color-cream-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 24px rgba(42, 42, 42, 0.08);
}

.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-green);
  margin-bottom: 1rem;
}

.category-card h3 {
  margin-bottom: 0.35em;
}

.category-card p {
  margin: 0;
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
}

/* -----------------------------------------------------------
   Brand story
   ----------------------------------------------------------- */
.brand-story {
  background: #fff;
  padding: 4rem 0;
  scroll-margin-top: 100px;
}

.brand-story-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.brand-story-visual {
  flex: 0 0 300px;
  display: flex;
  justify-content: center;
}

.brand-story-visual img {
  max-width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

.brand-story-copy {
  flex: 1 1 480px;
}

.brand-story-copy .section-title {
  text-align: left;
}

@media (max-width: 860px) {
  .brand-story-inner {
    flex-direction: column;
    text-align: center;
  }

  .brand-story-copy .section-title {
    text-align: center;
  }
}

/* -----------------------------------------------------------
   Feature row
   ----------------------------------------------------------- */
.feature-row {
  padding: 3.5rem 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-green);
  color: #fff;
  margin-bottom: 0.85rem;
}

.feature-item h4 {
  font-family: var(--font-heading);
  color: var(--color-green-dark);
  margin-bottom: 0.35em;
}

.feature-item p {
  margin: 0;
  font-size: 0.88rem;
}

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

/* -----------------------------------------------------------
   Generic page template
   ----------------------------------------------------------- */
.page-section {
  padding: 3rem 0 4rem;
}

.page-title {
  margin-bottom: 1em;
}

.page-content :is(h2, h3) {
  margin-top: 1.2em;
}

/* -----------------------------------------------------------
   Footer
   ----------------------------------------------------------- */
.site-footer {
  background: var(--color-green-dark);
  color: #f2f0e4;
  margin-top: 3rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
  padding: 3.5rem 24px 2.5rem;
}

.footer-logo img {
  height: 64px;
  width: auto;
  margin-bottom: 0.75em;
}

.footer-tagline {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-orange);
  margin: 0;
}

.footer-heading {
  font-family: var(--font-heading);
  color: #fff;
  font-size: 1.05rem;
  margin-bottom: 0.85em;
}

.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-list li {
  margin-bottom: 0.6em;
}

.footer-list a {
  color: #dcead0;
  font-size: 0.92rem;
}

.footer-list a:hover {
  color: var(--color-orange);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1.25rem 0;
}

.footer-bottom .container {
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  font-size: 0.82rem;
  color: #cddcc0;
}

@media (max-width: 860px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 540px) {
  .footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-logo img {
    height: 56px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* -----------------------------------------------------------
   WooCommerce overrides
   ----------------------------------------------------------- */
.woocommerce-section {
  padding: 2.5rem 0 4rem;
}

.woocommerce-page-inner .page-title,
.woocommerce-page-inner h1.page-title {
  font-size: 2.2rem;
  margin-bottom: 1em;
}

.woocommerce ul.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem;
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}

/* WooCommerce's own stylesheet puts a float-clearfix on ul.products
   (::before/::after { content:" "; display:table; }) for its legacy
   float-based grid. Inside a CSS Grid container that generated ::before
   still becomes a real (invisible) grid item and silently occupies the
   first cell, pushing every actual product over by one column. Kill it. */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
  content: none !important;
  display: none !important;
}

/* WooCommerce's own woocommerce-layout.css still ships a legacy float-grid
   (ul.products.columns-3 li.product { width: 30.75%; float: left; margin: ... })
   at higher selector specificity than a plain ".woocommerce ul.products
   li.product" rule (it combines "woocommerce-page" + "products" + "columns-3"
   + "product"). Grid layout on the parent already neutralizes float, but the
   leftover width/margin from that stylesheet still shrinks every card to
   ~22-30% of its grid cell - that's the "tiny narrow cards with huge gaps"
   bug. !important resets are required here to reliably win. */
.woocommerce ul.products li.product {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  background: var(--color-cream-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.25rem;
  text-align: center;
}

.woocommerce ul.products li.product a.woocommerce-loop-product__link {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: var(--color-bg);
  margin-bottom: 0.85em;
}

.woocommerce ul.products li.product a.woocommerce-loop-product__link img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  margin: 0 !important;
  border-radius: 10px;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--font-heading);
  color: var(--color-green-dark);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
  margin: 0 0 0.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.woocommerce span.onsale {
  background: var(--color-orange);
  font-family: var(--font-body);
  font-weight: 700;
}

.woocommerce ul.products li.product .price {
  color: var(--color-orange-dark);
  font-weight: 700;
  margin-bottom: 0.75em;
}

.woocommerce ul.products li.product a.button {
  margin-top: auto;
  width: 100%;
  text-align: center;
}

.woocommerce div.product .product_title {
  font-size: 2rem;
}

.woocommerce div.product p.price,
.woocommerce div.product span.price {
  color: var(--color-orange-dark);
  font-weight: 700;
}

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.wc-block-components-button,
.wp-block-woocommerce-checkout .wc-block-components-checkout-place-order-button {
  background: var(--color-orange) !important;
  color: #fff !important;
  border-radius: 999px !important;
  font-family: var(--font-body) !important;
  font-weight: 700 !important;
  border: none !important;
  padding: 0.85em 1.8em !important;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.wc-block-components-button:hover {
  background: var(--color-orange-dark) !important;
}

.woocommerce a.added_to_cart {
  color: var(--color-green-dark);
  font-weight: 700;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
  border-radius: 8px;
}

.woocommerce table.shop_table,
.wc-block-cart,
.wc-block-checkout {
  font-family: var(--font-body);
}

.woocommerce-checkout #payment,
.wp-block-woocommerce-checkout-payment-block {
  border-radius: 12px;
}

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  border-top-color: var(--color-green) !important;
  font-family: var(--font-body);
}

@media (max-width: 1024px) {
  .woocommerce ul.products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  .woocommerce ul.products {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (max-width: 480px) {
  .woocommerce ul.products {
    gap: 0.85rem;
  }

  .woocommerce ul.products li.product {
    padding: 0.85rem;
  }
}
