/* ============================================================
   COMPONENTS.CSS — Reusable UI Components
   KD Excavating v2 | Noir Studio

   Every class here is self-contained. Components know nothing
   about where they live on the page — layout files handle
   positioning. A .btn works the same in the nav, hero, or
   footer without any overrides.

   Sections:
     1. Buttons
     2. Typography Components
     3. Nav
     4. Ticker
     5. Service Row
     6. Why / Review Items
     7. Metric Cells
     8. Contact Info Items
     9. Contact Form
    10. Footer
    11. Chat Widget
   ============================================================ */


/* ══════════════════════════════════════════════════════════════
   1. BUTTONS
   Three variants, one shared base. Add a modifier class to
   change the look — the base handles sizing and behaviour.
   ══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  padding: 16px 32px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default);
}

/* Solid white — primary CTA on dark backgrounds */
.btn--solid {
  color: var(--color-black);
  background: var(--color-white);
  border-color: var(--color-white);
}
.btn--solid:hover { opacity: 0.80; }

/* Ghost white — secondary CTA on dark backgrounds */
.btn--ghost {
  color: var(--color-white);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.30);
}
.btn--ghost:hover { border-color: var(--color-white); }

/* Solid black — primary CTA on light backgrounds */
.btn--dark {
  color: var(--color-white);
  background: var(--color-black);
  border-color: var(--color-black);
}
.btn--dark:hover { opacity: 0.75; }

/* Size modifier — used in CTA bars */
.btn--lg { padding: 18px 44px; }


/* ══════════════════════════════════════════════════════════════
   2. TYPOGRAPHY COMPONENTS
   Reusable text patterns that appear across multiple sections.
   ══════════════════════════════════════════════════════════════ */

/* Small all-caps label above a section title */
.label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

/* Main section heading — display font, tight leading */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-display-lg);
  line-height: var(--leading-tight);
  text-transform: uppercase;
  letter-spacing: var(--tracking-display);
}

/* Intro paragraph under section headings */
.section-intro {
  font-size: var(--text-md);
  font-weight: var(--weight-light);
  line-height: var(--leading-loose);
  color: var(--color-text-muted);
  max-width: 400px;
}

/* Muted text variant used on dark backgrounds */
.section-intro--light {
  color: rgba(255, 255, 255, 0.65);
}


/* ══════════════════════════════════════════════════════════════
   3. NAV
   ══════════════════════════════════════════════════════════════ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--padding-inline);
  height: var(--nav-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.nav__logo {
  display: flex;
  align-items: center;
  filter: invert(1); /* white logo image on white nav = inverted to black */
}

.nav__logo img {
  height: 52px;
  width: auto;
}

.nav__links {
  display: flex;
  gap: var(--space-10);
}

.nav__links a {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-default);
}

.nav__links a:hover { color: var(--color-text); }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1000;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-black);
  transition: transform var(--duration-base) var(--ease-default),
              opacity   var(--duration-base) var(--ease-default);
}

/* Animate hamburger into an X when open */
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile-only nav items — links that only appear in the hamburger menu */
.nav__mobile-only { display: none; }


/* ══════════════════════════════════════════════════════════════
   4. TICKER
   Infinite scrolling marquee of service names.
   ══════════════════════════════════════════════════════════════ */

.ticker {
  overflow: hidden;
  background: var(--color-bg-dark);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.ticker__track {
  display: flex;
  white-space: nowrap;
  animation: ticker-scroll 28s linear infinite;
}

.ticker__item {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-light);
  padding: 15px 48px;
  flex-shrink: 0;
}

.ticker__sep {
  color: rgba(255, 255, 255, 0.25);
  padding: 15px 0;
  flex-shrink: 0;
}

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


/* ══════════════════════════════════════════════════════════════
   5. SERVICE ROW
   Each service listed as a full-width interactive row.
   ══════════════════════════════════════════════════════════════ */

