/* ---------- CSS variables ---------- */
:root {
  --background-color: #08090d;
  --text-color: #f7f7f7;
  --body-font-family: Roboto, Georgia, "Times New Roman", serif;
  --body-font-size: 18px;
  --subhed-font-family: Roboto, Georgia, "Times New Roman", serif;
  --subhed-font-size: 20px;
  --chart-font-family: Inter, Arial, Helvetica, sans-serif;
  --axis-font-family: Inter, Arial, sans-serif;
  --chart-font-size: 16px;
  --axis-font-size: 14px;
  /* --borough-color: #08090d;
  --inner-hole-color: #08090d; */
}

/* ---------- Base layout & typography ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--body-font-size);
}

body {
  margin: 0;
  font-family: var(--body-font-family);
  font-size: var(--body-font-size);
  background: var(--background-color);
  color: var(--text-color);
  /* Prevent rendering issues on mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent black screen issues */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.site-header {
  border-bottom: 1px solid #1a1b22;
  /* background: radial-gradient(circle at top, #181b24, #050509); */
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.landing-complex {
  margin-bottom: 2rem;
  max-width: 250px;
  width: 100%;
  /* Reserve space to prevent layout shift during image load */
  aspect-ratio: 1 / 1.047; /* Matches card with palette bar */
  position: relative; /* For crossfade positioning */
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .site-header__inner {
    padding: 1rem;
    justify-content: flex-start;
    padding-top: 2rem;
  }

  .landing-complex {
    margin-bottom: 1.5rem;
    max-width: 200px;
    /* Maintain aspect ratio on mobile to prevent layout shift */
    aspect-ratio: 1 / 1.047;
  }

  .site-header__title-line--large {
    font-size: 3.5rem;
  }

  .site-header__title-line--small {
    font-size: 0.85rem;
  }

  .site-subtitle {
    font-size: 1rem;
    margin-top: 0.5rem;
  }
}

.landing-complex .complex-card {
  background: #15151c;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.6s ease-in-out;
}

.landing-complex .complex-card.fade-out {
  opacity: 0;
}

.landing-complex .complex-card.fade-in {
  opacity: 1;
}

.landing-complex .complex-card__image-wrapper {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.landing-complex .complex-card__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.landing-complex .complex-card__label {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  padding: 0.25rem 0.5rem;
  color: #ffffff;
  font-size: 0.75rem;
  max-width: 100%;
  font-family: var(--chart-font-family);
  -webkit-text-stroke: 2px #000000;
  text-shadow: 
    1px 1px 2px rgba(0, 0, 0, 0.8),
    -1px -1px 2px rgba(0, 0, 0, 0.8),
    1px -1px 2px rgba(0, 0, 0, 0.8),
    -1px 1px 2px rgba(0, 0, 0, 0.8);
  paint-order: stroke fill;
}

.landing-complex .complex-card__palette {
  display: block;
  height: 12px;
  width: 100%;
  border-top: 1px solid #1f1f26;
  font-size: 0;
}

.landing-complex .complex-card__palette-segment {
  display: inline-block;
  height: 100%;
}

.site-header__title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  font-family: 'DM Sans', sans-serif;
}

.letter-o {
  display: inline-block;
  vertical-align: baseline;
  line-height: 1;
  position: relative;
}

.letter-o img {
  display: inline-block;
  height: 0.85em;
  width: 0.85em;
  vertical-align: baseline;
  position: relative;
  top: 0.1em;
  transform: translateY(-2%);
}

.site-header__title-line {
  display: block;
}

.site-header__title-line--large {
  font-size: 4.5rem;
  letter-spacing: 0.05em;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
}

.site-header__title-line--small {
  font-size: 1rem;
  letter-spacing: 0.1em;
  font-weight: 400;
  margin: 0.2rem 0;
  color: var(--text-color);
  font-family: 'DM Sans', sans-serif;
}

.site-subtitle {
  margin: 0.8rem 0 0;
  font-size: 1.2rem;
  color: var(--text-color);
  font-family: var(--chart-font-family);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  /* Prevent rendering issues on mobile */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.section {
  margin-bottom: 3rem;
}

.section-divider {
  border: none;
  border-top: 1px solid #1a1b22;
  margin: 2rem 0 3rem 0;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.section__inner {
  max-width: 100%;
}

/* Add more padding for narrative text sections on desktop */
@media (min-width: 768px) {
  .section--narrative .section__inner,
  .section:not(.section--featured):not(#borough-sunburst-section):not(#court-mosaic-section) .section__inner {
    padding-left: 8rem;
    padding-right: 8rem;
  }
}

.section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}

.section p {
  margin: 0.4rem 0;
  max-width: 60rem;
  line-height: 1.6;
  color: var(--text-color);
}

/* Link styling */
a {
  color: #a0b4d4;
  text-decoration: underline;
  text-decoration-color: rgba(160, 180, 212, 0.4);
  text-underline-offset: 2px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

a:hover {
  color: #c0d4f4;
  text-decoration-color: rgba(192, 212, 244, 0.6);
}

a:visited {
  color: #b0a4d4;
}

.section--narrative p {
  /* font-size: 1rem; */
}

.color-subhed {
  font-size: var(--subhed-font-size);
  font-family: var(--subhed-font-family);
  font-weight: 700;
  margin: 1.5rem 0 0.75rem 0;
  text-align: left;
  color: var(--text-color);
}

/* ---------- Complex grids ---------- */

.complex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* small mobile: 2 cols */
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Mobile: 3 columns */
@media (min-width: 480px) {
  .complex-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Desktop: 4 columns */
@media (min-width: 1024px) {
  .complex-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Featured layout (gray/green sections) ---------- */

.section--featured {
  margin-top: 2rem;
}

.featured-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.featured-layout__text {
  flex: 1;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}

.featured-layout__text.fade-in {
  opacity: 1;
  transform: translateY(0);
}

.featured-layout__text p {
  margin: 0;
  font-size: var(--body-font-size);
  line-height: 1.6;
}

.featured-layout__images {
  flex: 1;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}

.featured-layout__images.fade-in {
  opacity: 1;
  transform: translateY(0);
}

.featured-single {
  width: 100%;
}

.featured-single .complex-card {
  max-width: 100%;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 1rem;
}

/* 1 large image on top, 2 images below */
.featured-grid .complex-card:nth-child(1) {
  grid-column: 1 / 3; /* Spans both columns */
  grid-row: 1;
}

/* Make top image less tall (wider aspect ratio) */
.featured-grid .complex-card:nth-child(1) .complex-card__image-wrapper {
  aspect-ratio: 2 / 1; /* Wider, less tall */
}

.featured-grid .complex-card:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}

.featured-grid .complex-card:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.featured-grid .complex-card:nth-child(4) {
  display: none; /* Hide 4th image */
}

/* Desktop: two-column layout */
@media (min-width: 768px) {
  .featured-layout {
    flex-direction: row;
    align-items: center;
    gap: 3rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }


  .featured-layout--green {
    /* Images left, text right - reverse order */
    flex-direction: row-reverse;
  }
}

/* ---------- Complex card component ---------- */

.complex-card {
  background: #15151c;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.complex-card__image-wrapper {
  position: relative;
  aspect-ratio: 1 / 1; /* square */
  overflow: hidden;
}

.complex-card__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Park name overlay */
.complex-card__label {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  padding: 0.25rem 0.5rem;
  color: #ffffff;
  font-size: 0.75rem;
  max-width: 100%;
  font-family: var(--chart-font-family);
  -webkit-text-stroke: 2px #000000;
  text-shadow: 
    1px 1px 2px rgba(0, 0, 0, 0.8),
    -1px -1px 2px rgba(0, 0, 0, 0.8),
    1px -1px 2px rgba(0, 0, 0, 0.8),
    -1px 1px 2px rgba(0, 0, 0, 0.8);
  paint-order: stroke fill;
}

/* Palette label at bottom of image (for single complex) */
.complex-card__palette-label {
  position: absolute;
  bottom: 0.25rem;
  left: 0.25rem;
  padding: 0.25rem 0.5rem;
  color: #ffffff;
  font-size: 0.75rem;
  font-family: var(--chart-font-family);
  -webkit-text-stroke: 2px #000000;
  text-shadow: 
    1px 1px 2px rgba(0, 0, 0, 0.8),
    -1px -1px 2px rgba(0, 0, 0, 0.8),
    1px -1px 2px rgba(0, 0, 0, 0.8),
    -1px 1px 2px rgba(0, 0, 0, 0.8);
  paint-order: stroke fill;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.complex-card__palette-label .palette-arrow {
  display: inline-block;
  vertical-align: middle;
  color: #ffffff;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8)) 
          drop-shadow(-1px -1px 2px rgba(0, 0, 0, 0.8))
          drop-shadow(1px -1px 2px rgba(0, 0, 0, 0.8))
          drop-shadow(-1px 1px 2px rgba(0, 0, 0, 0.8));
}

/* Palette bar under image */
.complex-card__palette {
  display: block;
  height: 12px;
  width: 100%;
  border-top: 1px solid #1f1f26;
  font-size: 0; /* remove inline-block gaps */
}

.complex-card__palette-segment {
  display: inline-block;
  height: 100%;
}

/* Optional meta for later atlas section */
.complex-card__meta {
  padding: 0.45rem 0.75rem 0.6rem;
  font-size: 0.78rem;
  color: #a0a0b4;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid #1a1b22;
  background: #050509;
}

.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1rem 1.2rem;
  font-size: 0.8rem;
  color: #80829a;
}



/* ---------- Borough Sunburst ---------- */

/* Align chart title with sunburst */

.chart-title, 
.chart-subtitle {
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  font-family: var(--chart-font-family);
  text-align: center;
}

.chart-title {
  font-weight: 700;
  margin-bottom: 5px;
  font-size: var(--chart-font-size);
}

.chart-subtitle {
  font-weight: 500;
  margin-bottom: 15px;
  font-size: var(--axis-font-size);
}



#borough-sunburst {
    margin-top: 10px;
    display: flex;
    justify-content: center;
}
  
#borough-sunburst svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 600px;
}

/* Sunburst path styles */
.sunburst-path--borough {
  fill: var(--background-color);
}

/* Sunburst inner hole circle */
.inner-hole-circle {
  fill: var(--background-color);
}

/* Sunburst label styles */
.sunburst-label {
  font-family: var(--chart-font-family);
  fill: #f7f7f7;
  text-anchor: middle;
  dominant-baseline: middle;
}

.sunburst-label--borough {
  font-size: 14px;
}

.sunburst-label--hue {
  font-size: 12px;
  font-weight: bold;
}

/* Mobile styles for sunburst labels */
@media (max-width: 767px) {
  .sunburst-label--borough {
    font-size: 11px;
  }
  
  .sunburst-label--hue {
    font-size: 10px;
  }
}

/* Mobile: stack sunburst groups vertically */
/* @media (max-width: 767px) {
  .sunburst-mobile-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
  }
  
  .sunburst-group {
    width: 100%;
  }
} */

/* #borough-sunburst {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#borough-sunburst svg {
  display: block;
  margin: 0 auto;
  max-width: 800px;
  height: auto;
} */

/* ---------- Lookup Tool ---------- */

#methodology {
  margin-bottom: 1rem;
}

#lookup-tool .section__inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#lookup-tool .section-divider {
  width: 100%;
}

