.categories-page {
  --cat-bg-1: #f8faf6;
  --cat-bg-2: #edf3e8;
  --cat-card: #ffffff;
  --cat-border: rgba(182, 145, 99, 0.28);
  --cat-title: #1f252f;
  --cat-text: #5d646e;
  --cat-accent: #ef820a;
  --cat-accent-soft: #d4a35a;
  background: linear-gradient(180deg, var(--cat-bg-1), var(--cat-bg-2));
  color: #222;
  overflow-x: clip;
}

.categories-shell {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
}

.categories-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(217, 178, 123, 0.35);
  background:
    linear-gradient(110deg, rgba(8, 12, 18, 0.9) 0%, rgba(30, 22, 16, 0.78) 46%, rgba(30, 22, 16, 0.5) 72%, rgba(8, 12, 18, 0.7) 100%),
    url('/assets/images/hero/pages/categories.webp') center center / cover no-repeat;
  padding: calc(var(--hero-navbar-height, 74px) + 1.5rem) 0 2.7rem;
}

.categories-hero__orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(40px);
  pointer-events: none;
}

.categories-hero__orb--left {
  width: 18rem;
  height: 18rem;
  left: -4rem;
  top: -4rem;
  background: rgba(212, 163, 90, 0.2);
}

.categories-hero__orb--right {
  width: 20rem;
  height: 20rem;
  right: -4.8rem;
  bottom: -5.8rem;
  background: rgba(116, 93, 68, 0.24);
}

.categories-hero__shell {
  position: relative;
  z-index: 1;
}

.categories-hero__panel {
  max-width: 42rem;
  padding: 0;
}

.categories-hero__panel h1 {
  margin: 0.9rem 0 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.55rem, 3.9vw, 2.85rem);
  line-height: 1.04;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
  display: inline-block;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
  border-right: 0.12em solid currentColor;
  animation: saltship-caret 0.85s step-end infinite 3.1s;
}

