/* DigismartHub responsive refinement layer.
   Desktop styling stays in tailwind.css; this file improves phone and tablet layouts. */

:root { scroll-padding-top: 84px; }
html { -webkit-text-size-adjust: 100%; }
body { width: 100%; overflow-x: clip; }
img, svg, video, iframe { max-width: 100%; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }

@media (max-width: 767px) {
  :root { scroll-padding-top: 76px; }
  body { font-size: 15px; }
  section[id] { scroll-margin-top: 76px; }
  .max-w-7xl { max-width: 100%; }

  /* Compact top announcement and a genuinely phone-sized navigation bar. */
  body > div.bg-brand-black.text-white.border-b > .max-w-7xl {
    min-height: 34px;
    height: 34px;
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }
  body > div.bg-brand-black.text-white.border-b > .max-w-7xl > div:first-child > span:nth-child(2),
  body > div.bg-brand-black.text-white.border-b > .max-w-7xl > div:last-child {
    display: none !important;
  }
  body > div.bg-brand-black.text-white.border-b > .max-w-7xl > div:first-child {
    width: 100%;
    justify-content: center;
  }
  body > div.bg-brand-black.text-white.border-b > .max-w-7xl > div:first-child > span:first-child {
    font-size: 10px;
    letter-spacing: .06em;
  }

  #mainHeader > .max-w-7xl {
    height: 68px !important;
    min-height: 68px;
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }
  #mainHeader > .max-w-7xl > a img {
    height: 34px;
    width: auto;
    max-width: 136px;
  }
  #headerBookCallBtn {
    min-height: 42px;
    padding: 8px 10px;
    gap: 6px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.1;
  }
  #headerBookCallBtn svg { display: none; }
  #mobileMenuBtn { min-width: 42px; min-height: 42px; padding: 9px; }
  #mobileNavMenu {
    max-height: calc(100dvh - 102px);
    overflow-y: auto;
    padding: 10px 14px 18px;
    box-shadow: 0 18px 28px rgba(7,9,9,.12);
  }
  #mobileNavMenu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eceee9;
    font-size: 14px;
  }

  /* Hero: clearer reading order, comfortable type, full-width touch targets. */
  #hero { padding-top: 28px; padding-bottom: 48px; }
  #hero > .max-w-7xl { padding-left: 16px; padding-right: 16px; }
  #hero > .max-w-7xl > .grid { gap: 28px; }
  #hero h1 {
    font-size: clamp(34px, 8.8vw, 42px) !important;
    line-height: 1.06 !important;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
  }
  #heroSubTagline {
    font-size: 10px;
    line-height: 1.55;
    letter-spacing: .10em;
  }
  #hero .text-base.sm\:text-lg { font-size: 15px; line-height: 1.75; }
  #heroPrimaryCtaBtn,
  #hero a[href="#services-section"] {
    width: 100%;
    min-height: 52px;
    padding: 13px 14px;
    white-space: normal;
    text-align: center;
    font-size: 14px;
  }
  #hero .pt-5.border-t.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }
  #hero .pt-5.border-t.grid > div:nth-child(3) { grid-column: 1 / -1; }
  #hero .rounded-3xl.bg-brand-black {
    padding: 14px;
    border-radius: 20px;
  }
  #heroMainVisualImg { height: 218px !important; }
  #hero .rounded-3xl.bg-brand-black > .flex.items-center.justify-between {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  #hero .rounded-3xl.bg-brand-black > .flex.items-center.justify-between > div:first-child {
    max-width: 100%;
    font-size: 10px;
  }
  #heroVisualTabStudio, #heroVisualTabEngine {
    white-space: normal;
    font-size: 10px;
    line-height: 1.25;
  }
  #heroLayerStack { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #heroLayerStack .hero-layer-card {
    display: grid;
    grid-template-columns: minmax(88px, .72fr) minmax(0, 1.28fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    align-items: center;
    padding: 10px 11px;
  }
  #heroLayerStack .hero-layer-card > div:first-child {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin: 0;
    align-self: center;
  }
  #heroLayerStack .hero-layer-card > div:nth-child(2) {
    grid-column: 2;
    font-size: 12px;
    line-height: 1.3;
  }
  #heroLayerStack .hero-layer-card > div:nth-child(3) {
    grid-column: 2;
    font-size: 10px;
    line-height: 1.35;
  }
  #heroLayerDetailBox {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  #heroLayerDetailBox a { align-self: flex-start; }
  #hero .mt-12.lg\:mt-14 { margin-top: 30px; }

  /* Reduce oversized desktop section spacing while maintaining separation. */
  section[id] { padding-top: 54px !important; padding-bottom: 54px !important; }
  section[id] h2 {
    font-size: clamp(27px, 7.2vw, 34px) !important;
    line-height: 1.13 !important;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
  }
  section[id] h3 { overflow-wrap: anywhere; }
  section[id] .max-w-7xl { padding-left: 16px; padding-right: 16px; }
  section[id] .mb-14 { margin-bottom: 28px; }
  section[id] .mb-12 { margin-bottom: 26px; }
  section[id] .mb-10 { margin-bottom: 24px; }

  /* Principle switcher: allow long labels to wrap and remain tappable. */
  #principleViewCardsBtn,
  #principleViewCompareBtn {
    white-space: normal !important;
    flex: 1 1 140px;
    min-height: 42px;
    line-height: 1.25;
    padding: 9px 10px;
  }
  #principleViewCardsBtn:has(+ #principleViewCompareBtn) { min-width: 0; }
  #principleViewToggle {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
  }
  #principleDetailPanel { padding: 14px; }
  #principlesCompareContainer .overflow-x-auto { max-width: 100%; }
  #principlesCompareContainer table { min-width: 680px; }

  /* Problem explorer: avoid four tiny diagnostic nodes across a phone. */
  #stateDisconnectedBtn, #stateCoordinatedBtn {
    white-space: normal !important;
    width: 100%;
    min-height: 44px;
    text-align: left;
    line-height: 1.35;
  }
  #growthStateToggle {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
  }
  #problem-section .rounded-2xl.bg-brand-carbon.border.border-brand-darkborder.p-6 {
    padding: 16px;
  }
  #problem-section .grid.grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #problem-section .grid.grid-cols-4 > div { min-width: 0; }
  #problem-section .grid.grid-cols-4 > div > div:last-child { overflow-wrap: anywhere; }

  /* Services: turn desktop toggle bars into responsive controls. */
  #serviceModeInspectorBtn, #serviceModeGridBtn {
    white-space: normal !important;
    flex: 1 1 140px;
    min-height: 42px;
    line-height: 1.25;
    padding: 9px 10px;
  }
  #serviceModeToggle {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }
  #serviceTabsList .srv-tab-btn { padding: 12px; gap: 8px; }
  #serviceTabsList .srv-tab-btn > div:first-child { gap: 9px; }
  #serviceTabsList .srv-tab-btn > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
  #srvDetailTitle { font-size: 22px; line-height: 1.12; }
  #srvDetailHeroImg { min-height: 210px; }
  #serviceInspectorView .p-6.sm\:p-8 { padding: 16px; }
  #serviceInspectorView .pt-5.border-t.flex {
    align-items: stretch;
  }
  #toggleServiceStackBtn, #srvBookDirectBtn {
    width: 100%;
    min-height: 46px;
    white-space: normal;
    line-height: 1.3;
    padding: 12px;
  }
  #customStackBar { padding: 16px; }
  #customStackBar > div:last-child { width: 100%; }
  #customStackBar button { min-height: 42px; }
  #bookWithStackBtn { flex: 1; white-space: normal !important; }

  /* Industry selectors become a neat 2-column touch grid. */
  #industryTabsContainer { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #industryTabsContainer .ind-tab-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 8px;
    white-space: normal !important;
    line-height: 1.25;
    font-size: 11px;
  }
  #industries-section .rounded-2xl.bg-brand-Alabaster { padding: 16px; }
  #industries-section #indBookCallBtn { width: 100%; justify-content: center; padding: 13px 12px; }
  #industries-section .relative.h-60.sm\:h-64 { height: 220px; }
  #industries-section .relative.h-60.sm\:h-64 > div.absolute.bottom-3 { flex-wrap: wrap; align-items: flex-start; }
  #industries-section #indTagRight { white-space: normal; }

  /* Growth stage cards and diagnostic panel. */
  #system-section .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 { gap: 12px; margin-bottom: 36px; }
  #system-section .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 > div { padding: 17px; }
  #system-section .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 > div > div:first-child > div:first-child {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  #diagnostic-section { padding: 16px !important; border-radius: 20px; }
  #diagnostic-section > .grid > div:last-child { padding: 16px; }
  #diagnostic-section #diagPriorityLevel { white-space: normal; text-align: right; }
  #diagBookWithPlanBtn { min-height: 48px; white-space: normal; }

  /* Contact form: readable inputs, no tiny controls, no side-by-side squeeze. */
  #booking-section .rounded-3xl,
  #booking-section .rounded-2xl.bg-brand-black { border-radius: 18px; }
  #booking-section input,
  #booking-section select,
  #booking-section textarea {
    min-width: 0;
    width: 100%;
    min-height: 46px;
    font-size: 16px !important;
    line-height: 1.4;
  }
  #booking-section textarea { min-height: 100px; }
  #bookingGoalPills .goal-pill { min-height: 46px; line-height: 1.35; }
  #booking-section button[type="submit"] { min-height: 52px; }
  #booking-section #bookConsent { width: 18px; min-width: 18px; min-height: 18px; }
  #booking-section #bookConsent + div { min-width: 0; }

  /* Footer columns and links should read naturally instead of compressing. */
  footer .max-w-7xl { padding-top: 36px; padding-bottom: 28px; }
  footer .pt-8.flex { align-items: flex-start; }
  footer .pt-8.flex > div:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
  footer .inline-block.bg-white { max-width: 100%; }
  footer img { max-width: 150px; height: auto; }

  /* Consistent tap targets and safe wrapping on long text. */
  button, .goal-pill, .faq-trigger { min-height: 42px; }
  p, li, label, a, span { overflow-wrap: break-word; }
  .overflow-x-auto { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 380px) {
  #mainHeader > .max-w-7xl { padding-left: 9px; padding-right: 9px; gap: 6px; }
  #mainHeader > .max-w-7xl > a img { height: 30px; max-width: 118px; }
  #headerBookCallBtn { padding: 7px 8px; font-size: 10px; }
  #mobileMenuBtn { min-width: 39px; min-height: 40px; }
  #hero h1 { font-size: 32px !important; }
  #hero .rounded-3xl.bg-brand-black { padding: 11px; }
  #hero .rounded-3xl.bg-brand-black > .flex.items-center.justify-between > div:first-child { font-size: 9px; }
  #industryTabsContainer { grid-template-columns: 1fr 1fr; }
  #problem-section .grid.grid-cols-4 { gap: 6px; }
  #problem-section .grid.grid-cols-4 > div { padding: 8px 6px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  section[id] { scroll-margin-top: 88px; }
  #mainHeader > .max-w-7xl { height: 72px; padding-left: 20px; padding-right: 20px; }
  #mainHeader > .max-w-7xl > a img { max-width: 150px; }
  #headerBookCallBtn { padding: 10px 13px; font-size: 12px; }
  #hero { padding-top: 42px; padding-bottom: 58px; }
  #hero h1 { font-size: clamp(40px, 5.2vw, 48px) !important; }
  #problem-section .grid.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #diagnostic-section { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Final mobile polish: better proof-point cards and a shorter enquiry journey. */
@media (max-width: 767px) {
  /* Slightly tighter hero rhythm; keep the same type scale and visual direction. */
  #hero {
    padding-top: 22px !important;
    padding-bottom: 38px !important;
  }
  #hero > .max-w-7xl > .grid {
    row-gap: 22px !important;
  }
  #hero > .max-w-7xl > .grid > div:first-child.space-y-6 > * + * {
    margin-top: 19px !important;
  }
  #hero > .max-w-7xl > .grid > div:first-child > .inline-flex.rounded-full {
    max-width: 100%;
    padding: 7px 11px;
    gap: 7px;
  }
  #hero > .max-w-7xl > .grid > div:first-child > .inline-flex.rounded-full span:last-child {
    font-size: 9px;
    letter-spacing: .075em;
    line-height: 1.4;
  }
  #hero h1 {
    font-size: clamp(33px, 8.3vw, 39px) !important;
    line-height: 1.055 !important;
  }
  #hero .text-base.sm\:text-lg {
    font-size: 15px !important;
    line-height: 1.62 !important;
  }
  #heroPrimaryCtaBtn,
  #hero a[href="#services-section"] {
    min-height: 50px;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  /* Convert the three credibility points into distinct, readable mini-cards. */
  #heroCredibilityGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
    padding-top: 14px;
  }
  #heroCredibilityGrid > div {
    min-width: 0;
    min-height: 76px;
    padding: 10px 9px;
    gap: 8px;
    border: 1px solid rgba(7, 9, 9, .10);
    border-radius: 12px;
    background: rgba(255, 255, 255, .82);
  }
  #heroCredibilityGrid > div:nth-child(3) {
    grid-column: 1 / -1;
    min-height: 62px;
  }
  #heroCredibilityGrid > div > div:first-child {
    width: 29px;
    min-width: 29px;
    height: 29px;
    margin-top: 0;
    font-size: 10px;
  }
  #heroCredibilityGrid > div > div:nth-child(2) > div {
    font-size: 10px;
    line-height: 1.3;
  }
  #heroCredibilityGrid > div > div:nth-child(2) > p {
    font-size: 10px;
    line-height: 1.4;
  }

  /* Compact booking panel heading so the title and label don't compete. */
  #booking-section .rounded-3xl.bg-brand-black {
    padding: 16px !important;
  }
  #bookingFormHeader {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 9px;
    padding-bottom: 14px;
    margin-bottom: 16px;
  }
  #bookingFormHeader > div {
    flex: 1 1 100%;
    min-width: 0;
  }
  #bookingFormHeader h3 {
    font-size: 21px !important;
    line-height: 1.15 !important;
  }
  #bookingFormHeader > span {
    white-space: normal !important;
    font-size: 10px;
    line-height: 1.3;
  }

  /* Short fields side-by-side on phones; notes and consent remain full-width. */
  #bookingContactGrid,
  #bookingBusinessGrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 11px !important;
  }
  #bookingContactGrid > div,
  #bookingBusinessGrid > div {
    min-width: 0;
  }
  #discoveryBookingForm label {
    font-size: 9px;
    line-height: 1.35;
    letter-spacing: .025em;
  }
  #discoveryBookingForm input:not([type="checkbox"]),
  #discoveryBookingForm select {
    min-width: 0;
    width: 100%;
    padding-left: 9px;
    padding-right: 7px;
  }
  #discoveryBookingForm input::placeholder,
  #discoveryBookingForm textarea::placeholder {
    font-size: 11px;
    opacity: .85;
  }
  #bookingGoalPills {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }
  #bookingGoalPills .goal-pill {
    min-width: 0;
    min-height: 48px;
    padding: 9px 10px;
    font-size: 11px;
    line-height: 1.3;
  }
  #bookTimeline {
    min-height: 44px;
  }
  #booking-section textarea#bookNotes {
    min-height: 84px;
    padding: 10px 11px;
  }
  #booking-section .flex.items-start.gap-2\.5 {
    gap: 8px;
  }
}

@media (max-width: 359px) {
  /* Keep controls comfortable on very narrow older phones. */
  #heroCredibilityGrid,
  #bookingContactGrid,
  #bookingBusinessGrid,
  #bookingGoalPills {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #heroCredibilityGrid > div:nth-child(3) { grid-column: auto; }
  #heroCredibilityGrid > div { min-height: 0; }
}

@media (max-width: 767px) {
  /* Reduce the mobile header height without shrinking the tap targets too far. */
  #mainHeader > .max-w-7xl {
    height: 62px !important;
    min-height: 62px;
    gap: 7px;
  }
  #mainHeader > .max-w-7xl > a img {
    height: 32px;
    max-width: 130px;
  }
  #headerBookCallBtn {
    min-height: 39px;
    padding: 7px 9px;
    font-size: 10.5px;
  }
  #mobileMenuBtn {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }
}
