/*
 * RibhLab mobile-first hardening, layered after VIVA.
 * Keep typography and colors intact; fix flow, RTL, touch targets and local
 * scrolling without making the entire page horizontally scrollable.
 */
*,*::before,*::after{box-sizing:border-box}
html{overflow-x:clip}
body{min-width:0;max-width:100%;overflow-x:clip}
img,svg,video,canvas{max-width:100%}
img{height:auto}
.shell,.nav-inner,.hero-grid,.hero-copy,.hero-editorial-cover,
.article-grid,.article-card,.card-link,.card-body,.market-digest-grid,
.market-digest-card,.market-digest-body,.article-layout,.article-content,
.tool-layout,.tool-card,.studio-pro,.studio-editor,.studio-controls,
.studio-preview-panel,.studio-document,.footer-grid,.page-hero .shell{min-width:0}
h1,h2,h3,p,li,blockquote,figcaption{overflow-wrap:break-word}
.article-content a,.article-sources a,.article-resource-box a,
.market-original-link a,.market-reader-comment a,.footer a,
.prose-page a,.tool-card a{overflow-wrap:anywhere}
pre,code{overflow-wrap:anywhere;white-space:pre-wrap}
textarea,select,input{max-width:100%;min-width:0}
.lang-menu .lang-short{display:none}
.article-card .card-cover-image,.market-digest-cover img,.hero-photo-wrap img,
.market-story-figure img{height:100%;max-width:none;width:100%;object-fit:cover}
.card-link{min-width:0}
.section-head.split{gap:16px}
.section-head.split>*{min-width:0}
.market-digest-card:first-child .market-digest-body{min-width:0}
.market-original-link{min-width:0}
.market-article-body{min-width:0}
.studio-pro .studio-document{max-width:100%;overflow-x:auto;overflow-wrap:anywhere}
.studio-pro .studio-doc-table{max-width:100%}
.studio-pro .studio-form-grid>label{min-width:0}
.search-modal{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow-y:auto}