.service-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 80px;
  align-items: center;
  padding: 0 var(--padding-inline);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  transition: background var(--duration-base) var(--ease-default);
}

.service-row:hover {
  background: var(--color-bg-dark);
  color: var(--color-text-light);
}

.service-row__num {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  padding: 36px 0;
}

.service-row__name {
  font-family: var(--font-display);
  font-size: var(--text-display-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tight);
  padding: 36px var(--space-10);
}

.service-row__desc {
  font-size: 14px;
  font-weight: var(--weight-light);
  line-height: var(--leading-loose);
  color: var(--color-text-muted);
  padding: 36px var(--space-10) 36px 0;
}

.service-row__arrow {
  font-size: 24px;
  opacity: 0;
  justify-self: end;
  transition: opacity var(--duration-base) var(--ease-default);
}

/* Show arrow and update muted text colours on hover */
.service-row:hover .service-row__num,
.service-row:hover .service-row__desc  { color: rgba(255, 255, 255, 0.45); }
.service-row:hover .service-row__arrow { opacity: 1; }


/* ══════════════════════════════════════════════════════════════
   6. WHY / REVIEW ITEMS
   Customer review cards in the Why section.
   ══════════════════════════════════════════════════════════════ */

.review-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--color-border);
}

.review-item:last-child { border-bottom: 1px solid var(--color-border); }

.review-item__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.review-item__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 24px;
  flex-shrink: 0;
  object-fit: cover;   /* works when element is an <img> */
  border: 1px solid #eee;
}

.review-item__name {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-text);
}

.review-item__role {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.review-item__text {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}


/* ══════════════════════════════════════════════════════════════
   7. METRIC CELLS
   Large stat numbers in the dark right panel of the Why section.
   ══════════════════════════════════════════════════════════════ */

.metric-cell {
  padding: var(--space-14) var(--padding-inline);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--color-border-dark);
  border-bottom: 1px solid var(--color-border-dark);
}

/* Video background is decorative — sits behind the stat numbers */
.metric-cell__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.15;
  z-index: 0;
}

.metric-cell__content {
  position: relative;
  z-index: 1;
}

.metric-cell__num {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 80px);
  letter-spacing: var(--tracking-display);
  line-height: 1;
  color: var(--color-text-light);
  margin-bottom: var(--space-2);
}

.metric-cell__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.40);
}


/* ══════════════════════════════════════════════════════════════
   8. CONTACT INFO ITEMS
   Phone, email, address entries in the contact left panel.
   ══════════════════════════════════════════════════════════════ */

.contact-item {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.contact-item:last-child { border-bottom: 1px solid var(--color-border); }

.contact-item__label {
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.contact-item__value {
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
}


/* ══════════════════════════════════════════════════════════════
   9. CONTACT FORM
   Grid-based form with editorial bordered-field layout.
   ══════════════════════════════════════════════════════════════ */

.form {
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

/* Each row holds one or two fields side by side */
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--color-border);
}

.form__row--single {
  grid-template-columns: 1fr;
}

/* A field is a label + input stacked vertically */
.form__field {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
}

.form__row--single .form__field,
.form__field:last-child { border-right: none; }

.form__field label {
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: var(--space-4) var(--space-5) var(--space-2);
}

.form__field input,
.form__field select,
.form__field textarea {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--color-text);
  padding: 0 var(--space-5) var(--space-4);
  width: 100%;
  appearance: none;
}

.form__field textarea {
  resize: none;
  min-height: 140px;
}

.form__field input::placeholder,
.form__field textarea::placeholder { color: #bbb; }

/* Turnstile captcha row */
.form__captcha {
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
}

.form__captcha-error {
  display: none;
  font-size: var(--text-sm);
  color: #c00;
  letter-spacing: 0.05em;
  padding: 0 var(--space-5) var(--space-4);
}

/* Submit row */
.form__submit button {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-light);
  background: var(--color-bg-dark);
  border: none;
  padding: 22px;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-default);
}

