/* Mobile chapter rhythm and collection controls. Load after the existing home styles. */
/* Texture contrast stays independent of the scroll-driven opacity animation. */
#philosophy .glaze-macro {
  filter: brightness(1.18) contrast(1.1);
}

.collection-detail-cta { display: none; }

@media (max-width: 760px) {
  .header .brand--image .brand-logo-frame {
    width: var(--qy-mobile-logo-width, 126px);
  }

  /* A compact horizontal chapter directory beneath the existing header. */
  .header #nav {
    height: clamp(250px, 35svh, 296px);
    max-height: calc(100svh - 72px);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 9px 24px;
    padding: 15px 22px 18px;
  }
  .header #nav > a {
    min-height: 0;
    align-content: center;
    gap: 5px;
    padding: 8px 0 12px;
  }
  .header #nav .nav-entry-number { font-size: 10px; line-height: 1.4; }
  .header #nav .nav-entry-title { font-size: 21px; line-height: 1.35; }
  .header #nav .nav-entry-description {
    margin-top: 1px;
    font-size: 12px;
    line-height: 1.65;
  }

  /* Return to the compact action beside the product name. */
  #collection .product-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0 0;
  }
  #collection .product-meta::after { content: none; }
  #collection .product-name {
    min-width: 0;
    font-size: 19px;
    line-height: 1.55;
    letter-spacing: .01em;
  }
  #collection .collection-detail-cta {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 0 3px;
    border-bottom: 1px solid rgb(156 183 170 / 60%);
    color: #d9e5dc;
    font: 400 13px/1.4 var(--sans);
    letter-spacing: .025em;
    white-space: nowrap;
  }
  #collection .collection-detail-cta > svg {
    width: 31px;
    height: 23px;
    flex: 0 0 31px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.1;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  #collection .product-card:active .collection-detail-cta { color: #f2f5ef; border-color: currentColor; }

  /* Existing per-product buttons flank a genuinely centred reading indicator. */
  #collection .gallery-bottom {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 18px;
    margin-top: 17px;
    padding-top: 0;
  }
  #collection .gallery-count,
  #collection .page-numbers { display: none; }
  #collection .mobile-collection-cue {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    width: min(100%, 190px);
    min-width: 0;
    justify-self: center;
    gap: 8px;
  }
  #collection .mobile-collection-track { width: 100%; }
  #collection .mobile-collection-caption { justify-content: center; font-size: 10px; line-height: 1.4; }
  #collection .mobile-collection-caption > span:first-child { display: none; }
  #collection .collection-pagination { display: contents; }
  #collection .collection-pagination[hidden] { display: none; }
  #collection .collection-pagination > button {
    grid-row: 1;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    justify-content: center;
  }
  #collection #page-previous { grid-column: 1; }
  #collection #page-next { grid-column: 3; }
  #collection .collection-pagination > button > span { display: none; }
  #collection .collection-pagination > button svg {
    width: 31px;
    height: 23px;
    margin: 0;
    stroke-width: 1.1;
  }

  /* Remove the small catalogue labels and give the complete plate a shorter chapter. */
  #philosophy .philosophy-header,
  #philosophy .glaze-label { display: none; }
  #philosophy .philosophy-stage {
    grid-template-rows: auto auto;
    grid-template-areas: 'copy' 'plate';
    align-items: start;
    align-content: start;
    gap: 10px;
    min-height: 0;
    height: auto;
    max-height: none;
    padding: 22px 22px 16px;
  }
  #philosophy .philosophy-copy h2 { font-size: clamp(28px, 7.7vw, 31px); line-height: 1.3; }
  #philosophy .philosophy-copy p { margin-top: 9px; font-size: 14px; line-height: 1.75; }
  #philosophy .philosophy-copy .line-link { margin-top: 7px; min-height: 42px; }
  #philosophy .philosophy-stage > .texture-frame {
    width: min(65vw, 228px);
    height: auto;
    min-height: 0;
    max-width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    justify-self: center;
    align-self: center;
  }
  #philosophy + .glaze-reading-chapter { padding-top: 34px; }

  /* A restrained closing line: copyright on the left, back to top on the right. */
  footer.footer { padding-block: 20px 22px; }
  footer.footer .footer-brand-line {
    display: block;
    padding: 0;
    border: 0;
  }
  footer.footer .footer-wordmark.brand--image { display: none; }
  footer.footer .footer-brand-line .footer-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: nowrap;
    font-size: 10px;
    line-height: 1.8;
  }
  footer.footer .footer-brand-line .footer-bottom > span { flex: 1 1 auto; }
  footer.footer .footer-origin { display: block; }
  footer.footer .footer-brand-line #ui48-backtop {
    flex: 0 0 auto;
    gap: 8px;
    min-height: 44px;
    padding: 0;
    font-size: 11px;
  }
  footer.footer #ui48-backtop svg { width: 19px; height: 22px; }
}

@media (max-width: 360px) {
  .header #nav { gap: 8px 18px; padding-inline: 20px; }
  .header #nav .nav-entry-title { font-size: 20px; }
  .header #nav .nav-entry-description { font-size: 11px; }
  #collection .product-name { font-size: 18px; }
  #collection .collection-detail-cta { font-size: 13px; }
  #collection .gallery-bottom { gap: 12px; }
  #philosophy .philosophy-stage { padding-inline: 20px; }
  footer.footer .footer-brand-line .footer-bottom { gap: 10px; font-size: 9px; }
}

@media (max-width: 760px) and (max-height: 520px) {
  .header #nav { height: min(250px, calc(100svh - 72px)); padding-block: 12px; gap: 6px 24px; }
  .header #nav > a { padding-block: 5px 8px; gap: 3px; }
}
