/* ============================================================
   The Ethical Enterprise — layout, navigation, responsive layer
   Page content carries its own inline styles; the media queries
   near the bottom reach those through [style*=...] selectors, so
   the markup needs no per-element classes.
   ============================================================ */

:root {
  --bg:      #f7f4ee;
  --ink:     #1c1a16;
  --muted:   #57534a;
  --subtle:  #857e70;
  --rule:    #ddd5c5;
  --accent:  #b8562f;
  --gutter:  32px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  overflow-x: hidden;      /* nothing should scroll sideways */
}

a { text-decoration: none; }

img { max-width: 100%; }

.page {
  font-family: 'Public Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font: 500 14px/1 'Public Sans', sans-serif;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.nav-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;              /* lets the tagline ellipsis instead of overflowing */
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: 'Source Serif 4', serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}
.brand-e { position: relative; }
.brand-e sup { font-size: 0.55em; margin-left: 0.5px; }

.brand-rule { color: var(--rule); font-weight: 300; font-size: 18px; flex-shrink: 0; }

.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.brand-name {
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.brand-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--subtle);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ nav */

/* Desktop: the wrapper vanishes and .site-nav sits in the header flex row. */
.nav-drawer { display: contents; }

.site-nav {
  display: flex;
  gap: 22px;
  align-items: center;
  white-space: nowrap;
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--ink); }
.nav-link.is-active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.nav-cta {
  font-size: 13px;
  font-weight: 600;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  white-space: nowrap;
}
.nav-cta:hover { background: #000; }

/* ------------------------------------------------------------ hamburger */

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.nav-toggle-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  height: 100%;
}

.nav-bar {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

body.nav-open .nav-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(28, 26, 22, 0.35);
}

/* ------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--rule); }

.footer-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--gutter);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copy { font-size: 14px; color: var(--subtle); margin: 0; }
.footer-nav { display: flex; gap: 24px; }
.footer-nav a { font-size: 14px; color: var(--muted); }
.footer-nav a:hover { color: var(--ink); }

/* ------------------------------------------------------------ service cards
   Replaces the former React frontOpacity/backOpacity state. */

.svc-card .svc-front { opacity: 1; }
.svc-card .svc-back  { opacity: 0; }
.svc-card:hover .svc-front,
.svc-card:focus .svc-front,
.svc-card.is-open .svc-front { opacity: 0; }
.svc-card:hover .svc-back,
.svc-card:focus .svc-back,
.svc-card.is-open .svc-back { opacity: 1; }
.svc-card:focus { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* --- tablet / small desktop -------------------------------- */
@media (max-width: 1000px) {
  .brand-tag { display: none; }
  .site-nav { gap: 16px; }
}

/* --- mobile drawer ----------------------------------------- */
@media (max-width: 900px) {
  .nav-toggle { display: block; }

  /* Fixed, viewport-sized and clipped: the drawer slides *inside* this layer,
     so its off-canvas position never contributes to page width. */
  .nav-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0s 0.3s;
  }
  body.nav-open .nav-drawer {
    pointer-events: auto;
    visibility: visible;
    transition-delay: 0s;
  }

  .site-nav {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 82vw);
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 88px 24px 32px;
    background: var(--bg);
    border-left: 1px solid var(--rule);
    box-shadow: -12px 0 32px rgba(28, 26, 22, 0.12);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    overflow-y: auto;
  }

  body.nav-open .site-nav { transform: translateX(0); }
  body.nav-open { overflow: hidden; }

  /* Toggle and drawer are siblings in the header's stacking context, so the
     close button needs to outrank the drawer's z-index directly. */
  .nav-toggle { position: relative; z-index: 60; }
  body.nav-open .nav-toggle { background: var(--bg); }

  .nav-link {
    font-size: 17px;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
  }
  .nav-link.is-active { border-bottom-color: var(--accent); }

  .nav-cta {
    margin-top: 20px;
    text-align: center;
    font-size: 15px;
    padding: 14px 18px;
  }
}

@media (min-width: 901px) {
  .nav-scrim { display: none; }
}

/* --- content reflow ----------------------------------------
   The page body is inline-styled, so these reach it by matching
   the inline declarations directly. !important is required to
   outrank a style attribute. */

@media (max-width: 900px) {
  /* Grid and flex items default to min-width:auto and so refuse to shrink below
     their min-content width. A long email address or URL then widens the page. */
  [style*="display: grid"] > *,
  [style*="display: flex"] > * { min-width: 0; }

  .page { overflow-wrap: break-word; }
  a[href^="mailto:"], a[href^="tel:"] { overflow-wrap: anywhere; }

  [style*="grid-template-columns: 220px 1fr"],
  [style*="grid-template-columns: 260px 1fr"],
  [style*="grid-template-columns: 180px 200px 1fr"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  [style*="grid-template-columns: 70px 1fr 100px"] {
    grid-template-columns: 56px 1fr !important;
  }

  /* two-column hero / bio splits */
  [style*="display: flex; gap: 48px; align-items: flex-start"],
  [style*="display: flex; gap: 56px; align-items: flex-start"] {
    flex-direction: column !important;
    gap: 32px !important;
  }
}

@media (max-width: 700px) {
  :root { --gutter: 20px; }

  [style*="max-width: 1120px"],
  [style*="max-width: 1080px"] {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  [style*="grid-template-columns: 70px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  /* the email is one long unbreakable token — size it to fit rather than split */
  a[href^="mailto:"] { font-size: 19px !important; }

  /* headline scale */
  [style*="font-size: 52px"] { font-size: 34px !important; }
  [style*="font-size: 44px"] { font-size: 30px !important; }
  [style*="font-size: 36px"] { font-size: 26px !important; }
  [style*="font-size: 32px"] { font-size: 24px !important; }

  /* the hero portrait is fixed-width in the markup */
  [style*="width: 240px"][style*="height: 290px"],
  [style*="width: 180px"][style*="height: 220px"] {
    width: 100% !important;
    max-width: 260px !important;
    height: auto !important;
    aspect-ratio: 4 / 5;
  }

  .footer-wrap { flex-direction: column; gap: 20px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 16px; }
  .nav-wrap { padding-top: 16px; padding-bottom: 16px; }
}

/* --- motion / print ---------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .site-header, .nav-toggle, .nav-scrim, .skip-link { display: none !important; }
  .page { min-height: 0; }
}
