/* ==========================================================================
   0. SELF-HOSTED FONTS
   ========================================================================== */

/* Crimson Pro: Regular (400) */
@font-face {
  font-family: 'Crimson Pro';
  src: url('/fonts/crimson-pro-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Crimson Pro: Italic (400) */
@font-face {
  font-family: 'Crimson Pro';
  src: url('/fonts/crimson-pro-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Crimson Pro: SemiBold (600) */
@font-face {
  font-family: 'Crimson Pro';
  src: url('/fonts/crimson-pro-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Crimson Pro: Bold (700) */
@font-face {
  font-family: 'Crimson Pro';
  src: url('/fonts/crimson-pro-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Source Code Pro: Light (300) */
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-300.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* Source Code Pro: Light Italic (300) */
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-300-italic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* Source Code Pro: Regular (400) */
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-400-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Source Code Pro: Regular Italic (400) */
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Source Code Pro: Medium (500) */
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. COLOR SYSTEM & BRAND VARIABLES
   ========================================================================== */
:root {
  --color-marble-white:  #eae8da;
  --color-pure-white:    #ffffff;
  --color-bellori-black: #372c23;
  --color-marble-red:    #74605e;
  --color-penny-red:     #ef6251;
  --color-ledger-red:    #a8322d;

  --font-serif: 'Crimson Pro', Georgia, serif;
  --font-code:  'Source Code Pro', monospace;
}

/* ==========================================================================
   2. BASE STYLES & LAYOUT
   ========================================================================== */
html {
  scroll-behavior: smooth;
}

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

body {
  background-color: var(--color-marble-white);
  color: var(--color-bellori-black);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.75;
  padding: 0 1.5rem 5rem;
  max-width: 880px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
}

p {
  margin-bottom: 1.5rem;
}

/* Accessibility: Keyboard Focus States */
.toggle-btn:focus-visible, 
.nav-link:focus-visible, 
.cta-link:focus-visible {
  outline: 2px solid var(--color-penny-red);
  outline-offset: 4px;
}

/* ==========================================================================
   3. TYPOGRAPHY
   ========================================================================== */
h1 {
  color: var(--color-marble-red);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 2.85rem;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.caption, .meta-tag {
  font-family: var(--font-code);
  font-weight: 300;
  font-size: 0.85rem;
  color: var(--color-ledger-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ==========================================================================
   4. HEADER, LOGO & NAVIGATION
   ========================================================================== */
header {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--color-marble-red);
  margin-bottom: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-link {
  display: inline-block;
  text-decoration: none;
}

.logo-img {
  height: 2.2rem;
  width: auto;
  display: block;
}

.site-nav {
  display: flex;
  gap: 2rem;
  font-family: var(--font-code);
  font-size: 0.85rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-link {
  color: var(--color-bellori-black);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--color-penny-red);
}

/* ==========================================================================
   5. TOGGLE BUTTONS (LANDING PAGE & SERVICES)
   ========================================================================== */
.audience-toggle,
.services-toggle {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 3rem 0 -1px 0; /* 1px desktop overlap: keeps inactive tabs flush with card */
  position: relative;
  z-index: 2;
}

.audience-toggle::-webkit-scrollbar,
.services-toggle::-webkit-scrollbar {
  display: none;
}

.toggle-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--color-ledger-red);
  color: var(--color-bellori-black);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.2;
  padding: 0.75rem 1.75rem;
  cursor: pointer;
  background-color: var(--color-marble-white);
  margin-right: -1px;
  /* FIX FOR JUMPING: Only transition colors, never animate layout geometry */
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.toggle-btn.active {
  border: 1px solid var(--color-penny-red);
  border-bottom: none;
  background-color: var(--color-pure-white);
  color: var(--color-penny-red);
  font-weight: 600;
  padding-bottom: calc(0.75rem + 1px); /* Matches inactive button total height exactly */
}

.toggle-btn:last-child {
  margin-right: 0;
}

/* ==========================================================================
   6. PURE WHITE MONOSPACE CONTAINER BOX
   ========================================================================== */
.dynamic-card {
  background-color: var(--color-pure-white);
  border: 1px solid var(--color-penny-red);
  padding: 3rem 2.5rem 1.5rem;
  margin-bottom: 4rem;
  font-family: var(--font-code);
  font-size: 0.95rem;
  line-height: 1.7;
  box-shadow: 0 4px 20px rgba(55, 44, 35, 0.03);
}

.content-panel {
  display: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.content-panel.active {
  display: block;
  visibility: visible;
  opacity: 1;
}

.dynamic-card h2 {
  font-family: var(--font-code);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-marble-red);
  margin-top: 2rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-marble-white);
  padding-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dynamic-card h2:first-of-type {
  margin-top: 0;
}

.problem-list {
  list-style: none;
  margin: 1.5rem 0;
}

.problem-list li {
  margin-bottom: 1.5rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--color-ledger-red);
}

.problem-title {
  font-weight: 500;
  color: var(--color-ledger-red);
}

/* ==========================================================================
   7. GLOBAL CTA COMPONENT
   ========================================================================== */
.global-cta {
  margin-top: 5rem;
  padding-top: 3rem;
  border-top: 1px solid var(--color-penny-red);
}

.global-cta h2 {
  font-family: var(--font-serif);
  color: var(--color-marble-red);
  font-size: 2rem;
  font-weight: 400;
  margin-top: 0;
  margin-bottom: 1.25rem;
  border-bottom: none;
}

.cta-link {
  display: inline-block;
  margin: 1.5rem 0 1rem;
  color: var(--color-penny-red);
  font-family: var(--font-code);
  font-size: 1.15rem;
  text-decoration: none;
  border-bottom: 1px solid var(--color-penny-red);
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}

.cta-link:hover {
  opacity: 0.8;
}

/* ==========================================================================
   8. FOOTER & LEGAL INFORMATION
   ========================================================================== */
footer {
  margin-top: 6rem;
  padding-top: 3rem;
  border-top: 1px solid var(--color-marble-red);
}

.footer-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.footer-logo-img {
  height: 1.75rem;
  width: auto;
  display: block;
}

.trademark-notice {
  font-size: 0.95rem;
  color: var(--color-bellori-black);
  margin-bottom: 2rem;
  font-style: italic;
}

.legal-info {
  font-family: var(--font-code);
  font-weight: 300;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--color-ledger-red);
  border-top: 1px solid rgba(116, 96, 94, 0.25);
  padding-top: 1.5rem;
}

.legal-info p {
  margin-bottom: 0.5rem;
}

.legal-info p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   9. PAGE-SPECIFIC: ABOUT & PROFILES
   ========================================================================== */
h2 {
  color: var(--color-marble-red);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.3;
  margin-top: 3.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-marble-red);
  padding-bottom: 0.5rem;
}

h3 {
  color: var(--color-marble-red);
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.6rem;
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.lead-text {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--color-marble-red);
  margin-bottom: 1.5rem;
}

.role-title {
  font-family: var(--font-code);
  font-weight: 300;
  font-size: 0.9rem;
  color: var(--color-ledger-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  display: block;
}

.nav-link.active {
  border-bottom: 1px solid var(--color-penny-red);
  padding-bottom: 2px;
}

.profile-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-areas: 
    "portrait header"
    "portrait body";
  column-gap: 2.5rem;
  margin-top: 2rem;
  margin-bottom: 3.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(116, 96, 94, 0.25);
}

.profile-card.no-img {
  grid-template-columns: 1fr;
  grid-template-areas: 
    "header"
    "body";
}

.portrait-frame {
  grid-area: portrait;
  width: 100%;
  max-width: 220px;
  line-height: 0;
}

.portrait-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.profile-header {
  grid-area: header;
}

.profile-body {
  grid-area: body;
}

.profile-header h3 {
  margin-top: 0;
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.about-cta {
  margin-top: 3.5rem;
  padding-top: 0;
  border-top: none;
}

/* ==========================================================================
   10. PAGE-SPECIFIC: BELLORI BIO GRID
   ========================================================================== */
.bio-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 3rem;
  align-items: start;
  margin-bottom: 3rem;
}

.bio-grid .portrait-frame {
  grid-area: auto;
  width: 100%;
  max-width: 220px;
}

.image-credit {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--color-marble-red);
  margin-top: 0.75rem;
}

/* ==========================================================================
   DESKTOP ONLY: EXPAND SERVICES TABS TO 100%
   ========================================================================== */
@media (min-width: 769px) {
  .services-toggle {
    overflow: visible;
  }

  .services-toggle .toggle-btn {
    flex: 1 1 0;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    text-align: center;
  }

  .services-toggle .toggle-btn:last-child {
    margin-right: 0;
  }
}

/* ==========================================================================
   11. CONSOLIDATED RESPONSIVE DESIGN (MOBILE OVERRIDES)
   ========================================================================== */
@media (max-width: 768px) {
  /* Typography & Layout */
  h1 {
    font-size: 2.15rem;
    line-height: 1.25;
  }
  .dynamic-card {
    padding: 2rem 1.25rem 1.5rem;
  }

  /* Header & Navigation */
  header {
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 2.5rem 0 1.5rem;
  }
  header .meta-tag {
    display: none;
  }
  .site-nav {
    width: 100%;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--color-marble-white);
  }

  /* Mobile Overlap: 2px pull to kill high-DPI sub-pixel bleed */
  .audience-toggle,
  .services-toggle {
    margin-bottom: -2px;
  }

  /* Home Page: 50/50 split across full mobile width */
  .audience-toggle .toggle-btn {
    flex: 1 1 0;
    text-align: center;
  }

  /* Services: Right-edge swipe cue */
  .services-toggle {
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }

  /* FIX FOR ESTATES: Turns off mask when the final tab is active */
  .services-toggle:has(.toggle-btn:last-child.active) {
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* Team Profiles Grid Overrides */
  .profile-card {
    grid-template-columns: 1fr;
    grid-template-areas: 
      "header"
      "portrait"
      "body";
    gap: 1.5rem;
  }
  .profile-card.no-img {
    grid-template-areas: 
      "header"
      "body";
  }
  .portrait-frame {
    max-width: 100%;
    margin: 0;
  }

  /* Bellori Bio Grid Overrides */
  .bio-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .bio-grid .portrait-frame {
    grid-row: 1; 
    max-width: 100%;
    margin: 0;
  }
  .image-credit {
    text-align: left;
  }
}