/* ==========================================================================
   RIDGELINE ROOFING CO. — RESPONSIVE DESIGN SYSTEM
   ========================================================================== */

/* --------------------------------------------------------------------------
   LARGE TABLET & SMALL DESKTOP (<= 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .hero-copy-column {
    max-width: 580px;
  }

  .nav-menu {
    gap: 1.5rem;
  }

  .metrics-container {
    grid-template-columns: 1fr auto 1.1fr auto 1fr auto 1.8fr;
  }

  .metric-separator {
    margin: 0 clamp(0.75rem, 1.5vw, 1.75rem);
  }
}

/* --------------------------------------------------------------------------
   TABLET PORTRAIT (<= 992px)
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .hero-section {
    min-height: 720px;
  }

  .hero-bg-image {
    /* Balance roof visibility and text legibility on tablet */
    object-position: 82% center;
  }

  .hero-scrim-horizontal {
    background: linear-gradient(
      90deg,
      rgba(8, 11, 15, 0.92) 0%,
      rgba(8, 11, 15, 0.86) 42%,
      rgba(8, 11, 15, 0.55) 68%,
      rgba(8, 11, 15, 0.20) 100%
    );
  }

  /* Navigation adjustments */
  .nav-menu {
    display: none; /* Collapsed to mobile toggle */
  }

  .nav-location {
    display: none; /* Preserves clean nav bar */
  }

  .nav-divider {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-cta-btn {
    padding: 0.5rem 0.95rem;
    font-size: 0.75rem;
  }

  /* Metrics Strip Reflow (2x2 Grid) */
  .metrics-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2rem;
    padding: 1.5rem var(--container-padding);
  }

  .metric-separator {
    display: none;
  }

  .metric-item-social {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* Mobile Drawer Active Overlay */
  .mobile-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(7, 10, 14, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 55;
    padding: 5.5rem var(--container-padding) 2.5rem;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  }

  .mobile-drawer.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
  }

  .mobile-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-white-70);
    font-size: 0.8125rem;
    font-weight: 500;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .mobile-menu {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
  }

  .mobile-link {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-white-80);
    transition: color 0.2s, transform 0.2s;
    display: inline-block;
  }

  .mobile-link:hover,
  .mobile-link.active {
    color: var(--color-white);
    transform: translateX(6px);
  }

  .mobile-cta-wrapper {
    margin-top: auto;
    padding-top: 1.5rem;
  }

  .btn-block {
    width: 100%;
    padding: 1.1rem;
    font-size: 1rem;
  }

  /* Hamburger Toggle Transformation */
  .nav-toggle.is-active .toggle-bar:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
  }

  .nav-toggle.is-active .toggle-bar:nth-child(2) {
    transform: translateY(-4px) rotate(-45deg);
  }

  /* Section 02: About / Approach Tablet Reflow */
  .about-section {
    padding: clamp(5.5rem, 8vw, 7.5rem) 0;
  }

  .about-editorial-grid {
    flex-direction: column;
    gap: 3.5rem;
  }

  .about-content-col {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .about-visual-col {
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
  }

  .about-principles {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 3.25rem;
    padding-top: 2rem;
  }

  .principle-divider {
    display: none;
  }

  .principle-desc {
    max-width: 100%;
  }

  /* Section 03: Services Mobile Accordion Reflow */
  .services-section {
    padding: clamp(5rem, 8vw, 7rem) 0;
  }

  .services-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  }

  .services-header-title-block,
  .services-header-copy-block {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .services-supporting-copy {
    font-size: 1.05rem;
    line-height: 1.6;
  }

  /* Single Column Layout (Desktop sticky photo stage is hidden) */
  .services-showcase-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .services-stage {
    display: none; /* Inverted to in-place accordions on mobile */
  }

  /* Mobile Accordion Container */
  .service-item {
    padding: 0;
  }

  .service-row-content {
    display: grid;
    grid-template-columns: 2.2ch 1fr auto;
    align-items: start;
    gap: 1rem;
    padding: 1.25rem 0;
  }

  .service-number {
    padding-top: 0.2rem;
  }

  .service-title {
    font-size: clamp(1.25rem, 5.2vw, 1.65rem);
    letter-spacing: -0.02em;
  }

  .service-arrow {
    padding-top: 0.15rem;
    transition: transform 0.4s var(--ease-out-expo), color 0.3s ease;
  }

  .service-item.is-active .service-arrow {
    transform: rotate(45deg);
  }

  /* Description reveals on active item */
  .service-desc-wrap {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.45s var(--ease-out-expo), opacity 0.35s ease;
  }

  .service-item.is-active .service-desc-wrap {
    grid-template-rows: 1fr;
    opacity: 1;
  }

  .service-item.is-active .service-desc {
    padding-top: 0.65rem;
    padding-bottom: 0.25rem;
    font-size: 0.9375rem;
  }

  /* Mobile Media Drawer */
  .service-mobile-drawer {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.45s var(--ease-out-expo), opacity 0.35s ease;
  }

  .service-item.is-active .service-mobile-drawer {
    grid-template-rows: 1fr;
    opacity: 1;
  }

  .service-mobile-media {
    overflow: hidden;
    width: 100%;
    margin-top: 0.85rem;
    margin-bottom: 1.5rem;
  }

  .service-mobile-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
    border-radius: 2px;
    display: block;
  }

  .service-mobile-caption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 0.65rem;
  }

  .caption-title {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-primary);
  }

  .caption-subtitle {
    font-size: 0.6875rem;
    font-weight: 350;
    letter-spacing: 0.08em;
    color: var(--color-secondary);
    text-transform: uppercase;
  }

  /* Section 04: Selected Projects Tablet Reflow */
  .projects-section {
    padding: clamp(5.5rem, 8vw, 7.5rem) 0;
  }

  .projects-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: clamp(3rem, 6vw, 4.5rem);
  }

  .projects-header-left,
  .projects-header-right {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .project-spread-wide .project-media-frame,
  .project-spread-wide .project-meta-bar {
    width: 100%;
  }

  .project-spread-wide .project-meta-bar {
    grid-template-columns: auto 1fr auto auto;
    gap: 1.5rem;
  }

  .project-spread-asymmetric .project-asymmetric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .project-asymmetric-info {
    padding-left: 0;
  }

  /* Section 05: Final CTA Tablet Reflow */
  .final-cta-section {
    padding: clamp(7rem, 12vw, 10rem) 0;
  }

  .final-cta-content {
    max-width: 720px;
  }

  /* Footer Tablet Reflow (2-column layout) */
  .site-footer {
    padding: 6rem var(--container-gutter) 3.5rem;
  }

  .footer-main-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4rem 3rem;
    margin-bottom: 5rem;
  }

  .footer-col-brand {
    grid-column: span 2;
  }
}

