/* responsive.css - global mobile readiness */

/* Prevent accidental horizontal scrolling due to wide elements */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Media should never overflow */
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

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

/* Mobile tap target baseline */
button, .btn, a.button, input, select, textarea {
  min-height: 44px;
}

:root {
  --container-max: 1200px;
  --pad-desktop: 24px;
  --pad-mobile: 12px;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

@media (max-width: 768px) {
  .container {
    padding-left: 0;
    padding-right: 0;
  }

  .nav-toggle {
    display: inline-flex !important;
    width: 100%;
    justify-content: center;
  }

  .primary-nav-container {
    display: block;
    width: 100%;
    flex-basis: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-6px);
    transition: max-height 0.3s ease, opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
  }

  .primary-nav-container.is-open {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .primary-nav {
    width: 100%;
    flex-direction: column;
    gap: 4px;
    font-size: 0.88rem;
  }

  .primary-nav .nav-link {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  :root {
    --pad-mobile: 10px;
  }

  body {
    font-size: 0.9375rem; /* 15px / 16px */
    line-height: 1.65;
  }


  h1 {
    font-size: 1.65rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .brand h1 {
    font-size: 1.55rem;
  }

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

  .hero-copy h1 {
    font-size: clamp(1.6rem, 6vw, 2.1rem);
  }

  .hero-copy .lead {
    font-size: 1rem;
  }

  .page-shell {
    padding: 0 var(--pad-mobile);
  }

  .type-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .type-tabs .tab-pill {
    scroll-snap-align: start;
  }

  header {
    padding: 20px 0 12px;
  }

  .header-shell {
    grid-template-columns: 1fr;
    padding: 10px var(--pad-mobile);
    gap: 6px;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .global-search {
    order: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .global-search-results {
    position: static;
    box-shadow: none;
    margin-top: 6px;
  }

  .header-user-controls,
  .auth-wrapper {
    width: 100%;
    justify-content: center;
  }

  .header-user-controls {
    flex-wrap: wrap;
  }

  .header-user-controls {
    order: 1;
  }

  .nav-toggle {
    order: 2;
  }

  .primary-nav-container {
    order: 3;
  }

  .login-dropdown,
  .user-menu-dropdown {
    left: var(--pad-mobile);
    right: var(--pad-mobile);
    margin-left: 0;
    margin-right: 0;
  }

  .user-menu-dropdown {
    display: flex;
    justify-content: flex-end;
  }

  .nav-toggle {
    min-height: 44px;
  }

  .primary-nav-container {
    max-height: 0;
  }

  .primary-nav-container.is-open {
    max-height: 320px;
  }

  .primary-nav {
    width: 100%;
  }

  .primary-nav .nav-link {
    width: 100%;
  }

  .primary-nav .ghost-button,
  .header-actions .ghost-button,
  .header-actions .primary-pill {
    min-height: 44px;
    padding: 6px 10px;
    flex: 0 1 auto;
    justify-content: center;
    font-size: 0.9rem;
  }

  .card-testing {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .card-testing .testing-detail::before {
    margin: 0 4px;
  }

  .card-testing .testing-confirmed-icon {
    margin-left: 0;
  }

  .ghost-button,
  .primary-pill,
  .btn,
  button,
  a.button {
    min-height: 44px;
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .icon-button,
  .theme-toggle {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
  }

  .product-grid,
  .dashboard-grid,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .owned-products-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-card,
  .type-card,
  .assistant-card,
  .card,
  .stat-card,
  .dashboard-card,
  .agent-card,
  .marketplace-card {
    padding: 12px;
    gap: 8px;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .card-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .card-actions .primary-pill.review-button {
    width: 100%;
    justify-content: center;
  }

  .card-actions .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 960px) {
  .prompt-hero-content {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }

  .product-box-hero-face-overlay {
    top: 16.9%;
    right: 24.8%;
    bottom: 15.8%;
    left: 36.2%;
  }

  .product-box-hero-overlay,
  .product-box-overlay {
    transform: skewY(-0.75deg) rotate(-0.28deg);
    transform-origin: 50% 15%;
  }

  .prompt-hero-visual {
    width: 100%;
  }

  .prompt-hero-content .product-info {
    width: 100%;
  }

  .product-hero-layout {
    gap: 14px;
  }

  .product-sticky-card {
    order: -1;
    margin-bottom: 2px;
  }

  .product-sticky-card .ownership-card {
    margin-top: 0.35rem;
    padding: 0.65rem;
  }

  .product-sticky-card .ownership-card-header {
    align-items: flex-start;
    gap: 0.35rem 0.5rem;
  }

  .product-sticky-card .ownership-owned-since {
    font-size: 0.78rem;
  }

  .product-sticky-card .product-cta {
    gap: 8px;
  }

  .product-sticky-card .product-hint {
    font-size: 0.84rem;
  }


  .owned-product-ownership-row {
    align-items: flex-start;
  }

  .owned-product-ownership-row .ownership-badge,
  .owned-product-ownership-row .pill {
    width: fit-content;
    max-width: 100%;
  }
  .pill-row,
  .pill-row-ownership {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .pill-row .pill,
  .pill-row .type-pill,
  .pill-row-ownership .pill {
    max-width: 100%;
  }
}

@media (min-width: 961px) {
  .product-box-hero-face-overlay {
    top: 16.6%;
    right: 24.2%;
    bottom: 15.2%;
    left: 36.6%;
  }

  .product-box-hero-overlay,
  .product-box-overlay {
    transform: skewY(-0.75deg) rotate(-0.28deg);
    transform-origin: 50% 13%;
  }
}

@media (max-width: 640px) {
  .prompt-hero-content {
    gap: 14px;
  }

  .product-box-hero {
    max-width: 300px;
  }

  .product-box-hero-inner,
  .product-box-hero img,
  .product-box-hero-placeholder {
    min-height: 360px;
    max-height: 420px;
  }

  .product-box-hero-meta {
    justify-content: center;
  }

  .product-box-hero-overlay,
  .product-box-overlay {
    transform: skewY(-0.72deg) rotate(-0.24deg);
    transform-origin: 50% 18%;
    clip-path: polygon(1% 0, 99% 0, 100% 100%, 0 100%);
  }

  .product-box-hero-face-overlay {
    top: 14.2%;
    right: 23.6%;
    bottom: 13.8%;
    left: 35.4%;
  }

  .product-box-hero-overlay,
  .product-box-overlay {
    --overlay-gap: clamp(0.25rem, 0.72vw, 0.48rem);
    --overlay-inline-pad: clamp(0.16rem, 0.65vw, 0.3rem);
  }

  .product-box-hero-overlay-title,
  .product-box-overlay-title {
    font-size: clamp(1rem, 2.55vw, 1.6rem);
    -webkit-line-clamp: 2;
  }

  .product-box-hero-overlay-tagline,
  .product-box-overlay-tagline {
    font-size: clamp(0.52rem, 1.5vw, 0.72rem);
    -webkit-line-clamp: 2;
  }

  .product-box-hero-overlay-bullets,
  .product-box-overlay-bullets {
    font-size: clamp(0.5rem, 1.35vw, 0.68rem);
  }

  .product-box-hero-overlay-version,
  .product-box-overlay-version {
    font-size: clamp(0.48rem, 1.25vw, 0.62rem);
  }

  .prompt-hero-content .product-info {
    text-align: center;
  }

  .prompt-hero-content .badge-row,
  .prompt-hero-content .pill-row {
    justify-content: center;
  }

  .product-sticky-card {
    padding: 12px;
  }

  .product-sticky-card .product-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .product-sticky-card .product-cta .primary-pill,
  .product-sticky-card .product-cta .secondary-cta,
  .product-sticky-card .product-cta .tertiary-cta {
    width: 100%;
    justify-content: center;
  }

  .ownership-id-wrap {
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .ownership-id-code {
    max-width: min(68vw, 18rem);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ownership-copy-button {
    white-space: nowrap;
  }
}


@media (max-width: 1024px) {
  .home-hero-grid--with-featured {
    grid-template-areas: "copy" "featured";
    grid-template-columns: 1fr;
    row-gap: 1.25rem;
  }

  .home-hero-main {
    width: 100%;
  }

  .home-hero-featured {
    justify-content: flex-start;
    max-width: min(420px, 100%);
  }

  .home-hero-featured-panel {
    max-width: 100%;
  }

  .home-hero-featured-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.85rem;
  }
}

@media (max-width: 720px) {
  .home-hero-featured-stack {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-hero-featured {
    max-width: 100%;
  }
}

@media (max-width: 1100px) {
  .home-listing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .home-listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-featured-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .home-listing-grid {
    grid-template-columns: 1fr;
  }

  .home-listing-card,
  .home-featured-card {
    min-height: 0;
  }

  .hero-chip-row {
    gap: 6px;
  }
}
