/* Jozi Justice - Monochrome (Black & White) Styles */
:root {
  /* Color palette (use explicit RGB values) */
  --bg: rgb(255,255,255);
  --paper: rgb(250,250,250);
  --text: rgb(17,17,17);
  --muted: rgb(107,107,107);
  --border: rgb(230,230,230);
  --accent: rgb(0,0,0);

  /* Layout */
  --max-width: 1100px;
  --gutter: 1.25rem;

  /* Hero sizing (adjustable) - default: top quarter on desktop */
  --hero-desktop: 25vh; /* roughly top quarter */
  --hero-mobile: 30vh;  /* slightly taller on small screens */
}

/* Reset & base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { width: min(94%, var(--max-width)); margin: 0 auto; }

main { flex: 1 1 auto; }

/* Header / Navigation */
header {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 60;
}
.nav-container { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding: .85rem 0; }
.logo { font-weight: 700; font-size: 1.25rem; letter-spacing: .2px; }
nav { display:flex; gap: 1rem; align-items:center; }
nav a { color:var(--text); text-decoration:none; font-weight:600; padding:.35rem .25rem; border-radius:6px; }
nav a:hover, nav a:focus { background: rgba(0,0,0,0.04); outline: none; }

.menu-toggle { display:none; background:transparent; border:0; font-size:1.35rem; cursor:pointer; padding:.25rem .5rem; position:relative; z-index:80; }
.menu-toggle:focus { outline:2px solid rgba(0,0,0,0.12); }

.mobile-nav { display:none; position:absolute; left:0; right:0; top:100%; background:var(--paper); border-top:1px solid var(--border); padding: .75rem 1rem; box-shadow:0 6px 18px rgba(0,0,0,0.06); z-index:70; }
.mobile-nav a { display:block; padding:.65rem 0; border-bottom:1px solid rgba(0,0,0,0.03); }
.mobile-nav.active { display:block; }

/* Slide-down animation and initial hidden state for mobile nav */
.mobile-nav {
  transform-origin: top center;
  transform: translateY(-6px);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: transform 260ms ease, opacity 260ms ease, max-height 260ms ease;
  pointer-events: none;
}
.mobile-nav.active {
  transform: translateY(0);
  opacity: 1;
  max-height: 90vh; /* allow room for menu content */
  pointer-events: auto;
}

/* Close button inside mobile nav */
.mobile-close {
  position: absolute;
  right: 0.6rem;
  top: 0.4rem;
  background: transparent;
  border: 0;
  font-size: 1.25rem;
  padding: .5rem;
  color: var(--text);
  cursor: pointer;
}
.mobile-close:focus { outline: 2px solid rgba(0,0,0,0.12); border-radius:6px; }

/* On very small screens make the menu take the full viewport height (optional) */
@media (max-width: 420px) {
  .mobile-nav { position: fixed; top: 0; left: 0; right: 0; bottom: 0; padding-top: calc(var(--hero-mobile) + 0.5rem); overflow:auto; }
  header { position: static; }
}

/* Prevent a brief horizontal scrollbar caused by full-bleed elements */
html, body { overflow-x: hidden; }

