/*
 * BuildMaster: landing page layer on top of the Hazen Studio kit
 * (/hazen/hazen.css). Type, colours, buttons, cards and form fields come from
 * the kit; this file lays out the page and draws the story stage. The rules
 * join the kit's cascade layers so kit components keep their own spacing.
 */

@layer base {
  h1,
  h2,
  h3,
  h4,
  p,
  ul,
  ol,
  dl,
  dd,
  figure,
  blockquote {
    margin: 0;
  }
  ul[role="list"],
  ol[role="list"] {
    padding: 0;
    list-style: none;
  }
  img {
    display: block;
  }
  [hidden] {
    display: none !important;
  }
}

@layer components {
  /* ─── Header ─── */
  .bm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 100%;
  }
  .bm-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--hz-text);
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    text-decoration: none;
    border-radius: var(--hz-radius-sm);
  }
  .bm-brand strong {
    color: var(--hz-accent-text);
    font-weight: 600;
  }
  .bm-brand__mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--hz-radius-sm);
    background: var(--hz-accent);
    color: var(--hz-on-accent);
  }
  .bm-nav {
    display: none;
    gap: 2px;
  }
  .bm-nav .hz-nav-link.is-current {
    color: var(--hz-text);
    background: var(--hz-surface-2);
  }
  .bm-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .bm-menu {
    border-top: 1px solid var(--hz-line);
    background: var(--hz-bg);
    box-shadow: var(--hz-shadow-md);
  }
  .bm-menu ul {
    display: grid;
    gap: 2px;
    padding-block: 12px 16px;
  }
  .bm-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding-inline: 12px;
    border-radius: var(--hz-radius-md);
    color: var(--hz-text);
    font-weight: 500;
    text-decoration: none;
  }
  .bm-menu a:hover {
    background: var(--hz-surface-2);
  }
  @media (min-width: 900px) {
    .bm-nav {
      display: flex;
    }
    .bm-menu-button,
    .bm-menu {
      display: none;
    }
  }

  /* ─── Hero ─── */
  .bm-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-end;
    min-height: min(92svh, 60rem);
    overflow: clip;
    background: var(--hz-bg);
    color: var(--hz-text);
  }
  .bm-hero__image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .bm-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
      linear-gradient(to top, var(--hz-bg) 4%, color-mix(in srgb, var(--hz-bg) 72%, transparent) 45%, color-mix(in srgb, var(--hz-bg) 25%, transparent)),
      linear-gradient(to right, color-mix(in srgb, var(--hz-bg) 55%, transparent), transparent 70%);
  }
  .bm-hero__content {
    padding-block: 8rem 3rem;
  }
  .bm-hero .hz-display {
    max-width: 15ch;
    margin-top: 1.5rem;
  }
  .bm-hero .hz-lead {
    max-width: 36rem;
    margin-top: 1.75rem;
  }
  .bm-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 2.25rem;
  }
  .bm-hero__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 40rem;
    margin-top: clamp(3rem, 2rem + 4vw, 5rem);
    padding-top: 1.5rem;
    border-top: 1px solid var(--hz-line-strong);
  }

  /* ─── Sections ─── */
  .bm-band {
    border-block: 1px solid var(--hz-line);
    background: var(--hz-bg-raise);
  }
  .bm-head {
    display: grid;
    gap: 1.5rem 3rem;
    align-items: end;
    margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem);
  }
  .bm-head h2 {
    margin-top: 1rem;
  }
  @media (min-width: 960px) {
    .bm-head {
      grid-template-columns: 7fr 5fr;
    }
  }

  .bm-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--hz-radius-md);
    background: var(--hz-accent-soft);
    color: var(--hz-accent-text);
  }
  .bm-index {
    color: var(--hz-text-3);
    font-family: var(--hz-font-mono);
    font-size: var(--hz-text-xs);
  }

  /* ─── Services ─── */
  .bm-services {
    display: grid;
    gap: 1rem;
  }
  .bm-services__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .bm-services h3 {
    margin-top: 1.5rem;
    font-size: 1.125rem;
  }
  .bm-services p {
    margin-top: 0.5rem;
    color: var(--hz-text-2);
    font-size: var(--hz-text-sm);
  }
  .bm-cta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    margin-top: 2.5rem;
    color: var(--hz-text-2);
  }
  @media (min-width: 640px) {
    .bm-services {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  @media (min-width: 1080px) {
    .bm-services {
      grid-template-columns: repeat(4, 1fr);
    }
  }

  /* ─── Projects ─── */
  .bm-filter {
    display: grid;
    justify-items: start;
    gap: 8px;
  }
  .bm-filter .hz-segmented {
    max-width: 100%;
    overflow-x: auto;
  }
  .bm-count {
    color: var(--hz-text-3);
    font-size: var(--hz-text-sm);
  }
  .bm-projects {
    display: grid;
    gap: 1.25rem;
  }
  .bm-project {
    overflow: hidden;
    height: 100%;
  }
  .bm-project img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: var(--hz-surface-2);
    transition: transform var(--hz-dur-slow) var(--hz-ease-out);
  }
  .bm-project:hover img {
    transform: scale(1.03);
  }
  .bm-project__body {
    padding: 1.25rem 1.5rem 1.5rem;
  }
  .bm-project__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--hz-text-3);
    font-family: var(--hz-font-mono);
    font-size: var(--hz-text-xs);
  }
  .bm-project h3 {
    margin-top: 1rem;
    font-size: 1.25rem;
  }
  .bm-project__body > p:last-child {
    margin-top: 0.5rem;
    color: var(--hz-text-2);
    font-size: var(--hz-text-sm);
  }
  @media (min-width: 720px) {
    .bm-projects {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  @media (min-width: 960px) {
    .bm-filter {
      justify-items: end;
    }
  }

  /* ─── Story (scrollytelling) ─── */
  .bm-story__stage {
    display: none;
  }
  .bm-story__steps {
    display: grid;
    gap: 1.25rem;
  }
  .bm-story__step {
    padding: clamp(1.25rem, 1rem + 1vw, 2rem);
    border: 1px solid var(--hz-line);
    border-radius: var(--hz-radius-lg);
    background: var(--hz-surface);
    transition:
      border-color var(--hz-dur) var(--hz-ease-out),
      box-shadow var(--hz-dur) var(--hz-ease-out);
  }
  .bm-story__inline {
    width: 100%;
    aspect-ratio: 16 / 10;
    margin-bottom: 1.25rem;
    border-radius: var(--hz-radius-md);
    object-fit: cover;
    background: var(--hz-surface-2);
  }
  .bm-story__when {
    color: var(--hz-accent-text);
    font-family: var(--hz-font-mono);
    font-size: var(--hz-text-sm);
    font-weight: 500;
  }
  .bm-story__step h3 {
    margin-top: 0.5rem;
    font-size: var(--hz-text-h3);
  }
  .bm-story__step p:last-child {
    margin-top: 0.5rem;
    color: var(--hz-text-2);
  }
  @media (min-width: 1024px) {
    .bm-story {
      display: grid;
      grid-template-columns: 6fr 5fr;
      gap: 4rem;
    }
    .bm-story__stage {
      position: sticky;
      top: calc(var(--hz-header-h) + 2.5rem);
      display: block;
      align-self: start;
    }
    .bm-story__frame {
      position: relative;
      overflow: hidden;
      aspect-ratio: 9 / 7;
      border-radius: var(--hz-radius-2xl);
      background: var(--hz-surface-2);
    }
    .bm-story__frame img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      opacity: 0;
      transform: scale(1.04);
      transition:
        opacity var(--hz-dur-slow) var(--hz-ease-out),
        transform 1.2s var(--hz-ease-out);
    }
    .bm-story__frame::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(to top, rgb(0 0 0 / 0.6), transparent 55%);
    }
    .bm-story__stage[data-active="0"] [data-scene="0"],
    .bm-story__stage[data-active="1"] [data-scene="1"],
    .bm-story__stage[data-active="2"] [data-scene="2"],
    .bm-story__stage[data-active="3"] [data-scene="3"],
    .bm-story__stage[data-active="4"] [data-scene="4"] {
      opacity: 1;
      transform: none;
    }
    .bm-story__year {
      position: absolute;
      left: 2rem;
      bottom: 1.5rem;
      z-index: 1;
      color: #fff;
      font-family: var(--hz-font-mono);
      font-size: clamp(4rem, 2rem + 4vw, 6.5rem);
      font-weight: 500;
      letter-spacing: -0.05em;
      line-height: 1;
      font-variant-numeric: tabular-nums;
    }
    .bm-story__bars {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 6px;
      margin-top: 14px;
    }
    .bm-story__bars span {
      height: 4px;
      border-radius: var(--hz-radius-full);
      background: var(--hz-surface-2);
      transition: background-color var(--hz-dur) var(--hz-ease-out);
    }
    .bm-story__stage[data-active="0"] .bm-story__bars span:nth-child(-n + 1),
    .bm-story__stage[data-active="1"] .bm-story__bars span:nth-child(-n + 2),
    .bm-story__stage[data-active="2"] .bm-story__bars span:nth-child(-n + 3),
    .bm-story__stage[data-active="3"] .bm-story__bars span:nth-child(-n + 4),
    .bm-story__stage[data-active="4"] .bm-story__bars span {
      background: var(--hz-accent);
    }
    .bm-story__steps {
      gap: 0;
    }
    .bm-story__step {
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-height: 62svh;
      border-color: transparent;
      background: transparent;
    }
    /* Steps out of view stay readable (4.5:1); only their title steps back. */
    .bm-story__step:not(.is-active) h3 {
      color: var(--hz-text-2);
    }
    .bm-story__step.is-active {
      border-color: var(--hz-accent-line);
      background: var(--hz-surface);
      box-shadow: var(--hz-shadow-md);
    }
    .bm-story__inline {
      display: none;
    }
  }

  /* ─── Clients ─── */
  .bm-quotes {
    display: grid;
    gap: 1.25rem;
  }
  .bm-quote {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
  }
  .bm-quote blockquote {
    font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 1.4;
    text-wrap: pretty;
  }
  .bm-quote blockquote::before {
    content: "“";
    display: block;
    margin-bottom: 0.25rem;
    color: var(--hz-accent-text);
    font-family: var(--hz-font-serif);
    font-size: 3.5rem;
    line-height: 0.8;
  }
  .bm-quote figcaption {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 1.25rem;
    border-top: 1px solid var(--hz-line);
    color: var(--hz-text-2);
    font-size: var(--hz-text-sm);
  }
  .bm-quote figcaption img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--hz-surface-2);
  }
  .bm-quote strong {
    display: block;
    color: var(--hz-text);
  }
  @media (min-width: 860px) {
    .bm-quotes {
      grid-template-columns: 1fr 1fr;
    }
  }

  /* ─── Careers ─── */
  .bm-careers {
    display: grid;
    gap: 3rem;
  }
  .bm-careers h2 {
    margin-top: 1rem;
  }
  .bm-careers .hz-lead {
    margin-top: 1.25rem;
  }
  .bm-careers__image {
    width: 100%;
    aspect-ratio: 3 / 2;
    margin-top: 2rem;
    border-radius: var(--hz-radius-xl);
    object-fit: cover;
    background: var(--hz-surface-2);
  }
  .bm-careers__title {
    margin-bottom: 1rem;
    color: var(--hz-text-3);
    font-family: var(--hz-font-mono);
    font-size: var(--hz-text-eyebrow);
    font-weight: 500;
    letter-spacing: var(--hz-tracking-eyebrow);
    text-transform: uppercase;
  }
  .bm-jobs {
    display: grid;
    gap: 1rem;
  }
  .bm-job {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
  }
  .bm-job > div {
    flex: 1 1 16rem;
  }
  .bm-job h4 {
    font-size: 1.125rem;
  }
  .bm-job p {
    margin-top: 4px;
    color: var(--hz-text-2);
    font-size: var(--hz-text-sm);
  }
  .bm-job__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px !important;
  }
  @media (min-width: 1024px) {
    .bm-careers {
      grid-template-columns: 1fr 1fr;
      gap: 4rem;
      align-items: center;
    }
  }

  /* ─── Contact ─── */
  .bm-contact {
    display: grid;
    gap: 1.25rem;
  }
  .bm-contact form,
  .bm-sent {
    display: grid;
    gap: 1.25rem;
  }
  .bm-fields {
    display: grid;
    gap: 1.25rem;
  }
  .bm-optional {
    color: var(--hz-text-3);
    font-weight: 400;
  }
  .hz-select[aria-invalid="true"] {
    border-color: var(--hz-danger);
  }
  .bm-sent {
    justify-items: start;
    padding-block: 1rem;
  }
  .bm-sent h3 {
    font-size: var(--hz-text-h3);
    outline: none;
  }
  .bm-sent p {
    color: var(--hz-text-2);
  }
  .bm-check {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--hz-success-soft);
    color: var(--hz-success);
  }
  .bm-info {
    display: grid;
    align-self: start;
  }
  .bm-info li {
    display: flex;
    gap: 14px;
    padding: 1.25rem;
  }
  .bm-info li + li {
    border-top: 1px solid var(--hz-line);
  }
  .bm-info small {
    display: block;
    color: var(--hz-text-3);
    font-size: var(--hz-text-xs);
  }
  @media (min-width: 640px) {
    .bm-fields {
      grid-template-columns: 1fr 1fr;
    }
  }
  @media (min-width: 1024px) {
    .bm-contact {
      grid-template-columns: 1.5fr 1fr;
      gap: 2rem;
      align-items: start;
    }
  }

  /* ─── Footer ─── */
  .bm-footer {
    display: grid;
    gap: 2rem;
  }
  .bm-footer p {
    max-width: 26rem;
    margin-top: 1rem;
  }
  .bm-footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
  }
  .bm-footer a:not(.bm-brand),
  .bm-footer__bottom a {
    color: var(--hz-text-2);
    text-decoration: none;
  }
  .bm-footer a:not(.bm-brand):hover,
  .bm-footer__bottom a:hover {
    color: var(--hz-text);
  }
  .bm-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--hz-line);
  }
  @media (min-width: 900px) {
    .bm-footer {
      grid-template-columns: 1fr auto;
      align-items: start;
    }
  }
}
