/* ---------- Base & Resets ---------- */
:root {
  /* Tweak as needed; JS will also measure and overwrite this */
  --sidebar-width: 320px;
  --gap: 16px;
  --border: #e6e6e6;
  --text: #222;
  --muted: #666;
  --bg: #fff;
  --bg-soft: #f6f6f6;
  --sidebar-bg: #2c2c2c;
  --sidebar-text: #fff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 2px;
}


/* ---------- Layout Shell ----------
   Support BOTH .flex-shell (recommended) and .flex-container (your original) */
.flex-shell,
.flex-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - 64px); /* leaves room for a sticky header */
  gap: 0;
}

/* When body has .sidebar-collapsed, hide sidebar column */
.sidebar-collapsed .flex-shell,
.sidebar-collapsed .flex-container {
  grid-template-columns: 0 1fr;
}

/* ---------- Sidebar ---------- */
#sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow: auto;
  transition: width 200ms ease, padding 200ms ease, border-color 200ms ease;
  width: var(--sidebar-width);
  border-right: 1px solid transparent;
  padding: 16px;
  position: relative; /* for the toggle button */
}

.sidebar-collapsed #sidebar {
  width: 0 !important;
  padding: 0;
  border-right-color: transparent;
  overflow: hidden;
}

/* Sidebar content */
#sidebar ul { margin: 0; padding: 0; list-style: none; }
#sidebar ul li { padding: 6px 0; }

#sidebar .main-category {
  display: block;
  font-weight: 600;
  padding: 8px 0;
  cursor: pointer;
  color: #fff;
}

#sidebar .main-category:hover { text-decoration: underline; }

#sidebar .sub-category {
  margin: 4px 0 12px;
  padding-left: 12px;
  list-style: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height 250ms ease;
}

#sidebar .sub-category a {
  display: inline-block;
  padding: 4px 0;
  color: #f0f0f0;
  opacity: 0.9;
}

#sidebar .sub-category a:hover,
#sidebar .sub-category a.active {
  text-decoration: underline;
  opacity: 1;
}

#sidebar .sidebar-outcome {
  margin: 2px 0 6px;
  font-size: 0.85rem;
  color: #c9ced6;
  opacity: 0.85;
  line-height: 1.4;
}

/* ---------- Sidebar Toggle Button ---------- */
.sidebar-toggle {
  position: absolute;
  top: 8px;
  left: calc(var(--sidebar-width) - 28px);
  transform: translateX(0);
  background: #1f1f1f;
  color: #fff;
  border: 1px solid #000;
  font-size: 1.25rem;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 20;
  transition: left 200ms ease, transform 200ms ease, background 150ms ease;
}

.sidebar-toggle:hover { background: #111; }

/* When collapsed, keep the toggle visible near the left edge */
.sidebar-collapsed .sidebar-toggle {
  left: 8px;
}

/* ---------- Content Area ---------- */
#content,
#content-container,
.content-container {
  /* allow both your original IDs/classes */
  padding: 16px;
  background: var(--bg);
}

/* Individual “pages” shown/hidden by JS */
.contentDiv {
  display: none;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin: 0 0 16px 0;
  max-width: 100%;
}

.contentDiv.show { display: block; }

/* Old helper remains supported */
.hidden { display: none !important; }

/* Demo launcher buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}
.btn:hover { background: #fefefe; }

/* Shared iframe for demos (ensures each demo's own assets load relative to its folder) */
#demoFrame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

/* ---------- Back to top ---------- */
#back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: none;
  background: #333;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
}
#back-to-top:hover { background: #111; }

.introduction {
  padding: 2.5rem clamp(1rem, 4vw, 3rem);
  background: var(--bg-soft);
  border-radius: 24px;
  margin: 1.5rem auto;
  max-width: 980px;
}

/* ---------- Narrative & Layout Blocks ---------- */
.section {
  padding: clamp(1.5rem, 3vw, 3rem) clamp(1rem, 4vw, 3rem);
  max-width: 1100px;
  margin: 0 auto 1.5rem auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.section .lede {
  color: var(--muted);
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
}

.card strong { color: var(--text); }

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 0.9rem;
}

.process-list {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
}

.process-step {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}

.social-proof {
  display: grid;
  gap: 1rem;
}