#lookup-tool .complex-grid-title,
#lookup-tool p {
  text-align: center;
}

#lookup-tool-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.lookup-tool__search-wrapper {
  position: relative;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.lookup-tool__input {
  width: 100%;
  max-width: 500px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--chart-font-family);
  background: #22232a;
  border: 1px solid #2a2b32;
  border-radius: 6px;
  color: var(--text-color);
  outline: none;
  transition: border-color 0.2s;
}

.lookup-tool__input:focus {
  border-color: #4a4b52;
}

.lookup-tool__autocomplete {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  max-height: 300px;
  overflow-y: auto;
  background: #1a1b22;
  border: 1px solid #2a2b32;
  border-top: none;
  border-radius: 0 0 6px 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
}

.lookup-tool__autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: var(--text-color);
  font-family: var(--chart-font-family);
  transition: background-color 0.2s;
}

.lookup-tool__autocomplete-item:hover,
.lookup-tool__autocomplete-item--active {
  background: #2a2b32;
}

.lookup-tool__results {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lookup-tool__results-header {
  font-size: var(--chart-font-size);
  font-family: var(--chart-font-family);
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--text-color);
  text-align: center;
}

.lookup-tool__cards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.lookup-tool__cards-container .complex-card {
  max-width: 300px;
  width: 100%;
}

/* Desktop: side by side */
@media (min-width: 768px) {
  .lookup-tool__cards-container {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .lookup-tool__cards-container .complex-card {
    flex: 0 0 auto;
  }
}

.lookup-tool__no-results {
  color: #80829a;
  font-style: italic;
  margin: 2rem 0;
  text-align: center;
}

/* ---------- Court Mosaic / Color Collage ---------- */

#court-mosaic-section {
  margin-top: 4rem;
}

#court-mosaic-section .section__inner {
  text-align: center;
  max-width: 100%;
}

#court-mosaic {
  display: block;
  width: 100%;
  margin-top: 2rem;
}

#court-mosaic img {
  width: 100%;
  height: auto;
  display: block;
}

/* Remove extra padding on desktop for mosaic section */
@media (min-width: 768px) {
  #court-mosaic-section .section__inner {
    padding-left: 0;
    padding-right: 0;
  }
}

/* Old dynamic mosaic CSS removed - now using static images */


