/* ==========================================================================
   Mwalili Company Limited — Design System
   Palette: signal red / near-black / paper / steel gray + sector accents
   Type: Barlow Condensed (display) + Inter (body) + IBM Plex Mono (data/refs)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Core palette */
  --red: #C41E1E;
  --red-dark: #9A1717;
  --ink: #161513;
  --ink-soft: #322F2B;
  --paper: #F6F3EC;
  --paper-dim: #ECE7DC;
  --steel: #7C7A74;
  --steel-line: #D8D3C6;
  --white: #FFFFFF;

  /* Sector accents */
  --teal: #2B7A6F;    /* pharma & agrovet */
  --blue: #2B3A67;    /* education */
  --amber: #C97A1E;   /* general supplies */
  --steel-accent: #55524B; /* construction */

  /* Type */
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Spacing scale */
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2.5rem;
  --sp-5: 4rem;
  --sp-6: 6rem;
  --sp-7: 9rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--sp-3);
}

@media (max-width: 640px) {
  .container { padding: 0 var(--sp-2); }
}

/* ---- Typography ---- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.05;
  color: var(--ink);
}

h1 { font-size: clamp(2.6rem, 6vw, 5rem); font-weight: 800; }
h2 { font-size: clamp(2rem, 4vw, 3.1rem); }
h3 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }

p { font-size: 1.05rem; color: var(--ink-soft); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: var(--sp-2);
}

.eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--red);
  display: inline-block;
}

.mono { font-family: var(--font-mono); }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 1rem;
  padding: 0.85em 1.7em;
  border-radius: 2px;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn-dark:hover { background: #000; }

.btn-outline {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--paper); }

.btn:active { transform: translateY(1px); }

/* ---- Header / Nav ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--steel-line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand img { height: 40px; width: auto; }

.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-text span {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  margin-top: 0.25em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.nav-links a {
  position: relative;
  padding: 0.3em 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

.nav-links a.active { color: var(--red); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--ink); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    border-bottom: 1px solid var(--steel-line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open { max-height: 400px; }
  .nav-links a { width: 100%; padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--steel-line); }
  .nav-links a::after { display: none; }
}

/* ---- Hero (diagonal red band) ---- */

.hero {
  position: relative;
  overflow: hidden;
  padding: var(--sp-7) 0 var(--sp-6);
  background: var(--ink);
  color: var(--paper);
}

.hero::before {
  content: '';
  position: absolute;
  top: -20%; right: -10%;
  width: 70%; height: 160%;
  background: var(--red);
  clip-path: polygon(45% 0, 100% 0, 100% 100%, 15% 100%);
  opacity: 0.94;
}

.hero::after {
  content: '';
  position: absolute;
  top: -20%; right: 6%;
  width: 22%; height: 160%;
  background: var(--ink);
  clip-path: polygon(45% 0, 100% 0, 100% 100%, 15% 100%);
  opacity: 0.5;
}

.hero-inner { position: relative; z-index: 2; max-width: 680px; }

.hero .eyebrow { color: var(--red); }
.hero.on-red .eyebrow { color: var(--paper); }

.hero h1 { color: var(--paper); margin-bottom: var(--sp-3); }

.hero p.lead {
  color: #D9D5C9;
  font-size: 1.2rem;
  max-width: 540px;
  margin-bottom: var(--sp-4);
}

.hero-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---- Trust strip / stamp ---- */

.trust-strip {
  background: var(--paper-dim);
  border-top: 1px solid var(--steel-line);
  border-bottom: 1px solid var(--steel-line);
  padding: var(--sp-4) 0;
}

.trust-grid {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr);
  gap: var(--sp-4);
  align-items: center;
}

@media (max-width: 780px) {
  .trust-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
}

.stamp {
  width: 92px;
  height: 92px;
  border: 2px solid var(--red);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--red);
  transform: rotate(-8deg);
  flex-shrink: 0;
}

.stamp strong {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stamp span { font-size: 0.56rem; margin-top: 2px; }

.trust-item .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--steel);
  margin-bottom: 0.3em;
}

.trust-item .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  text-transform: uppercase;
}

/* ---- Sector entries (manifest style) ---- */

.section { padding: var(--sp-6) 0; }
.section-tight { padding: var(--sp-5) 0; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  border-bottom: 3px solid var(--ink);
  padding-bottom: var(--sp-3);
}

.section-head p { max-width: 420px; }

.entries { display: flex; flex-direction: column; }

.entry {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--steel-line);
  transition: background 0.15s ease;
}

.entry:hover { background: var(--paper-dim); }

.entry-id {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--steel);
}

.entry-id .tag {
  display: inline-block;
  margin-top: 0.5em;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3em 0.6em;
  border-radius: 2px;
  color: var(--white);
}