.form__submit button:hover { opacity: 0.75; }


/* ══════════════════════════════════════════════════════════════
   10. FOOTER
   ══════════════════════════════════════════════════════════════ */

.footer__logo img {
  height: 60px;
  width: auto;
  filter: invert(1);
  margin-bottom: var(--space-4);
}

.footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__links a {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-default);
}

.footer__links a:hover { color: var(--color-text); }

.footer__tagline {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: var(--leading-snug);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tight);
}


/* ══════════════════════════════════════════════════════════════
   11. CHAT WIDGET
   Fixed bubble + sliding window — fully self-contained.
   ══════════════════════════════════════════════════════════════ */

.chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-4);
  font-family: var(--font-body);
}

.chat-bubble__toggle {
  width: 58px;
  height: 58px;
  background: var(--color-black);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  transition: transform var(--duration-base) var(--ease-default);
  flex-shrink: 0;
}

.chat-bubble__toggle:hover { transform: scale(1.08); }

.chat-bubble__toggle svg {
  width: 26px;
  height: 26px;
  stroke: var(--color-white);
  fill: none;
  stroke-width: 1.8;
  transition: opacity var(--duration-base) var(--ease-default);
}

.chat-bubble__toggle .icon-close { display: none; }

/* Chat window — hidden until toggled open */
.chat-window {
  width: 360px;
  background: var(--color-white);
  border: 1px solid var(--color-black);
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.18);
}

.chat-window.is-open { display: flex; }

.chat-window__header {
  background: var(--color-black);
  color: var(--color-white);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid #222;
}

.chat-window__avatar {
  width: 36px;
  height: 36px;
  background: var(--color-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-window__avatar svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-black);
  fill: none;
  stroke-width: 1.8;
}

.chat-window__title {
  font-size: 13px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.chat-window__sub {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.50);
  margin-top: 1px;
}

/* Message feed */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 340px;
  min-height: 200px;
}

.msg {
  max-width: 82%;
  font-size: 14px;
  padding: var(--space-3) 15px;
}

.msg--bot {
  background: #f4f4f2;
  color: var(--color-black);
  align-self: flex-start;
  border: 1px solid #e8e8e8;
}

.msg--user {
  background: var(--color-black);
  color: var(--color-white);
  align-self: flex-end;
}

.msg--owner {
  background: #222;
  color: var(--color-white);
  align-self: flex-start;
  border-left: 3px solid #666;
}

.msg--typing {
  background: #f4f4f2;
  border: 1px solid #e8e8e8;
  align-self: flex-start;
  padding: var(--space-3) 18px;
}

/* Small sender label above each bubble */
.msg__label {
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.msg--user  .msg__label { color: rgba(255, 255, 255, 0.50); }
.msg--bot   .msg__label { color: rgba(0,   0,   0,   0.40); }
.msg--owner .msg__label { color: rgba(255, 255, 255, 0.45); }

/* Centered handoff status strip */
.msg--status {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #999;
  padding: var(--space-1) 0;
  width: 100%;
}

/* Typing indicator dots */
.typing-dots {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--color-mid);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.20s; }
.typing-dots span:nth-child(3) { animation-delay: 0.40s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40%            { opacity: 1.0; }
}

/* Input row */
.chat-input-row {
  display: flex;
  border-top: 1px solid var(--color-black);
}

.chat-input-row__field {
  flex: 1;
  border: none;
  outline: none;
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--color-white);
  color: var(--color-black);
}

.chat-input-row__field::placeholder { color: #bbb; }

.chat-input-row__send {
  background: var(--color-black);
  border: none;
  padding: 0 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--duration-fast) var(--ease-default);
}

.chat-input-row__send:hover { opacity: 0.70; }

.chat-input-row__send svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-white);
  fill: none;
  stroke-width: 2;
}
