/* ===== CMT Sourcing — styles.css =====
   Palette from Matt's official email signature (source of truth, supersedes earlier logo-sampled values):
   navy  #2D3A5A  — brand navy, card surfaces, buttons
   gold  #C9A84C  — accent, primary CTA, headings underline
   Dark theme: deep navy page background (#1B2436) with photo sections, per Tom's direction.
*/

:root {
  --bg: #1B2436;
  --surface: #263151;
  --color-navy: #2D3A5A;
  --color-navy-dark: #151D2C;
  --color-gold: #C9A84C;
  --color-gold-dark: #B08F3A;
  --color-white: #FFFFFF;
  --color-off-white: #F5F4F1;
  --color-grey: #A9B4C9;
  --color-border: rgba(255, 255, 255, 0.14);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1440px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-off-white);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("assets/logo-icon.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(85vmin, 900px);
  opacity: 0.06;
  filter: brightness(0) invert(1);
  z-index: -1;
  pointer-events: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}

/* The generic gold outline above passes contrast (6.8:1) on this site's dark
   backgrounds, but the header is white — gold-on-white measures 2.29:1,
   failing the 3:1 UI-component minimum. Override for the one light surface. */
.site-header a:focus-visible,
.site-header button:focus-visible {
  outline-color: var(--color-gold-dark);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-white);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  background: var(--color-white);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-sm);
  z-index: 50;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.site-header.header-hidden {
  transform: translateY(-100%);
}

html {
  scroll-padding-top: 84px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Nav toggle (mobile) ---------- */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: rgba(45, 58, 90, 0.06);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-navy);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--color-navy);
}

.brand .logo {
  height: 48px;
  width: 48px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
}

.site-header nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 0;
  padding: 0;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-display);
  text-decoration: none;
  color: var(--color-navy);
  font-weight: 600;
  font-size: 0.95rem;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--color-gold-dark);
  border-bottom-color: var(--color-gold-dark);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: calc(100vh - 78px);
  min-height: calc(100svh - 78px);
  padding: 110px 0 100px;
  background-image:
    linear-gradient(90deg, rgba(21, 29, 44, 0.82) 0%, rgba(21, 29, 44, 0.5) 42%, rgba(21, 29, 44, 0.08) 68%),
    linear-gradient(0deg, rgba(21, 29, 44, 0.55) 0%, rgba(21, 29, 44, 0) 40%),
    url("assets/construction-2.jpg");
  background-size: cover;
  background-position: center top;
  border-bottom: 1px solid var(--color-border);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin: 0 0 16px;
}

.hero h1 {
  font-size: clamp(2.1rem, 1.1rem + 3.6vw, 3.4rem);
  max-width: 820px;
  margin: 0 0 20px;
}

.hero h1 .highlight {
  color: var(--color-gold);
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--color-grey);
  max-width: 620px;
  margin: 0 0 32px;
}

.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1rem;
  background: var(--color-gold);
  color: var(--color-navy-dark);
  text-decoration: none;
  font-weight: 700;
  padding: 14px 30px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--color-gold-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ---------- Sections (general) ---------- */

.section {
  padding: 64px 0;
}

.section > .container {
  position: relative;
  z-index: 1;
  border-left: 4px solid var(--color-gold);
  padding-left: 28px;
}

.section-alt {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-navy-dark);
}

.section-photo,
.section-photo-about {
  position: relative;
  overflow: hidden;
  background-color: var(--color-navy-dark);
}

.section-photo::before,
.section-photo-about::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
}

.section-photo::before {
  background-image:
    linear-gradient(rgba(21, 29, 44, 0.85), rgba(21, 29, 44, 0.85)),
    url("assets/mining-3.jpg");
  background-position: center 30%;
}

.section-photo-about::before {
  background-image:
    linear-gradient(rgba(21, 29, 44, 0.88), rgba(21, 29, 44, 0.88)),
    url("assets/hongkong-night.jpg");
  background-position: center 35%;
}

@media (prefers-reduced-motion: no-preference) {
  html.js .section-photo::before,
  html.js .section-photo-about::before {
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 0.9s ease, transform 0.9s ease;
  }

  html.js .section-photo.is-visible::before,
  html.js .section-photo-about.is-visible::before {
    opacity: 1;
    transform: scale(1);
  }
}

.section h2 {
  font-size: 1.75rem;
  margin: 0 0 12px;
}

.section h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: var(--color-gold);
  margin-top: 14px;
}

.section-intro {
  color: var(--color-grey);
  max-width: 680px;
  margin: 0 0 32px;
}

/* ---------- About ---------- */

.about-grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.about-grid h3 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.about-grid p {
  color: var(--color-grey);
  margin: 0;
}

/* ---------- What We Source ---------- */

.sourcing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.source-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  min-height: 180px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.source-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.source-card.has-photo {
  background-image: linear-gradient(180deg, rgba(21, 29, 44, 0.35) 0%, rgba(21, 29, 44, 0.92) 85%), var(--card-photo);
  /* Card photos are pre-cropped to this box's wide shape (full width of the
     original, trimmed top/bottom), so cover fills corner to corner without
     zooming in. */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.source-card h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.source-card p {
  margin: 0;
  color: var(--color-grey);
  font-size: 0.95rem;
}

.source-card.has-photo p {
  color: var(--color-off-white);
}

/* ---------- How It Works ---------- */

.process-list {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.step-icon {
  display: block;
  width: 40px;
  height: 40px;
  color: var(--color-off-white);
  margin-bottom: 16px;
}

.step-number {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.process-list h3 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}

.process-list p {
  margin: 0;
  color: var(--color-grey);
  font-size: 0.95rem;
}

/* ---------- Contact ---------- */

.contact-grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.contact-block h3 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.contact-block p {
  margin: 0 0 10px;
  color: var(--color-grey);
}

.contact-link {
  display: inline-block;
  padding: 8px 0;
  color: var(--color-off-white);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--color-gold);
  text-decoration-color: var(--color-gold);
}

.contact-form-block {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--color-border);
  max-width: 720px;
}

