/* Project-specific styles: U.S. Housing Market Analysis */

:root{
  /* Soft “glass” palette tuned to match your mockup */
  --uh-ink: rgba(25, 24, 32, 0.88);
  --uh-ink-2: rgba(25, 24, 32, 0.72);
  --uh-ink-3: rgba(25, 24, 32, 0.58);

  --uh-card: rgba(255,255,255,0.58);
  --uh-card-2: rgba(255,255,255,0.45);
  --uh-border: rgba(255,255,255,0.65);
  --uh-border-2: rgba(0,0,0,0.06);

  --uh-shadow: 0 18px 45px rgba(30, 18, 55, 0.10);
  --uh-shadow-2: 0 10px 28px rgba(30, 18, 55, 0.12);

  --uh-radius-lg: 28px;
  --uh-radius-md: 18px;
  --uh-radius-pill: 999px;

  --uh-blur: 14px;

  /* Tableau scale-down lever (0.85–1.0). Lower = smaller viz, fewer scrollbars. */
  --uh-tableau-scale: 0.88;
}

/* Page background */
.project-page{
  color: var(--uh-ink);
  background:
    radial-gradient(900px 380px at 16% 6%, rgba(206, 174, 255, 0.45), rgba(206,174,255,0) 60%),
    radial-gradient(900px 420px at 84% 10%, rgba(255, 195, 160, 0.35), rgba(255,195,160,0) 62%),
    radial-gradient(1200px 520px at 50% 56%, rgba(217, 170, 255, 0.22), rgba(217,170,255,0) 66%),
    linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.92));
}

/* Reduce “mystery gaps” by normalizing section spacing */
.project-page .project-section{
  padding: 26px 0;
  scroll-margin-top: 110px;
}

.project-page .container{
  max-width: 1200px;
}

/* HERO */
.project-hero{
  padding: 34px 0 12px;
}

.project-breadcrumbs{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--uh-ink-3);
  margin: 0 0 18px;
}

.project-breadcrumbs a{
  color: inherit;
  text-decoration: none;
}

.project-breadcrumbs a:hover{
  text-decoration: underline;
}

.project-hero-grid{
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 26px;
  align-items: stretch;
}

.project-hero-card,
.project-overview,
.section-card,
.tableau-block,
.viz-card,
.tool{
  background: var(--uh-card);
  border: 1px solid var(--uh-border);
  box-shadow: var(--uh-shadow);
  backdrop-filter: blur(var(--uh-blur));
  -webkit-backdrop-filter: blur(var(--uh-blur));
}

.project-hero-card{
  border-radius: var(--uh-radius-lg);
  overflow: hidden;
}

.project-hero-media{
  position: relative;
  height: 170px;
  overflow: hidden;
  background: rgba(255,255,255,0.25);
}

.project-hero-media::after{
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.72), rgba(255,255,255,0.10) 55%, rgba(255,255,255,0.00) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.00) 45%, rgba(255,255,255,0.18));
  pointer-events: none;
}

.project-hero-media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-hero-content{
  padding: 22px 24px 22px;
}

.project-title{
  margin: 0 0 10px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.06;
}

.project-subtitle{
  margin: 0 0 16px;
  color: var(--uh-ink-2);
  font-size: 16.5px;
  line-height: 1.55;
  max-width: 70ch;
}

.project-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

/* Chips inherit your global .chip.pill, but we “match the mock” here */
.project-chips .chip.pill{
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(187, 160, 255, 0.55);
  box-shadow: 0 10px 22px rgba(60, 30, 90, 0.12);
  color: var(--uh-ink-2);
  padding: 8px 14px;
  font-weight: 600;
}

.project-cta{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.project-cta .btn{
  border-radius: var(--uh-radius-pill);
  padding: 10px 16px;
  font-weight: 650;
}

.project-cta .btn-primary{
  background: rgba(60, 55, 70, 0.92);
  border: 1px solid rgba(60, 55, 70, 0.92);
  color: rgba(255,255,255,0.96);
  box-shadow: 0 10px 24px rgba(20, 12, 35, 0.16);
}

.project-cta .btn-primary:hover{
  filter: brightness(1.03);
}

.project-cta .btn-ghost{
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(0,0,0,0.08);
  color: var(--uh-ink);
}

.project-cta .btn-ghost:hover{
  background: rgba(255,255,255,0.85);
}

/* OVERVIEW CARD */
.project-overview{
  border-radius: var(--uh-radius-lg);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
}

.overview-head{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 12px;
}

.overview-emoji{
  font-size: 20px;
}

.overview-title{
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.overview-block{
  padding: 10px 10px 0;
}

.overview-h3{
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--uh-ink);
}

.overview-list{
  margin: 0;
  padding-left: 18px;
  color: var(--uh-ink-2);
  line-height: 1.55;
}

.overview-list li{
  margin: 8px 0;
}

.overview-divider{
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 14px 10px 6px;
}

.overview-links{
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 6px;
  color: var(--uh-ink-3);
  border-top: 1px solid rgba(0,0,0,0.06);
}

.overview-link{
  color: var(--uh-ink-2);
  text-decoration: none;
  font-weight: 650;
}

.overview-link:hover{
  text-decoration: underline;
}

.overview-sep{
  opacity: 0.6;
}

/* SECTION TABS */
.project-tabs{
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255,255,255,0.50);
  border: 1px solid rgba(255,255,255,0.70);
  box-shadow: var(--uh-shadow-2);
  backdrop-filter: blur(var(--uh-blur));
  -webkit-backdrop-filter: blur(var(--uh-blur));
  overflow-x: auto;
}