/* The seven-link desktop navigation needs a breakpoint above 920px. */
@media(max-width:1220px){
 .header{z-index:150}
 .nav-inner{position:relative;gap:13px;min-height:75px}
 .nav-links{
  display:none;
  position:absolute;
  top:calc(100% - 1px);
  left:0;right:0;
  flex-direction:column;
  align-items:stretch;
  gap:0;
  max-height:min(70dvh,600px);
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:12px 18px 18px;
  background:#fff;
  border:1px solid #e4e3f7;
  border-radius:0 0 18px 18px;
  box-shadow:0 24px 44px rgba(33,23,106,.16);
  z-index:160;
 }
 .nav-links.open{display:flex}
 .nav-links a{
  display:flex;align-items:center;
  padding:11px 10px;
  min-height:45px;
  border-bottom:1px solid #f0eff9;
  font-size:14px;line-height:1.5;
  white-space:normal;
 }
 .nav-links a:last-child{border-bottom:0}
 .nav-links .nav-current{box-shadow:inset 3px 0 0 #7551f6;background:#f3f0ff;border-radius:8px}
 html[dir=rtl] .nav-links .nav-current{box-shadow:inset -3px 0 0 #7551f6}
 .mobile-menu{display:grid;place-items:center}
 .nav-actions{margin-inline-start:auto}
 .brand-copy small{display:none}
 .icon-button{min-height:42px}
 .lang-menu a{min-height:36px;display:inline-flex;align-items:center;justify-content:center}
}
/* Laptop / horizontal tablet: no cramped two-column features. */
@media(max-width:1060px){
 .shell{width:calc(100% - 44px)}
 .hero-grid{gap:clamp(18px,3.5vw,42px)}
 .article-layout{grid-template-columns:minmax(0,1fr) 220px;gap:28px}
 .editorial-section-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .category-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .studio-pro .studio-editor{grid-template-columns:minmax(0,1fr)}
 .studio-pro .studio-controls,.studio-pro .studio-preview-panel{width:100%}
 .studio-pro .studio-doc-table{font-size:.82rem}
 .footer-grid{gap:20px}
 .market-digest-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .market-digest-card:first-child{grid-column:span 2}
 .utility-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
/* Tablet portrait: simplify cards and long-reads without squeezing text. */
@media(max-width:800px){
 .shell{width:calc(100% - 36px)}
 .nav-inner{min-height:70px;height:70px}
 .hero-grid{grid-template-columns:minmax(0,1fr);gap:32px;padding-block:42px 54px}
 .hero-copy{max-width:680px}
 .hero-editorial-cover{max-width:630px;transform:none}
 .hero-editorial-cover:hover{transform:translateY(-3px)}
 .article-layout{grid-template-columns:minmax(0,1fr);gap:24px}
 .article-sidebar{grid-row:1}
 .toc-card{position:static;max-width:100%}
 .latest-first .article-grid[data-story-grid]{grid-template-columns:repeat(2,minmax(0,1fr))}
 .latest-first .article-card:first-child{grid-column:span 2;grid-row:auto}
 .latest-first .article-card:first-child .card-art{height:auto;min-height:0;aspect-ratio:16/9;flex:none}
 .latest-first .article-grid[data-filtered=true] .article-card.is-filter-lead{grid-column:span 2;grid-row:auto}
 .latest-first .article-grid[data-filtered=true] .article-card.is-filter-lead .card-art{height:auto;min-height:0;aspect-ratio:16/9;flex:none}
 .article-grid,.related-section .article-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .article-card .card-art,.latest-first .article-card:not(:first-child) .card-art{
  height:auto;min-height:0;aspect-ratio:16/10;flex:none;
 }
 .card-cover-image{object-fit:cover}
 .market-digest-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .market-digest-card:first-child{grid-column:span 2}
 .market-digest-card:first-child .market-digest-cover{aspect-ratio:16/9;height:auto;min-height:0}
 .market-digest-card:first-child .market-digest-body{padding:23px}
 .market-discussion-heading{flex-direction:column;align-items:stretch}
 .market-discussion-heading .btn{min-width:0;width:100%}
 .market-promo,.tools-banner{flex-wrap:wrap;align-items:flex-start}
 .market-promo .btn,.tools-banner .btn{flex:0 1 auto}
 .article-content p{font-size:clamp(15px,2vw,17px)}
 .speed-results{grid-template-columns:repeat(2,minmax(0,1fr))}
 .pulse-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .pulse-event{grid-template-columns:minmax(0,1fr) auto}
 .footer-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .footer-grid>div:first-child{grid-column:1/-1}
}
/* Phones: one column of comfortably sized stories, not postage-stamp thumbnails. */
@media(max-width:600px){
 .shell{width:calc(100% - 30px)}
 .topbar{height:30px}
 .topbar-inner{min-width:0;gap:7px;font-size:10px}
 .topbar-inner>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
 .topbar-end{flex:none;letter-spacing:.02em;font-size:9px}
 .nav-inner{height:66px;min-height:66px}
 .nav-links{left:-15px;right:-15px;padding:9px 18px 16px;border-radius:0 0 16px 16px}
 .brand-symbol{width:38px;height:38px;font-size:22px;border-radius:12px}
 .brand{gap:8px}
 .brand-copy strong{font-size:20px}
 .brand-copy small{display:none}
 .nav-actions{gap:5px}
 .icon-button,.nav-actions .icon-button{min-width:40px;width:40px;height:40px;min-height:40px}
 .lang-menu{padding:2px;gap:0;border-radius:10px}
 .lang-menu a{padding:6px 5px;min-height:36px}
 .hero-grid{gap:26px;padding-block:30px 43px}
 .hero-copy h1{font-size:clamp(38px,8.6vw,55px);line-height:1.16}
 html[lang=ar] .hero-copy h1{font-size:clamp(33px,8vw,45px);line-height:1.46}
 .hero-copy>p{font-size:14px;line-height:1.8}
 .hero-buttons{display:grid;grid-template-columns:1fr;gap:10px}
 .hero-buttons .btn{width:100%;justify-content:center}
 .hero-trust{display:flex;flex-wrap:wrap;gap:11px;font-size:11px}
 .hero-photo-wrap{aspect-ratio:16/10}
 .hero-cover-caption{padding:17px 19px 20px}
 .hero-cover-caption h2{font-size:clamp(22px,5.5vw,30px)}
 html[lang=ar] .hero-cover-caption h2{font-size:clamp(20px,5.5vw,27px)}
 .magazine-topic-rail-inner{display:block;padding-block:14px}
 .magazine-rail-links,.archive-category-nav,.smart-story-filters,.pulse-filters{
  display:flex;flex-wrap:nowrap;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;
  scrollbar-width:thin;-webkit-overflow-scrolling:touch;
 }
 .magazine-rail-links>a,.archive-category-nav>a,.smart-story-filters>button,.pulse-filters>button{flex:0 0 auto}
 .section{padding-block:43px}
 .section-head{margin-bottom:23px}
 .section-head.split{display:flex;flex-direction:column;align-items:flex-start;gap:8px}
 .section-head.split .text-link{align-self:flex-start}
 .article-grid,.related-section .article-grid,.latest-first .article-grid[data-story-grid],
 .archive-article-grid,.market-digest-grid,.pulse-grid,.category-grid,
 .editorial-section-grid,.utility-grid{grid-template-columns:minmax(0,1fr)}
 .article-card,.latest-first .article-card:first-child,.market-digest-card:first-child{
  grid-column:span 1;grid-row:auto;min-width:0;
 }
 .latest-first .article-grid[data-filtered=true] .article-card.is-filter-lead,
 .latest-first .article-grid[data-filtered=true] .article-card:first-child{grid-column:span 1;grid-row:auto}
 .article-card .card-art,.latest-first .article-card:first-child .card-art,
 .latest-first .article-card:not(:first-child) .card-art,
 .latest-first .article-grid[data-filtered=true] .article-card.is-filter-lead .card-art{
  height:auto;min-height:0;aspect-ratio:16/10;flex:none;
 }
 .card-body,.latest-first .article-card:first-child .card-body,
 .latest-first .article-card:not(:first-child) .card-body,
 .latest-first .article-grid[data-filtered=true] .article-card.is-filter-lead .card-body{
  padding:20px;min-height:0;
 }
 .card-body h3,.latest-first .article-card:first-child .card-body h3,
 .latest-first .article-card:not(:first-child) .card-body h3,
 .latest-first .article-grid[data-filtered=true] .article-card.is-filter-lead .card-body h3{font-size:clamp(22px,5.5vw,28px);line-height:1.4}
 html[lang=ar] .card-body h3,html[lang=ar] .latest-first .article-card:first-child .card-body h3{font-size:clamp(20px,5.2vw,25px);line-height:1.6}
 .card-body p{font-size:13px}
 .topic-card{min-height:220px;padding:23px}
 .topic-top{margin-bottom:23px}
 .market-digest-card:first-child{display:flex}
 .market-digest-card:first-child .market-digest-cover{height:auto;min-height:0;aspect-ratio:16/9}
 .market-digest-card:first-child .market-digest-body{padding:19px}
 .market-digest-card:first-child h3{font-size:clamp(22px,5.6vw,29px)}
 .market-digest-cover img{width:100%;height:100%}
 .market-original-link{flex-direction:column;align-items:flex-start}
 .market-story-figure{max-width:100%}
 .market-discussion{padding:16px}
 .market-comment-actions{gap:10px}
 .pulse-event{grid-template-columns:minmax(0,1fr)}
 .pulse-card{min-width:0}
 .tool-layout{grid-template-columns:minmax(0,1fr);gap:16px;padding-block:25px}
 .tool-card,.isolated-tool-layout .tool-card{padding:19px 16px;border-radius:15px}
 .tool-card .tool-form,.studio-pro .studio-form-grid{grid-template-columns:minmax(0,1fr)}
 .tool-result{display:flex;align-items:flex-start;flex-direction:column}
 .speed-results{grid-template-columns:minmax(0,1fr)}
 .studio-pro .studio-pro-head{flex-direction:column;align-items:stretch;gap:15px;padding:20px}
 .studio-pro .studio-price{width:100%;min-width:0}
 .studio-pro .studio-controls,.studio-pro .studio-preview-panel{padding:15px}
 .studio-pro .studio-editor{grid-template-columns:minmax(0,1fr)}
 .studio-pro .studio-form-grid{gap:11px}
 .studio-pro .studio-line{grid-template-columns:repeat(2,minmax(0,1fr))}
 .studio-pro .studio-line-label:first-child{grid-column:1/-1}
 .studio-pro .studio-remove-row{grid-column:1/-1;width:100%}
 .studio-pro .studio-action-buttons .btn,.studio-pro .studio-storage-buttons .btn,.studio-pro .studio-import-btn{
  display:flex;width:100%;justify-content:center;white-space:normal;
 }
 .studio-pro input,.studio-pro textarea,.studio-pro select,.tool-card input,.tool-card textarea,.tool-card select{font-size:16px}
 .studio-pro .studio-document{padding:14px;min-height:240px}
 .studio-pro .studio-doc-table{font-size:11px;table-layout:fixed}
 .studio-pro .studio-doc-table th,.studio-pro .studio-doc-table td{padding:6px 3px;overflow-wrap:anywhere}
 .studio-pro .studio-doc-table th:first-child{width:35%}
 .studio-pro .studio-doc-summary{max-width:100%}
 .studio-pro .studio-cv-contact{display:flex;flex-wrap:wrap;gap:5px}
 .footer-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:21px}
 .footer-grid>div:first-child{grid-column:1/-1}
 .footer-bottom{display:flex;flex-direction:column;align-items:flex-start;gap:10px}
 .footer-bottom span:last-child{max-width:100%;text-align:start}
 .search-modal{padding:16px}
 .search-head h2{font-size:20px}
 .section-head h2{font-size:clamp(27px,7vw,36px)}
 .page-hero h1{font-size:clamp(30px,7.5vw,43px);line-height:1.35}
 html[lang=ar] .page-hero h1{font-size:clamp(28px,7vw,37px);line-height:1.55}
 .article-hero h1{font-size:clamp(30px,7vw,41px);line-height:1.35}
 html[lang=ar] .article-hero h1{font-size:clamp(27px,6.8vw,36px);line-height:1.55}
 .article-content p{font-size:15px;line-height:1.95}
 .article-content .lead{font-size:17px}
 .article-block h2{font-size:clamp(23px,6vw,30px)}
 .archive-page{padding-block:22px 60px}
 .archive-smart-search{padding:15px}
 .studio-home-actions{flex-wrap:wrap}
 .studio-home-actions .btn{width:100%}
}
/* Even compact 320px phones keep the logo, search, language and menu usable. */
@media(max-width:420px){
 .shell{width:calc(100% - 28px)}
 .brand{gap:6px}
 .brand-symbol{width:35px;height:35px;font-size:20px}
 .brand-copy strong{font-size:18px}
 .lang-menu .lang-full{display:none}
 .lang-menu .lang-short{display:inline}
 .lang-menu a{min-width:24px;min-height:36px;padding:6px 2px;font-size:11px;font-weight:800}
 .nav-inner{gap:5px}
 .nav-actions{gap:3px}
 .nav-actions .icon-button{width:38px;min-width:38px;height:40px;min-height:40px}
 .nav-links{left:-14px;right:-14px}
 .topbar-end{display:none}
 .topbar-inner>span:nth-child(2){max-width:100%}
 .footer-grid{grid-template-columns:minmax(0,1fr)}
 .footer-grid>div:first-child{grid-column:auto}
 .hero-trust{flex-direction:column;align-items:flex-start;gap:6px}
 .studio-pro .studio-price strong{font-size:clamp(23px,8vw,31px)}
 .studio-pro .studio-line{gap:7px}
 .market-article-dates{display:flex;flex-wrap:wrap}
 .search-modal{width:calc(100% - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:13px}
}
/* Tiny devices: preserve tap targets and predictable one-column flow. */
@media(max-width:340px){
 .shell{width:calc(100% - 22px)}
 .brand-copy strong{font-size:17px}
 .brand-symbol{width:32px;height:32px;font-size:19px}
 .lang-menu a{min-width:22px;font-size:10px}
 .nav-actions .icon-button{width:36px;min-width:36px}
 .nav-actions{gap:2px}
 .nav-links{left:-11px;right:-11px}
 .tool-card,.isolated-tool-layout .tool-card{padding:15px 12px}
}
/* Printing Document Studio and readable articles must not inherit phone layouts. */
@media print{
 html,body{overflow:visible!important}
 .studio-pro .studio-document{overflow:visible!important;max-width:100%!important}
}