.categories-hero__panel h1 .hero-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.18em);
  animation: hero-word-appear 0.34s ease forwards;
  animation-delay: calc(var(--word-index, 0) * 0.12s + 0.35s);
  margin-right: 0.3ch;
}
.categories-hero__panel h1 .hero-word:last-child {
  margin-right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .categories-hero__panel h1 {
    animation: none;
    border-right: none;
  }
  .categories-hero__panel h1 .hero-word {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

@keyframes saltship-typewriter {
  to { clip-path: inset(0 0 0 0); }
}

@keyframes saltship-caret {
  50% { border-right-color: transparent; }
}

@keyframes hero-word-appear {
  from {
    opacity: 0;
    transform: translateY(0.18em);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.categories-hero__panel > p {
  margin: 0.9rem 0 0;
  max-width: 43ch;
  color: #fdf5ea;
  font-size: 0.98rem;
  line-height: 1.65;
}

.categories-main {
  padding: 2rem 0 2.8rem;
}

.categories-main__head {
  margin-bottom: 1.6rem;
  text-align: center;
}

.categories-main__head p {
  margin: 0;
  color: #9f6f33;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.categories-main__head h2 {
  margin: 0.4rem 0 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: #2a261f;
}

.categories-empty {
  border-radius: 1rem;
  border: 1px solid rgba(208, 177, 138, 0.35);
  background: rgba(255, 255, 255, 0.7);
  padding: 3rem 1rem;
  text-align: center;
  color: #5b6470;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.category-card {
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid var(--cat-border);
  background: var(--cat-card);
  box-shadow: 0 14px 30px rgba(29, 23, 17, 0.09);
  transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.category-card__link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.category-card__media {
  height: 12rem;
  overflow: hidden;
}

.category-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms ease;
}

.category-card__icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: -1.75rem auto 0;
  border-radius: 9999px;
  border: 1px solid rgba(212, 163, 90, 0.55);
  background: radial-gradient(circle at 35% 30%, #fffdf8, #f4ebdf);
  color: #af7a35;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(29, 23, 17, 0.14);
  position: relative;
  z-index: 1;
}

.category-card__body {
  padding: 0.75rem 1rem 1rem;
  text-align: center;
}

.category-card__body h3 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.2;
  color: var(--cat-title);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(1.2em * 2);
}

.category-card__body p {
  margin: 0.65rem 0 0;
  color: var(--cat-text);
  font-size: 0.92rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(1.6em * 3);
}

.category-card__cta {
  margin-top: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--cat-accent);
  font-size: 0.88rem;
  font-weight: 800;
}

.category-card:hover {
  transform: translateY(-6px);
  border-color: rgba(212, 163, 90, 0.6);
  box-shadow: 0 22px 38px rgba(29, 23, 17, 0.15);
}

.category-card:hover .category-card__media img {
  transform: scale(1.05);
}

.categories-trust {
  margin-top: 1.65rem;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(201, 165, 120, 0.3);
  background: linear-gradient(180deg, #fcf8f1, #f2e8d8);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.categories-trust article {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem;
  border-right: 1px solid rgba(206, 178, 137, 0.3);
}

.categories-trust article:last-child {
  border-right: 0;
}

.categories-trust span {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 1px solid rgba(212, 163, 90, 0.6);
  display: grid;
  place-items: center;
  color: #af7a35;
  font-size: 0.88rem;
  font-weight: 800;
}

.categories-trust h4 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.02rem;
  color: #252b34;
}

.categories-trust p {
  margin: 0.16rem 0 0;
  color: #626a74;
  font-size: 0.84rem;
  line-height: 1.45;
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 560ms ease, transform 560ms cubic-bezier(.22, 1, .36, 1);
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.categories-grid .category-card:nth-child(1) { transition-delay: 40ms; }
.categories-grid .category-card:nth-child(2) { transition-delay: 90ms; }
.categories-grid .category-card:nth-child(3) { transition-delay: 140ms; }
.categories-grid .category-card:nth-child(4) { transition-delay: 190ms; }
.categories-grid .category-card:nth-child(5) { transition-delay: 240ms; }
.categories-grid .category-card:nth-child(6) { transition-delay: 290ms; }

@media (max-width: 1200px) {
  .categories-shell {
    width: calc(100% - 1.5rem);
  }

  .categories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .categories-trust {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .categories-trust article:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 980px) {
  .categories-hero {
    padding-top: calc(var(--hero-navbar-height, 72px) + 1rem);
    padding-bottom: 2rem;
  }

  .categories-hero__panel {
    max-width: 100%;
  }

  .categories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .categories-shell {
    width: calc(100% - 1rem);
  }

  .categories-main {
    padding: 1.45rem 0 2rem;
  }

  .categories-grid,
  .categories-trust {
    grid-template-columns: 1fr;
  }

  .category-card__media {
    height: 10.7rem;
  }

  .category-card__body p {
    min-height: auto;
  }

  .categories-trust article {
    border-right: 0;
    border-bottom: 1px solid rgba(206, 178, 137, 0.3);
  }

  .categories-trust article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 420px) {
  .categories-hero__panel {
    padding: 0;
  }

  .categories-hero__panel > p {
    font-size: 0.84rem;
    line-height: 1.52;
  }

  .category-card__body {
    padding-left: 0.82rem;
    padding-right: 0.82rem;
  }

  .category-card__body p {
    font-size: 0.84rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll,
  .category-card,
  .category-card__media img,
  .categories-hero {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .reveal-on-scroll {
    opacity: 1 !important;
  }
}

/* Categories hero typewriter effect (matches contact style) */
.categories-hero__panel h1.hero-typewriter {
  overflow: hidden;
  clip-path: inset(0 100% 0 0);
  animation: categories-typewriter 2.4s steps(34, end) 0.4s forwards, categories-caret 0.8s step-end infinite 3s;
  border-right: 0.12em solid currentColor;
}

@keyframes categories-typewriter {
  to { clip-path: inset(0 0 0 0); }
}

@keyframes categories-caret {
  50% { border-right-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .categories-hero__panel h1.hero-typewriter {
    animation: none;
    clip-path: none;
    border-right: none;
  }
}

/* JS-driven typewriter override */
.hero-typewriter {
  animation: none !important;
  clip-path: none !important;
  border-right: 0 !important;
  display: block;
}

.hero-typewriter__text {
  display: inline;
}

.hero-typewriter__text.is-typing {
  border-right: 0.08em solid currentColor !important;
  animation: hero-caret-blink 0.8s step-end infinite !important;
}

@keyframes hero-caret-blink {
  50% { border-right-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-typewriter,
  .hero-typewriter__text.is-typing {
    animation: none !important;
    border-right: 0 !important;
  }
}

/* Hero responsiveness hardening */
.categories-hero__panel h1,
.categories-hero__panel > p {
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .categories-hero {
    padding-top: calc(var(--hero-navbar-height, 72px) + 0.9rem);
    padding-bottom: 2rem;
  }

  .categories-hero__panel {
    max-width: 100%;
  }

  .categories-hero__panel > p {
    max-width: 100%;
    font-size: clamp(0.88rem, 2.8vw, 0.98rem);
  }
}

@media (max-width: 460px) {
  .categories-shell {
    width: min(100%, calc(100% - 1rem));
  }

  .categories-hero__panel h1 {
    line-height: 1.1;
  }
}

