/* =========================================================
   Home page hero: "Let's grow <your brand>"
   Everything is scoped under .brand-hero so it cannot affect
   other sections. Markup: src/shared/sections/index-2/BrandHero.tsx
   and the no-JavaScript copy in src/content/brandHero.ts.
   ========================================================= */

.brand-hero {
  --bh-bg: #f4f3f0;
  --bh-ink: #14130f;
  --bh-soft: #b5aea2;
  --bh-label: #6b6357;
  --bh-text: #33302a;
  --bh-line: #dad5cb;
  --bh-pad-x: clamp(20px, 5vw, 72px);
  /* The site header floats over the top of the page. */
  --bh-header: 85px;
  --bh-size: clamp(40px, 9.4vw, 146px);
  --bh-ease: cubic-bezier(0.16, 1, 0.3, 1);

  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100svh;
  padding: calc(var(--bh-header) + 32px) var(--bh-pad-x) 36px;
  background: var(--bh-bg);
  color: var(--bh-ink);
  font-family: "Space Grotesk", sans-serif;
  overflow: hidden;
}

/* Dark mode follows the site toggle (data-bs-theme on <html>), so the header,
   which turns white in dark mode, stays readable over the hero. */
[data-bs-theme="dark"] .brand-hero {
  --bh-bg: #14130f;
  --bh-ink: #f4f3f0;
  --bh-soft: #5f5a51;
  --bh-label: #a39b8f;
  --bh-text: #d7d2c8;
  --bh-line: #3a3730;
}

.brand-hero *,
.brand-hero *::before,
.brand-hero *::after {
  box-sizing: border-box;
}

/* Headline block, vertically centred in the space above the services. */
.brand-hero__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0 56px;
}

/* 1. Hint */
.brand-hero__hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bh-label);
}

.brand-hero__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bh-ink);
  animation: brand-hero-blink 1.4s steps(1, end) infinite;
}

@keyframes brand-hero-blink {
  50% {
    opacity: 0;
  }
}

/* 2. Headline */
.brand-hero__headline {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: var(--bh-size);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.brand-hero__line {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  color: var(--bh-soft);
}

/* The brand line: letters underneath, a transparent input on top.
   Long names shrink so the line never overflows the screen. */
.brand-hero__brand {
  position: relative;
  display: block;
  margin: 0;
  cursor: text;
  font-size: min(1em, calc((100vw - 2 * var(--bh-pad-x)) / (var(--bh-chars) * 0.66)));
  border-bottom: 3px solid var(--bh-line);
  transition: border-color 0.3s ease;
}

.brand-hero__brand:focus-within {
  border-bottom-color: var(--bh-ink);
}

/* The input selectors carry .brand-hero twice over so they outrank the theme's
   input[type=text] rules (font-size, height, line-height, colour). */
.brand-hero__letters,
.brand-hero .brand-hero__input {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: inherit;
  line-height: 0.96;
  letter-spacing: -0.05em;
  /* Letters are separate spans, so kerning and ligatures are off on both
     layers to keep the caret exactly between the visible letters. */
  font-kerning: none;
  font-variant-ligatures: none;
  white-space: pre;
}

/* Padding makes room for descenders (y, g) that a 0.96 line height would clip. */
.brand-hero__letters {
  display: block;
  overflow: hidden;
  padding: 0.04em 0 0.16em;
}

.brand-hero__placeholder {
  color: var(--bh-soft);
}

.brand-hero__char {
  display: inline-block;
  color: var(--bh-ink);
  white-space: pre;
  animation: brand-hero-rise 520ms var(--bh-ease) both;
}

@keyframes brand-hero-rise {
  from {
    opacity: 0;
    transform: translateY(38%);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.brand-hero .brand-hero__input,
.brand-hero .brand-hero__input:focus {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.04em 0 0.16em;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: var(--bh-ink);
  box-shadow: none;
  transition: none;
  -webkit-appearance: none;
  appearance: none;
}

.brand-hero .brand-hero__input::selection {
  background: rgba(20, 19, 15, 0.12);
}

/* 3. Paragraph and button row */
.brand-hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
  margin-top: 44px;
}

.brand-hero__text {
  max-width: 44ch;
  margin: 0;
  font-family: "Sora", sans-serif;
  font-weight: 300;
  font-size: 17px;
  line-height: 28px;
  letter-spacing: normal;
  color: var(--bh-text);
}

.brand-hero__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--bh-ink);
  color: var(--bh-bg);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.brand-hero__btn:hover {
  opacity: 0.86;
  color: var(--bh-bg);
}

/* 4. Services row, pinned to the bottom */
.brand-hero__services {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brand-hero__svc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--bh-line);
  color: var(--bh-ink);
  text-decoration: none;
  transition: border-color 420ms ease;
}

.brand-hero__svc-num {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--bh-label);
}

.brand-hero__svc-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.3;
  transition: color 420ms ease;
}

.brand-hero__svc-arrow {
  flex: none;
  color: var(--bh-soft);
  transition: color 420ms ease, transform 420ms var(--bh-ease);
}

.brand-hero__svc:hover,
.brand-hero__svc:focus-visible {
  border-top-color: var(--bh-ink);
  color: var(--bh-ink);
}

.brand-hero__svc:hover .brand-hero__svc-arrow,
.brand-hero__svc:focus-visible .brand-hero__svc-arrow {
  color: var(--bh-ink);
  transform: translate(3px, -3px);
}

/* While one service is hovered or focused, the others fade back. */
.brand-hero__services:hover .brand-hero__svc:not(:hover) .brand-hero__svc-label,
.brand-hero__services:focus-within .brand-hero__svc:not(:focus-visible):not(:hover) .brand-hero__svc-label {
  color: var(--bh-label);
}

/* Keyboard focus */
.brand-hero a:focus-visible {
  outline: 2px solid var(--bh-ink);
  outline-offset: 4px;
}

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

/* Full height on desktop, less the 64px the site's fixed bottom blur band
   (.px-blur-bottom) would otherwise lay over the services row. */
@media (min-width: 992px) {
  .brand-hero {
    min-height: max(800px, calc(100svh - 64px));
  }
}

@media (max-width: 991px) {
  .brand-hero__services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-hero__main {
    padding: 24px 0 48px;
  }
}

@media (max-width: 575px) {
  .brand-hero {
    --bh-header: 72px;
    min-height: auto;
  }

  .brand-hero__services {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand-hero__row {
    margin-top: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-hero__dot,
  .brand-hero__char {
    animation: none;
  }

  .brand-hero__svc,
  .brand-hero__svc-label,
  .brand-hero__svc-arrow,
  .brand-hero__brand {
    transition: none;
  }
}
