/* PetaniRapi v2.24 — accessibility, responsive hardening, and font scaling */

/* Font-size preference. text-size-adjust scales even legacy px typography on mobile;
   root sizing provides a fallback for the rem-based overrides below. */
html{font-size:15px;-webkit-text-size-adjust:100%;text-size-adjust:100%}
html[data-font-size="large"]{font-size:15px;-webkit-text-size-adjust:112%;text-size-adjust:112%}
html[data-font-size="xlarge"]{font-size:15px;-webkit-text-size-adjust:125%;text-size-adjust:125%}

/* Readability + flexible text. Do not force single-line text in user-facing cards. */
body{font-size:1rem}
body,button,input,select,textarea{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
p,.meta,.muted,.form-hint{font-size:.86rem;line-height:1.5}
label{font-size:.9rem!important;line-height:1.35}
input,select,textarea{font-size:1rem!important;line-height:1.35;max-width:100%;min-width:0}
button,.btn{font-size:.93rem;line-height:1.25;white-space:normal;overflow-wrap:anywhere;height:auto}
h1{font-size:1.55rem;line-height:1.08}
h2{font-size:1.18rem!important;line-height:1.18}
h3{font-size:1.04rem;line-height:1.22}
.card,.list-item,.choice,.quick,.settings-row,.home-action-card-v218,.home-secondary-actions-v218 a{min-width:0}
.card strong,.card small,.list-item strong,.list-item small,.settings-row strong,.settings-row small,.home-action-copy-v218 strong,.home-action-copy-v218 small{overflow-wrap:anywhere;word-break:normal;white-space:normal}
.row,.grid2,.grid3,.stats,.home-metrics,.home-action-grid-v218,.home-farm-switcher,.profile-summary-main,.profile-summary-actions,.settings-block,.font-size-options-v224{min-width:0}
.row>* ,.grid2>* ,.grid3>* ,.stats>* ,.home-metrics>* ,.home-action-grid-v218>* ,.home-farm-switcher>* ,.profile-summary-main>* ,.settings-block>*{min-width:0}

/* Dark wordmarks on light surfaces */
.landing-brand-lockup-v224{display:block!important;min-width:0;max-width:68%}
.landing-wordmark-v224{display:block;width:min(205px,100%);height:auto;object-fit:contain;object-position:left center}
.auth-wordmark-v224{display:block;width:min(220px,78vw);height:auto;object-fit:contain;margin:0 auto}
.auth-brand-row{width:100%;display:flex!important;justify-content:center!important;align-items:center!important}
.auth-brand-icon{display:none!important}

/* Keep topbar identity readable without consuming precious width. */
.topbar-brandtext{font-size:.72rem!important;color:#536d60!important;font-weight:900!important;white-space:normal!important}
.topbar h1{font-size:1.36rem!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.topbar-copy{min-width:0}
.topbar-main{min-width:0}
.topbar-quickcard,.home-weather-v223{flex-shrink:0;min-width:0}
.topbar-quickcard-kicker,.topbar-quickcard strong,.topbar-quickcard small,.home-weather-copy-v223 strong,.home-weather-copy-v223 small{white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.home-greeting-v223 strong{font-size:1rem!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.home-greeting-v223 small{font-size:.73rem!important}
.home-weather-copy-v223 strong{font-size:1.17rem!important}
.home-weather-copy-v223 small{font-size:.7rem!important}

/* Overview cards and actions scale vertically rather than clipping. */
.home-metrics>div{min-height:74px;display:flex!important;flex-direction:column;justify-content:center}
.home-metrics>div strong{font-size:1.15rem!important;line-height:1.18!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere}
.home-metrics>div small{font-size:.74rem!important}
.home-quick-head-v218 h2{font-size:1.18rem!important;line-height:1.18!important}
.home-quick-head-v218 p{font-size:.8rem!important;line-height:1.45!important}
.home-quick-all-v218{font-size:.8rem!important;white-space:normal}
.home-action-card-v218{min-height:128px!important;height:auto!important;overflow:visible!important}
.home-action-copy-v218{min-width:0;width:100%}
.home-action-copy-v218 strong{font-size:1.04rem!important;line-height:1.18!important}
.home-action-copy-v218 small{font-size:.76rem!important;line-height:1.42!important}
.home-action-arrow-v218{line-height:1}
.home-secondary-actions-v218 a{font-size:.84rem!important;line-height:1.3!important;height:auto!important}
.weather-mini-action{font-size:.78rem!important;line-height:1.45!important}
.compact-history .list-item{height:auto!important}

/* Bottom nav: labels may wrap to 2 lines; keep tap targets intact. */
.bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))!important}
.bottom-nav a{min-width:0!important;height:auto!important;min-height:58px!important;padding:2px 1px!important}
.bottom-nav a small{font-size:.69rem!important;line-height:1.12!important;text-align:center;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;max-width:100%}
.bottom-nav .nav-ico{flex:0 0 auto}

/* Generic forms, buttons and settings must grow instead of crop. */
.btn-row,.inline{min-width:0}
.btn-row>* ,.inline>*{min-width:0}
.settings-row{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;gap:11px!important;align-items:center!important;height:auto!important;min-height:60px!important}
.settings-row>div{min-width:0}
.settings-row strong{font-size:.92rem!important;line-height:1.25!important}
.settings-row small{font-size:.75rem!important;line-height:1.4!important}
.settings-row>b{align-self:center}
.compact-disclosure>summary{min-height:58px;height:auto!important;align-items:center!important;gap:10px!important}
.compact-disclosure>summary>span:first-child{min-width:0}
.compact-disclosure>summary strong{font-size:.94rem!important;line-height:1.25!important}
.compact-disclosure>summary small{font-size:.75rem!important;line-height:1.4!important;white-space:normal!important}
.settings-block{grid-template-columns:minmax(0,1fr) auto!important;align-items:start!important}
.settings-block p{margin:.25rem 0 0}

/* User font preference UI */
.display-settings-v224 .disclosure-body{padding-top:10px}
.font-size-settings-v224{display:grid;gap:12px}
.font-size-options-v224{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.font-size-option-v224{position:relative;display:grid!important;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:center;padding:10px;border:1px solid var(--line)!important;border-radius:17px;background:#fbfcfb;color:var(--text)!important;cursor:pointer;min-width:0}
.font-size-option-v224 input{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;min-height:0!important}
.font-size-option-v224:has(input:checked){border-color:#89b79d!important;background:#f1f7f3;box-shadow:0 0 0 2px rgba(23,107,64,.06)}
.font-size-preview-v224{display:grid;place-items:center;width:36px;height:36px;border-radius:13px;background:#edf5f0;color:var(--primary);font-weight:900;line-height:1}
.font-size-preview-v224.large{font-size:1.12em}
.font-size-preview-v224.xlarge{font-size:1.28em}
.font-size-option-v224 input:checked + .font-size-preview-v224{outline:2px solid #6fa987;outline-offset:2px;background:#e5f2e9}
.font-size-option-v224>span:last-child{display:grid;gap:2px;min-width:0}
.font-size-option-v224 strong{font-size:.82rem;line-height:1.2;overflow-wrap:anywhere}
.font-size-option-v224 small{font-size:.68rem;line-height:1.3;color:var(--muted);overflow-wrap:anywhere}
.font-size-note-v224{margin:0;color:var(--muted)}

/* Landing & auth typography also honor last font preference stored on this device. */
.landing-copy-v223 h1{font-size:2.05rem!important}
.landing-copy-v223 p{font-size:.94rem!important}
.landing-feature-v223 strong{font-size:.88rem!important}
.landing-feature-v223 small{font-size:.74rem!important;line-height:1.4!important}
.landing-step-v223 strong{font-size:.9rem!important}
.landing-step-v223 small{font-size:.74rem!important}
.auth-brand-copy h1{font-size:1.75rem!important}
.auth-brand-copy p{font-size:.84rem!important}
.auth-mini-badges-v215{flex-wrap:wrap!important}
.auth-mini-badges-v215 span{min-width:0!important;height:auto!important}
.auth-mini-badges-v215 b{font-size:.73rem!important;white-space:normal!important}
.auth-card-v215{min-width:0}

/* Narrow phone hardening (common 320–360 CSS px low/mid-end Android). */
@media(max-width:360px){
  .phone-shell{width:100%!important}
  .content{padding-left:11px!important;padding-right:11px!important}
  .topbar{padding-left:11px!important;padding-right:11px!important}
  .home-topbar-v223{gap:7px!important}
  .home-greeting-v223{gap:7px!important}
  .home-greeting-v223 .avatar{flex-basis:36px!important;width:36px!important;height:36px!important}
  .home-weather-v223{min-width:72px!important;padding:4px!important;gap:5px!important}
  .weather-icon-badge{width:29px!important;height:29px!important;font-size:15px!important}
  .home-metrics{gap:7px!important}
  .home-metrics>div{padding:10px!important;min-height:70px}
  .home-action-grid-v218{gap:7px!important}
  .home-action-card-v218{padding:11px!important;min-height:120px!important}
  .home-action-card-v218 .home-action-icon-v218{width:37px!important;height:37px!important;border-radius:13px!important}
  .home-action-arrow-v218{right:9px!important;top:9px!important}
  .landing-content-v223,.compact-auth-wrap{padding-left:12px!important;padding-right:12px!important}
  .landing-brand-lockup-v224{max-width:72%}
  .font-size-options-v224{grid-template-columns:1fr}
  .font-size-option-v224{grid-template-columns:42px minmax(0,1fr)}
}

/* Large font mode: simplify dense two-column areas where readability matters more than density. */
html[data-font-size="large"] .home-action-card-v218{min-height:142px!important}
html[data-font-size="large"] .home-metrics>div{min-height:80px}
html[data-font-size="large"] .settings-block{grid-template-columns:1fr!important}
html[data-font-size="large"] .settings-block .btn{justify-self:start}

html[data-font-size="xlarge"] .home-action-grid-v218,
html[data-font-size="xlarge"] .home-metrics,
html[data-font-size="xlarge"] .grid2,
html[data-font-size="xlarge"] .grid3,
html[data-font-size="xlarge"] .stats,
html[data-font-size="xlarge"] .btn-row,
html[data-font-size="xlarge"] .profile-summary-actions{grid-template-columns:1fr!important}
html[data-font-size="xlarge"] .home-action-card-v218{min-height:auto!important;display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;align-items:center!important;padding:13px!important}
html[data-font-size="xlarge"] .home-action-copy-v218{width:auto}
html[data-font-size="xlarge"] .home-action-arrow-v218{position:static!important;align-self:center}
html[data-font-size="xlarge"] .home-metrics>div{min-height:auto;padding:13px!important}
html[data-font-size="xlarge"] .home-topbar-v223{align-items:flex-start!important}
html[data-font-size="xlarge"] .home-weather-v223{min-width:70px!important}
html[data-font-size="xlarge"] .topbar:not(.home-topbar-v223){align-items:flex-start!important}
html[data-font-size="xlarge"] .topbar-main{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:7px!important}
html[data-font-size="xlarge"] .topbar-quickcard{max-width:135px!important}
html[data-font-size="xlarge"] .settings-block{grid-template-columns:1fr!important}
html[data-font-size="xlarge"] .settings-block .btn{justify-self:stretch;width:100%}
html[data-font-size="xlarge"] .font-size-options-v224{grid-template-columns:1fr}

/* If the viewport itself is tiny, choose the safe one-column layout even at Normal. */
@media(max-width:330px){
  .home-action-grid-v218{grid-template-columns:1fr!important}
  .home-action-card-v218{min-height:auto!important;display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;align-items:center!important}
  .home-action-arrow-v218{position:static!important}
  .home-metrics{grid-template-columns:1fr!important}
  .bottom-nav a small{font-size:.64rem!important}
}

/* Reduce expensive effects for low-end devices and users preferring less motion. */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}
@media(max-width:480px){
  .topbar,.bottom-nav,.landing-photo-caption-v223{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
  .phone-shell,.card,.list-item{box-shadow:none!important}
}

/* Controls that previously had fixed heights now grow with the chosen text size. */
.compact-location-picker .location-search,
.compact-location-picker select{height:auto!important;min-height:44px!important;font-size:.82rem!important;line-height:1.35!important;padding-top:9px!important;padding-bottom:9px!important}
.pin-toggle{height:auto!important;min-height:34px!important;line-height:1.15!important;white-space:normal!important}
.pwa-install-promo-head strong{font-size:.92rem!important;white-space:normal!important;overflow-wrap:anywhere}
.pwa-install-promo-head small{font-size:.76rem!important;white-space:normal!important;overflow-wrap:anywhere}
.pwa-install-benefits{flex-wrap:wrap!important}
.pwa-install-benefits span{height:auto!important;font-size:.7rem!important;white-space:normal!important}
.pwa-install-actions{grid-template-columns:repeat(2,minmax(0,1fr))!important}
html[data-font-size="xlarge"] .pwa-install-actions{grid-template-columns:1fr!important}
html[data-font-size="xlarge"] .pwa-install-promo-head{grid-template-columns:40px minmax(0,1fr) 30px!important}

/* Tables stay scrollable instead of pushing the phone viewport wider. */
.table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
table{min-width:0}

/* In enlarged-text modes, remove intentional one-line truncation from informative content. */
html[data-font-size="large"] .clamp-one,
html[data-font-size="large"] .farm-detail-head .meta,
html[data-font-size="large"] .fert-farm-switch .meta,
html[data-font-size="large"] .fert-context-grid strong,
html[data-font-size="large"] .fert-context-grid span,
html[data-font-size="large"] .fert-compact-farm-switch span,
html[data-font-size="large"] .fert-context-strip small,
html[data-font-size="large"] .fert-context-strip strong,
html[data-font-size="large"] .fert-history-scope-head strong,
html[data-font-size="large"] .weather-location-chip strong,
html[data-font-size="large"] .weather-location-line span:last-child,
html[data-font-size="xlarge"] .clamp-one,
html[data-font-size="xlarge"] .farm-detail-head .meta,
html[data-font-size="xlarge"] .fert-farm-switch .meta,
html[data-font-size="xlarge"] .fert-context-grid strong,
html[data-font-size="xlarge"] .fert-context-grid span,
html[data-font-size="xlarge"] .fert-compact-farm-switch span,
html[data-font-size="xlarge"] .fert-context-strip small,
html[data-font-size="xlarge"] .fert-context-strip strong,
html[data-font-size="xlarge"] .fert-history-scope-head strong,
html[data-font-size="xlarge"] .weather-location-chip strong,
html[data-font-size="xlarge"] .weather-location-line span:last-child{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;max-width:none!important}
html[data-font-size="large"] .fert-context-strip,
html[data-font-size="xlarge"] .fert-context-strip{grid-template-columns:1fr 1fr!important}
html[data-font-size="large"] .fert-confidence,
html[data-font-size="large"] .fert-advisor-entry a,
html[data-font-size="large"] .calculator-inline-link a,
html[data-font-size="large"] .history-dose-action,
html[data-font-size="xlarge"] .fert-confidence,
html[data-font-size="xlarge"] .fert-advisor-entry a,
html[data-font-size="xlarge"] .calculator-inline-link a,
html[data-font-size="xlarge"] .history-dose-action{white-space:normal!important;height:auto!important;line-height:1.3!important}
html[data-font-size="xlarge"] .fert-advisor-entry,
html[data-font-size="xlarge"] .calculator-inline-link{grid-template-columns:1fr!important;display:grid!important;align-items:start!important}
