/* Ellis-inspired (original) Bootstrap theme
   Notes:
   - Uses Bootstrap 5 via CDN.
   - Uses CSS variables to make palette easy to adjust.
*/

:root{
  --bg: #ffffff;
  --text: #111318;
  --muted: #5b6472;
  --border: #e7ebf0;
  --surface: #f6f8fb;

  /* Accent (tune to your brand) */
  --accent: #1f4bd8;
  --accent-2: #0aa6a6;

  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.08);

  --container-max: 1180px;
}

html{ scroll-behavior: smooth; }
/* Cross-browser safety */
img{ max-width:100%; height:auto; }
button, input, textarea, select{ font: inherit; }

body{
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a{ color: var(--accent); }
a:hover{ color: #183bb0; }

.container-ellis{
  max-width: var(--container-max);
}

.bg-blue { background: #8FA9D6 !important; }
.bg-soft-blue { background: #EAF2FF !important;}
.bg-strong-blue { background: #1F4BD8 !important; }

.bg-turquoise { background: #2C95B8 !important; }
.bg-soft-turquoise { background: #E8F8F8 !important; }
.bg-strong-turquoise { background: #0E8C8C !important; }

.bg-green { background: #6BB17D !important; }
.bg-soft-green { background: #EAF7F1 !important; }
.bg-strong-green { background: #1F8F63 !important; }

.bg-orange { background: #F0A357 !important; }
.bg-soft-orange { background: #FFF4E8 !important; }
.bg-strong-orange { background: #C76312 !important; }

.bg-red { background: #E44C4C !important; }
.bg-soft-red { background: #FDEEEF !important; }
.bg-strong-red { background: #B4232C !important; }

/* Top utility bar */
.topbar{
  font-size: .92rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.topbar a{
  color: var(--muted);
  text-decoration: none;
}
.topbar a:hover{ color: #183bb0; }

/* Navbar */
.navbar-ellis{
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.navbar-ellis .navbar-brand{
  letter-spacing: .06em;
  font-weight: 700;
}
.navbar-ellis .nav-link{
  color: var(--text);
  font-weight: 600;
}
.navbar-ellis .nav-link:hover{ color: var(--accent); }
.navbar-ellis .dropdown-menu{
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.navbar-ellis.is-scrolled{
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 10px 30px rgba(16,24,40,.06);
}
.navbar-logo {
  height: auto;
  width: 160px;
  max-width: 100%;
  transition: width 0.3s ease;
}

/* Hero */
.hero{
  padding: 5.5rem 0 3.5rem;
}
.hero-kicker{
  color: var(--muted);
  font-weight: 600;
}
.hero h1{
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.hero p{
  color: var(--muted);
  font-size: 1.125rem;
  max-width: 52ch;
}
.hero-card{
  background: linear-gradient(180deg, var(--surface), #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.hero-card .mini{
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #fff;
}

/* Buttons */
.btn-ellis{
  --bs-btn-padding-y: .7rem;
  --bs-btn-padding-x: 1.05rem;
  --bs-btn-border-radius: 999px;
  font-weight: 700;
}
.btn-accent{
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: #1636a0;
  --bs-btn-hover-border-color: #1636a0;
  --bs-btn-color: #fff;
}
.btn-ghost{
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--surface);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-color: var(--text);
}

/* Sections */
.section{
  padding: 3.25rem 0;
}
.section-title{
  font-weight: 800;
  letter-spacing: -0.02em;
}
.section-subtitle{
  color: var(--muted);
  max-width: 70ch;
}

/* Metrics */
.metric{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.metric .value{
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.metric .label{ color: var(--muted); font-weight: 600; }

/* Cards */
.card-ellis{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-ellis .card-body{ padding: 1.25rem; }
.card-ellis .eyebrow{
  color: var(--muted);
  font-weight: 700;
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.icon-badge{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(31, 75, 216, 0.10);
  border: 1px solid rgba(31, 75, 216, 0.18);
  color: var(--accent);
}

/* Quote */
.quote{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--surface));
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
}
.quote blockquote{
  margin: 0;
  font-size: 1.1rem;
}
.quote .who{
  margin-top: .9rem;
  display: flex;
  gap: .75rem;
  align-items: center;
}
.avatar{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--muted);
}

/* Lists */
.list-slim > li{
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.list-slim > li:last-child{ border-bottom: 0; }

/* Footer */
.footer{
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 2.5rem 0;
}
.footer a{
  color: var(--muted);
  text-decoration: none;
}
.footer a:hover{ color: #183bb0; }
.newsletter{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: var(--surface);
}
.form-control, .form-select{
  border-radius: 12px;
  border-color: var(--border);
}
.form-control:focus, .form-select:focus{
  border-color: rgba(31, 75, 216, 0.35);
  box-shadow: 0 0 0 .2rem rgba(31, 75, 216, 0.18);
}

/* Page header */
.page-hero{
  padding: 3.5rem 0 2.25rem;
  background: linear-gradient(180deg, var(--surface), #fff);
  border-bottom: 1px solid var(--border);
}
.breadcrumb a{ text-decoration: none; }

/* Utilities */
.text-muted-ellis{ color: var(--muted) !important; }
.bg-surface{ background: var(--surface) !important; }
.border-ellis{ border-color: var(--border) !important; }

.research-accordion .research-item{
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Trigger (full-width clickable header) */
.research-trigger{
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
}

.research-trigger:focus-visible{
  outline: 3px solid rgba(31,75,216,.45);
  outline-offset: 3px;
  border-radius: var(--radius-lg);
}

/* Header layout */
.research-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.research-head-left{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0; /* allow text to shrink without breaking layout */
}

.research-title-wrap{
  min-width: 0;
  overflow: hidden; /* protects chevron alignment */
}

.research-title{
  margin: 0;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere; /* prevents overflow on long titles */
}

.research-summary{
  margin: .35rem 0 0 0;
  color: var(--muted);
}

/* Optional metadata pills row */
.research-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Chevron button (purely visual) */
.research-chevron{
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  flex: 0 0 auto;
  transition: transform .22s ease, background .22s ease;
}

.research-item.is-open .research-chevron{
  transform: rotate(180deg);
  background: #f7f7f8;
}

/* Expand panel */
.research-panel{
  overflow: hidden;
  height: 0;
  opacity: 0;
  transform: translateY(-6px);
  transition: height .28s ease, opacity .18s ease, transform .18s ease;
}

.research-item.is-open .research-panel{
  opacity: 1;
  transform: translateY(0);
}

/* Premium emphasis on open state */
.research-item.is-open .card.card-ellis{
  border: 2px solid rgba(31,75,216,.35);
  box-shadow: 0 18px 50px rgba(0,0,0,.10);
}

/* Bullets */
.research-bullets{
  margin: 0;
  padding-left: 1.1rem;
}
.research-bullets li{
  margin: .35rem 0;
}

/* --- Research: subtle stagger animation (enterprise polish) --- */
.research-panel .stagger-item{
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
  transition-delay: var(--stagger-delay, 0ms);
}

/* When open, reveal stagger items */
.research-item.is-open .research-panel .stagger-item{
  opacity: 1;
  transform: translateY(0);
}

/* Make the topic buttons behave like cards */
#serviceTopics button{
  border-radius: var(--radius-lg);
}

/* Smooth hover lift (subtle) */
#serviceTopics .card-ellis{
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
#serviceTopics button:hover .card-ellis{
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.10);
}

/* Active topic card */
#serviceTopics button[aria-selected="true"] .card-ellis{
  border: 2px solid rgba(31, 75, 216, 0.35);
  box-shadow: 0 18px 50px rgba(0,0,0,.10);
}

/* Optional: make the icon badge a bit stronger when active */
#serviceTopics button[aria-selected="true"] .icon-badge{
  background: rgba(31, 75, 216, 0.14);
  border-color: rgba(31, 75, 216, 0.28);
}

/* Keep keyboard focus visible */
#serviceTopics button:focus-visible{
  outline: 3px solid rgba(31,75,216,.45);
  outline-offset: 3px;
}

/* Services topics: equal-height cards */
#serviceTopics > [class*="col-"]{
  display: flex;            /* make each grid column a flex container */
}

#serviceTopics > [class*="col-"] > button{
  display: flex;
  width: 100%;
}

#serviceTopics > [class*="col-"] > button > .card{
  flex: 1 1 auto;           /* card fills remaining height */
}

/* Optional: ensure consistent text wrapping does not alter layout rhythm */
#serviceTopics .card-ellis .text-muted-ellis{
  margin-bottom: 0;
}

/* Services topics: equal-height cards (anchor version) */
#serviceTopics > [class*="col-"]{
  display: flex;
}

#serviceTopics > [class*="col-"] > .service-topic-card{
  display: flex;
  width: 100%;
}

#serviceTopics > [class*="col-"] > .service-topic-card > .card{
  flex: 1 1 auto;
}

.mellytek-hero{
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #e1ebfa 0%, #edf3fd 55%, #f8fbff 100%);
  border-bottom: 1px solid var(--border, #e7ebf0);
}

/* Typography (Apple-minimal, bold) */
.hero-kicker{
  font-size: .82rem;
  letter-spacing: .12em;
  font-weight: 700;
  text-transform: uppercase;
  color: #4c5a75;
  margin-bottom: 1.25rem;
}

.hero-title{
  font-size: clamp(2.6rem, 4.6vw, 4.4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.03;
  color: #0e1726;
  max-width: 18ch;
}

.hero-title .accent{
  background: linear-gradient(90deg, #1f4bd8, #0aa6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle{
  margin-top: 1.35rem;
  color: #5b6472;
  font-size: clamp(1.1rem, 1.25vw, 1.35rem);
  line-height: 1.6;
  max-width: 54ch;
}

/* Simple badges */
.hero-badges{
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.hero-badge{
  display: inline-flex;
  align-items: center;
  padding: .45rem .75rem;
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(31,75,216,.12);
  color: #22304a;
  font-weight: 700;
  font-size: .9rem;
}

/* Canvas sizing (bigger, right-weighted) */
.hero-canvas-wrap{
  width: 100%;
  height: clamp(420px, 70vh, 760px);
  position: relative;
}
#heroCanvas{
  width: 100%;
  height: 100%;
  display: block;
}

.detangle-background {
  position: relative;
  overflow: hidden;
  isolation: isolate; /* keeps overlay contained */

  /* Background image */
  background-image: url('../img/projects/detangle/detangle-logo.png') !important; /* update path */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Soft overlay for premium feel */
.detangle-background::before {
  content: "";
  position: absolute;
  inset: 0;

  /* Elegant overlay blend */
  background: linear-gradient(
      180deg,
      rgba(255,255,255,0.75) 0%,
      rgba(255,255,255,0.85) 60%,
      rgba(255,255,255,0.95) 100%
  );

  z-index: 0;
}

/* Ensure content stays above overlay */
.detangle-background > * {
  position: relative;
  z-index: 1;
}

/* Mobile: keep clean */
@media (max-width: 992px){
  .hero-title{ max-width: 22ch; }
  .hero-canvas-wrap{ height: 52vh; }
}

@media (max-width: 992px){
  .hero{ padding: 4.25rem 0 2.75rem; 
  }
  .navbar-logo {
    width: 130px;
  }
}

/* Mobile */
@media (max-width: 576px) {
  .navbar-logo{width: 110px; }
  .research-head-left{ gap: 12px; }
  .research-chevron{ width: 38px; height: 38px; }
  .research-summary{ font-size: .98rem; }
}
/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce){
  .research-panel,
  .research-chevron{
    transition: none !important;
  }
  .research-panel .stagger-item{
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  #serviceTopics .card-ellis{
    transition: none !important;
  }
  #serviceTopics button:hover .card-ellis{
    transform: none !important;
  }
}