:root {
  --color-primary: #1D9E76;      /* Comfort Textiles brand green */
  --color-primary-dark: #085041; /* deep forest green, from logo icon/wordmark */
  --color-secondary: #085041;    /* deep forest green accent */
  --color-mint: #9FE1CC;         /* light mint, from logo tagline */
  --color-bg: #FAF7F2;
  --color-surface: #FFFFFF;
  --color-text: #2B2B2B;
  --color-text-muted: #6b6b6b;
  --color-border: #E7E0D6;
  --color-success: #3f7d4f;
  --color-danger: #b0403c;
  --radius: 8px;
  --max-width: 1200px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;   /* don't let iOS inflate text on rotate */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;              /* nothing should scroll sideways */
  font-family: 'Nunito', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
}

.section { padding: 40px 16px; }

/* Top bar */
.topbar {
  background: var(--color-secondary);
  color: #fff;
  font-size: 13px;
}
.topbar-inner {
  display: flex;
  gap: 24px;
  padding: 8px 16px;
  flex-wrap: wrap;
}
.topbar-inner a:hover { text-decoration: underline; }

/* Main nav */
.mainnav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.mainnav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.brand-logo { height: 44px; width: auto; }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  position: relative;
}
.menu-bars::before { content: ''; top: -7px; }
.menu-bars::after { content: ''; top: 5px; }
.navlinks {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.navlinks > li { position: relative; }
.navlinks > li > a {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  padding: 8px 0;
  display: inline-block;
}
.navlinks > li > a:hover { color: var(--color-primary); }
.subnav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-width: 220px;
  list-style: none;
  padding: 8px 0;
  margin: 0;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.has-sub:hover .subnav { display: block; }
.subnav li a { display: block; padding: 8px 16px; font-size: 13px; font-weight: 400; }
.subnav li a:hover { background: var(--color-bg); }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
  color: #fff;
  padding: 70px 16px;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 12px; }
.hero p { max-width: 640px; margin: 0 auto 24px; opacity: 0.95; }

a, button { -webkit-tap-highlight-color: rgba(29,158,118,0.15); }

input, select, textarea, button { font-family: inherit; font-size: 16px; }