.contact-form-block h3 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.contact-form-block h3 + p {
  margin: 0 0 32px;
  color: var(--color-grey);
}

.contact-form {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-full {
  grid-column: 1 / -1;
}

.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-off-white);
}

.form-row input,
.form-row textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--color-off-white);
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row textarea {
  resize: vertical;
}

.form-row input:focus-visible,
.form-row textarea:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 1px;
  border-color: var(--color-gold);
  box-shadow: var(--shadow-sm);
}

.contact-form .btn {
  grid-column: 1 / -1;
  justify-self: start;
  border: none;
  cursor: pointer;
}

.form-status {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-gold);
  border-radius: var(--radius);
}

.form-status p {
  margin: 0;
  color: var(--color-grey);
  font-size: 0.95rem;
}

.form-status p + p {
  margin-top: 8px;
}

.form-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0;
}

.btn-small {
  padding: 9px 18px;
  font-size: 0.9rem;
}

.btn-secondary {
  background: transparent;
  color: var(--color-gold);
  border: 1px solid var(--color-gold);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(201, 168, 76, 0.12);
  color: var(--color-gold);
}

.enquiry-text {
  width: 100%;
  margin-top: 14px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-off-white);
  background: var(--color-navy-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px;
  resize: vertical;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--color-navy-dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 28px 0;
  font-size: 0.9rem;
  border-top: 1px solid var(--color-border);
}

.site-footer p {
  margin: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.social-link {
  display: inline-flex;
  padding: 12px;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.15s ease;
}

.social-link svg {
  width: 20px;
  height: 20px;
}

.social-link:hover,
.social-link:focus-visible {
  color: var(--color-gold);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .process-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sourcing-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  body::before {
    background-size: min(80vmin, 380px);
    opacity: 0.05;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 72px 0 56px;
    /* Mobile photo is portrait, text stacks at the top instead of sitting
       beside the image like on desktop, so this needs a top-to-bottom
       overlay instead of the desktop's left-to-right one: dark behind the
       eyebrow/headline/subtitle, fading out toward the bottom where only
       the button (its own solid background) and the crane's base sit. */
    background-image:
      linear-gradient(180deg, rgba(21, 29, 44, 0.93) 0%, rgba(21, 29, 44, 0.77) 45%, rgba(21, 29, 44, 0.40) 68%, rgba(21, 29, 44, 0.13) 100%),
      url("assets/hero-mobile-1.jpg");
  }

  .about-grid,
  .sourcing-grid,
  .process-list,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    padding: 13px 20px;
  }

  .brand .logo {
    height: 46px;
    width: 46px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .contact-form {
    grid-template-columns: 1fr;
  }
}

/* ---------- Collapsed nav ---------- */

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .site-header nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .site-header nav#primary-nav.is-open {
    max-height: 320px;
  }

  .site-header nav ul {
    flex-direction: column;
    gap: 0;
    padding: 8px 20px 16px;
  }

  .site-header nav a {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  .site-header nav li:last-child a {
    border-bottom: 0;
  }

  html {
    scroll-padding-top: 68px;
  }
}

/* ---------- Reveal on scroll ---------- */
/* Elements start hidden only once JS has confirmed it's running (the "js"
   class set synchronously in <head>) — without JS, [data-reveal] content
   is never hidden in the first place. */

html.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--reveal-delay, 0) * 90ms);
}

html.js [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal-delay="1"] { --reveal-delay: 1; }
[data-reveal-delay="2"] { --reveal-delay: 2; }
[data-reveal-delay="3"] { --reveal-delay: 3; }

@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .site-header {
    transition: none;
  }
}

/* ---------- Skeleton loading screen ---------- */
/* Shown only until the page finishes loading (see the script at the end of
   <body>), then faded out and removed — a brief static placeholder for
   slow connections rather than a real fetch-driven loading state. */

#page-skeleton {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  padding: 24px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

#page-skeleton.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 10px 0 48px;
}

.skeleton-hero {
  max-width: 720px;
  margin: 60px auto 0;
  padding: 0 4px;
}

.skeleton {
  background: linear-gradient(
    100deg,
    var(--surface) 30%,
    var(--color-navy) 50%,
    var(--surface) 70%
  );
  background-size: 300% 100%;
  animation: skeleton-shimmer 2.6s ease-in-out infinite;
  border-radius: var(--radius);
}

.skeleton-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-brand {
  width: 180px;
  height: 20px;
}

.skeleton-line {
  height: 18px;
  margin-bottom: 16px;
}

.skeleton-eyebrow { width: 45%; height: 14px; }
.skeleton-title-1 { width: 90%; height: 34px; }
.skeleton-title-2 { width: 65%; height: 34px; margin-bottom: 28px; }
.skeleton-sub-1 { width: 100%; }
.skeleton-sub-2 { width: 80%; margin-bottom: 32px; }

.skeleton-button {
  width: 150px;
  height: 44px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}
