/* Progressive accessibility and resilient-rendering layer for the existing pages. */
html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { overflow-wrap: anywhere; }
main { min-height: 55vh; }
main:focus { outline: none; }
img { color: #746E67; font-size: .8rem; }
button, [type="button"], [type="submit"], summary { -webkit-tap-highlight-color: rgba(217,119,50,.18); }
input[type="search"] { appearance: none; -webkit-appearance: none; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input::placeholder { color: #8b837b; opacity: 1; }
a, button, input, summary { touch-action: manipulation; }

/* Keep interactive targets usable for touch without changing desktop density. */
@media (pointer: coarse) {
  .primary-nav a, .topic-links a, .suggestion-links a, .catalog-jump a { min-height: 44px; display: inline-flex; align-items: center; }
  .footer-links a { min-height: 40px; display: inline-flex; align-items: center; }
  .faq-list summary { min-height: 52px; }
  .text-link { display: inline-flex; align-items: center; min-height: 42px; }
}

/* Preserve semantic reading order when images are unavailable during deployment. */
img:not([src]), img[src=""] { visibility: hidden; }
.hero-media, .subhero, .catalog-head, .search-hero, .group-visual, .visual-card, .brand-links > a, .feature-card { position: relative; }
.hero-media > img, .subhero > img, .catalog-head > img, .search-hero > img, .group-visual > img, .visual-card > img, .brand-links img, .feature-card img { background-color: #EEE8E0; }

/* Stronger keyboard focus for navigation within dense content lists. */
.primary-nav a:focus-visible, .catalog-jump a:focus-visible, .topic-links a:focus-visible, .suggestion-links a:focus-visible {
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(217,119,50,.14);
}
.feature-card:focus-within, .category-panel:focus-within, .brand-links > a:focus-within, .search-result-list article:focus-within {
  border-color: #A78B6D;
}

/* Improve readability at high browser zoom and for longer localized strings. */
.hero h1, .subhero h1, .catalog-head h1, .brand-hero h1, .search-hero h1, .section-heading h2, .visual-card h2, .brand-strip h2 {
  hyphens: auto;
  text-wrap: balance;
}
.hero-lead, .section-heading > p:last-child, .feature-copy p, .discovery-row p, .catalog-entry p, .guide-item p, .brand-links p {
  text-wrap: pretty;
}

/* Explicit visited-state treatment stays subtle and does not alter CTA hierarchy. */
.topic-links a:visited, .suggestion-links a:visited, .footer-links a:visited { text-decoration-color: currentColor; }

/* Forced-colors mode keeps controls and current-page state visible. */
@media (forced-colors: active) {
  .button, .menu-toggle, .primary-nav a, .topic-links a, .tag, .catalog-jump a, .faq-list details, .category-panel, .feature-card, .search-result-list article {
    border: 1px solid ButtonText;
    forced-color-adjust: auto;
  }
  .primary-nav a.is-active { outline: 2px solid Highlight; }
  .button-primary { background: Highlight; color: HighlightText; }
  .hero-note, .guide-aside, .fact-grid article { border: 1px solid CanvasText; }
  .eyebrow, .meta-label, .text-link, .discovery-type { color: LinkText; }
  .tag { color: CanvasText; background: Canvas; }
}

/* More contrast for users who request it while preserving the intended palette. */
@media (prefers-contrast: more) {
  :root { --c-muted: #514a44; --c-line: #b9aea3; }
  .primary-nav a, .section-heading > p:last-child, .feature-copy p, .discovery-row p, .catalog-entry p, .guide-item p, .mini-card-grid p, .brand-links p, .search-result-list p { color: #514a44; }
  .button-ghost, .button-small, .category-panel, .feature-card, .faq-list details, .search-result-list article { border-width: 2px; }
  .tag { color: #4f463f; }
  .site-footer p { color: rgba(255,255,255,.78); }
}

/* Keep motion-free mode completely static, including hover lift. */
@media (prefers-reduced-motion: reduce) {
  .button:hover, .brand-links > a:hover { transform: none; }
  .site-header { backdrop-filter: none; }
}

/* Large text / zoom reflow safeguards. */
@media (max-width: 1080px) and (min-resolution: 1.5dppx) {
  .header-shell { gap: 18px; }
  .primary-nav { gap: 2px; }
  .primary-nav a { padding-inline: 12px; }
}

@media (max-width: 820px) {
  .primary-nav.is-open { max-height: calc(100vh - 68px); overflow-y: auto; overscroll-behavior: contain; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .menu-toggle span { transition: transform .18s ease, opacity .18s ease; transform-origin: center; }
  .catalog-jump { scroll-snap-type: x proximity; overscroll-behavior-inline: contain; }
  .catalog-jump a { scroll-snap-align: start; }
}

@media (max-width: 620px) {
  .hero-search input, .search-form input { font-size: 16px; }
  .hero-actions { align-items: stretch; }
  .hero-actions .button { min-height: 50px; }
  .category-panel, .feature-card, .brand-links > a, .search-result-list article, .faq-list details { border-radius: 16px; }
  .discovery-row p, .catalog-entry p, .guide-item p { max-width: 65ch; }
  .brand-strip-inner p { max-width: 60ch; }
}

/* Landscape phones should not inherit unnecessary tall image crops. */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 940px) {
  .site-header { position: relative; }
  .hero { min-height: 0; }
  .hero-media > img, .subhero img, .catalog-head img, .search-hero img { max-height: 340px; object-fit: cover; }
  .primary-nav.is-open { max-height: none; position: static; grid-column: 1 / -1; }
}

/* Safer print treatment for URLs and hidden interactive chrome. */
@media print {
  @page { margin: 16mm; }
  html, body { background: #fff !important; color: #000 !important; }
  body { font-size: 11pt; line-height: 1.5; }
  .skip-link, .menu-toggle, .hero-note, .catalog-jump, .tags, .button, .section-cta { display: none !important; }
  img { max-height: 90mm; object-fit: contain; break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
  article, section, details { break-inside: avoid; }
  .tone-section, .brand-strip, .visual-card, .brand-mark { background: #fff !important; color: #000 !important; }
  .visual-card p, .brand-strip p, .site-footer p { color: #000 !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; font-weight: 400; }
  a[href^="/"]::after { content: " (https://cupfox-web.com.cn" attr(href) ")"; font-size: 8pt; font-weight: 400; }
}

/* Utility states shared by current and future server-rendered content pages. */
[hidden] { display: none !important; }
.is-visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.status-message { padding: 12px 14px; border: 1px solid #D9D1C8; border-radius: 12px; background: #fff; color: #514a44; }
.status-message[role="alert"] { border-color: #D97732; }
.loading-placeholder { min-height: 96px; border-radius: 14px; background: #EEE8E0; }
.inline-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0; margin: 0; list-style: none; }
.inline-list > li { margin: 0; }
.prose-measure { max-width: 70ch; }
.no-wrap { white-space: nowrap; }
.break-word { overflow-wrap: anywhere; word-break: break-word; }
.safe-area-bottom { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.safe-area-top { padding-top: max(0px, env(safe-area-inset-top)); }

/* Keep content usable when CSS image effects or backdrop filters are unsupported. */
@supports not (backdrop-filter: blur(2px)) {
  .site-header { background: #F7F4EF; }
}
@supports not (color: color-mix(in srgb, black, white)) {
  :focus-visible { outline-color: #D97732; }
}
@supports not (text-wrap: balance) {
  .hero h1, .subhero h1, .catalog-head h1, .brand-hero h1, .search-hero h1 { max-width: 18ch; }
}

/* States created by progressive JavaScript enhancements. */
.media-missing { opacity: 0; position: absolute !important; pointer-events: none; }
.has-missing-media { min-height: 150px; background: linear-gradient(135deg, #EEE8E0, #F7F4EF); overflow: hidden; }
.missing-media-label { display: flex; align-items: center; justify-content: center; min-height: 150px; padding: 20px; color: #746E67; font-size: .82rem; text-align: center; }
.hero-media.has-missing-media .missing-media-label { min-height: 360px; }
.group-visual.has-missing-media .missing-media-label, .visual-card.has-missing-media .missing-media-label { min-height: 300px; }
.search-clear { border: 0; background: transparent; color: #746E67; padding: 0 8px; border-radius: 8px; font-size: .84rem; }
.search-clear:hover { color: #25211E; background: #EEE8E0; }
.search-clear[hidden] { display: none; }
:root { --header-height: 76px; }
[id^="group-"] { scroll-margin-top: calc(var(--header-height) + 24px); }
@media (max-width: 820px) { :root { --header-height: 68px; } }
@media (max-width: 620px) {
  .hero-media.has-missing-media .missing-media-label { min-height: 260px; }
  .group-visual.has-missing-media .missing-media-label, .visual-card.has-missing-media .missing-media-label { min-height: 220px; }
}