.btn {
  display: inline-block;
  min-height: 44px;
  line-height: 20px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-size: 14px;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-large { padding: 14px 32px; font-size: 16px; }
.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-order {
  background: var(--color-secondary);
  color: #fff;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
}
.btn-order:hover { background: #2c4a72; }

/* Trust badges */
.trust-badges { background: #fff; border-bottom: 1px solid var(--color-border); padding: 20px 0; }
.trust-badges-inner {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 14px;
}
.trust-note { text-align: center; font-size: 11px; color: var(--color-text-muted); margin-top: 8px; }

/* Section header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.link-more { color: var(--color-primary); font-weight: 600; font-size: 14px; }

/* Product grid + card */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-card-img img { border-radius: var(--radius); aspect-ratio: 1 / 1; object-fit: cover; background: #f2ece2; }
.product-card-name { font-size: 13px; font-weight: 600; line-height: 1.3; min-height: 34px; }
.product-card-name:hover { color: var(--color-primary); }
.product-card-price { font-weight: 700; color: var(--color-primary-dark); }

/* Why us */
.why-us { background: var(--color-secondary); color: #fff; padding: 50px 16px; }
.why-us h2 { text-align: center; margin-bottom: 24px; }
.why-list { list-style: none; padding: 0; max-width: 640px; margin: 0 auto; display: grid; gap: 12px; }

/* CTA bottom */
.cta-bottom { background: var(--color-primary); color: #fff; text-align: center; padding: 50px 16px; }
.cta-actions { display: flex; justify-content: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.cta-bottom .btn-secondary { background: #fff; color: var(--color-primary); border: none; }

/* Footer */
.sitefooter { background: #232323; color: #ccc; padding: 40px 16px 16px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.footer-logo { margin-bottom: 12px; }
.sitefooter h4 { color: #fff; margin-bottom: 10px; }
.sitefooter ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sitefooter a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #3a3a3a; margin-top: 24px; padding-top: 16px; font-size: 12px; text-align: center; color: #999; }

/* Category page */
.breadcrumb { font-size: 13px; color: var(--color-text-muted); margin-bottom: 8px; }
.result-count { color: var(--color-text-muted); margin-bottom: 16px; }
.sub-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
}
.pill.active, .pill:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.category-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }
.filters-sidebar { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; align-self: start; }
.filters-sidebar label { display: block; font-size: 12px; font-weight: 700; margin: 12px 0 4px; text-transform: uppercase; color: var(--color-text-muted); }
.filters-sidebar select, .filters-sidebar input[type="text"] {
  width: 100%; padding: 11px 10px; min-height: 44px; border: 1px solid var(--color-border); border-radius: 6px;
}
.filters-sidebar .btn { margin-top: 12px; width: 100%; }

.pagination { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.page-link {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  line-height: 28px;
  text-align: center;
  padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 6px; font-weight: 600; font-size: 13px;
}
.page-link.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Product detail */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.product-detail-img img { border-radius: var(--radius); background: #f2ece2; }
.sku { color: var(--color-text-muted); font-size: 13px; margin: 0 0 4px; }
.product-detail-info h1 { margin: 0 0 12px; }
.stock-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-bottom: 12px; }
.stock-badge.in-stock { background: #e5f3e8; color: var(--color-success); }
.stock-badge.out-of-stock { background: #fbeaea; color: var(--color-danger); }
.price { font-size: 28px; font-weight: 800; color: var(--color-primary-dark); margin: 0 0 16px; }
.category-tag { font-size: 12px; color: var(--color-text-muted); margin: 16px 0; }

/* Contact page */
.contact-page h1 { margin-bottom: 8px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
.contact-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.contact-form { max-width: 480px; display: flex; flex-direction: column; gap: 6px; }
.contact-form input, .contact-form textarea {
  padding: 12px; min-height: 44px; border: 1px solid var(--color-border); border-radius: 6px; margin-bottom: 12px; font-family: inherit;
}
.form-note { font-size: 12px; color: var(--color-text-muted); }

/* Mobile order bar (product pages) */
.mobile-order-bar { display: none; }

/* ---------------------------------------------------------------
   Responsive / mobile
   --------------------------------------------------------------- */

/* Tablet and below */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .category-layout { grid-template-columns: 1fr; gap: 20px; }
  .product-detail { grid-template-columns: 1fr; gap: 24px; }
  .contact-grid { grid-template-columns: 1fr; }

  /* Hamburger nav */
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin-left: auto;
  }
  .navlinks {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 8px 0 4px;
    border-top: 1px solid var(--color-border);
    margin-top: 8px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .navlinks.open { display: flex; }
  .navlinks > li { width: 100%; border-bottom: 1px solid var(--color-border); }
  .navlinks > li:last-child { border-bottom: none; }
  .navlinks > li > a {
    display: block;
    padding: 14px 4px;
    font-size: 16px;
  }
  /* Subcategories can't be hovered on touch devices — show them inline
     inside the open drawer so every category is reachable by tapping. */
  .subnav,
  .has-sub:hover .subnav {
    display: block;
    position: static;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0 0 8px;
    min-width: 0;
  }
  .subnav li a {
    padding: 11px 4px 11px 18px;
    font-size: 15px;
    color: var(--color-text-muted);
  }

  .product-detail-img img { max-height: 55vh; width: auto; margin: 0 auto; }
}

/* Phones */
@media (max-width: 600px) {
  .section { padding: 28px 16px; }

  .topbar { font-size: 14px; }
  .topbar-inner { gap: 0 20px; padding: 6px 16px; }
  .topbar-inner a { padding: 6px 0; }

  .brand-logo { height: 36px; }

  .hero { padding: 44px 16px; }
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: 15px; }
  .hero .btn { width: 100%; max-width: 320px; }

  /* Two product cards per row reads better than one giant card */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card { padding: 8px; gap: 6px; }
  .product-card-name { font-size: 12.5px; min-height: 32px; }
  .product-card-price { font-size: 15px; }
  .btn-order { padding: 11px 8px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.3rem; }

  /* Category filters: horizontal pill strip, full-width controls */
  .sub-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px 16px;
    padding: 2px 16px 8px;
  }
  .sub-pills::-webkit-scrollbar { display: none; }
  .pill { flex: 0 0 auto; padding: 9px 16px; }

  .filters-sidebar { padding: 14px; }
  .filters-sidebar h3 { margin-top: 0; font-size: 1rem; }

  .why-us, .cta-bottom { padding: 36px 16px; }
  .cta-actions { flex-direction: column; align-items: stretch; }
  .cta-actions .btn { width: 100%; }

  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .sitefooter { padding: 32px 16px 16px; }
  .sitefooter ul { gap: 12px; }

  .price { font-size: 24px; }

  /* Sticky order bar so the CTA is always a thumb away */
  .mobile-order-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  }
  .mobile-order-bar .mob-price { font-weight: 800; font-size: 18px; color: var(--color-primary-dark); }
  .mobile-order-bar .btn { flex: 1; text-align: center; min-height: 48px; line-height: 24px; }
  body.has-order-bar { padding-bottom: 76px; }
  body.has-order-bar .sitefooter { margin-bottom: 8px; }
  /* The sticky bar already carries this CTA; don't show it twice. */
  .product-detail-info > .btn-large { display: none; }
}