.tag-construction { background: var(--steel-accent); }
.tag-pharma { background: var(--teal); }
.tag-education { background: var(--blue); }
.tag-supplies { background: var(--amber); }

.entry-body h3 { text-transform: none; margin-bottom: 0.3em; }
.entry-body p { font-size: 0.98rem; }

.entry-arrow {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--red);
  transition: transform 0.15s ease;
}
.entry:hover .entry-arrow { transform: translateX(6px); }

@media (max-width: 700px) {
  .entry { grid-template-columns: 1fr; gap: var(--sp-1); }
  .entry-arrow { display: none; }
}

/* ---- Cards ---- */

.card {
  background: var(--white);
  border: 1px solid var(--steel-line);
  padding: var(--sp-3);
}

/* ---- Footer ---- */

.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-5) 0 var(--sp-3);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid #3A3833;
}

@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-grid h4 {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--steel);
  margin-bottom: var(--sp-2);
}

.footer-links { display: flex; flex-direction: column; gap: 0.6em; font-size: 0.95rem; color: #D9D5C9; }
.footer-links a:hover { color: var(--red); }

.footer-brand p { color: #B4B0A5; max-width: 320px; margin-top: var(--sp-2); font-size: 0.92rem; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--steel);
  flex-wrap: wrap;
  gap: var(--sp-1);
}

/* ---- Placeholder pages ---- */

.pending-banner {
  background: #FDF3E4;
  border: 1px dashed var(--amber);
  color: #8A5A14;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: 0.6em;
}

/* ---- Page hero (interior pages) ---- */

.page-hero {
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-5) 0 var(--sp-4);
  border-bottom: 6px solid var(--red);
}

.page-hero h1 { color: var(--paper); font-size: clamp(2.2rem, 5vw, 3.4rem); }
.page-hero .eyebrow { color: #E9A3A3; }

/* ---- Utility ---- */

.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
@media (max-width: 780px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---- Chat widget ---- */

.chat-bubble {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--red); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; box-shadow: 0 4px 16px rgba(22,21,19,0.25);
  transition: transform 0.15s ease;
}
.chat-bubble:hover { transform: scale(1.06); background: var(--red-dark); }
.chat-bubble svg { width: 26px; height: 26px; }

.chat-badge {
  position: absolute; top: -4px; right: -4px; background: var(--ink);
  color: var(--white); border-radius: 50%; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.65rem; border: 2px solid var(--paper);
}

.chat-window {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  width: 340px; max-width: calc(100vw - 2rem); height: 460px; max-height: calc(100vh - 3rem);
  background: var(--white); border: 1px solid var(--steel-line);
  display: none; flex-direction: column; box-shadow: 0 8px 32px rgba(22,21,19,0.3);
  border-radius: 4px; overflow: hidden;
}
.chat-window.open { display: flex; }

.chat-head {
  background: var(--ink); color: var(--paper); padding: 0.9rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-head .chat-title { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 0.95rem; letter-spacing: 0.02em; }
.chat-head .chat-sub { font-family: var(--font-mono); font-size: 0.68rem; color: #C9C5B8; margin-top: 0.15em; }
.chat-close { background: none; border: none; color: var(--paper); font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0.2em; }

.chat-body {
  flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--paper-dim);
}

.chat-msg { max-width: 82%; padding: 0.55em 0.8em; border-radius: 10px; font-size: 0.9rem; line-height: 1.4; }
.chat-msg.from-visitor { align-self: flex-end; background: var(--red); color: var(--white); border-bottom-right-radius: 2px; }
.chat-msg.from-admin { align-self: flex-start; background: var(--white); border: 1px solid var(--steel-line); border-bottom-left-radius: 2px; }
.chat-msg .chat-status { display: block; font-family: var(--font-mono); font-size: 0.62rem; margin-top: 0.3em; opacity: 0.75; }

.chat-empty { color: var(--steel); font-size: 0.85rem; text-align: center; margin: auto; padding: 1rem; }

.chat-foot { display: flex; border-top: 1px solid var(--steel-line); background: var(--white); }
.chat-foot input {
  flex: 1; border: none; padding: 0.8em 1em; font-family: var(--font-body); font-size: 0.9rem; outline: none;
}
.chat-foot button {
  background: var(--red); color: var(--white); border: none; padding: 0 1.1em; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 0.85rem;
}
.chat-foot button:hover { background: var(--red-dark); }
.chat-foot button:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 500px) {
  .chat-window { right: 1rem; bottom: 5.5rem; width: calc(100vw - 2rem); }
  .chat-bubble { right: 1rem; bottom: 1rem; }
}