/* --------------------------------------------------------------------------
   MOBILE DEVICES (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .hero-section {
    min-height: 100svh;
    height: auto;
  }

  .hero-stage {
    padding-top: 5rem;
    padding-bottom: 2.5rem;
  }

  /* Art-directed crop: position the roofline visibly in the upper right/center */
  .hero-bg-image {
    object-position: 80% 25%;
    transform: scale(1.05);
  }

  /* Stronger mobile gradient for seamless text legibility */
  .hero-scrim-horizontal {
    background: linear-gradient(
      180deg,
      rgba(8, 11, 15, 0.65) 0%,
      rgba(8, 11, 15, 0.88) 35%,
      rgba(8, 11, 15, 0.95) 75%,
      rgba(8, 11, 15, 0.98) 100%
    );
  }

  /* Headline sizing: clamp between 44px and 56px per specification */
  .hero-headline {
    font-size: clamp(2.75rem, 11vw, 3.75rem); /* approx 44px - 60px */
    line-height: 0.96;
    letter-spacing: -0.035em;
  }

  .hero-description {
    font-size: 0.95rem;
    line-height: 1.55;
    margin-top: 1.25rem;
    margin-bottom: 2rem;
  }

  /* Stacked Action CTAs */
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.875rem;
  }

  .btn-primary {
    width: 100%;
    padding: 0.95rem 1.5rem;
  }

  .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
  }

  .btn-secondary::after {
    display: none;
  }

  /* Reflow Metrics Strip */
  .hero-metrics-strip {
    position: relative;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .metrics-container {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 1.5rem var(--container-padding);
  }

  .metric-number {
    font-size: 1.85rem;
  }

  .metric-suffix {
    font-size: 1.35rem;
  }

  .metric-label {
    font-size: 0.625rem;
  }

  .metric-item-social {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Section 02 Mobile Layout */
  .about-section {
    padding: 4.75rem 0;
  }

  .about-headline {
    font-size: clamp(2rem, 8.2vw, 2.75rem);
    margin-bottom: 1.5rem;
  }

  .about-editorial-grid {
    gap: 2.75rem;
  }

  .about-copy {
    margin-bottom: 2rem;
  }

  .about-lead {
    font-size: 1.05rem;
    line-height: 1.58;
  }

  .about-principles {
    margin-top: 2.75rem;
    padding-top: 1.85rem;
    gap: 1.75rem;
  }

  /* Section 04: Projects Mobile Stacking (Image First, Metadata Below) */
  .project-spread-asymmetric .project-asymmetric-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .project-asymmetric-grid .project-media-right {
    order: 1; /* Image first on mobile */
    width: 100%;
  }

  .project-asymmetric-grid .project-asymmetric-info {
    order: 2; /* Metadata below image */
    width: 100%;
    padding-left: 0;
  }

  .project-asymmetric-info .project-meta-index {
    margin-bottom: 0.75rem;
  }

  .project-asymmetric-info .project-info-body {
    margin-bottom: 1.25rem;
  }

  .project-spread-wide .project-meta-bar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: flex-start;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
  }

  .project-meta-primary {
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
  }

  .project-title {
    font-size: clamp(1.65rem, 6.8vw, 2.25rem);
  }

  .project-meta-specs {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .project-meta-specs .meta-separator {
    display: none;
  }

  .project-meta-bar .project-meta-cta {
    margin-top: 0.25rem;
  }

  .project-spread-divider {
    margin: clamp(3.5rem, 6vw, 4.5rem) 0;
  }

  /* Section 05: Final CTA Mobile Reflow */
  .final-cta-section {
    padding: clamp(6rem, 14vw, 8rem) 0;
  }

  .final-cta-headline {
    font-size: clamp(2.1rem, 8.5vw, 2.85rem);
    margin-bottom: 1.75rem;
  }

  .final-cta-supporting {
    font-size: 1.05rem;
    line-height: 1.65;
    margin-bottom: 2.75rem;
  }

  .final-cta-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 380px;
    gap: 1rem;
  }

  .cta-btn {
    width: 100%;
    padding: 1.15rem 1.75rem;
    font-size: 0.75rem;
  }

  .final-cta-container {
    padding: 0 1.5rem;
  }

  /* Footer Mobile Reflow (Single-column stacked layout) */
  .site-footer {
    padding: 5.5rem 0 3rem 0;
  }

  .footer-container {
    padding: 0 1.5rem;
  }

  .footer-main-grid {
    grid-template-columns: 1fr;
    gap: 3.25rem;
    margin-bottom: 4rem;
  }

  .footer-col-brand {
    grid-column: span 1;
  }

  .footer-bottom-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.35rem;
    padding-top: 2rem;
  }

  .footer-bottom-right {
    width: 100%;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Estimate Modal Mobile Reflow */
  .estimate-modal {
    padding: 0.75rem;
  }

  .estimate-modal-dialog {
    max-height: 94vh;
  }

  .estimate-modal-container {
    padding: 2rem 1.25rem 1.75rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    text-align: center;
  }

  .estimate-submit-btn {
    width: 100%;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   SMALL MOBILE VIEWPORTS (<= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --container-padding: 1.25rem;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    font-size: 0.5rem;
  }

  .brand-roof-icon {
    width: 26px;
    height: 20px;
  }

  .nav-cta-btn {
    display: none; /* Keep mobile top header uncluttered */
  }

  .hero-eyebrow {
    margin-bottom: 0.875rem;
  }

  .eyebrow-text {
    font-size: 0.6875rem;
    letter-spacing: 0.18em;
  }

  .hero-headline {
    font-size: clamp(2.65rem, 12vw, 3.25rem); /* ~42px - 52px */
  }

  .metrics-container {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .metric-item-social {
    grid-column: span 1;
  }
}

/* --------------------------------------------------------------------------
   SHORT VIEWPORTS / LAPTOPS WITH BROWSER TOOLBARS (max-height: 850px)
   -------------------------------------------------------------------------- */
@media (max-height: 850px) and (min-width: 993px) {
  .hero-section {
    min-height: 600px;
  }

  .site-nav {
    padding-top: 0.85rem;
    padding-bottom: 0.5rem;
  }

  .hero-eyebrow {
    margin-bottom: 0.5rem;
  }

  .hero-headline {
    font-size: clamp(2.25rem, 3.8vw, 3.5rem);
  }

  .hero-description {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 0.65rem;
    margin-bottom: 1rem;
    max-width: 440px;
  }

  .metrics-container {
    padding: 0.65rem var(--container-padding);
  }

  .metric-number {
    font-size: 1.65rem;
  }

  .metric-label {
    font-size: 0.6rem;
  }

  .avatar-img {
    width: 28px;
    height: 28px;
  }
}

/* --------------------------------------------------------------------------
   LARGE SCREENS / 1080p+ DESKTOPS (min-width: 1600px)
   -------------------------------------------------------------------------- */
@media (min-width: 1600px) {
  :root {
    --container-max-width: 1680px;
    --container-padding: clamp(2rem, 5.5vw, 6rem);
  }

  .hero-headline {
    font-size: clamp(3.1rem, 3.6vw, 4.35rem);
    line-height: 0.96;
  }

  .hero-copy-column {
    max-width: 680px;
  }

  .hero-description {
    font-size: 1.05rem;
    line-height: 1.68;
    max-width: 520px;
    margin-top: 1.25rem;
    margin-bottom: 2rem;
  }

  .hero-eyebrow {
    margin-bottom: 1.5rem;
  }

  .metrics-container {
    padding: 1.1rem var(--container-padding);
  }

  .metric-number {
    font-size: 2.35rem;
  }

  .metric-label {
    font-size: 0.6875rem;
  }

  /* Section 02 Large Display Scaling */
  .about-headline {
    font-size: clamp(2.85rem, 3.2vw, 4rem);
  }

  .about-content-col {
    max-width: 660px;
  }

  .about-visual-col {
    max-width: 600px;
  }

  .about-lead {
    font-size: 1.25rem;
  }

  .about-secondary {
    font-size: 1.05rem;
  }

  /* Section 03 Large Display Scaling */
  .services-headline {
    font-size: clamp(2.85rem, 3.2vw, 4rem);
  }

  .services-title {
    font-size: clamp(1.85rem, 2.3vw, 2.6rem);
  }

  .services-supporting-copy {
    font-size: 1.1875rem;
    max-width: 580px;
  }

  /* Section 04 Large Display Scaling */
  .projects-headline {
    font-size: clamp(2.85rem, 3.2vw, 4rem);
  }

  .project-title {
    font-size: clamp(1.85rem, 2.3vw, 2.65rem);
  }
}