.quote {
  border-left: 4px solid #222;
  padding-left: 1rem;
  font-style: italic;
  background: #fdfdfd;
  border-radius: 10px;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.logo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.logo-chip {
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn--primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

.btn--ghost {
  background: transparent;
}

.two-column {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.list-checks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.list-checks li::before {
  content: "✔";
  margin-right: 0.5rem;
  color: #0a7b44;
}

.contact-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: #fafafa;
}

.contact-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.contact-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.contact-form textarea {
  min-height: 120px;
  resize: vertical;
}

.contact-form .is-valid {
  border-color: #0a7b44;
  box-shadow: 0 0 0 3px rgba(10, 123, 68, 0.2);
}

.contact-form .is-invalid {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.2);
}

.form-status {
  margin: 0;
  font-size: 0.95rem;
}

.form-status--success {
  color: #0a7b44;
}

.form-status--error {
  color: #b71c1c;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e2a78;
  font-weight: 600;
  border: 1px solid #d9defa;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.metric-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
}

.metric-divider {
  width: 34px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(10, 123, 68, 0.65), rgba(10, 123, 68, 0));
}

.metric-value {
  color: #101828;
  font-weight: 500;
}

.introduction h1 {
  margin: 0 0 0.75rem 0;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
}

.lede {
  font-size: 1.05rem;
  max-width: 60ch;
  margin: 0 0 1rem 0;
  color: var(--muted);
}

/* ---------- Portfolio Grid ---------- */
.portfolio-intro {
  max-width: 65ch;
  margin: 0 0 1.5rem 0;
  color: var(--muted);
}

.portfolio-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  align-items: center;
}

.portfolio-hero__copy {
  display: grid;
  gap: 0.75rem;
}

.portfolio-hero__gallery {
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.9) 0%, rgba(245, 247, 252, 0.85) 70%), #f6f8fc;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 18px 44px -32px rgba(12, 26, 52, 0.38);
  padding: 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.gallery-stack {
  position: relative;
  min-height: 360px;
  perspective: 1600px;
}

.gallery-slide {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  overflow: hidden;
  transform-origin: center center;
  transition: transform 240ms ease, opacity 240ms ease, filter 240ms ease, box-shadow 240ms ease;
  box-shadow: 0 16px 48px -32px rgba(17, 34, 68, 0.45);
  background: linear-gradient(135deg, #f1f4fb, #e7ecf6);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 161, 186, 0.35);
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-slide figcaption {
  background: linear-gradient(180deg, rgba(12, 25, 46, 0.1), rgba(12, 25, 46, 0.5));
  color: #fff;
  padding: 0.75rem 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.gallery-slide:not(.is-active) figcaption {
  display: none;
}

.gallery-caption {
  color: var(--muted);
}

.gallery-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.gallery-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.gallery-indicator {
  color: var(--muted);
  font-size: 0.95rem;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.portfolio-card {
  --card-accent: #4d5f82;
  --card-accent-soft: rgba(136, 149, 182, 0.16);
  --card-accent-border: rgba(77, 95, 130, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-color: color-mix(in srgb, var(--card-accent-border) 50%, var(--border));
  border-radius: 18px;
  background: radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--card-accent-soft) 85%, #fff) 0%, #fff 65%), var(--card-accent-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
  box-shadow: 0 12px 32px -26px rgba(18, 32, 56, 0.8);
}

.portfolio-card:hover,
.portfolio-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 22px 40px -32px rgba(14, 30, 54, 0.9);
  border-color: color-mix(in srgb, var(--card-accent) 35%, var(--border));
}

.portfolio-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(244, 246, 251, 0.9), rgba(228, 233, 244, 0.85));
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 161, 186, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 6px 28px -24px rgba(11, 20, 36, 0.9);
}

.portfolio-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.08));
  mix-blend-mode: soft-light;
}

.portfolio-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.portfolio-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.portfolio-card .portfolio-description {
  color: var(--muted);
}

.portfolio-card .portfolio-outcome {
  font-size: 0.95rem;
  color: color-mix(in srgb, var(--muted) 65%, #101827);
}

.portfolio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: auto 0 0;
}

.portfolio-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--tag-accent-border, rgba(32, 64, 92, 0.15));
  background: var(--tag-accent-bg, rgba(32, 64, 92, 0.08));
  color: var(--tag-accent-text, #1f2b37);
}

.portfolio-empty {
  margin: 0;
  padding: 1rem;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--muted);
}

/* ---------- Mobile / Tablet ---------- */
@media (max-width: 900px) {
  /* Collapse sidebar by default (JS also flips aria/expanded) */
  .flex-shell, .flex-container { grid-template-columns: 0 1fr; }

  #sidebar { width: 0 !important; padding: 0; border-right: 0; }
  .sidebar-toggle { left: 8px; }

  .introduction { margin: 1rem; }
  #demoFrame { height: 65vh; }
}

/* ---------- Print (optional) ---------- */
@media print {
  .sidebar-toggle, #sidebar, #back-to-top { display: none !important; }
  .flex-shell, .flex-container { grid-template-columns: 1fr; }
  #demoFrame { display: none; }
}
