/* Almasraf Gold Prices Pro 1.6.11 — responsive system for home + country pages */
html body :is(#agp-country-specificity,.agp-gold-box),
html body :is(#agp-home-specificity,.agp-gold-home),
.agp-gold-news-content,.agpw-widget{box-sizing:border-box!important;width:100%!important;max-width:100%!important;min-width:0!important}
html body :is(#agp-country-specificity,.agp-gold-box) *,
html body :is(#agp-home-specificity,.agp-gold-home) *,
.agp-gold-news-content *,.agpw-widget *{box-sizing:border-box;min-width:0}
html body :is(#agp-country-specificity,.agp-gold-box) :is(img,svg,canvas,video,iframe),
html body :is(#agp-home-specificity,.agp-gold-home) :is(img,svg,canvas,video,iframe),
.agp-gold-news-content :is(img,svg,video,iframe){max-width:100%!important;height:auto}
html body :is(#agp-country-specificity,.agp-gold-box) :is(input,select,textarea,button),
html body :is(#agp-home-specificity,.agp-gold-home) :is(input,select,textarea,button){max-width:100%!important}
html body :is(#agp-country-specificity,.agp-gold-box) :is(h1,h2,h3,h4,p,a,strong,span,td,th,label,summary),
html body :is(#agp-home-specificity,.agp-gold-home) :is(h1,h2,h3,h4,p,a,strong,span,td,th,label,summary),
.agp-gold-news-content :is(h1,h2,h3,h4,p,a,strong,span,td,th){overflow-wrap:anywhere;word-break:normal}

/* Safe overflow: only data controls/tables scroll horizontally, never the whole content card. */
html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-table-wrap{display:block!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-table{max-width:none!important}
html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-chart-wrap,.agp-chart-panel,.agp-history-chart){width:100%!important;max-width:100%!important}
html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-chart-wrap,.agp-chart-panel){overflow:hidden!important}

/* Every grid/card family is width-safe before breakpoints are applied. */
html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-summary-grid,.agp-home-country-grid,.agp-important-grid,.agp-news-grid,.agp-method-grid,.agp-interest-links-grid,.agp-home-faq,.agp-calc-grid),
html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-summary-grid,.agp-price-grid,.agp-important-grid,.agp-country-news-grid,.agp-method-grid,.agp-interest-links-grid,.agp-country-links-grid,.agp-weekly-summary,.agp-calc-grid,.agp-local-summary-grid){width:100%!important;max-width:100%!important;min-width:0!important}

/* Desktop / small desktop: cards never become narrower than a sensible two-column tablet layout. */
@media(max-width:1024px){
 html body :is(#agp-home-specificity,.agp-gold-home){padding-inline:14px!important}
 html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-home-country-grid,.agp-important-grid,.agp-news-grid,.agp-method-grid,.agp-summary-grid,.agp-home-faq){grid-template-columns:repeat(2,minmax(0,1fr))!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-important-grid,.agp-country-news-grid,.agp-country-links-grid,.agp-method-grid,.agp-summary-grid,.agp-price-grid,.agp-weekly-summary){grid-template-columns:repeat(2,minmax(0,1fr))!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-interest-links-grid,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-interest-links-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

/* Tablet: big visual sections stack; card collections remain two columns. */
@media(max-width:900px){
 html body :is(#agp-country-specificity,.agp-gold-box){padding-inline:12px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-hero-reference,.agp-chart-panel,.agp-bar-feature){grid-template-columns:1fr!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-bar-feature-visual{order:2!important;justify-self:center!important;width:100%!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-bar-feature-copy{order:1!important;width:100%!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-analysis-panel{padding-inline:18px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-analysis-panel>h2.agp-blue-heading{width:100%!important;max-width:100%!important;margin-inline:0!important;white-space:normal!important}
}
@media(max-width:820px){
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-hero{grid-template-columns:1fr!important;grid-template-areas:"title" "copy" "visual"!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-visual{width:100%!important;max-width:100%!important;justify-self:center!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-visual img{width:min(100%,440px)!important;max-width:440px!important;margin-inline:auto!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bar-feature{grid-template-columns:1fr!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bar-feature-visual{justify-self:center!important;width:100%!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-calc-grid,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-calc-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

/* Mobile contract: every content/news/card collection is exactly ONE item per row. */
@media(max-width:600px){
 html body :is(#agp-country-specificity,.agp-gold-box),
 html body :is(#agp-home-specificity,.agp-gold-home){padding-inline:8px!important}

 html body :is(#agp-home-specificity,.agp-gold-home) :is(
   .agp-summary-grid,.agp-home-country-grid,.agp-important-grid,.agp-news-grid,.agp-method-grid,
   .agp-interest-links-grid,.agp-home-faq,.agp-calc-grid,.agp-bar-meta
 ),
 html body :is(#agp-country-specificity,.agp-gold-box) :is(
   .agp-summary-grid,.agp-price-grid,.agp-important-grid,.agp-country-news-grid,.agp-method-grid,
   .agp-interest-links-grid,.agp-country-links-grid,.agp-weekly-summary,.agp-calc-grid,.agp-local-summary-grid,.agp-bar-meta
 ){grid-template-columns:1fr!important}

 /* Cancel legacy spanning left over from two-column tablet rules. */
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-summary-card:last-child,.agp-weekly-change){grid-column:auto!important}

 /* Main cards always occupy the full available line. */
 html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-summary-card,.agp-home-country-card,.agp-important-card,.agp-news-card,.agp-method-card,.agp-interest-group,.agp-home-faq details),
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-summary-card,.agp-price-card,.agp-important-card,.agp-country-news-card,.agp-method-card,.agp-interest-group,.agp-country-link,.agp-faq details,.agp-weekly-summary>div){width:100%!important;max-width:100%!important;min-width:0!important}

 /* News cards: one full-width story, then the next story below it. */
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-news-card img,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-country-news-card img{display:block!important;width:100%!important;height:auto!important;aspect-ratio:2/1!important;object-fit:cover!important}

 /* Country selectors / search / calculator controls stack cleanly. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-country-switcher{grid-template-columns:1fr!important;gap:8px!important;text-align:center!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-country-switcher label{white-space:normal!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-country-switcher select,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bars-country select{width:100%!important;min-width:0!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-current-country{white-space:normal!important;width:100%!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-country-toolbar{display:block!important;width:100%!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-country-search{width:100%!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-calc-actions{grid-template-columns:1fr!important}

 /* Only compact controls scroll horizontally: chart ranges and bar weights. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-chart-controls{display:flex!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:thin;padding-bottom:5px!important;-webkit-overflow-scrolling:touch}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-chart-controls button{flex:0 0 auto!important;min-width:64px!important;min-height:44px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-bar-weight-tabs,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bar-weight-tabs{display:flex!important;max-width:100%!important;overflow-x:auto!important;flex-wrap:nowrap!important;-webkit-overflow-scrolling:touch;padding-bottom:5px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-bar-weight-button,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bar-weight-button{flex:0 0 auto!important;min-height:44px!important}

 /* Download controls wrap/stack instead of pushing the history panel wider. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-downloads{display:flex!important;flex-wrap:wrap!important;width:100%!important;max-width:100%!important;gap:8px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-downloads :is(a,button){flex:1 1 100%!important;width:100%!important;max-width:100%!important}

 /* Legacy wide/negative-margin headings are contained on phones. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-analysis-panel{padding-inline:12px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-analysis-panel>h2.agp-blue-heading{width:100%!important;max-width:100%!important;margin-inline:0!important;white-space:normal!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-faq>.agp-home-section-title{width:100%!important;max-width:100%!important;min-width:0!important;margin-inline:0!important;white-space:normal!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-blue-heading,.agp-summary-title,.agp-price-section-title),
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-section-title{max-width:100%!important;white-space:normal!important}

 /* Comfortable mobile typography and touch areas. */
 html body :is(#agp-country-specificity,.agp-gold-box) h1,
 html body :is(#agp-home-specificity,.agp-gold-home) h1{font-size:clamp(22px,7vw,28px)!important;line-height:1.45!important}
 html body :is(#agp-country-specificity,.agp-gold-box) h2,
 html body :is(#agp-home-specificity,.agp-gold-home) h2,.agp-gold-news-content h2{font-size:clamp(17px,5.4vw,21px)!important;line-height:1.5!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(button,.agp-country-link,.agp-download-button,.agp-download-csv,.agp-download-json),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(button,.agp-country-card-button),
 html body :is(#agp-country-specificity,.agp-gold-box) :is(details>summary),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(details>summary){min-height:44px!important}

 /* History keeps its own internal horizontal scroll; page width remains intact. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-table{min-width:480px!important;font-size:12px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-table :is(th,td){padding-inline:7px!important}

 .agp-gold-news-summary{grid-template-columns:1fr!important}
 .agp-gold-news-content :is(table,.wp-block-table){max-width:100%!important;overflow-x:auto!important}
}

@media(max-width:390px){
 html body :is(#agp-country-specificity,.agp-gold-box),html body :is(#agp-home-specificity,.agp-gold-home){padding-inline:6px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-content-panel,.agp-analysis-panel,.agp-home-section),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-home-section,.agp-content-panel){padding-inline:10px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-table{min-width:440px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-buy,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-sell{gap:5px!important;padding-inline:7px!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-country-card .agp-country-card-button{width:100%!important;min-width:0!important;padding-inline:10px!important}
}
@media(max-width:340px){
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-history-table{min-width:420px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-chart-controls button{min-width:58px!important;padding-inline:7px!important}
}
@media(pointer:coarse){
 html body :is(#agp-country-specificity,.agp-gold-box) :is(a,button,select,input,summary),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(a,button,select,input,summary){touch-action:manipulation}
}

/* 1.6.12 final responsive normalization — closes remaining 521–600px and legacy-width gaps. */
html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-top-intro,.agp-content-panel,.agp-price-section,.agp-summary-section,.agp-country-home-section,.agp-country-news,.agp-faq,.agp-ounce-box,.agp-section-heading,.agp-bars-country),
html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-home-section,.agp-ounce-box,.agp-section-heading,.agp-bars-country){width:100%!important;max-width:100%!important;min-width:0!important}

@media(max-width:1024px){
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-ounce-box,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-faq{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-ounce-box>.agp-ounce-metric:last-child:nth-child(odd){grid-column:1/-1!important}
}

@media(max-width:600px){
 /* Every public content collection is one item per row on phones. */
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-ounce-box,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-faq{grid-template-columns:1fr!important}
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-ounce-box>.agp-ounce-metric:last-child:nth-child(odd){grid-column:auto!important}

 /* Section headers stack instead of squeezing controls/text side by side. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-section-heading,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-section-heading{display:flex!important;flex-direction:column!important;align-items:stretch!important;justify-content:flex-start!important;gap:8px!important;width:100%!important;max-width:100%!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-section-heading>*{max-width:100%!important;min-width:0!important}

 /* Kill legacy minimum widths / negative margins on mobile headings. */
 html body :is(#agp-country-specificity,.agp-gold-box) :is(h1.agp-main-title,h2.agp-summary-title,h2.agp-price-section-title,.agp-blue-heading,.agp-card-heading),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-home-section-title,.agp-home-title){width:100%!important;max-width:100%!important;min-width:0!important;margin-inline:0!important;white-space:normal!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-price-section>h2.agp-price-section-title,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-content-panel>h2.agp-blue-heading{width:100%!important;max-width:100%!important;margin:0 0 12px!important;border-radius:10px!important}

 /* Bars selector and calculator fields never preserve desktop minimum widths. */
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-bars-country,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bars-country{display:flex!important;flex-direction:column!important;align-items:stretch!important;justify-content:center!important;gap:8px!important;width:100%!important}
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-bars-country select,
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-bars-country select,
 html body :is(#agp-country-specificity,.agp-gold-box) .agp-calculator :is(input,select,button),
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-calculator :is(input,select,button){width:100%!important;max-width:100%!important;min-width:0!important}

 /* Price rows may wrap values rather than push a card wider than the viewport. */
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-buy,.agp-sell){flex-wrap:wrap!important;min-width:0!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-buy,.agp-sell)>*{min-width:0!important;max-width:100%!important}

 /* Main visual layouts are explicitly width-safe when stacked. */
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-hero-reference,.agp-chart-panel,.agp-bar-feature),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-home-hero,.agp-bar-feature){width:100%!important;max-width:100%!important;min-width:0!important}

 /* Editorial/table content remains inside the panel; wide tables scroll internally. */
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-editor-content,.agp-local-editorial,.agp-buying-guide){width:100%!important;max-width:100%!important;min-width:0!important;overflow-wrap:anywhere}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-editor-content,.agp-local-editorial,.agp-buying-guide) table,
 .agp-gold-news-content table{display:block!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}

 /* Widget remains usable even inside narrow sidebars/phones. */
 :is(#agpw-specificity,.agpw-widget) .agpw-row{min-height:48px!important;height:auto!important;gap:8px!important;flex-wrap:wrap!important;padding-block:8px!important}
 :is(#agpw-specificity,.agpw-widget) .agpw-price{max-width:100%!important;overflow-wrap:anywhere}
}

@media(max-width:390px){
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-top-intro,.agp-content-panel,.agp-price-section,.agp-summary-section,.agp-country-home-section,.agp-country-news,.agp-faq),
 html body :is(#agp-home-specificity,.agp-gold-home) .agp-home-section{padding-inline:10px!important}
 html body :is(#agp-country-specificity,.agp-gold-box) :is(.agp-summary-card,.agp-price-card,.agp-country-news-card,.agp-important-card,.agp-method-card,.agp-interest-group),
 html body :is(#agp-home-specificity,.agp-gold-home) :is(.agp-summary-card,.agp-home-country-card,.agp-news-card,.agp-important-card,.agp-method-card,.agp-interest-group){max-width:100%!important;min-width:0!important}
}

@media(prefers-reduced-motion:reduce){
 html body :is(#agp-country-specificity,.agp-gold-box) *,
 html body :is(#agp-home-specificity,.agp-gold-home) *{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