/* Hero */
.hero { position: relative; overflow:hidden; padding-bottom: 2.25rem; color:#fff; }
.hero-image { position:absolute; top:0; left:50%; transform:translateX(-50%); width:100vw; max-width:none; height:var(--hero-desktop); object-fit:cover; object-position:top center; z-index:1; }
.hero .container { position:relative; z-index:3; padding-top: calc(var(--hero-desktop) + 1rem); text-align:center; }
.hero--overlay { padding-bottom: 0; min-height: var(--hero-desktop); }
.hero--overlay .container { padding-top: 0; display:flex; flex-direction:column; align-items:center; justify-content:center; min-height: var(--hero-desktop); }
.hero--overlay .hero-image { height: var(--hero-desktop); }
.hero h1 { font-size: clamp(1.6rem, 3.2vw, 2.8rem); margin: .25rem 0 1rem; color: #fff; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.hero p { max-width: 70ch; margin: 0 auto 1.5rem; color: rgba(255,255,255,0.95); font-size: 1.05rem; line-height: 1.6; }
.btn-primary { display: inline-block; background: #fff; color: #000; padding: 0.75rem 1.8rem; border-radius: 8px; font-weight: 700; text-decoration: none; border: 2px solid #fff; transition: all 220ms ease; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-primary:hover { background: #f0f0f0; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.2); }
.btn-primary:active { transform: translateY(0); }

/* Decorative visual header (black band) when .hero--visual is used */
.hero--visual::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgb(0,0,0) 0%, rgb(25,25,25) 100%); /* subtle dark gradient */
  z-index: 1;
}

/* Place hero content inside the black band for the visual header variant */
.hero--visual {
  min-height: auto;
  padding: 3rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgb(0,0,0) 0%, rgb(25,25,25) 100%);
}
.hero--visual .container {
  /* override the default hero container padding so text sits within the band */
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: auto; /* allow container to expand for content */
  position: relative;
  z-index: 3; /* sit above the black band pseudo-element */
  text-align: center;
}
/* ensure headings and buttons are high-contrast on the black band */
.hero--visual h1,
.hero--visual p { color: #fff; }
.hero--visual .btn-primary { background: #fff; color: #000; }

/* Warehouse / standalone image section (responsive) */
.hero-img { position: relative; overflow: visible; }
.hero-img .img-wrap { width: 100%; display:block; }
/* When the image wrapper also uses the .container class it gets constrained by --max-width.
   Make that wrapper full-bleed on wider viewports so the image can span the viewport.
*/
.hero-img .img-wrap.container {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 0;
  padding-right: 0;
}
/* Default image behaviour: fill width, crop on larger screens */
.hero-img img { width: 100%; max-width: 100%; display: block; border-radius: 0; height: auto; max-height: 70vh; object-fit: contain; margin: 0 auto; }

/* Desktop: show the full image (no crop) */
@media (min-width: 900px) {
  .hero-img img {
    height: auto; /* show full image height */
    object-fit: initial;
    object-position: center top;
  }
}


/* Alignment variants for the visual header band */
.hero--visual--center .container { justify-content: center; }
.hero--visual--top .container {
  justify-content: flex-start;
  padding-top: 0.75rem; /* a bit of breathing room at the top */
}
.hero--visual--bottom .container {
  justify-content: flex-end;
  padding-bottom: 0.75rem;
}

/* Place text below the band (decorative band only) */
.hero--visual--below::before {
  /* keep the band at the top */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hero-desktop);
  background: rgb(0,0,0);
  z-index: 1;
}
.hero--visual--below {
  padding-top: calc(var(--hero-desktop) + 1rem);
}

/* Thin subtle separator at the bottom of the band */
.hero--visual::after {
  content: '';
  position: absolute;
  top: calc(var(--hero-desktop) - 1px);
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.12); /* subtle white line */
  z-index: 2; /* above band but below content (content is z-index:3) */
  pointer-events: none;
}

/* Overlay for readability (used when image is present via .hero--overlay) */
.hero--overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.18));
  z-index: 2;
  pointer-events: none;
}

/* Sections */
section { padding: 3rem 0; }
section h2 { text-align:center; margin-bottom:1.25rem; }

/* Contact Section */
.contact-section { background: rgba(0,0,0,0.02); }
.section-intro { text-align: center; max-width: 60ch; margin: 0 auto 2rem; color: var(--muted); font-size: 1.05rem; }
.contact-grid { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 2rem; }
.contact-card { background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 1.75rem; text-align: center; }
.contact-card h3 { margin-top: 0; margin-bottom: 1rem; font-size: 1.15rem; }
.contact-card p { margin: 0.5rem 0; line-height: 1.6; }
.contact-card a { color: var(--accent); font-weight: 600; text-decoration: none; }
.contact-card a:hover { text-decoration: underline; }

/* Cards & grids */
.services-grid, .firms-grid { display:grid; gap:1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card, .lead, .aside-card, .firm-card { background: var(--paper); border:1px solid var(--border); border-radius:10px; padding:1.25rem; }
.card h3, .firm-card h3 { margin: .5rem 0; }

.lead { margin-top: -2rem; box-shadow: 0 8px 20px rgba(0,0,0,0.06); }
.grid { display:grid; grid-template-columns: 1fr 320px; gap:1.25rem; }

.firm-img { width:100%; height:140px; object-fit:cover; border-radius:8px; display:block; }

/* Footer */
footer { border-top:1px solid var(--border); padding:1.75rem 0; color:var(--muted); text-align:center; }

/* Utilities */
.muted { color:var(--muted); }
a { color:inherit; }

/* Accessibility focus */
a:focus, button:focus { outline: 3px solid rgba(0,0,0,0.12); outline-offset: 2px; }

/* Responsive adjustments */
@media (max-width: 900px) {
  nav { display:none; }
  /* show the hamburger toggle on small screens */
  .menu-toggle { display: inline-block; }
  .hero .container { padding-top: calc(var(--hero-mobile) + .75rem); }
  /* Make sure visual-band hero content isn't hidden behind the sticky header on small screens */
  .hero--visual .container {
    /* add a small top offset so the header doesn't overlap the heading */
    padding-top: 1.25rem;
    min-height: var(--hero-mobile);
    justify-content: center; /* keep centered by default */
  }

  /* On small screens, keep the image within the viewport height so it doesn't push content too far */
  .hero-img img {
    width: 100%;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
    display: block;
  }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  nav { display:none; }
  /* Make header non-sticky on mobile to avoid overlap */
  header { position: static; }
  .hero .container { padding-top: calc(var(--hero-mobile) + .75rem); }
  .hero-image { height: var(--hero-mobile); }
  .logo { font-size: 1rem; }
}

/* Small readable helpers */
.text-center { text-align:center; }
.sr-only { position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden; }
