/* DIE2HARD Studio 1.20 — the shell fits the device, not only the width.
   Loaded after every other style sheet.
     1. A phone held sideways (844 × 390): the same phone layout, but the menu moves to a slim rail on the left and the top bar
        gets thinner, so the work keeps most of the little height there is. "Sideways" needs a width of 520 px or more:
        an upright phone with the on-screen keyboard open is 430 × 400 in some browsers and must keep its upright layout.
     2. iPad and other mid-size screens (651–1099 px): the menu is a rail with an icon and a short name — never the squeezed
        desktop menu that broke "Create project" over three lines.
     3. Rows that slide sideways (project sections, filter chips) show a soft fade on the side where there is more.
   "Phone" means the same thing here, in studio-core.js (d19Phone) and in every other style sheet:
     (max-width:650px), (pointer:coarse) and (max-height:500px) and (max-width:1000px)                                          */

/* ============================================================ 0. the top bar height, for everything that sticks under it */
:root{--fit-top:68px}
@media (max-width:650px),(pointer:coarse) and (max-height:500px) and (max-width:1000px){:root{--fit-top:60px}}
/* the project sections stay reachable while you read: they stick under the top bar (they used to hide behind it) */
#workspace .p2-tabs{top:var(--fit-top)!important}

/* ============================================================ 1. a phone held sideways */
@media (min-width:520px) and (max-height:500px) and (orientation:landscape) and (max-width:650px),
       (pointer:coarse) and (min-width:520px) and (max-height:500px) and (orientation:landscape) and (max-width:1000px){
  :root{--fit-top:44px;--fit-rail:68px}
  body.d19 .topbar{height:var(--fit-top)!important;min-height:0!important;padding:0 12px!important}
  body.d19 .topbar .wordmark{font-size:17px!important}
  body.d19 .topbar .header-actions{gap:8px!important}
  body.d19 .topbar .header-actions>button{transform:none}
  body.d19 .topbar .round-button,body.d19 .topbar .avatar,body.d19 .topbar .music-pill{width:34px;height:34px;min-width:34px;min-height:34px}
  body.d19 #app:not([hidden]) .studio-shell{min-height:calc(100dvh - var(--fit-top))!important}
  body.d19 .studio-shell{padding-left:var(--fit-rail)!important;box-sizing:border-box}
  body.d19 #workspace{min-height:calc(100dvh - var(--fit-top))!important;padding:14px 18px calc(24px + env(safe-area-inset-bottom))!important}
  /* the tab bar stands up: five places in a column on the left */
  body.d19 .d19-tabbar{top:var(--fit-top);bottom:0;left:0;right:auto;width:var(--fit-rail);display:flex;flex-direction:column;justify-content:flex-start;gap:2px;padding:6px 6px;border-top:0;border-right:1px solid #2a2927;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
  body.d19 .d19-tabbar::-webkit-scrollbar{display:none}
  body.d19 .d19-tabbar button{flex:none;width:100%;min-height:54px;padding:6px 2px;border-radius:10px;font-size:10.5px;line-height:1.15}
  body.d19 .d19-tabbar button.active{background:rgba(242,101,34,.12)}
  /* the assistant opens as a panel on the right, not over the whole page */
  body.d19 #assistant.assistant.open{top:var(--fit-top)!important;bottom:0!important;left:auto!important;right:0!important;width:min(440px,calc(100vw - var(--fit-rail)))!important;border-radius:0!important;border-left:1px solid #2a2927!important}
  body.d19 #assistant{padding-top:0!important;padding-bottom:0!important}
  body.d19 #assistant .assistant-head{min-height:40px;padding:4px var(--ui-4)!important}
  body.d19 #assistant .ai-status{margin:0 0 var(--ui-1)!important}
  body.d19 #assistant .ai-prompts{display:flex!important;flex-wrap:nowrap;overflow-x:auto;gap:var(--ui-2);margin:0!important;padding:var(--ui-1) var(--ui-4) var(--ui-2)!important;scrollbar-width:none}
  body.d19 #assistant .ai-prompts::-webkit-scrollbar{display:none}
  body.d19 #assistant .ai-prompts button{flex:none;white-space:nowrap;min-height:36px;padding:0 var(--ui-3)}
  body.d19 #assistant .web-toggle,body.d19 #assistant .ai-footer{display:none!important}
  body.d19 #assistant #chatForm{padding-bottom:calc(var(--ui-2) + env(safe-area-inset-bottom))}
  body.d19 #assistant #chatInput{min-height:44px;max-height:64px}
  body.d19 #toast{bottom:16px!important}
  /* page headers get less air: the work should start on the first screen */
  #workspace .p2-head,#workspace .hm-head{padding-top:0}
  #workspace .p2-head h1,#workspace .p2-title{font-size:clamp(24px,5.2vw,30px)!important;line-height:1.08!important;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;max-width:none!important}
  #workspace .hm-now{margin-top:var(--ui-3)}
  #workspace .p2-tabs{top:0}
}

/* ============================================================ 2. iPad and mid-size screens: a rail */
@media (min-width:651px) and (max-width:1099px){
  body .studio-shell{grid-template-columns:76px minmax(0,1fr)!important}
  body .sidebar{width:76px!important;min-width:0;padding:12px 6px 10px!important;display:flex;flex-direction:column;overflow:hidden}
  body .sidebar .side-label,body .sidebar .sidebar-bottom,body .sidebar #globalCreateAgency{display:none!important}
  /* Create: one round "+", the name is in its tooltip and its accessible name */
  body .sidebar #globalCreate{flex:none;width:44px;height:44px;min-height:44px;margin:0 auto 10px;padding:0;border-radius:50%;font-size:0;letter-spacing:0;line-height:0;display:grid;place-items:center}
  body .sidebar #globalCreate::before{content:"+";font:400 30px/1 var(--sans);color:#111;margin-top:-2px}
  body .sidebar #mainNav{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none;display:flex;flex-direction:column;gap:2px}
  body .sidebar #mainNav::-webkit-scrollbar{display:none}
  body .sidebar #mainNav>button{position:relative;flex:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px!important;width:100%;min-height:52px!important;padding:7px 2px!important;border-radius:10px;font-size:10.5px!important;line-height:1.15;text-align:center;overflow-wrap:anywhere}
  body .sidebar #mainNav>button>span{font-size:19px!important;line-height:1;margin:0}
  body .sidebar #mainNav>button>b{position:absolute;top:3px;left:calc(50% + 6px);min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:var(--orange,#f26522);color:#111;font:700 10px/16px var(--sans);text-align:center}
  body .sidebar #mainNav>button>b:empty,body .sidebar #mainNav>button>b[data-zero]{display:none}
  /* the group names do not fit in 76 px (in Portuguese "Ferramentas" is wider than the rail): a thin line between groups,
     and "Tools" — the group that starts folded — is a row of three dots that opens it. The names stay in the markup for screen readers. */
  body .sidebar #mainNav .nav-group{flex:none;justify-content:center;font-size:0;letter-spacing:0;min-height:14px;margin:6px 4px 4px;padding:0;border-top:1px solid rgba(255,255,255,.12)}
  body .sidebar #mainNav .nav-group::after{display:none}
  body .sidebar #mainNav .nav-group[data-group="tools"]{min-height:28px}
  body .sidebar #mainNav .nav-group[data-group="tools"]::before{content:"•••";font:700 9px/1 var(--sans);letter-spacing:.3em;margin-left:.3em;color:#8f867d}
  body .sidebar #mainNav .nav-group[data-group="tools"][aria-expanded="true"]::before{color:var(--orange,#f26522)}
  #workspace{padding:26px 28px 56px!important}
  /* two columns on the Home as soon as the page is wide enough (rail + 880 px) */
}
@media (min-width:651px) and (max-width:1099px) and (max-height:820px){
  body .sidebar #mainNav>button{min-height:46px!important;padding:5px 2px!important}
  body .sidebar #mainNav>button>span{font-size:18px!important}
  body .sidebar #globalCreate{margin-bottom:6px}
}
@media (min-width:960px) and (max-width:1099px){
  #workspace .hm-grid:not(.is-one){grid-template-columns:minmax(0,1.15fr) minmax(0,1fr)}
}

/* ============================================================ 3. rows that slide sideways say so */
#workspace .p2-tabs::after{display:none}
#workspace .p2-tabs-in,#workspace .ui-filters,#workspace .gd-toc,#workspace .v114-pick-row{--fit-fade:28px}
[data-fit-r="1"]:not([data-fit-l="1"]){-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - var(--fit-fade)),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - var(--fit-fade)),transparent)}
[data-fit-l="1"]:not([data-fit-r="1"]){-webkit-mask-image:linear-gradient(90deg,transparent,#000 var(--fit-fade));mask-image:linear-gradient(90deg,transparent,#000 var(--fit-fade))}
[data-fit-l="1"][data-fit-r="1"]{-webkit-mask-image:linear-gradient(90deg,transparent,#000 var(--fit-fade),#000 calc(100% - var(--fit-fade)),transparent);mask-image:linear-gradient(90deg,transparent,#000 var(--fit-fade),#000 calc(100% - var(--fit-fade)),transparent)}

/* the close button of the assistant is a real touch target on a phone, upright or sideways */
@media (max-width:650px),(pointer:coarse) and (max-height:500px) and (max-width:1000px){
  body.d19 #assistant #closeAI{min-width:44px;min-height:44px;font-size:26px;line-height:1}
}

/* the menus that slide up and down say so too (the rail on an iPad, the tab rail on a phone held sideways) */
#mainNav[data-fit-b="1"]:not([data-fit-t="1"]),#d19TabBar[data-fit-b="1"]:not([data-fit-t="1"]){-webkit-mask-image:linear-gradient(#000 calc(100% - 28px),transparent);mask-image:linear-gradient(#000 calc(100% - 28px),transparent)}
#mainNav[data-fit-t="1"]:not([data-fit-b="1"]),#d19TabBar[data-fit-t="1"]:not([data-fit-b="1"]){-webkit-mask-image:linear-gradient(transparent,#000 28px);mask-image:linear-gradient(transparent,#000 28px)}
#mainNav[data-fit-t="1"][data-fit-b="1"],#d19TabBar[data-fit-t="1"][data-fit-b="1"]{-webkit-mask-image:linear-gradient(transparent,#000 28px,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(transparent,#000 28px,#000 calc(100% - 28px),transparent)}