.project-tabs::-webkit-scrollbar{ height: 6px; }
.project-tabs::-webkit-scrollbar-thumb{ background: rgba(0,0,0,0.10); border-radius: 999px; }

.project-tabs .tab{
  white-space: nowrap;
  text-decoration: none;
  color: var(--uh-ink-2);
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--uh-radius-pill);
  border: 1px solid transparent;
}

.project-tabs .tab:hover{
  background: rgba(255,255,255,0.60);
  border-color: rgba(0,0,0,0.06);
}

.project-tabs .tab.is-active{
  color: var(--uh-ink);
  background: rgba(255,255,255,0.78);
  border-color: rgba(187, 160, 255, 0.55);
  box-shadow: 0 10px 22px rgba(60, 30, 90, 0.12);
}

/* SECTION CARDS */
.section-card{
  border-radius: var(--uh-radius-lg);
  padding: 22px 22px;
}

.section-title{
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-h3{
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-lead{
  margin: 0 0 16px;
  color: var(--uh-ink-2);
  line-height: 1.6;
}

.section-card p{
  color: var(--uh-ink-2);
  line-height: 1.65;
}

/* Two-column blocks */
.two-col{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 12px;
}

.two-col .col{
  background: rgba(255,255,255,0.40);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--uh-radius-md);
  padding: 16px;
}

/* Approach steps */
.step-list{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

.step{
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--uh-radius-md);
  padding: 16px;
}

.step-title{
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 850;
}

.step ul{
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--uh-ink-2);
}

/* Results bullets */
.bullets{
  margin: 0;
  padding-left: 18px;
  color: var(--uh-ink-2);
  line-height: 1.65;
}

.bullets li{ margin: 10px 0; }

/* Tools */
.tools-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.tool{
  border-radius: var(--uh-radius-md);
  padding: 16px;
  background: rgba(255,255,255,0.48);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: none;
}

.tool-title{
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 850;
}

.tool p{
  margin: 0;
  color: var(--uh-ink-2);
}

/* Tableau block */
.tableau-block{
  border-radius: var(--uh-radius-lg);
  padding: 16px;
  margin-top: 16px;
  overflow: hidden; /* kill scrollbars from oversized embeds */
}

.tableau-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 6px 12px;
}

.mini-link{
  color: var(--uh-ink-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.mini-link:hover{ text-decoration: underline; }

/* Responsive Tableau embed (override fixed inline px sizes from Tableau code) */
.tableau-embed{
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: hidden; /* eliminates internal scrollbars */
  border-radius: 18px;

  /* Match your Tableau embed’s original ratio (1200 × 1027) so it scales cleanly */
  aspect-ratio: 1200 / 1027;

  /* Safety: if a browser doesn’t support aspect-ratio */
  min-height: 780px;
}

.tableau-embed .tableauPlaceholder{
  position: absolute !important;
  inset: 0 !important;
  width: calc(100% / var(--uh-tableau-scale)) !important;
  height: calc(100% / var(--uh-tableau-scale)) !important;
  max-width: none !important;
  overflow: hidden !important;
  transform: scale(var(--uh-tableau-scale));
  transform-origin: top left;
}

.tableau-embed .tableauViz,
.tableau-embed object,
.tableau-embed iframe{
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block !important;
  overflow: hidden !important;
}

/* Viz cards */
.viz-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.viz-card{
  border-radius: var(--uh-radius-lg);
  padding: 14px;
  background: rgba(255,255,255,0.50);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: none;
}

.viz-title{
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 850;
}

.viz-card img{
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.35);
}

.viz-note{
  margin: 10px 0 0;
  color: var(--uh-ink-3);
  line-height: 1.5;
  font-size: 14px;
}

/* Takeaways CTA */
.takeaway-cta{
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Footer */
.project-footer{
  padding: 18px 0 34px;
}

.project-footer .mini-link{
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--uh-radius-pill);
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 10px 22px rgba(60, 30, 90, 0.10);
}

/* Responsive */
@media (max-width: 980px){
  .project-hero-grid{
    grid-template-columns: 1fr;
  }

  .two-col{
    grid-template-columns: 1fr;
  }

  .step-list{
    grid-template-columns: 1fr;
  }

  .tools-grid{
    grid-template-columns: 1fr;
  }

  .viz-grid{
    grid-template-columns: 1fr;
  }

  .project-hero-media{
    height: 190px;
  }

  /* More aggressive scale on small screens */
  :root{ --uh-tableau-scale: 0.84; }
  .tableau-embed{ min-height: 620px; }
}

@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior: auto !important; }
}